diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/README.md new file mode 100644 index 0000000000000000000000000000000000000000..75602446b3d68138ca42f7e7b177e37015a8ea39 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/README.md @@ -0,0 +1,167 @@ +# @webassemblyjs/ast + +> AST utils for webassemblyjs + +## Installation + +```sh +yarn add @webassemblyjs/ast +``` + +## Usage + +### Traverse + +```js +import { traverse } from "@webassemblyjs/ast"; + +traverse(ast, { + Module(path) { + console.log(path.node); + } +}); +``` + +### Instruction signatures + +```js +import { signatures } from "@webassemblyjs/ast"; + +console.log(signatures); +``` + +### Path methods + +- `findParent: NodeLocator` +- `replaceWith: Node => void` +- `remove: () => void` +- `insertBefore: Node => void` +- `insertAfter: Node => void` +- `stop: () => void` + +### AST utils + +- function `module(id, fields, metadata)` +- function `moduleMetadata(sections, functionNames, localNames)` +- function `moduleNameMetadata(value)` +- function `functionNameMetadata(value, index)` +- function `localNameMetadata(value, localIndex, functionIndex)` +- function `binaryModule(id, blob)` +- function `quoteModule(id, string)` +- function `sectionMetadata(section, startOffset, size, vectorOfSize)` +- function `loopInstruction(label, resulttype, instr)` +- function `instruction(id, args, namedArgs)` +- function `objectInstruction(id, object, args, namedArgs)` +- function `ifInstruction(testLabel, test, result, consequent, alternate)` +- function `stringLiteral(value)` +- function `numberLiteralFromRaw(value, raw)` +- function `longNumberLiteral(value, raw)` +- function `floatLiteral(value, nan, inf, raw)` +- function `elem(table, offset, funcs)` +- function `indexInFuncSection(index)` +- function `valtypeLiteral(name)` +- function `typeInstruction(id, functype)` +- function `start(index)` +- function `globalType(valtype, mutability)` +- function `leadingComment(value)` +- function `blockComment(value)` +- function `data(memoryIndex, offset, init)` +- function `global(globalType, init, name)` +- function `table(elementType, limits, name, elements)` +- function `memory(limits, id)` +- function `funcImportDescr(id, signature)` +- function `moduleImport(module, name, descr)` +- function `moduleExportDescr(exportType, id)` +- function `moduleExport(name, descr)` +- function `limit(min, max)` +- function `signature(params, results)` +- function `program(body)` +- function `identifier(value, raw)` +- function `blockInstruction(label, instr, result)` +- function `callInstruction(index, instrArgs)` +- function `callIndirectInstruction(signature, intrs)` +- function `byteArray(values)` +- function `func(name, signature, body, isExternal, metadata)` +- Constant`isModule` +- Constant`isModuleMetadata` +- Constant`isModuleNameMetadata` +- Constant`isFunctionNameMetadata` +- Constant`isLocalNameMetadata` +- Constant`isBinaryModule` +- Constant`isQuoteModule` +- Constant`isSectionMetadata` +- Constant`isLoopInstruction` +- Constant`isInstruction` +- Constant`isObjectInstruction` +- Constant`isIfInstruction` +- Constant`isStringLiteral` +- Constant`isNumberLiteral` +- Constant`isLongNumberLiteral` +- Constant`isFloatLiteral` +- Constant`isElem` +- Constant`isIndexInFuncSection` +- Constant`isValtypeLiteral` +- Constant`isTypeInstruction` +- Constant`isStart` +- Constant`isGlobalType` +- Constant`isLeadingComment` +- Constant`isBlockComment` +- Constant`isData` +- Constant`isGlobal` +- Constant`isTable` +- Constant`isMemory` +- Constant`isFuncImportDescr` +- Constant`isModuleImport` +- Constant`isModuleExportDescr` +- Constant`isModuleExport` +- Constant`isLimit` +- Constant`isSignature` +- Constant`isProgram` +- Constant`isIdentifier` +- Constant`isBlockInstruction` +- Constant`isCallInstruction` +- Constant`isCallIndirectInstruction` +- Constant`isByteArray` +- Constant`isFunc` +- Constant`assertModule` +- Constant`assertModuleMetadata` +- Constant`assertModuleNameMetadata` +- Constant`assertFunctionNameMetadata` +- Constant`assertLocalNameMetadata` +- Constant`assertBinaryModule` +- Constant`assertQuoteModule` +- Constant`assertSectionMetadata` +- Constant`assertLoopInstruction` +- Constant`assertInstruction` +- Constant`assertObjectInstruction` +- Constant`assertIfInstruction` +- Constant`assertStringLiteral` +- Constant`assertNumberLiteral` +- Constant`assertLongNumberLiteral` +- Constant`assertFloatLiteral` +- Constant`assertElem` +- Constant`assertIndexInFuncSection` +- Constant`assertValtypeLiteral` +- Constant`assertTypeInstruction` +- Constant`assertStart` +- Constant`assertGlobalType` +- Constant`assertLeadingComment` +- Constant`assertBlockComment` +- Constant`assertData` +- Constant`assertGlobal` +- Constant`assertTable` +- Constant`assertMemory` +- Constant`assertFuncImportDescr` +- Constant`assertModuleImport` +- Constant`assertModuleExportDescr` +- Constant`assertModuleExport` +- Constant`assertLimit` +- Constant`assertSignature` +- Constant`assertProgram` +- Constant`assertIdentifier` +- Constant`assertBlockInstruction` +- Constant`assertCallInstruction` +- Constant`assertCallIndirectInstruction` +- Constant`assertByteArray` +- Constant`assertFunc` + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/clone.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/clone.js new file mode 100644 index 0000000000000000000000000000000000000000..c6f76c88bb75274db43068d37e39ff20a854815e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/clone.js @@ -0,0 +1,4 @@ +export function cloneNode(n) { + // $FlowIgnore + return Object.assign({}, n); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/definitions.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/definitions.js new file mode 100644 index 0000000000000000000000000000000000000000..c5053c2379f1741cc535c4a7f80fc89c649cfebf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/definitions.js @@ -0,0 +1,668 @@ +var definitions = {}; + +function defineType(typeName, metadata) { + definitions[typeName] = metadata; +} + +defineType("Module", { + spec: { + wasm: "https://webassembly.github.io/spec/core/binary/modules.html#binary-module", + wat: "https://webassembly.github.io/spec/core/text/modules.html#text-module" + }, + doc: "A module consists of a sequence of sections (termed fields in the text format).", + unionType: ["Node"], + fields: { + id: { + maybe: true, + type: "string" + }, + fields: { + array: true, + type: "Node" + }, + metadata: { + optional: true, + type: "ModuleMetadata" + } + } +}); +defineType("ModuleMetadata", { + unionType: ["Node"], + fields: { + sections: { + array: true, + type: "SectionMetadata" + }, + functionNames: { + optional: true, + array: true, + type: "FunctionNameMetadata" + }, + localNames: { + optional: true, + array: true, + type: "ModuleMetadata" + }, + producers: { + optional: true, + array: true, + type: "ProducersSectionMetadata" + } + } +}); +defineType("ModuleNameMetadata", { + unionType: ["Node"], + fields: { + value: { + type: "string" + } + } +}); +defineType("FunctionNameMetadata", { + unionType: ["Node"], + fields: { + value: { + type: "string" + }, + index: { + type: "number" + } + } +}); +defineType("LocalNameMetadata", { + unionType: ["Node"], + fields: { + value: { + type: "string" + }, + localIndex: { + type: "number" + }, + functionIndex: { + type: "number" + } + } +}); +defineType("BinaryModule", { + unionType: ["Node"], + fields: { + id: { + maybe: true, + type: "string" + }, + blob: { + array: true, + type: "string" + } + } +}); +defineType("QuoteModule", { + unionType: ["Node"], + fields: { + id: { + maybe: true, + type: "string" + }, + string: { + array: true, + type: "string" + } + } +}); +defineType("SectionMetadata", { + unionType: ["Node"], + fields: { + section: { + type: "SectionName" + }, + startOffset: { + type: "number" + }, + size: { + type: "NumberLiteral" + }, + vectorOfSize: { + comment: "Size of the vector in the section (if any)", + type: "NumberLiteral" + } + } +}); +defineType("ProducersSectionMetadata", { + unionType: ["Node"], + fields: { + producers: { + array: true, + type: "ProducerMetadata" + } + } +}); +defineType("ProducerMetadata", { + unionType: ["Node"], + fields: { + language: { + type: "ProducerMetadataVersionedName", + array: true + }, + processedBy: { + type: "ProducerMetadataVersionedName", + array: true + }, + sdk: { + type: "ProducerMetadataVersionedName", + array: true + } + } +}); +defineType("ProducerMetadataVersionedName", { + unionType: ["Node"], + fields: { + name: { + type: "string" + }, + version: { + type: "string" + } + } +}); +/* +Instructions +*/ + +defineType("LoopInstruction", { + unionType: ["Node", "Block", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "loop" + }, + label: { + maybe: true, + type: "Identifier" + }, + resulttype: { + maybe: true, + type: "Valtype" + }, + instr: { + array: true, + type: "Instruction" + } + } +}); +defineType("Instr", { + unionType: ["Node", "Expression", "Instruction"], + fields: { + id: { + type: "string" + }, + object: { + optional: true, + type: "Valtype" + }, + args: { + array: true, + type: "Expression" + }, + namedArgs: { + optional: true, + type: "Object" + } + } +}); +defineType("IfInstruction", { + unionType: ["Node", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "if" + }, + testLabel: { + comment: "only for WAST", + type: "Identifier" + }, + test: { + array: true, + type: "Instruction" + }, + result: { + maybe: true, + type: "Valtype" + }, + consequent: { + array: true, + type: "Instruction" + }, + alternate: { + array: true, + type: "Instruction" + } + } +}); +/* +Concrete value types +*/ + +defineType("StringLiteral", { + unionType: ["Node", "Expression"], + fields: { + value: { + type: "string" + } + } +}); +defineType("NumberLiteral", { + unionType: ["Node", "NumericLiteral", "Expression"], + fields: { + value: { + type: "number" + }, + raw: { + type: "string" + } + } +}); +defineType("LongNumberLiteral", { + unionType: ["Node", "NumericLiteral", "Expression"], + fields: { + value: { + type: "LongNumber" + }, + raw: { + type: "string" + } + } +}); +defineType("FloatLiteral", { + unionType: ["Node", "NumericLiteral", "Expression"], + fields: { + value: { + type: "number" + }, + nan: { + optional: true, + type: "boolean" + }, + inf: { + optional: true, + type: "boolean" + }, + raw: { + type: "string" + } + } +}); +defineType("Elem", { + unionType: ["Node"], + fields: { + table: { + type: "Index" + }, + offset: { + array: true, + type: "Instruction" + }, + funcs: { + array: true, + type: "Index" + } + } +}); +defineType("IndexInFuncSection", { + unionType: ["Node"], + fields: { + index: { + type: "Index" + } + } +}); +defineType("ValtypeLiteral", { + unionType: ["Node", "Expression"], + fields: { + name: { + type: "Valtype" + } + } +}); +defineType("TypeInstruction", { + unionType: ["Node", "Instruction"], + fields: { + id: { + maybe: true, + type: "Index" + }, + functype: { + type: "Signature" + } + } +}); +defineType("Start", { + unionType: ["Node"], + fields: { + index: { + type: "Index" + } + } +}); +defineType("GlobalType", { + unionType: ["Node", "ImportDescr"], + fields: { + valtype: { + type: "Valtype" + }, + mutability: { + type: "Mutability" + } + } +}); +defineType("LeadingComment", { + unionType: ["Node"], + fields: { + value: { + type: "string" + } + } +}); +defineType("BlockComment", { + unionType: ["Node"], + fields: { + value: { + type: "string" + } + } +}); +defineType("Data", { + unionType: ["Node"], + fields: { + memoryIndex: { + type: "Memidx" + }, + offset: { + type: "Instruction" + }, + init: { + type: "ByteArray" + } + } +}); +defineType("Global", { + unionType: ["Node"], + fields: { + globalType: { + type: "GlobalType" + }, + init: { + array: true, + type: "Instruction" + }, + name: { + maybe: true, + type: "Identifier" + } + } +}); +defineType("Table", { + unionType: ["Node", "ImportDescr"], + fields: { + elementType: { + type: "TableElementType" + }, + limits: { + assertNodeType: true, + type: "Limit" + }, + name: { + maybe: true, + type: "Identifier" + }, + elements: { + array: true, + optional: true, + type: "Index" + } + } +}); +defineType("Memory", { + unionType: ["Node", "ImportDescr"], + fields: { + limits: { + type: "Limit" + }, + id: { + maybe: true, + type: "Index" + } + } +}); +defineType("FuncImportDescr", { + unionType: ["Node", "ImportDescr"], + fields: { + id: { + type: "Identifier" + }, + signature: { + type: "Signature" + } + } +}); +defineType("ModuleImport", { + unionType: ["Node"], + fields: { + module: { + type: "string" + }, + name: { + type: "string" + }, + descr: { + type: "ImportDescr" + } + } +}); +defineType("ModuleExportDescr", { + unionType: ["Node"], + fields: { + exportType: { + type: "ExportDescrType" + }, + id: { + type: "Index" + } + } +}); +defineType("ModuleExport", { + unionType: ["Node"], + fields: { + name: { + type: "string" + }, + descr: { + type: "ModuleExportDescr" + } + } +}); +defineType("Limit", { + unionType: ["Node"], + fields: { + min: { + type: "number" + }, + max: { + optional: true, + type: "number" + }, + // Threads proposal, shared memory + shared: { + optional: true, + type: "boolean" + } + } +}); +defineType("Signature", { + unionType: ["Node"], + fields: { + params: { + array: true, + type: "FuncParam" + }, + results: { + array: true, + type: "Valtype" + } + } +}); +defineType("Program", { + unionType: ["Node"], + fields: { + body: { + array: true, + type: "Node" + } + } +}); +defineType("Identifier", { + unionType: ["Node", "Expression"], + fields: { + value: { + type: "string" + }, + raw: { + optional: true, + type: "string" + } + } +}); +defineType("BlockInstruction", { + unionType: ["Node", "Block", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "block" + }, + label: { + maybe: true, + type: "Identifier" + }, + instr: { + array: true, + type: "Instruction" + }, + result: { + maybe: true, + type: "Valtype" + } + } +}); +defineType("CallInstruction", { + unionType: ["Node", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "call" + }, + index: { + type: "Index" + }, + instrArgs: { + array: true, + optional: true, + type: "Expression" + }, + numeric: { + type: "Index", + optional: true + } + } +}); +defineType("CallIndirectInstruction", { + unionType: ["Node", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "call_indirect" + }, + signature: { + type: "SignatureOrTypeRef" + }, + intrs: { + array: true, + optional: true, + type: "Expression" + } + } +}); +defineType("ByteArray", { + unionType: ["Node"], + fields: { + values: { + array: true, + type: "Byte" + } + } +}); +defineType("Func", { + unionType: ["Node", "Block"], + fields: { + name: { + maybe: true, + type: "Index" + }, + signature: { + type: "SignatureOrTypeRef" + }, + body: { + array: true, + type: "Instruction" + }, + isExternal: { + comment: "means that it has been imported from the outside js", + optional: true, + type: "boolean" + }, + metadata: { + optional: true, + type: "FuncMetadata" + } + } +}); +/** + * Intrinsics + */ + +defineType("InternalBrUnless", { + unionType: ["Node", "Intrinsic"], + fields: { + target: { + type: "number" + } + } +}); +defineType("InternalGoto", { + unionType: ["Node", "Intrinsic"], + fields: { + target: { + type: "number" + } + } +}); +defineType("InternalCallExtern", { + unionType: ["Node", "Intrinsic"], + fields: { + target: { + type: "number" + } + } +}); // function bodies are terminated by an `end` instruction but are missing a +// return instruction +// +// Since we can't inject a new instruction we are injecting a new instruction. + +defineType("InternalEndAndReturn", { + unionType: ["Node", "Intrinsic"], + fields: {} +}); +module.exports = definitions; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..17ba19b7b15166e3b5d6af37107d637d023439c4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/index.js @@ -0,0 +1,7 @@ +export * from "./nodes"; +export { numberLiteralFromRaw, withLoc, withRaw, funcParam, indexLiteral, memIndexLiteral, instruction, objectInstruction } from "./node-helpers.js"; +export { traverse } from "./traverse"; +export { signatures } from "./signatures"; +export * from "./utils"; +export { cloneNode } from "./clone"; +export { moduleContextFromModuleAST } from "./transform/ast-module-to-module-context"; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/node-helpers.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/node-helpers.js new file mode 100644 index 0000000000000000000000000000000000000000..37ceda686d3366a2c13da7a51ecb7ae3bd221d48 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/node-helpers.js @@ -0,0 +1,84 @@ +import { parse32F, parse64F, parse32I, parse64I, parseU32, isNanLiteral, isInfLiteral } from "@webassemblyjs/helper-numbers"; +import { longNumberLiteral, floatLiteral, numberLiteral, instr } from "./nodes"; +export function numberLiteralFromRaw(rawValue) { + var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32"; + var original = rawValue; // Remove numeric separators _ + + if (typeof rawValue === "string") { + rawValue = rawValue.replace(/_/g, ""); + } + + if (typeof rawValue === "number") { + return numberLiteral(rawValue, String(original)); + } else { + switch (instructionType) { + case "i32": + { + return numberLiteral(parse32I(rawValue), String(original)); + } + + case "u32": + { + return numberLiteral(parseU32(rawValue), String(original)); + } + + case "i64": + { + return longNumberLiteral(parse64I(rawValue), String(original)); + } + + case "f32": + { + return floatLiteral(parse32F(rawValue), isNanLiteral(rawValue), isInfLiteral(rawValue), String(original)); + } + // f64 + + default: + { + return floatLiteral(parse64F(rawValue), isNanLiteral(rawValue), isInfLiteral(rawValue), String(original)); + } + } + } +} +export function instruction(id) { + var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + return instr(id, undefined, args, namedArgs); +} +export function objectInstruction(id, object) { + var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + return instr(id, object, args, namedArgs); +} +/** + * Decorators + */ + +export function withLoc(n, end, start) { + var loc = { + start: start, + end: end + }; + n.loc = loc; + return n; +} +export function withRaw(n, raw) { + n.raw = raw; + return n; +} +export function funcParam(valtype, id) { + return { + id: id, + valtype: valtype + }; +} +export function indexLiteral(value) { + // $FlowIgnore + var x = numberLiteralFromRaw(value, "u32"); + return x; +} +export function memIndexLiteral(value) { + // $FlowIgnore + var x = numberLiteralFromRaw(value, "u32"); + return x; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/node-path.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/node-path.js new file mode 100644 index 0000000000000000000000000000000000000000..b98c05e937d10d0479363a924ecebd25de911d03 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/node-path.js @@ -0,0 +1,141 @@ +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function findParent(_ref, cb) { + var parentPath = _ref.parentPath; + + if (parentPath == null) { + throw new Error("node is root"); + } + + var currentPath = parentPath; + + while (cb(currentPath) !== false) { + // Hit the root node, stop + // $FlowIgnore + if (currentPath.parentPath == null) { + return null; + } // $FlowIgnore + + + currentPath = currentPath.parentPath; + } + + return currentPath.node; +} + +function insertBefore(context, newNode) { + return insert(context, newNode); +} + +function insertAfter(context, newNode) { + return insert(context, newNode, 1); +} + +function insert(_ref2, newNode) { + var node = _ref2.node, + inList = _ref2.inList, + parentPath = _ref2.parentPath, + parentKey = _ref2.parentKey; + var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + + if (!inList) { + throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || "unknown")); + } + + if (!(parentPath != null)) { + throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || "unknown")); + } + + // $FlowIgnore + var parentList = parentPath.node[parentKey]; + var indexInList = parentList.findIndex(function (n) { + return n === node; + }); + parentList.splice(indexInList + indexOffset, 0, newNode); +} + +function remove(_ref3) { + var node = _ref3.node, + parentKey = _ref3.parentKey, + parentPath = _ref3.parentPath; + + if (!(parentPath != null)) { + throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || "unknown")); + } + + // $FlowIgnore + var parentNode = parentPath.node; // $FlowIgnore + + var parentProperty = parentNode[parentKey]; + + if (Array.isArray(parentProperty)) { + // $FlowIgnore + parentNode[parentKey] = parentProperty.filter(function (n) { + return n !== node; + }); + } else { + // $FlowIgnore + delete parentNode[parentKey]; + } + + node._deleted = true; +} + +function stop(context) { + context.shouldStop = true; +} + +function replaceWith(context, newNode) { + // $FlowIgnore + var parentNode = context.parentPath.node; // $FlowIgnore + + var parentProperty = parentNode[context.parentKey]; + + if (Array.isArray(parentProperty)) { + var indexInList = parentProperty.findIndex(function (n) { + return n === context.node; + }); + parentProperty.splice(indexInList, 1, newNode); + } else { + // $FlowIgnore + parentNode[context.parentKey] = newNode; + } + + context.node._deleted = true; + context.node = newNode; +} // bind the context to the first argument of node operations + + +function bindNodeOperations(operations, context) { + var keys = Object.keys(operations); + var boundOperations = {}; + keys.forEach(function (key) { + boundOperations[key] = operations[key].bind(null, context); + }); + return boundOperations; +} + +function createPathOperations(context) { + // $FlowIgnore + return bindNodeOperations({ + findParent: findParent, + replaceWith: replaceWith, + remove: remove, + insertBefore: insertBefore, + insertAfter: insertAfter, + stop: stop + }, context); +} + +export function createPath(context) { + var path = _objectSpread({}, context); // $FlowIgnore + + + Object.assign(path, createPathOperations(path)); // $FlowIgnore + + return path; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/nodes.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/nodes.js new file mode 100644 index 0000000000000000000000000000000000000000..d2323d55af1f92b2eb694758afcf4fab60820222 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/nodes.js @@ -0,0 +1,925 @@ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +// THIS FILE IS AUTOGENERATED +// see scripts/generateNodeUtils.js +function isTypeOf(t) { + return function (n) { + return n.type === t; + }; +} + +function assertTypeOf(t) { + return function (n) { + return function () { + if (!(n.type === t)) { + throw new Error('n.type === t' + " error: " + (undefined || "unknown")); + } + }(); + }; +} + +export function module(id, fields, metadata) { + if (id !== null && id !== undefined) { + if (!(typeof id === "string")) { + throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown")); + } + } + + if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) { + throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Module", + id: id, + fields: fields + }; + + if (typeof metadata !== "undefined") { + node.metadata = metadata; + } + + return node; +} +export function moduleMetadata(sections, functionNames, localNames, producers) { + if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) { + throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (functionNames !== null && functionNames !== undefined) { + if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) { + throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + if (localNames !== null && localNames !== undefined) { + if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) { + throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + if (producers !== null && producers !== undefined) { + if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) { + throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + var node = { + type: "ModuleMetadata", + sections: sections + }; + + if (typeof functionNames !== "undefined" && functionNames.length > 0) { + node.functionNames = functionNames; + } + + if (typeof localNames !== "undefined" && localNames.length > 0) { + node.localNames = localNames; + } + + if (typeof producers !== "undefined" && producers.length > 0) { + node.producers = producers; + } + + return node; +} +export function moduleNameMetadata(value) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + var node = { + type: "ModuleNameMetadata", + value: value + }; + return node; +} +export function functionNameMetadata(value, index) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + if (!(typeof index === "number")) { + throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || "unknown")); + } + + var node = { + type: "FunctionNameMetadata", + value: value, + index: index + }; + return node; +} +export function localNameMetadata(value, localIndex, functionIndex) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + if (!(typeof localIndex === "number")) { + throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || "unknown")); + } + + if (!(typeof functionIndex === "number")) { + throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || "unknown")); + } + + var node = { + type: "LocalNameMetadata", + value: value, + localIndex: localIndex, + functionIndex: functionIndex + }; + return node; +} +export function binaryModule(id, blob) { + if (id !== null && id !== undefined) { + if (!(typeof id === "string")) { + throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown")); + } + } + + if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) { + throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "BinaryModule", + id: id, + blob: blob + }; + return node; +} +export function quoteModule(id, string) { + if (id !== null && id !== undefined) { + if (!(typeof id === "string")) { + throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown")); + } + } + + if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) { + throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "QuoteModule", + id: id, + string: string + }; + return node; +} +export function sectionMetadata(section, startOffset, size, vectorOfSize) { + if (!(typeof startOffset === "number")) { + throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || "unknown")); + } + + var node = { + type: "SectionMetadata", + section: section, + startOffset: startOffset, + size: size, + vectorOfSize: vectorOfSize + }; + return node; +} +export function producersSectionMetadata(producers) { + if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) { + throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "ProducersSectionMetadata", + producers: producers + }; + return node; +} +export function producerMetadata(language, processedBy, sdk) { + if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) { + throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) { + throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) { + throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "ProducerMetadata", + language: language, + processedBy: processedBy, + sdk: sdk + }; + return node; +} +export function producerMetadataVersionedName(name, version) { + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown")); + } + + if (!(typeof version === "string")) { + throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || "unknown")); + } + + var node = { + type: "ProducerMetadataVersionedName", + name: name, + version: version + }; + return node; +} +export function loopInstruction(label, resulttype, instr) { + if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) { + throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "LoopInstruction", + id: "loop", + label: label, + resulttype: resulttype, + instr: instr + }; + return node; +} +export function instr(id, object, args, namedArgs) { + if (!(typeof id === "string")) { + throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown")); + } + + if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) { + throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Instr", + id: id, + args: args + }; + + if (typeof object !== "undefined") { + node.object = object; + } + + if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) { + node.namedArgs = namedArgs; + } + + return node; +} +export function ifInstruction(testLabel, test, result, consequent, alternate) { + if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) { + throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) { + throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) { + throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "IfInstruction", + id: "if", + testLabel: testLabel, + test: test, + result: result, + consequent: consequent, + alternate: alternate + }; + return node; +} +export function stringLiteral(value) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + var node = { + type: "StringLiteral", + value: value + }; + return node; +} +export function numberLiteral(value, raw) { + if (!(typeof value === "number")) { + throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown")); + } + + if (!(typeof raw === "string")) { + throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown")); + } + + var node = { + type: "NumberLiteral", + value: value, + raw: raw + }; + return node; +} +export function longNumberLiteral(value, raw) { + if (!(typeof raw === "string")) { + throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown")); + } + + var node = { + type: "LongNumberLiteral", + value: value, + raw: raw + }; + return node; +} +export function floatLiteral(value, nan, inf, raw) { + if (!(typeof value === "number")) { + throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown")); + } + + if (nan !== null && nan !== undefined) { + if (!(typeof nan === "boolean")) { + throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || "unknown")); + } + } + + if (inf !== null && inf !== undefined) { + if (!(typeof inf === "boolean")) { + throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || "unknown")); + } + } + + if (!(typeof raw === "string")) { + throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown")); + } + + var node = { + type: "FloatLiteral", + value: value, + raw: raw + }; + + if (nan === true) { + node.nan = true; + } + + if (inf === true) { + node.inf = true; + } + + return node; +} +export function elem(table, offset, funcs) { + if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) { + throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) { + throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Elem", + table: table, + offset: offset, + funcs: funcs + }; + return node; +} +export function indexInFuncSection(index) { + var node = { + type: "IndexInFuncSection", + index: index + }; + return node; +} +export function valtypeLiteral(name) { + var node = { + type: "ValtypeLiteral", + name: name + }; + return node; +} +export function typeInstruction(id, functype) { + var node = { + type: "TypeInstruction", + id: id, + functype: functype + }; + return node; +} +export function start(index) { + var node = { + type: "Start", + index: index + }; + return node; +} +export function globalType(valtype, mutability) { + var node = { + type: "GlobalType", + valtype: valtype, + mutability: mutability + }; + return node; +} +export function leadingComment(value) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + var node = { + type: "LeadingComment", + value: value + }; + return node; +} +export function blockComment(value) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + var node = { + type: "BlockComment", + value: value + }; + return node; +} +export function data(memoryIndex, offset, init) { + var node = { + type: "Data", + memoryIndex: memoryIndex, + offset: offset, + init: init + }; + return node; +} +export function global(globalType, init, name) { + if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) { + throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Global", + globalType: globalType, + init: init, + name: name + }; + return node; +} +export function table(elementType, limits, name, elements) { + if (!(limits.type === "Limit")) { + throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || "unknown")); + } + + if (elements !== null && elements !== undefined) { + if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) { + throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + var node = { + type: "Table", + elementType: elementType, + limits: limits, + name: name + }; + + if (typeof elements !== "undefined" && elements.length > 0) { + node.elements = elements; + } + + return node; +} +export function memory(limits, id) { + var node = { + type: "Memory", + limits: limits, + id: id + }; + return node; +} +export function funcImportDescr(id, signature) { + var node = { + type: "FuncImportDescr", + id: id, + signature: signature + }; + return node; +} +export function moduleImport(module, name, descr) { + if (!(typeof module === "string")) { + throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || "unknown")); + } + + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown")); + } + + var node = { + type: "ModuleImport", + module: module, + name: name, + descr: descr + }; + return node; +} +export function moduleExportDescr(exportType, id) { + var node = { + type: "ModuleExportDescr", + exportType: exportType, + id: id + }; + return node; +} +export function moduleExport(name, descr) { + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown")); + } + + var node = { + type: "ModuleExport", + name: name, + descr: descr + }; + return node; +} +export function limit(min, max, shared) { + if (!(typeof min === "number")) { + throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || "unknown")); + } + + if (max !== null && max !== undefined) { + if (!(typeof max === "number")) { + throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || "unknown")); + } + } + + if (shared !== null && shared !== undefined) { + if (!(typeof shared === "boolean")) { + throw new Error('typeof shared === "boolean"' + " error: " + ("Argument shared must be of type boolean, given: " + _typeof(shared) || "unknown")); + } + } + + var node = { + type: "Limit", + min: min + }; + + if (typeof max !== "undefined") { + node.max = max; + } + + if (shared === true) { + node.shared = true; + } + + return node; +} +export function signature(params, results) { + if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) { + throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) { + throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Signature", + params: params, + results: results + }; + return node; +} +export function program(body) { + if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) { + throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Program", + body: body + }; + return node; +} +export function identifier(value, raw) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + if (raw !== null && raw !== undefined) { + if (!(typeof raw === "string")) { + throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown")); + } + } + + var node = { + type: "Identifier", + value: value + }; + + if (typeof raw !== "undefined") { + node.raw = raw; + } + + return node; +} +export function blockInstruction(label, instr, result) { + if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) { + throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "BlockInstruction", + id: "block", + label: label, + instr: instr, + result: result + }; + return node; +} +export function callInstruction(index, instrArgs, numeric) { + if (instrArgs !== null && instrArgs !== undefined) { + if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) { + throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + var node = { + type: "CallInstruction", + id: "call", + index: index + }; + + if (typeof instrArgs !== "undefined" && instrArgs.length > 0) { + node.instrArgs = instrArgs; + } + + if (typeof numeric !== "undefined") { + node.numeric = numeric; + } + + return node; +} +export function callIndirectInstruction(signature, intrs) { + if (intrs !== null && intrs !== undefined) { + if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) { + throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + var node = { + type: "CallIndirectInstruction", + id: "call_indirect", + signature: signature + }; + + if (typeof intrs !== "undefined" && intrs.length > 0) { + node.intrs = intrs; + } + + return node; +} +export function byteArray(values) { + if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) { + throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "ByteArray", + values: values + }; + return node; +} +export function func(name, signature, body, isExternal, metadata) { + if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) { + throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (isExternal !== null && isExternal !== undefined) { + if (!(typeof isExternal === "boolean")) { + throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || "unknown")); + } + } + + var node = { + type: "Func", + name: name, + signature: signature, + body: body + }; + + if (isExternal === true) { + node.isExternal = true; + } + + if (typeof metadata !== "undefined") { + node.metadata = metadata; + } + + return node; +} +export function internalBrUnless(target) { + if (!(typeof target === "number")) { + throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown")); + } + + var node = { + type: "InternalBrUnless", + target: target + }; + return node; +} +export function internalGoto(target) { + if (!(typeof target === "number")) { + throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown")); + } + + var node = { + type: "InternalGoto", + target: target + }; + return node; +} +export function internalCallExtern(target) { + if (!(typeof target === "number")) { + throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown")); + } + + var node = { + type: "InternalCallExtern", + target: target + }; + return node; +} +export function internalEndAndReturn() { + var node = { + type: "InternalEndAndReturn" + }; + return node; +} +export var isModule = isTypeOf("Module"); +export var isModuleMetadata = isTypeOf("ModuleMetadata"); +export var isModuleNameMetadata = isTypeOf("ModuleNameMetadata"); +export var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata"); +export var isLocalNameMetadata = isTypeOf("LocalNameMetadata"); +export var isBinaryModule = isTypeOf("BinaryModule"); +export var isQuoteModule = isTypeOf("QuoteModule"); +export var isSectionMetadata = isTypeOf("SectionMetadata"); +export var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata"); +export var isProducerMetadata = isTypeOf("ProducerMetadata"); +export var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName"); +export var isLoopInstruction = isTypeOf("LoopInstruction"); +export var isInstr = isTypeOf("Instr"); +export var isIfInstruction = isTypeOf("IfInstruction"); +export var isStringLiteral = isTypeOf("StringLiteral"); +export var isNumberLiteral = isTypeOf("NumberLiteral"); +export var isLongNumberLiteral = isTypeOf("LongNumberLiteral"); +export var isFloatLiteral = isTypeOf("FloatLiteral"); +export var isElem = isTypeOf("Elem"); +export var isIndexInFuncSection = isTypeOf("IndexInFuncSection"); +export var isValtypeLiteral = isTypeOf("ValtypeLiteral"); +export var isTypeInstruction = isTypeOf("TypeInstruction"); +export var isStart = isTypeOf("Start"); +export var isGlobalType = isTypeOf("GlobalType"); +export var isLeadingComment = isTypeOf("LeadingComment"); +export var isBlockComment = isTypeOf("BlockComment"); +export var isData = isTypeOf("Data"); +export var isGlobal = isTypeOf("Global"); +export var isTable = isTypeOf("Table"); +export var isMemory = isTypeOf("Memory"); +export var isFuncImportDescr = isTypeOf("FuncImportDescr"); +export var isModuleImport = isTypeOf("ModuleImport"); +export var isModuleExportDescr = isTypeOf("ModuleExportDescr"); +export var isModuleExport = isTypeOf("ModuleExport"); +export var isLimit = isTypeOf("Limit"); +export var isSignature = isTypeOf("Signature"); +export var isProgram = isTypeOf("Program"); +export var isIdentifier = isTypeOf("Identifier"); +export var isBlockInstruction = isTypeOf("BlockInstruction"); +export var isCallInstruction = isTypeOf("CallInstruction"); +export var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction"); +export var isByteArray = isTypeOf("ByteArray"); +export var isFunc = isTypeOf("Func"); +export var isInternalBrUnless = isTypeOf("InternalBrUnless"); +export var isInternalGoto = isTypeOf("InternalGoto"); +export var isInternalCallExtern = isTypeOf("InternalCallExtern"); +export var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn"); +export var isNode = function isNode(node) { + return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node); +}; +export var isBlock = function isBlock(node) { + return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node); +}; +export var isInstruction = function isInstruction(node) { + return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node); +}; +export var isExpression = function isExpression(node) { + return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node); +}; +export var isNumericLiteral = function isNumericLiteral(node) { + return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node); +}; +export var isImportDescr = function isImportDescr(node) { + return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node); +}; +export var isIntrinsic = function isIntrinsic(node) { + return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node); +}; +export var assertModule = assertTypeOf("Module"); +export var assertModuleMetadata = assertTypeOf("ModuleMetadata"); +export var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata"); +export var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata"); +export var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata"); +export var assertBinaryModule = assertTypeOf("BinaryModule"); +export var assertQuoteModule = assertTypeOf("QuoteModule"); +export var assertSectionMetadata = assertTypeOf("SectionMetadata"); +export var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata"); +export var assertProducerMetadata = assertTypeOf("ProducerMetadata"); +export var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName"); +export var assertLoopInstruction = assertTypeOf("LoopInstruction"); +export var assertInstr = assertTypeOf("Instr"); +export var assertIfInstruction = assertTypeOf("IfInstruction"); +export var assertStringLiteral = assertTypeOf("StringLiteral"); +export var assertNumberLiteral = assertTypeOf("NumberLiteral"); +export var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral"); +export var assertFloatLiteral = assertTypeOf("FloatLiteral"); +export var assertElem = assertTypeOf("Elem"); +export var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection"); +export var assertValtypeLiteral = assertTypeOf("ValtypeLiteral"); +export var assertTypeInstruction = assertTypeOf("TypeInstruction"); +export var assertStart = assertTypeOf("Start"); +export var assertGlobalType = assertTypeOf("GlobalType"); +export var assertLeadingComment = assertTypeOf("LeadingComment"); +export var assertBlockComment = assertTypeOf("BlockComment"); +export var assertData = assertTypeOf("Data"); +export var assertGlobal = assertTypeOf("Global"); +export var assertTable = assertTypeOf("Table"); +export var assertMemory = assertTypeOf("Memory"); +export var assertFuncImportDescr = assertTypeOf("FuncImportDescr"); +export var assertModuleImport = assertTypeOf("ModuleImport"); +export var assertModuleExportDescr = assertTypeOf("ModuleExportDescr"); +export var assertModuleExport = assertTypeOf("ModuleExport"); +export var assertLimit = assertTypeOf("Limit"); +export var assertSignature = assertTypeOf("Signature"); +export var assertProgram = assertTypeOf("Program"); +export var assertIdentifier = assertTypeOf("Identifier"); +export var assertBlockInstruction = assertTypeOf("BlockInstruction"); +export var assertCallInstruction = assertTypeOf("CallInstruction"); +export var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction"); +export var assertByteArray = assertTypeOf("ByteArray"); +export var assertFunc = assertTypeOf("Func"); +export var assertInternalBrUnless = assertTypeOf("InternalBrUnless"); +export var assertInternalGoto = assertTypeOf("InternalGoto"); +export var assertInternalCallExtern = assertTypeOf("InternalCallExtern"); +export var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn"); +export var unionTypesMap = { + Module: ["Node"], + ModuleMetadata: ["Node"], + ModuleNameMetadata: ["Node"], + FunctionNameMetadata: ["Node"], + LocalNameMetadata: ["Node"], + BinaryModule: ["Node"], + QuoteModule: ["Node"], + SectionMetadata: ["Node"], + ProducersSectionMetadata: ["Node"], + ProducerMetadata: ["Node"], + ProducerMetadataVersionedName: ["Node"], + LoopInstruction: ["Node", "Block", "Instruction"], + Instr: ["Node", "Expression", "Instruction"], + IfInstruction: ["Node", "Instruction"], + StringLiteral: ["Node", "Expression"], + NumberLiteral: ["Node", "NumericLiteral", "Expression"], + LongNumberLiteral: ["Node", "NumericLiteral", "Expression"], + FloatLiteral: ["Node", "NumericLiteral", "Expression"], + Elem: ["Node"], + IndexInFuncSection: ["Node"], + ValtypeLiteral: ["Node", "Expression"], + TypeInstruction: ["Node", "Instruction"], + Start: ["Node"], + GlobalType: ["Node", "ImportDescr"], + LeadingComment: ["Node"], + BlockComment: ["Node"], + Data: ["Node"], + Global: ["Node"], + Table: ["Node", "ImportDescr"], + Memory: ["Node", "ImportDescr"], + FuncImportDescr: ["Node", "ImportDescr"], + ModuleImport: ["Node"], + ModuleExportDescr: ["Node"], + ModuleExport: ["Node"], + Limit: ["Node"], + Signature: ["Node"], + Program: ["Node"], + Identifier: ["Node", "Expression"], + BlockInstruction: ["Node", "Block", "Instruction"], + CallInstruction: ["Node", "Instruction"], + CallIndirectInstruction: ["Node", "Instruction"], + ByteArray: ["Node"], + Func: ["Node", "Block"], + InternalBrUnless: ["Node", "Intrinsic"], + InternalGoto: ["Node", "Intrinsic"], + InternalCallExtern: ["Node", "Intrinsic"], + InternalEndAndReturn: ["Node", "Intrinsic"] +}; +export var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"]; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/signatures.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/signatures.js new file mode 100644 index 0000000000000000000000000000000000000000..3efc4da25b9d74947f48c6512b59465077d08ea7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/signatures.js @@ -0,0 +1,199 @@ +function sign(input, output) { + return [input, output]; +} + +var u32 = "u32"; +var i32 = "i32"; +var i64 = "i64"; +var f32 = "f32"; +var f64 = "f64"; + +var vector = function vector(t) { + var vecType = [t]; // $FlowIgnore + + vecType.vector = true; + return vecType; +}; + +var controlInstructions = { + unreachable: sign([], []), + nop: sign([], []), + // block ? + // loop ? + // if ? + // if else ? + br: sign([u32], []), + br_if: sign([u32], []), + br_table: sign(vector(u32), []), + "return": sign([], []), + call: sign([u32], []), + call_indirect: sign([u32], []) +}; +var parametricInstructions = { + drop: sign([], []), + select: sign([], []) +}; +var variableInstructions = { + get_local: sign([u32], []), + set_local: sign([u32], []), + tee_local: sign([u32], []), + get_global: sign([u32], []), + set_global: sign([u32], []) +}; +var memoryInstructions = { + "i32.load": sign([u32, u32], [i32]), + "i64.load": sign([u32, u32], []), + "f32.load": sign([u32, u32], []), + "f64.load": sign([u32, u32], []), + "i32.load8_s": sign([u32, u32], [i32]), + "i32.load8_u": sign([u32, u32], [i32]), + "i32.load16_s": sign([u32, u32], [i32]), + "i32.load16_u": sign([u32, u32], [i32]), + "i64.load8_s": sign([u32, u32], [i64]), + "i64.load8_u": sign([u32, u32], [i64]), + "i64.load16_s": sign([u32, u32], [i64]), + "i64.load16_u": sign([u32, u32], [i64]), + "i64.load32_s": sign([u32, u32], [i64]), + "i64.load32_u": sign([u32, u32], [i64]), + "i32.store": sign([u32, u32], []), + "i64.store": sign([u32, u32], []), + "f32.store": sign([u32, u32], []), + "f64.store": sign([u32, u32], []), + "i32.store8": sign([u32, u32], []), + "i32.store16": sign([u32, u32], []), + "i64.store8": sign([u32, u32], []), + "i64.store16": sign([u32, u32], []), + "i64.store32": sign([u32, u32], []), + current_memory: sign([], []), + grow_memory: sign([], []) +}; +var numericInstructions = { + "i32.const": sign([i32], [i32]), + "i64.const": sign([i64], [i64]), + "f32.const": sign([f32], [f32]), + "f64.const": sign([f64], [f64]), + "i32.eqz": sign([i32], [i32]), + "i32.eq": sign([i32, i32], [i32]), + "i32.ne": sign([i32, i32], [i32]), + "i32.lt_s": sign([i32, i32], [i32]), + "i32.lt_u": sign([i32, i32], [i32]), + "i32.gt_s": sign([i32, i32], [i32]), + "i32.gt_u": sign([i32, i32], [i32]), + "i32.le_s": sign([i32, i32], [i32]), + "i32.le_u": sign([i32, i32], [i32]), + "i32.ge_s": sign([i32, i32], [i32]), + "i32.ge_u": sign([i32, i32], [i32]), + "i64.eqz": sign([i64], [i64]), + "i64.eq": sign([i64, i64], [i32]), + "i64.ne": sign([i64, i64], [i32]), + "i64.lt_s": sign([i64, i64], [i32]), + "i64.lt_u": sign([i64, i64], [i32]), + "i64.gt_s": sign([i64, i64], [i32]), + "i64.gt_u": sign([i64, i64], [i32]), + "i64.le_s": sign([i64, i64], [i32]), + "i64.le_u": sign([i64, i64], [i32]), + "i64.ge_s": sign([i64, i64], [i32]), + "i64.ge_u": sign([i64, i64], [i32]), + "f32.eq": sign([f32, f32], [i32]), + "f32.ne": sign([f32, f32], [i32]), + "f32.lt": sign([f32, f32], [i32]), + "f32.gt": sign([f32, f32], [i32]), + "f32.le": sign([f32, f32], [i32]), + "f32.ge": sign([f32, f32], [i32]), + "f64.eq": sign([f64, f64], [i32]), + "f64.ne": sign([f64, f64], [i32]), + "f64.lt": sign([f64, f64], [i32]), + "f64.gt": sign([f64, f64], [i32]), + "f64.le": sign([f64, f64], [i32]), + "f64.ge": sign([f64, f64], [i32]), + "i32.clz": sign([i32], [i32]), + "i32.ctz": sign([i32], [i32]), + "i32.popcnt": sign([i32], [i32]), + "i32.add": sign([i32, i32], [i32]), + "i32.sub": sign([i32, i32], [i32]), + "i32.mul": sign([i32, i32], [i32]), + "i32.div_s": sign([i32, i32], [i32]), + "i32.div_u": sign([i32, i32], [i32]), + "i32.rem_s": sign([i32, i32], [i32]), + "i32.rem_u": sign([i32, i32], [i32]), + "i32.and": sign([i32, i32], [i32]), + "i32.or": sign([i32, i32], [i32]), + "i32.xor": sign([i32, i32], [i32]), + "i32.shl": sign([i32, i32], [i32]), + "i32.shr_s": sign([i32, i32], [i32]), + "i32.shr_u": sign([i32, i32], [i32]), + "i32.rotl": sign([i32, i32], [i32]), + "i32.rotr": sign([i32, i32], [i32]), + "i64.clz": sign([i64], [i64]), + "i64.ctz": sign([i64], [i64]), + "i64.popcnt": sign([i64], [i64]), + "i64.add": sign([i64, i64], [i64]), + "i64.sub": sign([i64, i64], [i64]), + "i64.mul": sign([i64, i64], [i64]), + "i64.div_s": sign([i64, i64], [i64]), + "i64.div_u": sign([i64, i64], [i64]), + "i64.rem_s": sign([i64, i64], [i64]), + "i64.rem_u": sign([i64, i64], [i64]), + "i64.and": sign([i64, i64], [i64]), + "i64.or": sign([i64, i64], [i64]), + "i64.xor": sign([i64, i64], [i64]), + "i64.shl": sign([i64, i64], [i64]), + "i64.shr_s": sign([i64, i64], [i64]), + "i64.shr_u": sign([i64, i64], [i64]), + "i64.rotl": sign([i64, i64], [i64]), + "i64.rotr": sign([i64, i64], [i64]), + "f32.abs": sign([f32], [f32]), + "f32.neg": sign([f32], [f32]), + "f32.ceil": sign([f32], [f32]), + "f32.floor": sign([f32], [f32]), + "f32.trunc": sign([f32], [f32]), + "f32.nearest": sign([f32], [f32]), + "f32.sqrt": sign([f32], [f32]), + "f32.add": sign([f32, f32], [f32]), + "f32.sub": sign([f32, f32], [f32]), + "f32.mul": sign([f32, f32], [f32]), + "f32.div": sign([f32, f32], [f32]), + "f32.min": sign([f32, f32], [f32]), + "f32.max": sign([f32, f32], [f32]), + "f32.copysign": sign([f32, f32], [f32]), + "f64.abs": sign([f64], [f64]), + "f64.neg": sign([f64], [f64]), + "f64.ceil": sign([f64], [f64]), + "f64.floor": sign([f64], [f64]), + "f64.trunc": sign([f64], [f64]), + "f64.nearest": sign([f64], [f64]), + "f64.sqrt": sign([f64], [f64]), + "f64.add": sign([f64, f64], [f64]), + "f64.sub": sign([f64, f64], [f64]), + "f64.mul": sign([f64, f64], [f64]), + "f64.div": sign([f64, f64], [f64]), + "f64.min": sign([f64, f64], [f64]), + "f64.max": sign([f64, f64], [f64]), + "f64.copysign": sign([f64, f64], [f64]), + "i32.wrap/i64": sign([i64], [i32]), + "i32.trunc_s/f32": sign([f32], [i32]), + "i32.trunc_u/f32": sign([f32], [i32]), + "i32.trunc_s/f64": sign([f32], [i32]), + "i32.trunc_u/f64": sign([f64], [i32]), + "i64.extend_s/i32": sign([i32], [i64]), + "i64.extend_u/i32": sign([i32], [i64]), + "i64.trunc_s/f32": sign([f32], [i64]), + "i64.trunc_u/f32": sign([f32], [i64]), + "i64.trunc_s/f64": sign([f64], [i64]), + "i64.trunc_u/f64": sign([f64], [i64]), + "f32.convert_s/i32": sign([i32], [f32]), + "f32.convert_u/i32": sign([i32], [f32]), + "f32.convert_s/i64": sign([i64], [f32]), + "f32.convert_u/i64": sign([i64], [f32]), + "f32.demote/f64": sign([f64], [f32]), + "f64.convert_s/i32": sign([i32], [f64]), + "f64.convert_u/i32": sign([i32], [f64]), + "f64.convert_s/i64": sign([i64], [f64]), + "f64.convert_u/i64": sign([i64], [f64]), + "f64.promote/f32": sign([f32], [f64]), + "i32.reinterpret/f32": sign([f32], [i32]), + "i64.reinterpret/f64": sign([f64], [i64]), + "f32.reinterpret/i32": sign([i32], [f32]), + "f64.reinterpret/i64": sign([i64], [f64]) +}; +export var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/transform/ast-module-to-module-context/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/transform/ast-module-to-module-context/index.js new file mode 100644 index 0000000000000000000000000000000000000000..aaca41a59f847b096222f2259aeeb2f0b7ae374c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/transform/ast-module-to-module-context/index.js @@ -0,0 +1,377 @@ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +import { isSignature, isNumberLiteral } from "../../nodes.js"; +export function moduleContextFromModuleAST(m) { + var moduleContext = new ModuleContext(); + + if (!(m.type === "Module")) { + throw new Error('m.type === "Module"' + " error: " + (undefined || "unknown")); + } + + m.fields.forEach(function (field) { + switch (field.type) { + case "Start": + { + moduleContext.setStart(field.index); + break; + } + + case "TypeInstruction": + { + moduleContext.addType(field); + break; + } + + case "Func": + { + moduleContext.addFunction(field); + break; + } + + case "Global": + { + moduleContext.defineGlobal(field); + break; + } + + case "ModuleImport": + { + switch (field.descr.type) { + case "GlobalType": + { + moduleContext.importGlobal(field.descr.valtype, field.descr.mutability); + break; + } + + case "Memory": + { + moduleContext.addMemory(field.descr.limits.min, field.descr.limits.max); + break; + } + + case "FuncImportDescr": + { + moduleContext.importFunction(field.descr); + break; + } + + case "Table": + { + // FIXME(sven): not implemented yet + break; + } + + default: + throw new Error("Unsupported ModuleImport of type " + JSON.stringify(field.descr.type)); + } + + break; + } + + case "Memory": + { + moduleContext.addMemory(field.limits.min, field.limits.max); + break; + } + } + }); + return moduleContext; +} +/** + * Module context for type checking + */ + +export var ModuleContext = /*#__PURE__*/function () { + function ModuleContext() { + _classCallCheck(this, ModuleContext); + + this.funcs = []; + this.funcsOffsetByIdentifier = []; + this.types = []; + this.globals = []; + this.globalsOffsetByIdentifier = []; + this.mems = []; // Current stack frame + + this.locals = []; + this.labels = []; + this["return"] = []; + this.debugName = "unknown"; + this.start = null; + } + /** + * Set start segment + */ + + + _createClass(ModuleContext, [{ + key: "setStart", + value: function setStart(index) { + this.start = index.value; + } + /** + * Get start function + */ + + }, { + key: "getStart", + value: function getStart() { + return this.start; + } + /** + * Reset the active stack frame + */ + + }, { + key: "newContext", + value: function newContext(debugName, expectedResult) { + this.locals = []; + this.labels = [expectedResult]; + this["return"] = expectedResult; + this.debugName = debugName; + } + /** + * Functions + */ + + }, { + key: "addFunction", + value: function addFunction(func) { + /* eslint-disable */ + // $FlowIgnore + var _ref = func.signature || {}, + _ref$params = _ref.params, + args = _ref$params === void 0 ? [] : _ref$params, + _ref$results = _ref.results, + result = _ref$results === void 0 ? [] : _ref$results; + /* eslint-enable */ + + + args = args.map(function (arg) { + return arg.valtype; + }); + this.funcs.push({ + args: args, + result: result + }); + + if (typeof func.name !== "undefined") { + // $FlowIgnore + this.funcsOffsetByIdentifier[func.name.value] = this.funcs.length - 1; + } + } + }, { + key: "importFunction", + value: function importFunction(funcimport) { + if (isSignature(funcimport.signature)) { + // eslint-disable-next-line prefer-const + var _funcimport$signature = funcimport.signature, + args = _funcimport$signature.params, + result = _funcimport$signature.results; + args = args.map(function (arg) { + return arg.valtype; + }); + this.funcs.push({ + args: args, + result: result + }); + } else { + if (!isNumberLiteral(funcimport.signature)) { + throw new Error('isNumberLiteral(funcimport.signature)' + " error: " + (undefined || "unknown")); + } + + var typeId = funcimport.signature.value; + + if (!this.hasType(typeId)) { + throw new Error('this.hasType(typeId)' + " error: " + (undefined || "unknown")); + } + + var signature = this.getType(typeId); + this.funcs.push({ + args: signature.params.map(function (arg) { + return arg.valtype; + }), + result: signature.results + }); + } + + if (typeof funcimport.id !== "undefined") { + // imports are first, we can assume their index in the array + this.funcsOffsetByIdentifier[funcimport.id.value] = this.funcs.length - 1; + } + } + }, { + key: "hasFunction", + value: function hasFunction(index) { + return typeof this.getFunction(index) !== "undefined"; + } + }, { + key: "getFunction", + value: function getFunction(index) { + if (typeof index !== "number") { + throw new Error("getFunction only supported for number index"); + } + + return this.funcs[index]; + } + }, { + key: "getFunctionOffsetByIdentifier", + value: function getFunctionOffsetByIdentifier(name) { + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown")); + } + + return this.funcsOffsetByIdentifier[name]; + } + /** + * Labels + */ + + }, { + key: "addLabel", + value: function addLabel(result) { + this.labels.unshift(result); + } + }, { + key: "hasLabel", + value: function hasLabel(index) { + return this.labels.length > index && index >= 0; + } + }, { + key: "getLabel", + value: function getLabel(index) { + return this.labels[index]; + } + }, { + key: "popLabel", + value: function popLabel() { + this.labels.shift(); + } + /** + * Locals + */ + + }, { + key: "hasLocal", + value: function hasLocal(index) { + return typeof this.getLocal(index) !== "undefined"; + } + }, { + key: "getLocal", + value: function getLocal(index) { + return this.locals[index]; + } + }, { + key: "addLocal", + value: function addLocal(type) { + this.locals.push(type); + } + /** + * Types + */ + + }, { + key: "addType", + value: function addType(type) { + if (!(type.functype.type === "Signature")) { + throw new Error('type.functype.type === "Signature"' + " error: " + (undefined || "unknown")); + } + + this.types.push(type.functype); + } + }, { + key: "hasType", + value: function hasType(index) { + return this.types[index] !== undefined; + } + }, { + key: "getType", + value: function getType(index) { + return this.types[index]; + } + /** + * Globals + */ + + }, { + key: "hasGlobal", + value: function hasGlobal(index) { + return this.globals.length > index && index >= 0; + } + }, { + key: "getGlobal", + value: function getGlobal(index) { + return this.globals[index].type; + } + }, { + key: "getGlobalOffsetByIdentifier", + value: function getGlobalOffsetByIdentifier(name) { + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown")); + } + + // $FlowIgnore + return this.globalsOffsetByIdentifier[name]; + } + }, { + key: "defineGlobal", + value: function defineGlobal(global) { + var type = global.globalType.valtype; + var mutability = global.globalType.mutability; + this.globals.push({ + type: type, + mutability: mutability + }); + + if (typeof global.name !== "undefined") { + // $FlowIgnore + this.globalsOffsetByIdentifier[global.name.value] = this.globals.length - 1; + } + } + }, { + key: "importGlobal", + value: function importGlobal(type, mutability) { + this.globals.push({ + type: type, + mutability: mutability + }); + } + }, { + key: "isMutableGlobal", + value: function isMutableGlobal(index) { + return this.globals[index].mutability === "var"; + } + }, { + key: "isImmutableGlobal", + value: function isImmutableGlobal(index) { + return this.globals[index].mutability === "const"; + } + /** + * Memories + */ + + }, { + key: "hasMemory", + value: function hasMemory(index) { + return this.mems.length > index && index >= 0; + } + }, { + key: "addMemory", + value: function addMemory(min, max) { + this.mems.push({ + min: min, + max: max + }); + } + }, { + key: "getMemory", + value: function getMemory(index) { + return this.mems[index]; + } + }]); + + return ModuleContext; +}(); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/transform/denormalize-type-references/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/transform/denormalize-type-references/index.js new file mode 100644 index 0000000000000000000000000000000000000000..26891f9d18312c0654198a28770433b6995310ac --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/transform/denormalize-type-references/index.js @@ -0,0 +1,76 @@ +var t = require("../../index"); // func and call_indirect instructions can either define a signature inline, or +// reference a signature, e.g. +// +// ;; inline signature +// (func (result i64) +// (i64.const 2) +// ) +// ;; signature reference +// (type (func (result i64))) +// (func (type 0) +// (i64.const 2)) +// ) +// +// this AST transform denormalises the type references, making all signatures within the module +// inline. + + +export function transform(ast) { + var typeInstructions = []; + t.traverse(ast, { + TypeInstruction: function TypeInstruction(_ref) { + var node = _ref.node; + typeInstructions.push(node); + } + }); + + if (!typeInstructions.length) { + return; + } + + function denormalizeSignature(signature) { + // signature referenced by identifier + if (signature.type === "Identifier") { + var identifier = signature; + var typeInstruction = typeInstructions.find(function (t) { + return t.id.type === identifier.type && t.id.value === identifier.value; + }); + + if (!typeInstruction) { + throw new Error("A type instruction reference was not found ".concat(JSON.stringify(signature))); + } + + return typeInstruction.functype; + } // signature referenced by index + + + if (signature.type === "NumberLiteral") { + var signatureRef = signature; + var _typeInstruction = typeInstructions[signatureRef.value]; + return _typeInstruction.functype; + } + + return signature; + } + + t.traverse(ast, { + Func: function (_Func) { + function Func(_x) { + return _Func.apply(this, arguments); + } + + Func.toString = function () { + return _Func.toString(); + }; + + return Func; + }(function (_ref2) { + var node = _ref2.node; + node.signature = denormalizeSignature(node.signature); + }), + CallIndirectInstruction: function CallIndirectInstruction(_ref3) { + var node = _ref3.node; + node.signature = denormalizeSignature(node.signature); + } + }); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/transform/wast-identifier-to-index/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/transform/wast-identifier-to-index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b9c0023061e77b67fcac9daf5296332a180a99be --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/transform/wast-identifier-to-index/index.js @@ -0,0 +1,229 @@ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +import { isBlock, isFunc, isIdentifier, numberLiteralFromRaw, traverse } from "../../index"; +import { moduleContextFromModuleAST } from "../ast-module-to-module-context"; // FIXME(sven): do the same with all block instructions, must be more generic here + +function newUnexpectedFunction(i) { + return new Error("unknown function at offset: " + i); +} + +export function transform(ast) { + var module = null; + traverse(ast, { + Module: function (_Module) { + function Module(_x) { + return _Module.apply(this, arguments); + } + + Module.toString = function () { + return _Module.toString(); + }; + + return Module; + }(function (path) { + module = path.node; + }) + }); + + if (module == null) { + throw new Error("Module not foudn in program"); + } + + var moduleContext = moduleContextFromModuleAST(module); // Transform the actual instruction in function bodies + + traverse(ast, { + Func: function (_Func) { + function Func(_x2) { + return _Func.apply(this, arguments); + } + + Func.toString = function () { + return _Func.toString(); + }; + + return Func; + }(function (path) { + transformFuncPath(path, moduleContext); + }), + Start: function (_Start) { + function Start(_x3) { + return _Start.apply(this, arguments); + } + + Start.toString = function () { + return _Start.toString(); + }; + + return Start; + }(function (path) { + var index = path.node.index; + + if (isIdentifier(index) === true) { + var offsetInModule = moduleContext.getFunctionOffsetByIdentifier(index.value); + + if (typeof offsetInModule === "undefined") { + throw newUnexpectedFunction(index.value); + } // Replace the index Identifier + // $FlowIgnore: reference? + + + path.node.index = numberLiteralFromRaw(offsetInModule); + } + }) + }); +} + +function transformFuncPath(funcPath, moduleContext) { + var funcNode = funcPath.node; + var signature = funcNode.signature; + + if (signature.type !== "Signature") { + throw new Error("Function signatures must be denormalised before execution"); + } + + var params = signature.params; // Add func locals in the context + + params.forEach(function (p) { + return moduleContext.addLocal(p.valtype); + }); + traverse(funcNode, { + Instr: function (_Instr) { + function Instr(_x4) { + return _Instr.apply(this, arguments); + } + + Instr.toString = function () { + return _Instr.toString(); + }; + + return Instr; + }(function (instrPath) { + var instrNode = instrPath.node; + /** + * Local access + */ + + if (instrNode.id === "get_local" || instrNode.id === "set_local" || instrNode.id === "tee_local") { + var _instrNode$args = _slicedToArray(instrNode.args, 1), + firstArg = _instrNode$args[0]; + + if (firstArg.type === "Identifier") { + var offsetInParams = params.findIndex(function (_ref) { + var id = _ref.id; + return id === firstArg.value; + }); + + if (offsetInParams === -1) { + throw new Error("".concat(firstArg.value, " not found in ").concat(instrNode.id, ": not declared in func params")); + } // Replace the Identifer node by our new NumberLiteral node + + + instrNode.args[0] = numberLiteralFromRaw(offsetInParams); + } + } + /** + * Global access + */ + + + if (instrNode.id === "get_global" || instrNode.id === "set_global") { + var _instrNode$args2 = _slicedToArray(instrNode.args, 1), + _firstArg = _instrNode$args2[0]; + + if (isIdentifier(_firstArg) === true) { + var globalOffset = moduleContext.getGlobalOffsetByIdentifier( // $FlowIgnore: reference? + _firstArg.value); + + if (typeof globalOffset === "undefined") { + // $FlowIgnore: reference? + throw new Error("global ".concat(_firstArg.value, " not found in module")); + } // Replace the Identifer node by our new NumberLiteral node + + + instrNode.args[0] = numberLiteralFromRaw(globalOffset); + } + } + /** + * Labels lookup + */ + + + if (instrNode.id === "br") { + var _instrNode$args3 = _slicedToArray(instrNode.args, 1), + _firstArg2 = _instrNode$args3[0]; + + if (isIdentifier(_firstArg2) === true) { + // if the labels is not found it is going to be replaced with -1 + // which is invalid. + var relativeBlockCount = -1; // $FlowIgnore: reference? + + instrPath.findParent(function (_ref2) { + var node = _ref2.node; + + if (isBlock(node)) { + relativeBlockCount++; // $FlowIgnore: reference? + + var name = node.label || node.name; + + if (_typeof(name) === "object") { + // $FlowIgnore: isIdentifier ensures that + if (name.value === _firstArg2.value) { + // Found it + return false; + } + } + } + + if (isFunc(node)) { + return false; + } + }); // Replace the Identifer node by our new NumberLiteral node + + instrNode.args[0] = numberLiteralFromRaw(relativeBlockCount); + } + } + }), + + /** + * Func lookup + */ + CallInstruction: function (_CallInstruction) { + function CallInstruction(_x5) { + return _CallInstruction.apply(this, arguments); + } + + CallInstruction.toString = function () { + return _CallInstruction.toString(); + }; + + return CallInstruction; + }(function (_ref3) { + var node = _ref3.node; + var index = node.index; + + if (isIdentifier(index) === true) { + var offsetInModule = moduleContext.getFunctionOffsetByIdentifier(index.value); + + if (typeof offsetInModule === "undefined") { + throw newUnexpectedFunction(index.value); + } // Replace the index Identifier + // $FlowIgnore: reference? + + + node.index = numberLiteralFromRaw(offsetInModule); + } + }) + }); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/traverse.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/traverse.js new file mode 100644 index 0000000000000000000000000000000000000000..328dc09d3d1c524c6492001f639ad1fcd3c94c67 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/traverse.js @@ -0,0 +1,96 @@ +import { createPath } from "./node-path"; +import { unionTypesMap, nodeAndUnionTypes } from "./nodes"; // recursively walks the AST starting at the given node. The callback is invoked for +// and object that has a 'type' property. + +function walk(context, callback) { + var stop = false; + + function innerWalk(context, callback) { + if (stop) { + return; + } + + var node = context.node; + + if (node === undefined) { + console.warn("traversing with an empty context"); + return; + } + + if (node._deleted === true) { + return; + } + + var path = createPath(context); + callback(node.type, path); + + if (path.shouldStop) { + stop = true; + return; + } + + Object.keys(node).forEach(function (prop) { + var value = node[prop]; + + if (value === null || value === undefined) { + return; + } + + var valueAsArray = Array.isArray(value) ? value : [value]; + valueAsArray.forEach(function (childNode) { + if (typeof childNode.type === "string") { + var childContext = { + node: childNode, + parentKey: prop, + parentPath: path, + shouldStop: false, + inList: Array.isArray(value) + }; + innerWalk(childContext, callback); + } + }); + }); + } + + innerWalk(context, callback); +} + +var noop = function noop() {}; + +export function traverse(node, visitors) { + var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop; + var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop; + Object.keys(visitors).forEach(function (visitor) { + if (!nodeAndUnionTypes.includes(visitor)) { + throw new Error("Unexpected visitor ".concat(visitor)); + } + }); + var context = { + node: node, + inList: false, + shouldStop: false, + parentPath: null, + parentKey: null + }; + walk(context, function (type, path) { + if (typeof visitors[type] === "function") { + before(type, path); + visitors[type](path); + after(type, path); + } + + var unionTypes = unionTypesMap[type]; + + if (!unionTypes) { + throw new Error("Unexpected node type ".concat(type)); + } + + unionTypes.forEach(function (unionType) { + if (typeof visitors[unionType] === "function") { + before(unionType, path); + visitors[unionType](path); + after(unionType, path); + } + }); + }); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/types/basic.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/types/basic.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/types/nodes.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/types/nodes.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/types/traverse.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/types/traverse.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/utils.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..bf9ee9ae8d759bfd36a70d5961c4985eea28b78f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/esm/utils.js @@ -0,0 +1,272 @@ +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +import { signatures } from "./signatures"; +import { traverse } from "./traverse"; +import constants from "@webassemblyjs/helper-wasm-bytecode"; +import { getSectionForNode } from "@webassemblyjs/helper-wasm-bytecode"; +export function isAnonymous(ident) { + return ident.raw === ""; +} +export function getSectionMetadata(ast, name) { + var section; + traverse(ast, { + SectionMetadata: function (_SectionMetadata) { + function SectionMetadata(_x) { + return _SectionMetadata.apply(this, arguments); + } + + SectionMetadata.toString = function () { + return _SectionMetadata.toString(); + }; + + return SectionMetadata; + }(function (_ref) { + var node = _ref.node; + + if (node.section === name) { + section = node; + } + }) + }); + return section; +} +export function getSectionMetadatas(ast, name) { + var sections = []; + traverse(ast, { + SectionMetadata: function (_SectionMetadata2) { + function SectionMetadata(_x2) { + return _SectionMetadata2.apply(this, arguments); + } + + SectionMetadata.toString = function () { + return _SectionMetadata2.toString(); + }; + + return SectionMetadata; + }(function (_ref2) { + var node = _ref2.node; + + if (node.section === name) { + sections.push(node); + } + }) + }); + return sections; +} +export function sortSectionMetadata(m) { + if (m.metadata == null) { + console.warn("sortSectionMetadata: no metadata to sort"); + return; + } // $FlowIgnore + + + m.metadata.sections.sort(function (a, b) { + var aId = constants.sections[a.section]; + var bId = constants.sections[b.section]; + + if (typeof aId !== "number" || typeof bId !== "number") { + throw new Error("Section id not found"); + } + + return aId - bId; + }); +} +export function orderedInsertNode(m, n) { + assertHasLoc(n); + var didInsert = false; + + if (n.type === "ModuleExport") { + m.fields.push(n); + return; + } + + m.fields = m.fields.reduce(function (acc, field) { + var fieldEndCol = Infinity; + + if (field.loc != null) { + // $FlowIgnore + fieldEndCol = field.loc.end.column; + } // $FlowIgnore: assertHasLoc ensures that + + + if (didInsert === false && n.loc.start.column < fieldEndCol) { + didInsert = true; + acc.push(n); + } + + acc.push(field); + return acc; + }, []); // Handles empty modules or n is the last element + + if (didInsert === false) { + m.fields.push(n); + } +} +export function assertHasLoc(n) { + if (n.loc == null || n.loc.start == null || n.loc.end == null) { + throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information")); + } +} +export function getEndOfSection(s) { + assertHasLoc(s.size); + return s.startOffset + s.size.value + (s.size.loc.end.column - s.size.loc.start.column); +} +export function shiftLoc(node, delta) { + // $FlowIgnore + node.loc.start.column += delta; // $FlowIgnore + + node.loc.end.column += delta; +} +export function shiftSection(ast, node, delta) { + if (node.type !== "SectionMetadata") { + throw new Error("Can not shift node " + JSON.stringify(node.type)); + } + + node.startOffset += delta; + + if (_typeof(node.size.loc) === "object") { + shiftLoc(node.size, delta); + } // Custom sections doesn't have vectorOfSize + + + if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") { + shiftLoc(node.vectorOfSize, delta); + } + + var sectionName = node.section; // shift node locations within that section + + traverse(ast, { + Node: function Node(_ref3) { + var node = _ref3.node; + var section = getSectionForNode(node); + + if (section === sectionName && _typeof(node.loc) === "object") { + shiftLoc(node, delta); + } + } + }); +} +export function signatureForOpcode(object, name) { + var opcodeName = name; + + if (object !== undefined && object !== "") { + opcodeName = object + "." + name; + } + + var sign = signatures[opcodeName]; + + if (sign == undefined) { + // TODO: Uncomment this when br_table and others has been done + //throw new Error("Invalid opcode: "+opcodeName); + return [object, object]; + } + + return sign[0]; +} +export function getUniqueNameGenerator() { + var inc = {}; + return function () { + var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp"; + + if (!(prefix in inc)) { + inc[prefix] = 0; + } else { + inc[prefix] = inc[prefix] + 1; + } + + return prefix + "_" + inc[prefix]; + }; +} +export function getStartByteOffset(n) { + // $FlowIgnore + if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") { + throw new Error( // $FlowIgnore + "Can not get byte offset without loc informations, node: " + String(n.id)); + } + + return n.loc.start.column; +} +export function getEndByteOffset(n) { + // $FlowIgnore + if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") { + throw new Error("Can not get byte offset without loc informations, node: " + n.type); + } + + return n.loc.end.column; +} +export function getFunctionBeginingByteOffset(n) { + if (!(n.body.length > 0)) { + throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown")); + } + + var _n$body = _slicedToArray(n.body, 1), + firstInstruction = _n$body[0]; + + return getStartByteOffset(firstInstruction); +} +export function getEndBlockByteOffset(n) { + // $FlowIgnore + if (!(n.instr.length > 0 || n.body.length > 0)) { + throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown")); + } + + var lastInstruction; + + if (n.instr) { + // $FlowIgnore + lastInstruction = n.instr[n.instr.length - 1]; + } + + if (n.body) { + // $FlowIgnore + lastInstruction = n.body[n.body.length - 1]; + } + + if (!(_typeof(lastInstruction) === "object")) { + throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown")); + } + + // $FlowIgnore + return getStartByteOffset(lastInstruction); +} +export function getStartBlockByteOffset(n) { + // $FlowIgnore + if (!(n.instr.length > 0 || n.body.length > 0)) { + throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown")); + } + + var fistInstruction; + + if (n.instr) { + // $FlowIgnore + var _n$instr = _slicedToArray(n.instr, 1); + + fistInstruction = _n$instr[0]; + } + + if (n.body) { + // $FlowIgnore + var _n$body2 = _slicedToArray(n.body, 1); + + fistInstruction = _n$body2[0]; + } + + if (!(_typeof(fistInstruction) === "object")) { + throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown")); + } + + // $FlowIgnore + return getStartByteOffset(fistInstruction); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/clone.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/clone.js new file mode 100644 index 0000000000000000000000000000000000000000..a27218b46741d512358634a90573beda2536efdf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/clone.js @@ -0,0 +1,11 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.cloneNode = cloneNode; + +function cloneNode(n) { + // $FlowIgnore + return Object.assign({}, n); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/definitions.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/definitions.js new file mode 100644 index 0000000000000000000000000000000000000000..83a838ca775ad5d4b8f8fe667ba8e7e6ba731379 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/definitions.js @@ -0,0 +1,670 @@ +"use strict"; + +var definitions = {}; + +function defineType(typeName, metadata) { + definitions[typeName] = metadata; +} + +defineType("Module", { + spec: { + wasm: "https://webassembly.github.io/spec/core/binary/modules.html#binary-module", + wat: "https://webassembly.github.io/spec/core/text/modules.html#text-module" + }, + doc: "A module consists of a sequence of sections (termed fields in the text format).", + unionType: ["Node"], + fields: { + id: { + maybe: true, + type: "string" + }, + fields: { + array: true, + type: "Node" + }, + metadata: { + optional: true, + type: "ModuleMetadata" + } + } +}); +defineType("ModuleMetadata", { + unionType: ["Node"], + fields: { + sections: { + array: true, + type: "SectionMetadata" + }, + functionNames: { + optional: true, + array: true, + type: "FunctionNameMetadata" + }, + localNames: { + optional: true, + array: true, + type: "ModuleMetadata" + }, + producers: { + optional: true, + array: true, + type: "ProducersSectionMetadata" + } + } +}); +defineType("ModuleNameMetadata", { + unionType: ["Node"], + fields: { + value: { + type: "string" + } + } +}); +defineType("FunctionNameMetadata", { + unionType: ["Node"], + fields: { + value: { + type: "string" + }, + index: { + type: "number" + } + } +}); +defineType("LocalNameMetadata", { + unionType: ["Node"], + fields: { + value: { + type: "string" + }, + localIndex: { + type: "number" + }, + functionIndex: { + type: "number" + } + } +}); +defineType("BinaryModule", { + unionType: ["Node"], + fields: { + id: { + maybe: true, + type: "string" + }, + blob: { + array: true, + type: "string" + } + } +}); +defineType("QuoteModule", { + unionType: ["Node"], + fields: { + id: { + maybe: true, + type: "string" + }, + string: { + array: true, + type: "string" + } + } +}); +defineType("SectionMetadata", { + unionType: ["Node"], + fields: { + section: { + type: "SectionName" + }, + startOffset: { + type: "number" + }, + size: { + type: "NumberLiteral" + }, + vectorOfSize: { + comment: "Size of the vector in the section (if any)", + type: "NumberLiteral" + } + } +}); +defineType("ProducersSectionMetadata", { + unionType: ["Node"], + fields: { + producers: { + array: true, + type: "ProducerMetadata" + } + } +}); +defineType("ProducerMetadata", { + unionType: ["Node"], + fields: { + language: { + type: "ProducerMetadataVersionedName", + array: true + }, + processedBy: { + type: "ProducerMetadataVersionedName", + array: true + }, + sdk: { + type: "ProducerMetadataVersionedName", + array: true + } + } +}); +defineType("ProducerMetadataVersionedName", { + unionType: ["Node"], + fields: { + name: { + type: "string" + }, + version: { + type: "string" + } + } +}); +/* +Instructions +*/ + +defineType("LoopInstruction", { + unionType: ["Node", "Block", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "loop" + }, + label: { + maybe: true, + type: "Identifier" + }, + resulttype: { + maybe: true, + type: "Valtype" + }, + instr: { + array: true, + type: "Instruction" + } + } +}); +defineType("Instr", { + unionType: ["Node", "Expression", "Instruction"], + fields: { + id: { + type: "string" + }, + object: { + optional: true, + type: "Valtype" + }, + args: { + array: true, + type: "Expression" + }, + namedArgs: { + optional: true, + type: "Object" + } + } +}); +defineType("IfInstruction", { + unionType: ["Node", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "if" + }, + testLabel: { + comment: "only for WAST", + type: "Identifier" + }, + test: { + array: true, + type: "Instruction" + }, + result: { + maybe: true, + type: "Valtype" + }, + consequent: { + array: true, + type: "Instruction" + }, + alternate: { + array: true, + type: "Instruction" + } + } +}); +/* +Concrete value types +*/ + +defineType("StringLiteral", { + unionType: ["Node", "Expression"], + fields: { + value: { + type: "string" + } + } +}); +defineType("NumberLiteral", { + unionType: ["Node", "NumericLiteral", "Expression"], + fields: { + value: { + type: "number" + }, + raw: { + type: "string" + } + } +}); +defineType("LongNumberLiteral", { + unionType: ["Node", "NumericLiteral", "Expression"], + fields: { + value: { + type: "LongNumber" + }, + raw: { + type: "string" + } + } +}); +defineType("FloatLiteral", { + unionType: ["Node", "NumericLiteral", "Expression"], + fields: { + value: { + type: "number" + }, + nan: { + optional: true, + type: "boolean" + }, + inf: { + optional: true, + type: "boolean" + }, + raw: { + type: "string" + } + } +}); +defineType("Elem", { + unionType: ["Node"], + fields: { + table: { + type: "Index" + }, + offset: { + array: true, + type: "Instruction" + }, + funcs: { + array: true, + type: "Index" + } + } +}); +defineType("IndexInFuncSection", { + unionType: ["Node"], + fields: { + index: { + type: "Index" + } + } +}); +defineType("ValtypeLiteral", { + unionType: ["Node", "Expression"], + fields: { + name: { + type: "Valtype" + } + } +}); +defineType("TypeInstruction", { + unionType: ["Node", "Instruction"], + fields: { + id: { + maybe: true, + type: "Index" + }, + functype: { + type: "Signature" + } + } +}); +defineType("Start", { + unionType: ["Node"], + fields: { + index: { + type: "Index" + } + } +}); +defineType("GlobalType", { + unionType: ["Node", "ImportDescr"], + fields: { + valtype: { + type: "Valtype" + }, + mutability: { + type: "Mutability" + } + } +}); +defineType("LeadingComment", { + unionType: ["Node"], + fields: { + value: { + type: "string" + } + } +}); +defineType("BlockComment", { + unionType: ["Node"], + fields: { + value: { + type: "string" + } + } +}); +defineType("Data", { + unionType: ["Node"], + fields: { + memoryIndex: { + type: "Memidx" + }, + offset: { + type: "Instruction" + }, + init: { + type: "ByteArray" + } + } +}); +defineType("Global", { + unionType: ["Node"], + fields: { + globalType: { + type: "GlobalType" + }, + init: { + array: true, + type: "Instruction" + }, + name: { + maybe: true, + type: "Identifier" + } + } +}); +defineType("Table", { + unionType: ["Node", "ImportDescr"], + fields: { + elementType: { + type: "TableElementType" + }, + limits: { + assertNodeType: true, + type: "Limit" + }, + name: { + maybe: true, + type: "Identifier" + }, + elements: { + array: true, + optional: true, + type: "Index" + } + } +}); +defineType("Memory", { + unionType: ["Node", "ImportDescr"], + fields: { + limits: { + type: "Limit" + }, + id: { + maybe: true, + type: "Index" + } + } +}); +defineType("FuncImportDescr", { + unionType: ["Node", "ImportDescr"], + fields: { + id: { + type: "Identifier" + }, + signature: { + type: "Signature" + } + } +}); +defineType("ModuleImport", { + unionType: ["Node"], + fields: { + module: { + type: "string" + }, + name: { + type: "string" + }, + descr: { + type: "ImportDescr" + } + } +}); +defineType("ModuleExportDescr", { + unionType: ["Node"], + fields: { + exportType: { + type: "ExportDescrType" + }, + id: { + type: "Index" + } + } +}); +defineType("ModuleExport", { + unionType: ["Node"], + fields: { + name: { + type: "string" + }, + descr: { + type: "ModuleExportDescr" + } + } +}); +defineType("Limit", { + unionType: ["Node"], + fields: { + min: { + type: "number" + }, + max: { + optional: true, + type: "number" + }, + // Threads proposal, shared memory + shared: { + optional: true, + type: "boolean" + } + } +}); +defineType("Signature", { + unionType: ["Node"], + fields: { + params: { + array: true, + type: "FuncParam" + }, + results: { + array: true, + type: "Valtype" + } + } +}); +defineType("Program", { + unionType: ["Node"], + fields: { + body: { + array: true, + type: "Node" + } + } +}); +defineType("Identifier", { + unionType: ["Node", "Expression"], + fields: { + value: { + type: "string" + }, + raw: { + optional: true, + type: "string" + } + } +}); +defineType("BlockInstruction", { + unionType: ["Node", "Block", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "block" + }, + label: { + maybe: true, + type: "Identifier" + }, + instr: { + array: true, + type: "Instruction" + }, + result: { + maybe: true, + type: "Valtype" + } + } +}); +defineType("CallInstruction", { + unionType: ["Node", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "call" + }, + index: { + type: "Index" + }, + instrArgs: { + array: true, + optional: true, + type: "Expression" + }, + numeric: { + type: "Index", + optional: true + } + } +}); +defineType("CallIndirectInstruction", { + unionType: ["Node", "Instruction"], + fields: { + id: { + constant: true, + type: "string", + value: "call_indirect" + }, + signature: { + type: "SignatureOrTypeRef" + }, + intrs: { + array: true, + optional: true, + type: "Expression" + } + } +}); +defineType("ByteArray", { + unionType: ["Node"], + fields: { + values: { + array: true, + type: "Byte" + } + } +}); +defineType("Func", { + unionType: ["Node", "Block"], + fields: { + name: { + maybe: true, + type: "Index" + }, + signature: { + type: "SignatureOrTypeRef" + }, + body: { + array: true, + type: "Instruction" + }, + isExternal: { + comment: "means that it has been imported from the outside js", + optional: true, + type: "boolean" + }, + metadata: { + optional: true, + type: "FuncMetadata" + } + } +}); +/** + * Intrinsics + */ + +defineType("InternalBrUnless", { + unionType: ["Node", "Intrinsic"], + fields: { + target: { + type: "number" + } + } +}); +defineType("InternalGoto", { + unionType: ["Node", "Intrinsic"], + fields: { + target: { + type: "number" + } + } +}); +defineType("InternalCallExtern", { + unionType: ["Node", "Intrinsic"], + fields: { + target: { + type: "number" + } + } +}); // function bodies are terminated by an `end` instruction but are missing a +// return instruction +// +// Since we can't inject a new instruction we are injecting a new instruction. + +defineType("InternalEndAndReturn", { + unionType: ["Node", "Intrinsic"], + fields: {} +}); +module.exports = definitions; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..03c21dd8f6d66b397a84916e5aa7c99711af36bb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/index.js @@ -0,0 +1,129 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _exportNames = { + numberLiteralFromRaw: true, + withLoc: true, + withRaw: true, + funcParam: true, + indexLiteral: true, + memIndexLiteral: true, + instruction: true, + objectInstruction: true, + traverse: true, + signatures: true, + cloneNode: true, + moduleContextFromModuleAST: true +}; +Object.defineProperty(exports, "numberLiteralFromRaw", { + enumerable: true, + get: function get() { + return _nodeHelpers.numberLiteralFromRaw; + } +}); +Object.defineProperty(exports, "withLoc", { + enumerable: true, + get: function get() { + return _nodeHelpers.withLoc; + } +}); +Object.defineProperty(exports, "withRaw", { + enumerable: true, + get: function get() { + return _nodeHelpers.withRaw; + } +}); +Object.defineProperty(exports, "funcParam", { + enumerable: true, + get: function get() { + return _nodeHelpers.funcParam; + } +}); +Object.defineProperty(exports, "indexLiteral", { + enumerable: true, + get: function get() { + return _nodeHelpers.indexLiteral; + } +}); +Object.defineProperty(exports, "memIndexLiteral", { + enumerable: true, + get: function get() { + return _nodeHelpers.memIndexLiteral; + } +}); +Object.defineProperty(exports, "instruction", { + enumerable: true, + get: function get() { + return _nodeHelpers.instruction; + } +}); +Object.defineProperty(exports, "objectInstruction", { + enumerable: true, + get: function get() { + return _nodeHelpers.objectInstruction; + } +}); +Object.defineProperty(exports, "traverse", { + enumerable: true, + get: function get() { + return _traverse.traverse; + } +}); +Object.defineProperty(exports, "signatures", { + enumerable: true, + get: function get() { + return _signatures.signatures; + } +}); +Object.defineProperty(exports, "cloneNode", { + enumerable: true, + get: function get() { + return _clone.cloneNode; + } +}); +Object.defineProperty(exports, "moduleContextFromModuleAST", { + enumerable: true, + get: function get() { + return _astModuleToModuleContext.moduleContextFromModuleAST; + } +}); + +var _nodes = require("./nodes"); + +Object.keys(_nodes).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _nodes[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _nodes[key]; + } + }); +}); + +var _nodeHelpers = require("./node-helpers.js"); + +var _traverse = require("./traverse"); + +var _signatures = require("./signatures"); + +var _utils = require("./utils"); + +Object.keys(_utils).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _utils[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _utils[key]; + } + }); +}); + +var _clone = require("./clone"); + +var _astModuleToModuleContext = require("./transform/ast-module-to-module-context"); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/node-helpers.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/node-helpers.js new file mode 100644 index 0000000000000000000000000000000000000000..73c5959490fb493ca0fd12677d6ee6ed63700394 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/node-helpers.js @@ -0,0 +1,107 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.numberLiteralFromRaw = numberLiteralFromRaw; +exports.instruction = instruction; +exports.objectInstruction = objectInstruction; +exports.withLoc = withLoc; +exports.withRaw = withRaw; +exports.funcParam = funcParam; +exports.indexLiteral = indexLiteral; +exports.memIndexLiteral = memIndexLiteral; + +var _helperNumbers = require("@webassemblyjs/helper-numbers"); + +var _nodes = require("./nodes"); + +function numberLiteralFromRaw(rawValue) { + var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32"; + var original = rawValue; // Remove numeric separators _ + + if (typeof rawValue === "string") { + rawValue = rawValue.replace(/_/g, ""); + } + + if (typeof rawValue === "number") { + return (0, _nodes.numberLiteral)(rawValue, String(original)); + } else { + switch (instructionType) { + case "i32": + { + return (0, _nodes.numberLiteral)((0, _helperNumbers.parse32I)(rawValue), String(original)); + } + + case "u32": + { + return (0, _nodes.numberLiteral)((0, _helperNumbers.parseU32)(rawValue), String(original)); + } + + case "i64": + { + return (0, _nodes.longNumberLiteral)((0, _helperNumbers.parse64I)(rawValue), String(original)); + } + + case "f32": + { + return (0, _nodes.floatLiteral)((0, _helperNumbers.parse32F)(rawValue), (0, _helperNumbers.isNanLiteral)(rawValue), (0, _helperNumbers.isInfLiteral)(rawValue), String(original)); + } + // f64 + + default: + { + return (0, _nodes.floatLiteral)((0, _helperNumbers.parse64F)(rawValue), (0, _helperNumbers.isNanLiteral)(rawValue), (0, _helperNumbers.isInfLiteral)(rawValue), String(original)); + } + } + } +} + +function instruction(id) { + var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + return (0, _nodes.instr)(id, undefined, args, namedArgs); +} + +function objectInstruction(id, object) { + var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + return (0, _nodes.instr)(id, object, args, namedArgs); +} +/** + * Decorators + */ + + +function withLoc(n, end, start) { + var loc = { + start: start, + end: end + }; + n.loc = loc; + return n; +} + +function withRaw(n, raw) { + n.raw = raw; + return n; +} + +function funcParam(valtype, id) { + return { + id: id, + valtype: valtype + }; +} + +function indexLiteral(value) { + // $FlowIgnore + var x = numberLiteralFromRaw(value, "u32"); + return x; +} + +function memIndexLiteral(value) { + // $FlowIgnore + var x = numberLiteralFromRaw(value, "u32"); + return x; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/node-path.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/node-path.js new file mode 100644 index 0000000000000000000000000000000000000000..d7650a2a9b2cd6a0cc86653d45b997511518051e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/node-path.js @@ -0,0 +1,148 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createPath = createPath; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function findParent(_ref, cb) { + var parentPath = _ref.parentPath; + + if (parentPath == null) { + throw new Error("node is root"); + } + + var currentPath = parentPath; + + while (cb(currentPath) !== false) { + // Hit the root node, stop + // $FlowIgnore + if (currentPath.parentPath == null) { + return null; + } // $FlowIgnore + + + currentPath = currentPath.parentPath; + } + + return currentPath.node; +} + +function insertBefore(context, newNode) { + return insert(context, newNode); +} + +function insertAfter(context, newNode) { + return insert(context, newNode, 1); +} + +function insert(_ref2, newNode) { + var node = _ref2.node, + inList = _ref2.inList, + parentPath = _ref2.parentPath, + parentKey = _ref2.parentKey; + var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + + if (!inList) { + throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || "unknown")); + } + + if (!(parentPath != null)) { + throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || "unknown")); + } + + // $FlowIgnore + var parentList = parentPath.node[parentKey]; + var indexInList = parentList.findIndex(function (n) { + return n === node; + }); + parentList.splice(indexInList + indexOffset, 0, newNode); +} + +function remove(_ref3) { + var node = _ref3.node, + parentKey = _ref3.parentKey, + parentPath = _ref3.parentPath; + + if (!(parentPath != null)) { + throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || "unknown")); + } + + // $FlowIgnore + var parentNode = parentPath.node; // $FlowIgnore + + var parentProperty = parentNode[parentKey]; + + if (Array.isArray(parentProperty)) { + // $FlowIgnore + parentNode[parentKey] = parentProperty.filter(function (n) { + return n !== node; + }); + } else { + // $FlowIgnore + delete parentNode[parentKey]; + } + + node._deleted = true; +} + +function stop(context) { + context.shouldStop = true; +} + +function replaceWith(context, newNode) { + // $FlowIgnore + var parentNode = context.parentPath.node; // $FlowIgnore + + var parentProperty = parentNode[context.parentKey]; + + if (Array.isArray(parentProperty)) { + var indexInList = parentProperty.findIndex(function (n) { + return n === context.node; + }); + parentProperty.splice(indexInList, 1, newNode); + } else { + // $FlowIgnore + parentNode[context.parentKey] = newNode; + } + + context.node._deleted = true; + context.node = newNode; +} // bind the context to the first argument of node operations + + +function bindNodeOperations(operations, context) { + var keys = Object.keys(operations); + var boundOperations = {}; + keys.forEach(function (key) { + boundOperations[key] = operations[key].bind(null, context); + }); + return boundOperations; +} + +function createPathOperations(context) { + // $FlowIgnore + return bindNodeOperations({ + findParent: findParent, + replaceWith: replaceWith, + remove: remove, + insertBefore: insertBefore, + insertAfter: insertAfter, + stop: stop + }, context); +} + +function createPath(context) { + var path = _objectSpread({}, context); // $FlowIgnore + + + Object.assign(path, createPathOperations(path)); // $FlowIgnore + + return path; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/nodes.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/nodes.js new file mode 100644 index 0000000000000000000000000000000000000000..3fb4b634dd07ee008bedd0bea89c811b7d3ac4d0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/nodes.js @@ -0,0 +1,1144 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.module = _module; +exports.moduleMetadata = moduleMetadata; +exports.moduleNameMetadata = moduleNameMetadata; +exports.functionNameMetadata = functionNameMetadata; +exports.localNameMetadata = localNameMetadata; +exports.binaryModule = binaryModule; +exports.quoteModule = quoteModule; +exports.sectionMetadata = sectionMetadata; +exports.producersSectionMetadata = producersSectionMetadata; +exports.producerMetadata = producerMetadata; +exports.producerMetadataVersionedName = producerMetadataVersionedName; +exports.loopInstruction = loopInstruction; +exports.instr = instr; +exports.ifInstruction = ifInstruction; +exports.stringLiteral = stringLiteral; +exports.numberLiteral = numberLiteral; +exports.longNumberLiteral = longNumberLiteral; +exports.floatLiteral = floatLiteral; +exports.elem = elem; +exports.indexInFuncSection = indexInFuncSection; +exports.valtypeLiteral = valtypeLiteral; +exports.typeInstruction = typeInstruction; +exports.start = start; +exports.globalType = globalType; +exports.leadingComment = leadingComment; +exports.blockComment = blockComment; +exports.data = data; +exports.global = global; +exports.table = table; +exports.memory = memory; +exports.funcImportDescr = funcImportDescr; +exports.moduleImport = moduleImport; +exports.moduleExportDescr = moduleExportDescr; +exports.moduleExport = moduleExport; +exports.limit = limit; +exports.signature = signature; +exports.program = program; +exports.identifier = identifier; +exports.blockInstruction = blockInstruction; +exports.callInstruction = callInstruction; +exports.callIndirectInstruction = callIndirectInstruction; +exports.byteArray = byteArray; +exports.func = func; +exports.internalBrUnless = internalBrUnless; +exports.internalGoto = internalGoto; +exports.internalCallExtern = internalCallExtern; +exports.internalEndAndReturn = internalEndAndReturn; +exports.assertInternalCallExtern = exports.assertInternalGoto = exports.assertInternalBrUnless = exports.assertFunc = exports.assertByteArray = exports.assertCallIndirectInstruction = exports.assertCallInstruction = exports.assertBlockInstruction = exports.assertIdentifier = exports.assertProgram = exports.assertSignature = exports.assertLimit = exports.assertModuleExport = exports.assertModuleExportDescr = exports.assertModuleImport = exports.assertFuncImportDescr = exports.assertMemory = exports.assertTable = exports.assertGlobal = exports.assertData = exports.assertBlockComment = exports.assertLeadingComment = exports.assertGlobalType = exports.assertStart = exports.assertTypeInstruction = exports.assertValtypeLiteral = exports.assertIndexInFuncSection = exports.assertElem = exports.assertFloatLiteral = exports.assertLongNumberLiteral = exports.assertNumberLiteral = exports.assertStringLiteral = exports.assertIfInstruction = exports.assertInstr = exports.assertLoopInstruction = exports.assertProducerMetadataVersionedName = exports.assertProducerMetadata = exports.assertProducersSectionMetadata = exports.assertSectionMetadata = exports.assertQuoteModule = exports.assertBinaryModule = exports.assertLocalNameMetadata = exports.assertFunctionNameMetadata = exports.assertModuleNameMetadata = exports.assertModuleMetadata = exports.assertModule = exports.isIntrinsic = exports.isImportDescr = exports.isNumericLiteral = exports.isExpression = exports.isInstruction = exports.isBlock = exports.isNode = exports.isInternalEndAndReturn = exports.isInternalCallExtern = exports.isInternalGoto = exports.isInternalBrUnless = exports.isFunc = exports.isByteArray = exports.isCallIndirectInstruction = exports.isCallInstruction = exports.isBlockInstruction = exports.isIdentifier = exports.isProgram = exports.isSignature = exports.isLimit = exports.isModuleExport = exports.isModuleExportDescr = exports.isModuleImport = exports.isFuncImportDescr = exports.isMemory = exports.isTable = exports.isGlobal = exports.isData = exports.isBlockComment = exports.isLeadingComment = exports.isGlobalType = exports.isStart = exports.isTypeInstruction = exports.isValtypeLiteral = exports.isIndexInFuncSection = exports.isElem = exports.isFloatLiteral = exports.isLongNumberLiteral = exports.isNumberLiteral = exports.isStringLiteral = exports.isIfInstruction = exports.isInstr = exports.isLoopInstruction = exports.isProducerMetadataVersionedName = exports.isProducerMetadata = exports.isProducersSectionMetadata = exports.isSectionMetadata = exports.isQuoteModule = exports.isBinaryModule = exports.isLocalNameMetadata = exports.isFunctionNameMetadata = exports.isModuleNameMetadata = exports.isModuleMetadata = exports.isModule = void 0; +exports.nodeAndUnionTypes = exports.unionTypesMap = exports.assertInternalEndAndReturn = void 0; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +// THIS FILE IS AUTOGENERATED +// see scripts/generateNodeUtils.js +function isTypeOf(t) { + return function (n) { + return n.type === t; + }; +} + +function assertTypeOf(t) { + return function (n) { + return function () { + if (!(n.type === t)) { + throw new Error('n.type === t' + " error: " + (undefined || "unknown")); + } + }(); + }; +} + +function _module(id, fields, metadata) { + if (id !== null && id !== undefined) { + if (!(typeof id === "string")) { + throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown")); + } + } + + if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) { + throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Module", + id: id, + fields: fields + }; + + if (typeof metadata !== "undefined") { + node.metadata = metadata; + } + + return node; +} + +function moduleMetadata(sections, functionNames, localNames, producers) { + if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) { + throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (functionNames !== null && functionNames !== undefined) { + if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) { + throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + if (localNames !== null && localNames !== undefined) { + if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) { + throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + if (producers !== null && producers !== undefined) { + if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) { + throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + var node = { + type: "ModuleMetadata", + sections: sections + }; + + if (typeof functionNames !== "undefined" && functionNames.length > 0) { + node.functionNames = functionNames; + } + + if (typeof localNames !== "undefined" && localNames.length > 0) { + node.localNames = localNames; + } + + if (typeof producers !== "undefined" && producers.length > 0) { + node.producers = producers; + } + + return node; +} + +function moduleNameMetadata(value) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + var node = { + type: "ModuleNameMetadata", + value: value + }; + return node; +} + +function functionNameMetadata(value, index) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + if (!(typeof index === "number")) { + throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || "unknown")); + } + + var node = { + type: "FunctionNameMetadata", + value: value, + index: index + }; + return node; +} + +function localNameMetadata(value, localIndex, functionIndex) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + if (!(typeof localIndex === "number")) { + throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || "unknown")); + } + + if (!(typeof functionIndex === "number")) { + throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || "unknown")); + } + + var node = { + type: "LocalNameMetadata", + value: value, + localIndex: localIndex, + functionIndex: functionIndex + }; + return node; +} + +function binaryModule(id, blob) { + if (id !== null && id !== undefined) { + if (!(typeof id === "string")) { + throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown")); + } + } + + if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) { + throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "BinaryModule", + id: id, + blob: blob + }; + return node; +} + +function quoteModule(id, string) { + if (id !== null && id !== undefined) { + if (!(typeof id === "string")) { + throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown")); + } + } + + if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) { + throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "QuoteModule", + id: id, + string: string + }; + return node; +} + +function sectionMetadata(section, startOffset, size, vectorOfSize) { + if (!(typeof startOffset === "number")) { + throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || "unknown")); + } + + var node = { + type: "SectionMetadata", + section: section, + startOffset: startOffset, + size: size, + vectorOfSize: vectorOfSize + }; + return node; +} + +function producersSectionMetadata(producers) { + if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) { + throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "ProducersSectionMetadata", + producers: producers + }; + return node; +} + +function producerMetadata(language, processedBy, sdk) { + if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) { + throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) { + throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) { + throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "ProducerMetadata", + language: language, + processedBy: processedBy, + sdk: sdk + }; + return node; +} + +function producerMetadataVersionedName(name, version) { + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown")); + } + + if (!(typeof version === "string")) { + throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || "unknown")); + } + + var node = { + type: "ProducerMetadataVersionedName", + name: name, + version: version + }; + return node; +} + +function loopInstruction(label, resulttype, instr) { + if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) { + throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "LoopInstruction", + id: "loop", + label: label, + resulttype: resulttype, + instr: instr + }; + return node; +} + +function instr(id, object, args, namedArgs) { + if (!(typeof id === "string")) { + throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown")); + } + + if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) { + throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Instr", + id: id, + args: args + }; + + if (typeof object !== "undefined") { + node.object = object; + } + + if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) { + node.namedArgs = namedArgs; + } + + return node; +} + +function ifInstruction(testLabel, test, result, consequent, alternate) { + if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) { + throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) { + throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) { + throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "IfInstruction", + id: "if", + testLabel: testLabel, + test: test, + result: result, + consequent: consequent, + alternate: alternate + }; + return node; +} + +function stringLiteral(value) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + var node = { + type: "StringLiteral", + value: value + }; + return node; +} + +function numberLiteral(value, raw) { + if (!(typeof value === "number")) { + throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown")); + } + + if (!(typeof raw === "string")) { + throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown")); + } + + var node = { + type: "NumberLiteral", + value: value, + raw: raw + }; + return node; +} + +function longNumberLiteral(value, raw) { + if (!(typeof raw === "string")) { + throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown")); + } + + var node = { + type: "LongNumberLiteral", + value: value, + raw: raw + }; + return node; +} + +function floatLiteral(value, nan, inf, raw) { + if (!(typeof value === "number")) { + throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown")); + } + + if (nan !== null && nan !== undefined) { + if (!(typeof nan === "boolean")) { + throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || "unknown")); + } + } + + if (inf !== null && inf !== undefined) { + if (!(typeof inf === "boolean")) { + throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || "unknown")); + } + } + + if (!(typeof raw === "string")) { + throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown")); + } + + var node = { + type: "FloatLiteral", + value: value, + raw: raw + }; + + if (nan === true) { + node.nan = true; + } + + if (inf === true) { + node.inf = true; + } + + return node; +} + +function elem(table, offset, funcs) { + if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) { + throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) { + throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Elem", + table: table, + offset: offset, + funcs: funcs + }; + return node; +} + +function indexInFuncSection(index) { + var node = { + type: "IndexInFuncSection", + index: index + }; + return node; +} + +function valtypeLiteral(name) { + var node = { + type: "ValtypeLiteral", + name: name + }; + return node; +} + +function typeInstruction(id, functype) { + var node = { + type: "TypeInstruction", + id: id, + functype: functype + }; + return node; +} + +function start(index) { + var node = { + type: "Start", + index: index + }; + return node; +} + +function globalType(valtype, mutability) { + var node = { + type: "GlobalType", + valtype: valtype, + mutability: mutability + }; + return node; +} + +function leadingComment(value) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + var node = { + type: "LeadingComment", + value: value + }; + return node; +} + +function blockComment(value) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + var node = { + type: "BlockComment", + value: value + }; + return node; +} + +function data(memoryIndex, offset, init) { + var node = { + type: "Data", + memoryIndex: memoryIndex, + offset: offset, + init: init + }; + return node; +} + +function global(globalType, init, name) { + if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) { + throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Global", + globalType: globalType, + init: init, + name: name + }; + return node; +} + +function table(elementType, limits, name, elements) { + if (!(limits.type === "Limit")) { + throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || "unknown")); + } + + if (elements !== null && elements !== undefined) { + if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) { + throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + var node = { + type: "Table", + elementType: elementType, + limits: limits, + name: name + }; + + if (typeof elements !== "undefined" && elements.length > 0) { + node.elements = elements; + } + + return node; +} + +function memory(limits, id) { + var node = { + type: "Memory", + limits: limits, + id: id + }; + return node; +} + +function funcImportDescr(id, signature) { + var node = { + type: "FuncImportDescr", + id: id, + signature: signature + }; + return node; +} + +function moduleImport(module, name, descr) { + if (!(typeof module === "string")) { + throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || "unknown")); + } + + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown")); + } + + var node = { + type: "ModuleImport", + module: module, + name: name, + descr: descr + }; + return node; +} + +function moduleExportDescr(exportType, id) { + var node = { + type: "ModuleExportDescr", + exportType: exportType, + id: id + }; + return node; +} + +function moduleExport(name, descr) { + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown")); + } + + var node = { + type: "ModuleExport", + name: name, + descr: descr + }; + return node; +} + +function limit(min, max, shared) { + if (!(typeof min === "number")) { + throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || "unknown")); + } + + if (max !== null && max !== undefined) { + if (!(typeof max === "number")) { + throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || "unknown")); + } + } + + if (shared !== null && shared !== undefined) { + if (!(typeof shared === "boolean")) { + throw new Error('typeof shared === "boolean"' + " error: " + ("Argument shared must be of type boolean, given: " + _typeof(shared) || "unknown")); + } + } + + var node = { + type: "Limit", + min: min + }; + + if (typeof max !== "undefined") { + node.max = max; + } + + if (shared === true) { + node.shared = true; + } + + return node; +} + +function signature(params, results) { + if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) { + throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) { + throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Signature", + params: params, + results: results + }; + return node; +} + +function program(body) { + if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) { + throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "Program", + body: body + }; + return node; +} + +function identifier(value, raw) { + if (!(typeof value === "string")) { + throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown")); + } + + if (raw !== null && raw !== undefined) { + if (!(typeof raw === "string")) { + throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown")); + } + } + + var node = { + type: "Identifier", + value: value + }; + + if (typeof raw !== "undefined") { + node.raw = raw; + } + + return node; +} + +function blockInstruction(label, instr, result) { + if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) { + throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "BlockInstruction", + id: "block", + label: label, + instr: instr, + result: result + }; + return node; +} + +function callInstruction(index, instrArgs, numeric) { + if (instrArgs !== null && instrArgs !== undefined) { + if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) { + throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + var node = { + type: "CallInstruction", + id: "call", + index: index + }; + + if (typeof instrArgs !== "undefined" && instrArgs.length > 0) { + node.instrArgs = instrArgs; + } + + if (typeof numeric !== "undefined") { + node.numeric = numeric; + } + + return node; +} + +function callIndirectInstruction(signature, intrs) { + if (intrs !== null && intrs !== undefined) { + if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) { + throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + } + + var node = { + type: "CallIndirectInstruction", + id: "call_indirect", + signature: signature + }; + + if (typeof intrs !== "undefined" && intrs.length > 0) { + node.intrs = intrs; + } + + return node; +} + +function byteArray(values) { + if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) { + throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + var node = { + type: "ByteArray", + values: values + }; + return node; +} + +function func(name, signature, body, isExternal, metadata) { + if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) { + throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown")); + } + + if (isExternal !== null && isExternal !== undefined) { + if (!(typeof isExternal === "boolean")) { + throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || "unknown")); + } + } + + var node = { + type: "Func", + name: name, + signature: signature, + body: body + }; + + if (isExternal === true) { + node.isExternal = true; + } + + if (typeof metadata !== "undefined") { + node.metadata = metadata; + } + + return node; +} + +function internalBrUnless(target) { + if (!(typeof target === "number")) { + throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown")); + } + + var node = { + type: "InternalBrUnless", + target: target + }; + return node; +} + +function internalGoto(target) { + if (!(typeof target === "number")) { + throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown")); + } + + var node = { + type: "InternalGoto", + target: target + }; + return node; +} + +function internalCallExtern(target) { + if (!(typeof target === "number")) { + throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown")); + } + + var node = { + type: "InternalCallExtern", + target: target + }; + return node; +} + +function internalEndAndReturn() { + var node = { + type: "InternalEndAndReturn" + }; + return node; +} + +var isModule = isTypeOf("Module"); +exports.isModule = isModule; +var isModuleMetadata = isTypeOf("ModuleMetadata"); +exports.isModuleMetadata = isModuleMetadata; +var isModuleNameMetadata = isTypeOf("ModuleNameMetadata"); +exports.isModuleNameMetadata = isModuleNameMetadata; +var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata"); +exports.isFunctionNameMetadata = isFunctionNameMetadata; +var isLocalNameMetadata = isTypeOf("LocalNameMetadata"); +exports.isLocalNameMetadata = isLocalNameMetadata; +var isBinaryModule = isTypeOf("BinaryModule"); +exports.isBinaryModule = isBinaryModule; +var isQuoteModule = isTypeOf("QuoteModule"); +exports.isQuoteModule = isQuoteModule; +var isSectionMetadata = isTypeOf("SectionMetadata"); +exports.isSectionMetadata = isSectionMetadata; +var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata"); +exports.isProducersSectionMetadata = isProducersSectionMetadata; +var isProducerMetadata = isTypeOf("ProducerMetadata"); +exports.isProducerMetadata = isProducerMetadata; +var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName"); +exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName; +var isLoopInstruction = isTypeOf("LoopInstruction"); +exports.isLoopInstruction = isLoopInstruction; +var isInstr = isTypeOf("Instr"); +exports.isInstr = isInstr; +var isIfInstruction = isTypeOf("IfInstruction"); +exports.isIfInstruction = isIfInstruction; +var isStringLiteral = isTypeOf("StringLiteral"); +exports.isStringLiteral = isStringLiteral; +var isNumberLiteral = isTypeOf("NumberLiteral"); +exports.isNumberLiteral = isNumberLiteral; +var isLongNumberLiteral = isTypeOf("LongNumberLiteral"); +exports.isLongNumberLiteral = isLongNumberLiteral; +var isFloatLiteral = isTypeOf("FloatLiteral"); +exports.isFloatLiteral = isFloatLiteral; +var isElem = isTypeOf("Elem"); +exports.isElem = isElem; +var isIndexInFuncSection = isTypeOf("IndexInFuncSection"); +exports.isIndexInFuncSection = isIndexInFuncSection; +var isValtypeLiteral = isTypeOf("ValtypeLiteral"); +exports.isValtypeLiteral = isValtypeLiteral; +var isTypeInstruction = isTypeOf("TypeInstruction"); +exports.isTypeInstruction = isTypeInstruction; +var isStart = isTypeOf("Start"); +exports.isStart = isStart; +var isGlobalType = isTypeOf("GlobalType"); +exports.isGlobalType = isGlobalType; +var isLeadingComment = isTypeOf("LeadingComment"); +exports.isLeadingComment = isLeadingComment; +var isBlockComment = isTypeOf("BlockComment"); +exports.isBlockComment = isBlockComment; +var isData = isTypeOf("Data"); +exports.isData = isData; +var isGlobal = isTypeOf("Global"); +exports.isGlobal = isGlobal; +var isTable = isTypeOf("Table"); +exports.isTable = isTable; +var isMemory = isTypeOf("Memory"); +exports.isMemory = isMemory; +var isFuncImportDescr = isTypeOf("FuncImportDescr"); +exports.isFuncImportDescr = isFuncImportDescr; +var isModuleImport = isTypeOf("ModuleImport"); +exports.isModuleImport = isModuleImport; +var isModuleExportDescr = isTypeOf("ModuleExportDescr"); +exports.isModuleExportDescr = isModuleExportDescr; +var isModuleExport = isTypeOf("ModuleExport"); +exports.isModuleExport = isModuleExport; +var isLimit = isTypeOf("Limit"); +exports.isLimit = isLimit; +var isSignature = isTypeOf("Signature"); +exports.isSignature = isSignature; +var isProgram = isTypeOf("Program"); +exports.isProgram = isProgram; +var isIdentifier = isTypeOf("Identifier"); +exports.isIdentifier = isIdentifier; +var isBlockInstruction = isTypeOf("BlockInstruction"); +exports.isBlockInstruction = isBlockInstruction; +var isCallInstruction = isTypeOf("CallInstruction"); +exports.isCallInstruction = isCallInstruction; +var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction"); +exports.isCallIndirectInstruction = isCallIndirectInstruction; +var isByteArray = isTypeOf("ByteArray"); +exports.isByteArray = isByteArray; +var isFunc = isTypeOf("Func"); +exports.isFunc = isFunc; +var isInternalBrUnless = isTypeOf("InternalBrUnless"); +exports.isInternalBrUnless = isInternalBrUnless; +var isInternalGoto = isTypeOf("InternalGoto"); +exports.isInternalGoto = isInternalGoto; +var isInternalCallExtern = isTypeOf("InternalCallExtern"); +exports.isInternalCallExtern = isInternalCallExtern; +var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn"); +exports.isInternalEndAndReturn = isInternalEndAndReturn; + +var isNode = function isNode(node) { + return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node); +}; + +exports.isNode = isNode; + +var isBlock = function isBlock(node) { + return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node); +}; + +exports.isBlock = isBlock; + +var isInstruction = function isInstruction(node) { + return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node); +}; + +exports.isInstruction = isInstruction; + +var isExpression = function isExpression(node) { + return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node); +}; + +exports.isExpression = isExpression; + +var isNumericLiteral = function isNumericLiteral(node) { + return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node); +}; + +exports.isNumericLiteral = isNumericLiteral; + +var isImportDescr = function isImportDescr(node) { + return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node); +}; + +exports.isImportDescr = isImportDescr; + +var isIntrinsic = function isIntrinsic(node) { + return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node); +}; + +exports.isIntrinsic = isIntrinsic; +var assertModule = assertTypeOf("Module"); +exports.assertModule = assertModule; +var assertModuleMetadata = assertTypeOf("ModuleMetadata"); +exports.assertModuleMetadata = assertModuleMetadata; +var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata"); +exports.assertModuleNameMetadata = assertModuleNameMetadata; +var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata"); +exports.assertFunctionNameMetadata = assertFunctionNameMetadata; +var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata"); +exports.assertLocalNameMetadata = assertLocalNameMetadata; +var assertBinaryModule = assertTypeOf("BinaryModule"); +exports.assertBinaryModule = assertBinaryModule; +var assertQuoteModule = assertTypeOf("QuoteModule"); +exports.assertQuoteModule = assertQuoteModule; +var assertSectionMetadata = assertTypeOf("SectionMetadata"); +exports.assertSectionMetadata = assertSectionMetadata; +var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata"); +exports.assertProducersSectionMetadata = assertProducersSectionMetadata; +var assertProducerMetadata = assertTypeOf("ProducerMetadata"); +exports.assertProducerMetadata = assertProducerMetadata; +var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName"); +exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName; +var assertLoopInstruction = assertTypeOf("LoopInstruction"); +exports.assertLoopInstruction = assertLoopInstruction; +var assertInstr = assertTypeOf("Instr"); +exports.assertInstr = assertInstr; +var assertIfInstruction = assertTypeOf("IfInstruction"); +exports.assertIfInstruction = assertIfInstruction; +var assertStringLiteral = assertTypeOf("StringLiteral"); +exports.assertStringLiteral = assertStringLiteral; +var assertNumberLiteral = assertTypeOf("NumberLiteral"); +exports.assertNumberLiteral = assertNumberLiteral; +var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral"); +exports.assertLongNumberLiteral = assertLongNumberLiteral; +var assertFloatLiteral = assertTypeOf("FloatLiteral"); +exports.assertFloatLiteral = assertFloatLiteral; +var assertElem = assertTypeOf("Elem"); +exports.assertElem = assertElem; +var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection"); +exports.assertIndexInFuncSection = assertIndexInFuncSection; +var assertValtypeLiteral = assertTypeOf("ValtypeLiteral"); +exports.assertValtypeLiteral = assertValtypeLiteral; +var assertTypeInstruction = assertTypeOf("TypeInstruction"); +exports.assertTypeInstruction = assertTypeInstruction; +var assertStart = assertTypeOf("Start"); +exports.assertStart = assertStart; +var assertGlobalType = assertTypeOf("GlobalType"); +exports.assertGlobalType = assertGlobalType; +var assertLeadingComment = assertTypeOf("LeadingComment"); +exports.assertLeadingComment = assertLeadingComment; +var assertBlockComment = assertTypeOf("BlockComment"); +exports.assertBlockComment = assertBlockComment; +var assertData = assertTypeOf("Data"); +exports.assertData = assertData; +var assertGlobal = assertTypeOf("Global"); +exports.assertGlobal = assertGlobal; +var assertTable = assertTypeOf("Table"); +exports.assertTable = assertTable; +var assertMemory = assertTypeOf("Memory"); +exports.assertMemory = assertMemory; +var assertFuncImportDescr = assertTypeOf("FuncImportDescr"); +exports.assertFuncImportDescr = assertFuncImportDescr; +var assertModuleImport = assertTypeOf("ModuleImport"); +exports.assertModuleImport = assertModuleImport; +var assertModuleExportDescr = assertTypeOf("ModuleExportDescr"); +exports.assertModuleExportDescr = assertModuleExportDescr; +var assertModuleExport = assertTypeOf("ModuleExport"); +exports.assertModuleExport = assertModuleExport; +var assertLimit = assertTypeOf("Limit"); +exports.assertLimit = assertLimit; +var assertSignature = assertTypeOf("Signature"); +exports.assertSignature = assertSignature; +var assertProgram = assertTypeOf("Program"); +exports.assertProgram = assertProgram; +var assertIdentifier = assertTypeOf("Identifier"); +exports.assertIdentifier = assertIdentifier; +var assertBlockInstruction = assertTypeOf("BlockInstruction"); +exports.assertBlockInstruction = assertBlockInstruction; +var assertCallInstruction = assertTypeOf("CallInstruction"); +exports.assertCallInstruction = assertCallInstruction; +var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction"); +exports.assertCallIndirectInstruction = assertCallIndirectInstruction; +var assertByteArray = assertTypeOf("ByteArray"); +exports.assertByteArray = assertByteArray; +var assertFunc = assertTypeOf("Func"); +exports.assertFunc = assertFunc; +var assertInternalBrUnless = assertTypeOf("InternalBrUnless"); +exports.assertInternalBrUnless = assertInternalBrUnless; +var assertInternalGoto = assertTypeOf("InternalGoto"); +exports.assertInternalGoto = assertInternalGoto; +var assertInternalCallExtern = assertTypeOf("InternalCallExtern"); +exports.assertInternalCallExtern = assertInternalCallExtern; +var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn"); +exports.assertInternalEndAndReturn = assertInternalEndAndReturn; +var unionTypesMap = { + Module: ["Node"], + ModuleMetadata: ["Node"], + ModuleNameMetadata: ["Node"], + FunctionNameMetadata: ["Node"], + LocalNameMetadata: ["Node"], + BinaryModule: ["Node"], + QuoteModule: ["Node"], + SectionMetadata: ["Node"], + ProducersSectionMetadata: ["Node"], + ProducerMetadata: ["Node"], + ProducerMetadataVersionedName: ["Node"], + LoopInstruction: ["Node", "Block", "Instruction"], + Instr: ["Node", "Expression", "Instruction"], + IfInstruction: ["Node", "Instruction"], + StringLiteral: ["Node", "Expression"], + NumberLiteral: ["Node", "NumericLiteral", "Expression"], + LongNumberLiteral: ["Node", "NumericLiteral", "Expression"], + FloatLiteral: ["Node", "NumericLiteral", "Expression"], + Elem: ["Node"], + IndexInFuncSection: ["Node"], + ValtypeLiteral: ["Node", "Expression"], + TypeInstruction: ["Node", "Instruction"], + Start: ["Node"], + GlobalType: ["Node", "ImportDescr"], + LeadingComment: ["Node"], + BlockComment: ["Node"], + Data: ["Node"], + Global: ["Node"], + Table: ["Node", "ImportDescr"], + Memory: ["Node", "ImportDescr"], + FuncImportDescr: ["Node", "ImportDescr"], + ModuleImport: ["Node"], + ModuleExportDescr: ["Node"], + ModuleExport: ["Node"], + Limit: ["Node"], + Signature: ["Node"], + Program: ["Node"], + Identifier: ["Node", "Expression"], + BlockInstruction: ["Node", "Block", "Instruction"], + CallInstruction: ["Node", "Instruction"], + CallIndirectInstruction: ["Node", "Instruction"], + ByteArray: ["Node"], + Func: ["Node", "Block"], + InternalBrUnless: ["Node", "Intrinsic"], + InternalGoto: ["Node", "Intrinsic"], + InternalCallExtern: ["Node", "Intrinsic"], + InternalEndAndReturn: ["Node", "Intrinsic"] +}; +exports.unionTypesMap = unionTypesMap; +var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"]; +exports.nodeAndUnionTypes = nodeAndUnionTypes; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/signatures.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/signatures.js new file mode 100644 index 0000000000000000000000000000000000000000..5afc62fd02e367765bb82705f77443cb894f6649 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/signatures.js @@ -0,0 +1,207 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.signatures = void 0; + +function sign(input, output) { + return [input, output]; +} + +var u32 = "u32"; +var i32 = "i32"; +var i64 = "i64"; +var f32 = "f32"; +var f64 = "f64"; + +var vector = function vector(t) { + var vecType = [t]; // $FlowIgnore + + vecType.vector = true; + return vecType; +}; + +var controlInstructions = { + unreachable: sign([], []), + nop: sign([], []), + // block ? + // loop ? + // if ? + // if else ? + br: sign([u32], []), + br_if: sign([u32], []), + br_table: sign(vector(u32), []), + "return": sign([], []), + call: sign([u32], []), + call_indirect: sign([u32], []) +}; +var parametricInstructions = { + drop: sign([], []), + select: sign([], []) +}; +var variableInstructions = { + get_local: sign([u32], []), + set_local: sign([u32], []), + tee_local: sign([u32], []), + get_global: sign([u32], []), + set_global: sign([u32], []) +}; +var memoryInstructions = { + "i32.load": sign([u32, u32], [i32]), + "i64.load": sign([u32, u32], []), + "f32.load": sign([u32, u32], []), + "f64.load": sign([u32, u32], []), + "i32.load8_s": sign([u32, u32], [i32]), + "i32.load8_u": sign([u32, u32], [i32]), + "i32.load16_s": sign([u32, u32], [i32]), + "i32.load16_u": sign([u32, u32], [i32]), + "i64.load8_s": sign([u32, u32], [i64]), + "i64.load8_u": sign([u32, u32], [i64]), + "i64.load16_s": sign([u32, u32], [i64]), + "i64.load16_u": sign([u32, u32], [i64]), + "i64.load32_s": sign([u32, u32], [i64]), + "i64.load32_u": sign([u32, u32], [i64]), + "i32.store": sign([u32, u32], []), + "i64.store": sign([u32, u32], []), + "f32.store": sign([u32, u32], []), + "f64.store": sign([u32, u32], []), + "i32.store8": sign([u32, u32], []), + "i32.store16": sign([u32, u32], []), + "i64.store8": sign([u32, u32], []), + "i64.store16": sign([u32, u32], []), + "i64.store32": sign([u32, u32], []), + current_memory: sign([], []), + grow_memory: sign([], []) +}; +var numericInstructions = { + "i32.const": sign([i32], [i32]), + "i64.const": sign([i64], [i64]), + "f32.const": sign([f32], [f32]), + "f64.const": sign([f64], [f64]), + "i32.eqz": sign([i32], [i32]), + "i32.eq": sign([i32, i32], [i32]), + "i32.ne": sign([i32, i32], [i32]), + "i32.lt_s": sign([i32, i32], [i32]), + "i32.lt_u": sign([i32, i32], [i32]), + "i32.gt_s": sign([i32, i32], [i32]), + "i32.gt_u": sign([i32, i32], [i32]), + "i32.le_s": sign([i32, i32], [i32]), + "i32.le_u": sign([i32, i32], [i32]), + "i32.ge_s": sign([i32, i32], [i32]), + "i32.ge_u": sign([i32, i32], [i32]), + "i64.eqz": sign([i64], [i64]), + "i64.eq": sign([i64, i64], [i32]), + "i64.ne": sign([i64, i64], [i32]), + "i64.lt_s": sign([i64, i64], [i32]), + "i64.lt_u": sign([i64, i64], [i32]), + "i64.gt_s": sign([i64, i64], [i32]), + "i64.gt_u": sign([i64, i64], [i32]), + "i64.le_s": sign([i64, i64], [i32]), + "i64.le_u": sign([i64, i64], [i32]), + "i64.ge_s": sign([i64, i64], [i32]), + "i64.ge_u": sign([i64, i64], [i32]), + "f32.eq": sign([f32, f32], [i32]), + "f32.ne": sign([f32, f32], [i32]), + "f32.lt": sign([f32, f32], [i32]), + "f32.gt": sign([f32, f32], [i32]), + "f32.le": sign([f32, f32], [i32]), + "f32.ge": sign([f32, f32], [i32]), + "f64.eq": sign([f64, f64], [i32]), + "f64.ne": sign([f64, f64], [i32]), + "f64.lt": sign([f64, f64], [i32]), + "f64.gt": sign([f64, f64], [i32]), + "f64.le": sign([f64, f64], [i32]), + "f64.ge": sign([f64, f64], [i32]), + "i32.clz": sign([i32], [i32]), + "i32.ctz": sign([i32], [i32]), + "i32.popcnt": sign([i32], [i32]), + "i32.add": sign([i32, i32], [i32]), + "i32.sub": sign([i32, i32], [i32]), + "i32.mul": sign([i32, i32], [i32]), + "i32.div_s": sign([i32, i32], [i32]), + "i32.div_u": sign([i32, i32], [i32]), + "i32.rem_s": sign([i32, i32], [i32]), + "i32.rem_u": sign([i32, i32], [i32]), + "i32.and": sign([i32, i32], [i32]), + "i32.or": sign([i32, i32], [i32]), + "i32.xor": sign([i32, i32], [i32]), + "i32.shl": sign([i32, i32], [i32]), + "i32.shr_s": sign([i32, i32], [i32]), + "i32.shr_u": sign([i32, i32], [i32]), + "i32.rotl": sign([i32, i32], [i32]), + "i32.rotr": sign([i32, i32], [i32]), + "i64.clz": sign([i64], [i64]), + "i64.ctz": sign([i64], [i64]), + "i64.popcnt": sign([i64], [i64]), + "i64.add": sign([i64, i64], [i64]), + "i64.sub": sign([i64, i64], [i64]), + "i64.mul": sign([i64, i64], [i64]), + "i64.div_s": sign([i64, i64], [i64]), + "i64.div_u": sign([i64, i64], [i64]), + "i64.rem_s": sign([i64, i64], [i64]), + "i64.rem_u": sign([i64, i64], [i64]), + "i64.and": sign([i64, i64], [i64]), + "i64.or": sign([i64, i64], [i64]), + "i64.xor": sign([i64, i64], [i64]), + "i64.shl": sign([i64, i64], [i64]), + "i64.shr_s": sign([i64, i64], [i64]), + "i64.shr_u": sign([i64, i64], [i64]), + "i64.rotl": sign([i64, i64], [i64]), + "i64.rotr": sign([i64, i64], [i64]), + "f32.abs": sign([f32], [f32]), + "f32.neg": sign([f32], [f32]), + "f32.ceil": sign([f32], [f32]), + "f32.floor": sign([f32], [f32]), + "f32.trunc": sign([f32], [f32]), + "f32.nearest": sign([f32], [f32]), + "f32.sqrt": sign([f32], [f32]), + "f32.add": sign([f32, f32], [f32]), + "f32.sub": sign([f32, f32], [f32]), + "f32.mul": sign([f32, f32], [f32]), + "f32.div": sign([f32, f32], [f32]), + "f32.min": sign([f32, f32], [f32]), + "f32.max": sign([f32, f32], [f32]), + "f32.copysign": sign([f32, f32], [f32]), + "f64.abs": sign([f64], [f64]), + "f64.neg": sign([f64], [f64]), + "f64.ceil": sign([f64], [f64]), + "f64.floor": sign([f64], [f64]), + "f64.trunc": sign([f64], [f64]), + "f64.nearest": sign([f64], [f64]), + "f64.sqrt": sign([f64], [f64]), + "f64.add": sign([f64, f64], [f64]), + "f64.sub": sign([f64, f64], [f64]), + "f64.mul": sign([f64, f64], [f64]), + "f64.div": sign([f64, f64], [f64]), + "f64.min": sign([f64, f64], [f64]), + "f64.max": sign([f64, f64], [f64]), + "f64.copysign": sign([f64, f64], [f64]), + "i32.wrap/i64": sign([i64], [i32]), + "i32.trunc_s/f32": sign([f32], [i32]), + "i32.trunc_u/f32": sign([f32], [i32]), + "i32.trunc_s/f64": sign([f32], [i32]), + "i32.trunc_u/f64": sign([f64], [i32]), + "i64.extend_s/i32": sign([i32], [i64]), + "i64.extend_u/i32": sign([i32], [i64]), + "i64.trunc_s/f32": sign([f32], [i64]), + "i64.trunc_u/f32": sign([f32], [i64]), + "i64.trunc_s/f64": sign([f64], [i64]), + "i64.trunc_u/f64": sign([f64], [i64]), + "f32.convert_s/i32": sign([i32], [f32]), + "f32.convert_u/i32": sign([i32], [f32]), + "f32.convert_s/i64": sign([i64], [f32]), + "f32.convert_u/i64": sign([i64], [f32]), + "f32.demote/f64": sign([f64], [f32]), + "f64.convert_s/i32": sign([i32], [f64]), + "f64.convert_u/i32": sign([i32], [f64]), + "f64.convert_s/i64": sign([i64], [f64]), + "f64.convert_u/i64": sign([i64], [f64]), + "f64.promote/f32": sign([f32], [f64]), + "i32.reinterpret/f32": sign([f32], [i32]), + "i64.reinterpret/f64": sign([f64], [i64]), + "f32.reinterpret/i32": sign([i32], [f32]), + "f64.reinterpret/i64": sign([i64], [f64]) +}; +var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions); +exports.signatures = signatures; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/transform/ast-module-to-module-context/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/transform/ast-module-to-module-context/index.js new file mode 100644 index 0000000000000000000000000000000000000000..470ebee03c9156f0359e5d74fe674e0f22d0144f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/transform/ast-module-to-module-context/index.js @@ -0,0 +1,389 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.moduleContextFromModuleAST = moduleContextFromModuleAST; +exports.ModuleContext = void 0; + +var _nodes = require("../../nodes.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function moduleContextFromModuleAST(m) { + var moduleContext = new ModuleContext(); + + if (!(m.type === "Module")) { + throw new Error('m.type === "Module"' + " error: " + (undefined || "unknown")); + } + + m.fields.forEach(function (field) { + switch (field.type) { + case "Start": + { + moduleContext.setStart(field.index); + break; + } + + case "TypeInstruction": + { + moduleContext.addType(field); + break; + } + + case "Func": + { + moduleContext.addFunction(field); + break; + } + + case "Global": + { + moduleContext.defineGlobal(field); + break; + } + + case "ModuleImport": + { + switch (field.descr.type) { + case "GlobalType": + { + moduleContext.importGlobal(field.descr.valtype, field.descr.mutability); + break; + } + + case "Memory": + { + moduleContext.addMemory(field.descr.limits.min, field.descr.limits.max); + break; + } + + case "FuncImportDescr": + { + moduleContext.importFunction(field.descr); + break; + } + + case "Table": + { + // FIXME(sven): not implemented yet + break; + } + + default: + throw new Error("Unsupported ModuleImport of type " + JSON.stringify(field.descr.type)); + } + + break; + } + + case "Memory": + { + moduleContext.addMemory(field.limits.min, field.limits.max); + break; + } + } + }); + return moduleContext; +} +/** + * Module context for type checking + */ + + +var ModuleContext = /*#__PURE__*/function () { + function ModuleContext() { + _classCallCheck(this, ModuleContext); + + this.funcs = []; + this.funcsOffsetByIdentifier = []; + this.types = []; + this.globals = []; + this.globalsOffsetByIdentifier = []; + this.mems = []; // Current stack frame + + this.locals = []; + this.labels = []; + this["return"] = []; + this.debugName = "unknown"; + this.start = null; + } + /** + * Set start segment + */ + + + _createClass(ModuleContext, [{ + key: "setStart", + value: function setStart(index) { + this.start = index.value; + } + /** + * Get start function + */ + + }, { + key: "getStart", + value: function getStart() { + return this.start; + } + /** + * Reset the active stack frame + */ + + }, { + key: "newContext", + value: function newContext(debugName, expectedResult) { + this.locals = []; + this.labels = [expectedResult]; + this["return"] = expectedResult; + this.debugName = debugName; + } + /** + * Functions + */ + + }, { + key: "addFunction", + value: function addFunction(func) { + /* eslint-disable */ + // $FlowIgnore + var _ref = func.signature || {}, + _ref$params = _ref.params, + args = _ref$params === void 0 ? [] : _ref$params, + _ref$results = _ref.results, + result = _ref$results === void 0 ? [] : _ref$results; + /* eslint-enable */ + + + args = args.map(function (arg) { + return arg.valtype; + }); + this.funcs.push({ + args: args, + result: result + }); + + if (typeof func.name !== "undefined") { + // $FlowIgnore + this.funcsOffsetByIdentifier[func.name.value] = this.funcs.length - 1; + } + } + }, { + key: "importFunction", + value: function importFunction(funcimport) { + if ((0, _nodes.isSignature)(funcimport.signature)) { + // eslint-disable-next-line prefer-const + var _funcimport$signature = funcimport.signature, + args = _funcimport$signature.params, + result = _funcimport$signature.results; + args = args.map(function (arg) { + return arg.valtype; + }); + this.funcs.push({ + args: args, + result: result + }); + } else { + if (!(0, _nodes.isNumberLiteral)(funcimport.signature)) { + throw new Error('isNumberLiteral(funcimport.signature)' + " error: " + (undefined || "unknown")); + } + + var typeId = funcimport.signature.value; + + if (!this.hasType(typeId)) { + throw new Error('this.hasType(typeId)' + " error: " + (undefined || "unknown")); + } + + var signature = this.getType(typeId); + this.funcs.push({ + args: signature.params.map(function (arg) { + return arg.valtype; + }), + result: signature.results + }); + } + + if (typeof funcimport.id !== "undefined") { + // imports are first, we can assume their index in the array + this.funcsOffsetByIdentifier[funcimport.id.value] = this.funcs.length - 1; + } + } + }, { + key: "hasFunction", + value: function hasFunction(index) { + return typeof this.getFunction(index) !== "undefined"; + } + }, { + key: "getFunction", + value: function getFunction(index) { + if (typeof index !== "number") { + throw new Error("getFunction only supported for number index"); + } + + return this.funcs[index]; + } + }, { + key: "getFunctionOffsetByIdentifier", + value: function getFunctionOffsetByIdentifier(name) { + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown")); + } + + return this.funcsOffsetByIdentifier[name]; + } + /** + * Labels + */ + + }, { + key: "addLabel", + value: function addLabel(result) { + this.labels.unshift(result); + } + }, { + key: "hasLabel", + value: function hasLabel(index) { + return this.labels.length > index && index >= 0; + } + }, { + key: "getLabel", + value: function getLabel(index) { + return this.labels[index]; + } + }, { + key: "popLabel", + value: function popLabel() { + this.labels.shift(); + } + /** + * Locals + */ + + }, { + key: "hasLocal", + value: function hasLocal(index) { + return typeof this.getLocal(index) !== "undefined"; + } + }, { + key: "getLocal", + value: function getLocal(index) { + return this.locals[index]; + } + }, { + key: "addLocal", + value: function addLocal(type) { + this.locals.push(type); + } + /** + * Types + */ + + }, { + key: "addType", + value: function addType(type) { + if (!(type.functype.type === "Signature")) { + throw new Error('type.functype.type === "Signature"' + " error: " + (undefined || "unknown")); + } + + this.types.push(type.functype); + } + }, { + key: "hasType", + value: function hasType(index) { + return this.types[index] !== undefined; + } + }, { + key: "getType", + value: function getType(index) { + return this.types[index]; + } + /** + * Globals + */ + + }, { + key: "hasGlobal", + value: function hasGlobal(index) { + return this.globals.length > index && index >= 0; + } + }, { + key: "getGlobal", + value: function getGlobal(index) { + return this.globals[index].type; + } + }, { + key: "getGlobalOffsetByIdentifier", + value: function getGlobalOffsetByIdentifier(name) { + if (!(typeof name === "string")) { + throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown")); + } + + // $FlowIgnore + return this.globalsOffsetByIdentifier[name]; + } + }, { + key: "defineGlobal", + value: function defineGlobal(global) { + var type = global.globalType.valtype; + var mutability = global.globalType.mutability; + this.globals.push({ + type: type, + mutability: mutability + }); + + if (typeof global.name !== "undefined") { + // $FlowIgnore + this.globalsOffsetByIdentifier[global.name.value] = this.globals.length - 1; + } + } + }, { + key: "importGlobal", + value: function importGlobal(type, mutability) { + this.globals.push({ + type: type, + mutability: mutability + }); + } + }, { + key: "isMutableGlobal", + value: function isMutableGlobal(index) { + return this.globals[index].mutability === "var"; + } + }, { + key: "isImmutableGlobal", + value: function isImmutableGlobal(index) { + return this.globals[index].mutability === "const"; + } + /** + * Memories + */ + + }, { + key: "hasMemory", + value: function hasMemory(index) { + return this.mems.length > index && index >= 0; + } + }, { + key: "addMemory", + value: function addMemory(min, max) { + this.mems.push({ + min: min, + max: max + }); + } + }, { + key: "getMemory", + value: function getMemory(index) { + return this.mems[index]; + } + }]); + + return ModuleContext; +}(); + +exports.ModuleContext = ModuleContext; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/transform/denormalize-type-references/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/transform/denormalize-type-references/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3258f84d8de84fcae31f0da37d5e57e1b7fda042 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/transform/denormalize-type-references/index.js @@ -0,0 +1,83 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.transform = transform; + +var t = require("../../index"); // func and call_indirect instructions can either define a signature inline, or +// reference a signature, e.g. +// +// ;; inline signature +// (func (result i64) +// (i64.const 2) +// ) +// ;; signature reference +// (type (func (result i64))) +// (func (type 0) +// (i64.const 2)) +// ) +// +// this AST transform denormalises the type references, making all signatures within the module +// inline. + + +function transform(ast) { + var typeInstructions = []; + t.traverse(ast, { + TypeInstruction: function TypeInstruction(_ref) { + var node = _ref.node; + typeInstructions.push(node); + } + }); + + if (!typeInstructions.length) { + return; + } + + function denormalizeSignature(signature) { + // signature referenced by identifier + if (signature.type === "Identifier") { + var identifier = signature; + var typeInstruction = typeInstructions.find(function (t) { + return t.id.type === identifier.type && t.id.value === identifier.value; + }); + + if (!typeInstruction) { + throw new Error("A type instruction reference was not found ".concat(JSON.stringify(signature))); + } + + return typeInstruction.functype; + } // signature referenced by index + + + if (signature.type === "NumberLiteral") { + var signatureRef = signature; + var _typeInstruction = typeInstructions[signatureRef.value]; + return _typeInstruction.functype; + } + + return signature; + } + + t.traverse(ast, { + Func: function (_Func) { + function Func(_x) { + return _Func.apply(this, arguments); + } + + Func.toString = function () { + return _Func.toString(); + }; + + return Func; + }(function (_ref2) { + var node = _ref2.node; + node.signature = denormalizeSignature(node.signature); + }), + CallIndirectInstruction: function CallIndirectInstruction(_ref3) { + var node = _ref3.node; + node.signature = denormalizeSignature(node.signature); + } + }); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/transform/wast-identifier-to-index/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/transform/wast-identifier-to-index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8ab591bdc462415138b4f4802cba650c55b4dbd7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/transform/wast-identifier-to-index/index.js @@ -0,0 +1,238 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.transform = transform; + +var _index = require("../../index"); + +var _astModuleToModuleContext = require("../ast-module-to-module-context"); + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +// FIXME(sven): do the same with all block instructions, must be more generic here +function newUnexpectedFunction(i) { + return new Error("unknown function at offset: " + i); +} + +function transform(ast) { + var module = null; + (0, _index.traverse)(ast, { + Module: function (_Module) { + function Module(_x) { + return _Module.apply(this, arguments); + } + + Module.toString = function () { + return _Module.toString(); + }; + + return Module; + }(function (path) { + module = path.node; + }) + }); + + if (module == null) { + throw new Error("Module not foudn in program"); + } + + var moduleContext = (0, _astModuleToModuleContext.moduleContextFromModuleAST)(module); // Transform the actual instruction in function bodies + + (0, _index.traverse)(ast, { + Func: function (_Func) { + function Func(_x2) { + return _Func.apply(this, arguments); + } + + Func.toString = function () { + return _Func.toString(); + }; + + return Func; + }(function (path) { + transformFuncPath(path, moduleContext); + }), + Start: function (_Start) { + function Start(_x3) { + return _Start.apply(this, arguments); + } + + Start.toString = function () { + return _Start.toString(); + }; + + return Start; + }(function (path) { + var index = path.node.index; + + if ((0, _index.isIdentifier)(index) === true) { + var offsetInModule = moduleContext.getFunctionOffsetByIdentifier(index.value); + + if (typeof offsetInModule === "undefined") { + throw newUnexpectedFunction(index.value); + } // Replace the index Identifier + // $FlowIgnore: reference? + + + path.node.index = (0, _index.numberLiteralFromRaw)(offsetInModule); + } + }) + }); +} + +function transformFuncPath(funcPath, moduleContext) { + var funcNode = funcPath.node; + var signature = funcNode.signature; + + if (signature.type !== "Signature") { + throw new Error("Function signatures must be denormalised before execution"); + } + + var params = signature.params; // Add func locals in the context + + params.forEach(function (p) { + return moduleContext.addLocal(p.valtype); + }); + (0, _index.traverse)(funcNode, { + Instr: function (_Instr) { + function Instr(_x4) { + return _Instr.apply(this, arguments); + } + + Instr.toString = function () { + return _Instr.toString(); + }; + + return Instr; + }(function (instrPath) { + var instrNode = instrPath.node; + /** + * Local access + */ + + if (instrNode.id === "get_local" || instrNode.id === "set_local" || instrNode.id === "tee_local") { + var _instrNode$args = _slicedToArray(instrNode.args, 1), + firstArg = _instrNode$args[0]; + + if (firstArg.type === "Identifier") { + var offsetInParams = params.findIndex(function (_ref) { + var id = _ref.id; + return id === firstArg.value; + }); + + if (offsetInParams === -1) { + throw new Error("".concat(firstArg.value, " not found in ").concat(instrNode.id, ": not declared in func params")); + } // Replace the Identifer node by our new NumberLiteral node + + + instrNode.args[0] = (0, _index.numberLiteralFromRaw)(offsetInParams); + } + } + /** + * Global access + */ + + + if (instrNode.id === "get_global" || instrNode.id === "set_global") { + var _instrNode$args2 = _slicedToArray(instrNode.args, 1), + _firstArg = _instrNode$args2[0]; + + if ((0, _index.isIdentifier)(_firstArg) === true) { + var globalOffset = moduleContext.getGlobalOffsetByIdentifier( // $FlowIgnore: reference? + _firstArg.value); + + if (typeof globalOffset === "undefined") { + // $FlowIgnore: reference? + throw new Error("global ".concat(_firstArg.value, " not found in module")); + } // Replace the Identifer node by our new NumberLiteral node + + + instrNode.args[0] = (0, _index.numberLiteralFromRaw)(globalOffset); + } + } + /** + * Labels lookup + */ + + + if (instrNode.id === "br") { + var _instrNode$args3 = _slicedToArray(instrNode.args, 1), + _firstArg2 = _instrNode$args3[0]; + + if ((0, _index.isIdentifier)(_firstArg2) === true) { + // if the labels is not found it is going to be replaced with -1 + // which is invalid. + var relativeBlockCount = -1; // $FlowIgnore: reference? + + instrPath.findParent(function (_ref2) { + var node = _ref2.node; + + if ((0, _index.isBlock)(node)) { + relativeBlockCount++; // $FlowIgnore: reference? + + var name = node.label || node.name; + + if (_typeof(name) === "object") { + // $FlowIgnore: isIdentifier ensures that + if (name.value === _firstArg2.value) { + // Found it + return false; + } + } + } + + if ((0, _index.isFunc)(node)) { + return false; + } + }); // Replace the Identifer node by our new NumberLiteral node + + instrNode.args[0] = (0, _index.numberLiteralFromRaw)(relativeBlockCount); + } + } + }), + + /** + * Func lookup + */ + CallInstruction: function (_CallInstruction) { + function CallInstruction(_x5) { + return _CallInstruction.apply(this, arguments); + } + + CallInstruction.toString = function () { + return _CallInstruction.toString(); + }; + + return CallInstruction; + }(function (_ref3) { + var node = _ref3.node; + var index = node.index; + + if ((0, _index.isIdentifier)(index) === true) { + var offsetInModule = moduleContext.getFunctionOffsetByIdentifier(index.value); + + if (typeof offsetInModule === "undefined") { + throw newUnexpectedFunction(index.value); + } // Replace the index Identifier + // $FlowIgnore: reference? + + + node.index = (0, _index.numberLiteralFromRaw)(offsetInModule); + } + }) + }); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/traverse.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/traverse.js new file mode 100644 index 0000000000000000000000000000000000000000..86803cec49cb8c26baaf50685f74d5f72d4418a4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/traverse.js @@ -0,0 +1,105 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.traverse = traverse; + +var _nodePath = require("./node-path"); + +var _nodes = require("./nodes"); + +// recursively walks the AST starting at the given node. The callback is invoked for +// and object that has a 'type' property. +function walk(context, callback) { + var stop = false; + + function innerWalk(context, callback) { + if (stop) { + return; + } + + var node = context.node; + + if (node === undefined) { + console.warn("traversing with an empty context"); + return; + } + + if (node._deleted === true) { + return; + } + + var path = (0, _nodePath.createPath)(context); + callback(node.type, path); + + if (path.shouldStop) { + stop = true; + return; + } + + Object.keys(node).forEach(function (prop) { + var value = node[prop]; + + if (value === null || value === undefined) { + return; + } + + var valueAsArray = Array.isArray(value) ? value : [value]; + valueAsArray.forEach(function (childNode) { + if (typeof childNode.type === "string") { + var childContext = { + node: childNode, + parentKey: prop, + parentPath: path, + shouldStop: false, + inList: Array.isArray(value) + }; + innerWalk(childContext, callback); + } + }); + }); + } + + innerWalk(context, callback); +} + +var noop = function noop() {}; + +function traverse(node, visitors) { + var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop; + var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop; + Object.keys(visitors).forEach(function (visitor) { + if (!_nodes.nodeAndUnionTypes.includes(visitor)) { + throw new Error("Unexpected visitor ".concat(visitor)); + } + }); + var context = { + node: node, + inList: false, + shouldStop: false, + parentPath: null, + parentKey: null + }; + walk(context, function (type, path) { + if (typeof visitors[type] === "function") { + before(type, path); + visitors[type](path); + after(type, path); + } + + var unionTypes = _nodes.unionTypesMap[type]; + + if (!unionTypes) { + throw new Error("Unexpected node type ".concat(type)); + } + + unionTypes.forEach(function (unionType) { + if (typeof visitors[unionType] === "function") { + before(unionType, path); + visitors[unionType](path); + after(unionType, path); + } + }); + }); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/types/basic.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/types/basic.js new file mode 100644 index 0000000000000000000000000000000000000000..9a390c31f71bc7eae1522a280a2dc8f6723185bf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/types/basic.js @@ -0,0 +1 @@ +"use strict"; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/types/nodes.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/types/nodes.js new file mode 100644 index 0000000000000000000000000000000000000000..9a390c31f71bc7eae1522a280a2dc8f6723185bf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/types/nodes.js @@ -0,0 +1 @@ +"use strict"; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/types/traverse.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/types/traverse.js new file mode 100644 index 0000000000000000000000000000000000000000..9a390c31f71bc7eae1522a280a2dc8f6723185bf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/types/traverse.js @@ -0,0 +1 @@ +"use strict"; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/utils.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..87de15ed56dd68b08fb3a76d6b3409ff158b67b3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/lib/utils.js @@ -0,0 +1,315 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isAnonymous = isAnonymous; +exports.getSectionMetadata = getSectionMetadata; +exports.getSectionMetadatas = getSectionMetadatas; +exports.sortSectionMetadata = sortSectionMetadata; +exports.orderedInsertNode = orderedInsertNode; +exports.assertHasLoc = assertHasLoc; +exports.getEndOfSection = getEndOfSection; +exports.shiftLoc = shiftLoc; +exports.shiftSection = shiftSection; +exports.signatureForOpcode = signatureForOpcode; +exports.getUniqueNameGenerator = getUniqueNameGenerator; +exports.getStartByteOffset = getStartByteOffset; +exports.getEndByteOffset = getEndByteOffset; +exports.getFunctionBeginingByteOffset = getFunctionBeginingByteOffset; +exports.getEndBlockByteOffset = getEndBlockByteOffset; +exports.getStartBlockByteOffset = getStartBlockByteOffset; + +var _signatures = require("./signatures"); + +var _traverse = require("./traverse"); + +var _helperWasmBytecode = _interopRequireWildcard(require("@webassemblyjs/helper-wasm-bytecode")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function isAnonymous(ident) { + return ident.raw === ""; +} + +function getSectionMetadata(ast, name) { + var section; + (0, _traverse.traverse)(ast, { + SectionMetadata: function (_SectionMetadata) { + function SectionMetadata(_x) { + return _SectionMetadata.apply(this, arguments); + } + + SectionMetadata.toString = function () { + return _SectionMetadata.toString(); + }; + + return SectionMetadata; + }(function (_ref) { + var node = _ref.node; + + if (node.section === name) { + section = node; + } + }) + }); + return section; +} + +function getSectionMetadatas(ast, name) { + var sections = []; + (0, _traverse.traverse)(ast, { + SectionMetadata: function (_SectionMetadata2) { + function SectionMetadata(_x2) { + return _SectionMetadata2.apply(this, arguments); + } + + SectionMetadata.toString = function () { + return _SectionMetadata2.toString(); + }; + + return SectionMetadata; + }(function (_ref2) { + var node = _ref2.node; + + if (node.section === name) { + sections.push(node); + } + }) + }); + return sections; +} + +function sortSectionMetadata(m) { + if (m.metadata == null) { + console.warn("sortSectionMetadata: no metadata to sort"); + return; + } // $FlowIgnore + + + m.metadata.sections.sort(function (a, b) { + var aId = _helperWasmBytecode["default"].sections[a.section]; + var bId = _helperWasmBytecode["default"].sections[b.section]; + + if (typeof aId !== "number" || typeof bId !== "number") { + throw new Error("Section id not found"); + } + + return aId - bId; + }); +} + +function orderedInsertNode(m, n) { + assertHasLoc(n); + var didInsert = false; + + if (n.type === "ModuleExport") { + m.fields.push(n); + return; + } + + m.fields = m.fields.reduce(function (acc, field) { + var fieldEndCol = Infinity; + + if (field.loc != null) { + // $FlowIgnore + fieldEndCol = field.loc.end.column; + } // $FlowIgnore: assertHasLoc ensures that + + + if (didInsert === false && n.loc.start.column < fieldEndCol) { + didInsert = true; + acc.push(n); + } + + acc.push(field); + return acc; + }, []); // Handles empty modules or n is the last element + + if (didInsert === false) { + m.fields.push(n); + } +} + +function assertHasLoc(n) { + if (n.loc == null || n.loc.start == null || n.loc.end == null) { + throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information")); + } +} + +function getEndOfSection(s) { + assertHasLoc(s.size); + return s.startOffset + s.size.value + (s.size.loc.end.column - s.size.loc.start.column); +} + +function shiftLoc(node, delta) { + // $FlowIgnore + node.loc.start.column += delta; // $FlowIgnore + + node.loc.end.column += delta; +} + +function shiftSection(ast, node, delta) { + if (node.type !== "SectionMetadata") { + throw new Error("Can not shift node " + JSON.stringify(node.type)); + } + + node.startOffset += delta; + + if (_typeof(node.size.loc) === "object") { + shiftLoc(node.size, delta); + } // Custom sections doesn't have vectorOfSize + + + if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") { + shiftLoc(node.vectorOfSize, delta); + } + + var sectionName = node.section; // shift node locations within that section + + (0, _traverse.traverse)(ast, { + Node: function Node(_ref3) { + var node = _ref3.node; + var section = (0, _helperWasmBytecode.getSectionForNode)(node); + + if (section === sectionName && _typeof(node.loc) === "object") { + shiftLoc(node, delta); + } + } + }); +} + +function signatureForOpcode(object, name) { + var opcodeName = name; + + if (object !== undefined && object !== "") { + opcodeName = object + "." + name; + } + + var sign = _signatures.signatures[opcodeName]; + + if (sign == undefined) { + // TODO: Uncomment this when br_table and others has been done + //throw new Error("Invalid opcode: "+opcodeName); + return [object, object]; + } + + return sign[0]; +} + +function getUniqueNameGenerator() { + var inc = {}; + return function () { + var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp"; + + if (!(prefix in inc)) { + inc[prefix] = 0; + } else { + inc[prefix] = inc[prefix] + 1; + } + + return prefix + "_" + inc[prefix]; + }; +} + +function getStartByteOffset(n) { + // $FlowIgnore + if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") { + throw new Error( // $FlowIgnore + "Can not get byte offset without loc informations, node: " + String(n.id)); + } + + return n.loc.start.column; +} + +function getEndByteOffset(n) { + // $FlowIgnore + if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") { + throw new Error("Can not get byte offset without loc informations, node: " + n.type); + } + + return n.loc.end.column; +} + +function getFunctionBeginingByteOffset(n) { + if (!(n.body.length > 0)) { + throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown")); + } + + var _n$body = _slicedToArray(n.body, 1), + firstInstruction = _n$body[0]; + + return getStartByteOffset(firstInstruction); +} + +function getEndBlockByteOffset(n) { + // $FlowIgnore + if (!(n.instr.length > 0 || n.body.length > 0)) { + throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown")); + } + + var lastInstruction; + + if (n.instr) { + // $FlowIgnore + lastInstruction = n.instr[n.instr.length - 1]; + } + + if (n.body) { + // $FlowIgnore + lastInstruction = n.body[n.body.length - 1]; + } + + if (!(_typeof(lastInstruction) === "object")) { + throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown")); + } + + // $FlowIgnore + return getStartByteOffset(lastInstruction); +} + +function getStartBlockByteOffset(n) { + // $FlowIgnore + if (!(n.instr.length > 0 || n.body.length > 0)) { + throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown")); + } + + var fistInstruction; + + if (n.instr) { + // $FlowIgnore + var _n$instr = _slicedToArray(n.instr, 1); + + fistInstruction = _n$instr[0]; + } + + if (n.body) { + // $FlowIgnore + var _n$body2 = _slicedToArray(n.body, 1); + + fistInstruction = _n$body2[0]; + } + + if (!(_typeof(fistInstruction) === "object")) { + throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown")); + } + + // $FlowIgnore + return getStartByteOffset(fistInstruction); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/package.json new file mode 100644 index 0000000000000000000000000000000000000000..667d179a25616dadada1bf5bc254aba1d4d94063 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/package.json @@ -0,0 +1,32 @@ +{ + "name": "@webassemblyjs/ast", + "version": "1.14.1", + "description": "AST utils for webassemblyjs", + "keywords": [ + "webassembly", + "javascript", + "ast" + ], + "main": "lib/index.js", + "module": "esm/index.js", + "author": "Sven Sauleau", + "license": "MIT", + "dependencies": { + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@webassemblyjs/helper-test-framework": "1.14.1", + "array.prototype.flatmap": "^1.2.1", + "dump-exports": "^0.1.0", + "mamacro": "^0.0.7" + }, + "gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/scripts/generateNodeUtils.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/scripts/generateNodeUtils.js new file mode 100644 index 0000000000000000000000000000000000000000..88bff018e04e86249a9f90276b5209abf621d2d1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/scripts/generateNodeUtils.js @@ -0,0 +1,219 @@ +const definitions = require("../src/definitions"); +const flatMap = require("array.prototype.flatmap"); +const { + typeSignature, + iterateProps, + mapProps, + filterProps, + unique, +} = require("./util"); + +const stdout = process.stdout; + +const jsTypes = ["string", "number", "boolean"]; + +const quote = (value) => `"${value}"`; + +function params(fields) { + const optionalDefault = (field) => + field.default ? ` = ${field.default}` : ""; + return mapProps(fields) + .map((field) => `${typeSignature(field)}${optionalDefault(field)}`) + .join(","); +} + +function assertParamType({ assertNodeType, array, name, type }) { + if (array) { + // TODO - assert contents of array? + return `assert(typeof ${name} === "object" && typeof ${name}.length !== "undefined")\n`; + } else { + if (jsTypes.includes(type)) { + return `assert( + typeof ${name} === "${type}", + "Argument ${name} must be of type ${type}, given: " + typeof ${name} + )`; + } + + if (assertNodeType === true) { + return `assert( + ${name}.type === "${type}", + "Argument ${name} must be of type ${type}, given: " + ${name}.type + )`; + } + + return ""; + } +} + +function assertParam(meta) { + const paramAssertion = assertParamType(meta); + + if (paramAssertion === "") { + return ""; + } + + if (meta.maybe || meta.optional) { + return ` + if (${meta.name} !== null && ${meta.name} !== undefined) { + ${paramAssertion}; + } + `; + } else { + return paramAssertion; + } +} + +function assertParams(fields) { + return mapProps(fields).map(assertParam).join("\n"); +} + +function buildObject(typeDef) { + const optionalField = (meta) => { + if (meta.array) { + // omit optional array properties if the constructor function was supplied + // with an empty array + return ` + if (typeof ${meta.name} !== "undefined" && ${meta.name}.length > 0) { + node.${meta.name} = ${meta.name}; + } + `; + } else if (meta.type === "Object") { + // omit optional object properties if they have no keys + return ` + if (typeof ${meta.name} !== "undefined" && Object.keys(${meta.name}).length !== 0) { + node.${meta.name} = ${meta.name}; + } + `; + } else if (meta.type === "boolean") { + // omit optional boolean properties if they are not true + return ` + if (${meta.name} === true) { + node.${meta.name} = true; + } + `; + } else { + return ` + if (typeof ${meta.name} !== "undefined") { + node.${meta.name} = ${meta.name}; + } + `; + } + }; + + const fields = mapProps(typeDef.fields) + .filter((f) => !f.optional && !f.constant) + .map((f) => f.name); + + const constants = mapProps(typeDef.fields) + .filter((f) => f.constant) + .map((f) => `${f.name}: "${f.value}"`); + + return ` + const node: ${typeDef.flowTypeName || typeDef.name} = { + type: "${typeDef.name}", + ${constants.concat(fields).join(",")} + } + + ${mapProps(typeDef.fields) + .filter((f) => f.optional) + .map(optionalField) + .join("")} + `; +} + +function lowerCamelCase(name) { + return name.substring(0, 1).toLowerCase() + name.substring(1); +} + +function generate() { + stdout.write(` + // @flow + + // THIS FILE IS AUTOGENERATED + // see scripts/generateNodeUtils.js + + import { assert } from "mamacro"; + + function isTypeOf(t: string) { + return (n: Node) => n.type === t; + } + + function assertTypeOf(t: string) { + return (n: Node) => assert(n.type === t); + } + `); + + // Node builders + iterateProps(definitions, (typeDefinition) => { + stdout.write(` + export function ${lowerCamelCase(typeDefinition.name)} ( + ${params(filterProps(typeDefinition.fields, (f) => !f.constant))} + ): ${typeDefinition.name} { + + ${assertParams(filterProps(typeDefinition.fields, (f) => !f.constant))} + ${buildObject(typeDefinition)} + + return node; + } + `); + }); + + // Node testers + iterateProps(definitions, (typeDefinition) => { + stdout.write(` + export const is${typeDefinition.name}: ((n: Node) => boolean) = + isTypeOf("${typeDefinition.name}"); + `); + }); + + // Node union type testers + const unionTypes = unique( + flatMap( + mapProps(definitions).filter((d) => d.unionType), + (d) => d.unionType + ) + ); + unionTypes.forEach((unionType) => { + stdout.write( + ` + export const is${unionType} = (node: Node): boolean => ` + + mapProps(definitions) + .filter((d) => d.unionType && d.unionType.includes(unionType)) + .map((d) => `is${d.name}(node) `) + .join("||") + + ";\n\n" + ); + }); + + // Node assertion + iterateProps(definitions, (typeDefinition) => { + stdout.write(` + export const assert${typeDefinition.name}: ((n: Node) => void) = + assertTypeOf("${typeDefinition.name}"); + `); + }); + + // a map from node type to its set of union types + stdout.write( + ` + export const unionTypesMap = {` + + mapProps(definitions) + .filter((d) => d.unionType) + .map((t) => `"${t.name}": [${t.unionType.map(quote).join(",")}]\n`) + + `}; + ` + ); + + // an array of all node and union types + stdout.write( + ` + export const nodeAndUnionTypes = [` + + mapProps(definitions) + .map((t) => `"${t.name}"`) + .concat(unionTypes.map(quote)) + .join(",") + + `];` + ); +} + +generate(); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/scripts/generateTypeDefinitions.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/scripts/generateTypeDefinitions.js new file mode 100644 index 0000000000000000000000000000000000000000..3f6a9d160b59a55702fe06ab0d8455d2797eedc3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/scripts/generateTypeDefinitions.js @@ -0,0 +1,48 @@ +const definitions = require("../src/definitions"); +const flatMap = require("array.prototype.flatmap"); +const { typeSignature, mapProps, iterateProps, unique } = require("./util"); + +const stdout = process.stdout; + +function params(fields) { + return mapProps(fields).map(typeSignature).join(","); +} + +function generate() { + stdout.write(` + // @flow + /* eslint no-unused-vars: off */ + + // THIS FILE IS AUTOGENERATED + // see scripts/generateTypeDefinitions.js + `); + + // generate union types + const unionTypes = unique( + flatMap( + mapProps(definitions).filter((d) => d.unionType), + (d) => d.unionType + ) + ); + unionTypes.forEach((unionType) => { + stdout.write( + `type ${unionType} = ` + + mapProps(definitions) + .filter((d) => d.unionType && d.unionType.includes(unionType)) + .map((d) => d.name) + .join("|") + + ";\n\n" + ); + }); + + // generate the type definitions + iterateProps(definitions, (typeDef) => { + stdout.write(`type ${typeDef.name} = { + ...BaseNode, + type: "${typeDef.name}", + ${params(typeDef.fields)} + };\n\n`); + }); +} + +generate(); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/scripts/util.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/scripts/util.js new file mode 100644 index 0000000000000000000000000000000000000000..7581535583da0be5493c64cc80f2392cfd0db5bb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ast/scripts/util.js @@ -0,0 +1,38 @@ +function iterateProps(obj, iterator) { + Object.keys(obj).forEach((key) => iterator({ ...obj[key], name: key })); +} + +function mapProps(obj) { + return Object.keys(obj).map((key) => ({ ...obj[key], name: key })); +} + +function filterProps(obj, filter) { + const ret = {}; + Object.keys(obj).forEach((key) => { + if (filter(obj[key])) { + ret[key] = obj[key]; + } + }); + return ret; +} + +function typeSignature(meta) { + const type = meta.array ? `Array<${meta.type}>` : meta.type; + if (meta.optional) { + return `${meta.name}?: ${type}`; + } else if (meta.maybe) { + return `${meta.name}: ?${type}`; + } else { + return `${meta.name}: ${type}`; + } +} + +const unique = (items) => Array.from(new Set(items)); + +module.exports = { + iterateProps, + mapProps, + filterProps, + typeSignature, + unique, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d5471f86a6bc14627b57fc0e8cac763a984be14f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Mauro Bringolf + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/README.md new file mode 100644 index 0000000000000000000000000000000000000000..648e09bc258e4578c31a22b96a2812046990f700 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/README.md @@ -0,0 +1,34 @@ +# Parser function for floating point hexadecimals + +[![license](https://img.shields.io/github/license/maurobringolf/@webassemblyjs/floating-point-hex-parser.svg)]() +[![GitHub last commit](https://img.shields.io/github/last-commit/maurobringolf/@webassemblyjs/floating-point-hex-parser.svg)]() +[![npm](https://img.shields.io/npm/v/@webassemblyjs/floating-point-hex-parser.svg)]() + +> A JavaScript function to parse floating point hexadecimals as defined by the [WebAssembly specification](https://webassembly.github.io/spec/core/text/values.html#text-hexfloat). + +## Usage + +```javascript +import parseHexFloat from '@webassemblyjs/floating-point-hex-parser' + +parseHexFloat('0x1p-1') // 0.5 +parseHexFloat('0x1.921fb54442d18p+2') // 6.283185307179586 +``` + +## Tests + +This module is tested in two ways. The first one is through a small set of test cases that can be found in [test/regular.test.js](https://github.com/maurobringolf/@webassemblyjs/floating-point-hex-parser/blob/master/test/regular.test.js). The second one is non-deterministic (sometimes called *fuzzing*): + +1. Generate a random IEEE754 double precision value `x`. +1. Compute its representation `y` in floating point hexadecimal format using the C standard library function `printf` since C supports this format. +1. Give both values to JS testcase and see if `parseHexFloat(y) === x`. + +By default one `npm test` run tests 100 random samples. If you want to do more, you can set the environment variable `FUZZ_AMOUNT` to whatever number of runs you'd like. Because it uses one child process for each sample, it is really slow though. For more details about the randomized tests see [the source](https://github.com/maurobringolf/@webassemblyjs/floating-point-hex-parser/tree/master/test/fuzzing). + +## Links + +* [maurobringolf.ch/2017/12/hexadecimal-floating-point-notation/](https://maurobringolf.ch/2017/12/hexadecimal-floating-point-notation/) + +* [github.com/xtuc/js-webassembly-interpreter/issues/32](https://github.com/xtuc/js-webassembly-interpreter/issues/32) + +* [github.com/WebAssembly/design/issues/292](https://github.com/WebAssembly/design/issues/292) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d8d858d39e53104786e6ffe24ba2ff7ea8248631 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/esm/index.js @@ -0,0 +1,42 @@ +export default function parse(input) { + input = input.toUpperCase(); + var splitIndex = input.indexOf("P"); + var mantissa, exponent; + + if (splitIndex !== -1) { + mantissa = input.substring(0, splitIndex); + exponent = parseInt(input.substring(splitIndex + 1)); + } else { + mantissa = input; + exponent = 0; + } + + var dotIndex = mantissa.indexOf("."); + + if (dotIndex !== -1) { + var integerPart = parseInt(mantissa.substring(0, dotIndex), 16); + var sign = Math.sign(integerPart); + integerPart = sign * integerPart; + var fractionLength = mantissa.length - dotIndex - 1; + var fractionalPart = parseInt(mantissa.substring(dotIndex + 1), 16); + var fraction = fractionLength > 0 ? fractionalPart / Math.pow(16, fractionLength) : 0; + + if (sign === 0) { + if (fraction === 0) { + mantissa = sign; + } else { + if (Object.is(sign, -0)) { + mantissa = -fraction; + } else { + mantissa = fraction; + } + } + } else { + mantissa = sign * (integerPart + fraction); + } + } else { + mantissa = parseInt(mantissa, 16); + } + + return mantissa * (splitIndex !== -1 ? Math.pow(2, exponent) : 1); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..96b3bd14983d78d2cef384a214cab58379b4e079 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/lib/index.js @@ -0,0 +1,49 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = parse; + +function parse(input) { + input = input.toUpperCase(); + var splitIndex = input.indexOf("P"); + var mantissa, exponent; + + if (splitIndex !== -1) { + mantissa = input.substring(0, splitIndex); + exponent = parseInt(input.substring(splitIndex + 1)); + } else { + mantissa = input; + exponent = 0; + } + + var dotIndex = mantissa.indexOf("."); + + if (dotIndex !== -1) { + var integerPart = parseInt(mantissa.substring(0, dotIndex), 16); + var sign = Math.sign(integerPart); + integerPart = sign * integerPart; + var fractionLength = mantissa.length - dotIndex - 1; + var fractionalPart = parseInt(mantissa.substring(dotIndex + 1), 16); + var fraction = fractionLength > 0 ? fractionalPart / Math.pow(16, fractionLength) : 0; + + if (sign === 0) { + if (fraction === 0) { + mantissa = sign; + } else { + if (Object.is(sign, -0)) { + mantissa = -fraction; + } else { + mantissa = fraction; + } + } + } else { + mantissa = sign * (integerPart + fraction); + } + } else { + mantissa = parseInt(mantissa, 16); + } + + return mantissa * (splitIndex !== -1 ? Math.pow(2, exponent) : 1); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/package.json new file mode 100644 index 0000000000000000000000000000000000000000..aa8f7c7339001f02c3ddb5d9bddf2c96610eb316 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/floating-point-hex-parser/package.json @@ -0,0 +1,24 @@ +{ + "name": "@webassemblyjs/floating-point-hex-parser", + "scripts": { + "build-fuzzer": "[ -f ./test/fuzzing/parse.out ] || gcc ./test/fuzzing/parse.c -o ./test/fuzzing/parse.out -lm -Wall" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "version": "1.13.2", + "description": "A function to parse floating point hexadecimal strings as defined by the WebAssembly specification", + "main": "lib/index.js", + "module": "esm/index.js", + "keywords": [ + "webassembly", + "floating-point" + ], + "author": "Mauro Bringolf", + "license": "MIT", + "gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1839e11bc502e9379f9258975468494f770dd16b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/esm/index.js @@ -0,0 +1,63 @@ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } + +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +export var RuntimeError = /*#__PURE__*/function (_Error) { + _inherits(RuntimeError, _Error); + + var _super = _createSuper(RuntimeError); + + function RuntimeError() { + _classCallCheck(this, RuntimeError); + + return _super.apply(this, arguments); + } + + return RuntimeError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); +export var CompileError = /*#__PURE__*/function (_Error2) { + _inherits(CompileError, _Error2); + + var _super2 = _createSuper(CompileError); + + function CompileError() { + _classCallCheck(this, CompileError); + + return _super2.apply(this, arguments); + } + + return CompileError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); +export var LinkError = /*#__PURE__*/function (_Error3) { + _inherits(LinkError, _Error3); + + var _super3 = _createSuper(LinkError); + + function LinkError() { + _classCallCheck(this, LinkError); + + return _super3.apply(this, arguments); + } + + return LinkError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..759482ded6d5b55910bb65deffa3d28429648ef5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/lib/index.js @@ -0,0 +1,78 @@ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.LinkError = exports.CompileError = exports.RuntimeError = void 0; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } + +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var RuntimeError = /*#__PURE__*/function (_Error) { + _inherits(RuntimeError, _Error); + + var _super = _createSuper(RuntimeError); + + function RuntimeError() { + _classCallCheck(this, RuntimeError); + + return _super.apply(this, arguments); + } + + return RuntimeError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); + +exports.RuntimeError = RuntimeError; + +var CompileError = /*#__PURE__*/function (_Error2) { + _inherits(CompileError, _Error2); + + var _super2 = _createSuper(CompileError); + + function CompileError() { + _classCallCheck(this, CompileError); + + return _super2.apply(this, arguments); + } + + return CompileError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); + +exports.CompileError = CompileError; + +var LinkError = /*#__PURE__*/function (_Error3) { + _inherits(LinkError, _Error3); + + var _super3 = _createSuper(LinkError); + + function LinkError() { + _classCallCheck(this, LinkError); + + return _super3.apply(this, arguments); + } + + return LinkError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); + +exports.LinkError = LinkError; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/package.json new file mode 100644 index 0000000000000000000000000000000000000000..14bfeae4ccd036c87e4b3bfbdb815ce67be3032b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-api-error/package.json @@ -0,0 +1,18 @@ +{ + "name": "@webassemblyjs/helper-api-error", + "version": "1.13.2", + "description": "Common API errors", + "main": "lib/index.js", + "module": "esm/index.js", + "author": "Sven Sauleau", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git", + "directory": "packages/helper-api-error" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/esm/compare.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/esm/compare.js new file mode 100644 index 0000000000000000000000000000000000000000..8cea6b3e07e411685d62bd5569adf1c09fc59d88 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/esm/compare.js @@ -0,0 +1,65 @@ +// this are dev dependencies +var diff = require("jest-diff"); + +var _require = require("jest-diff/build/constants"), + NO_DIFF_MESSAGE = _require.NO_DIFF_MESSAGE; + +var _require2 = require("@webassemblyjs/wasm-parser"), + decode = _require2.decode; + +var oldConsoleLog = console.log; +export function compareArrayBuffers(l, r) { + /** + * Decode left + */ + var bufferL = ""; + + console.log = function () { + for (var _len = arguments.length, texts = new Array(_len), _key = 0; _key < _len; _key++) { + texts[_key] = arguments[_key]; + } + + return bufferL += texts.join("") + "\n"; + }; + + try { + decode(l, { + dump: true + }); + } catch (e) { + console.error(bufferL); + console.error(e); + throw e; + } + /** + * Decode right + */ + + + var bufferR = ""; + + console.log = function () { + for (var _len2 = arguments.length, texts = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + texts[_key2] = arguments[_key2]; + } + + return bufferR += texts.join("") + "\n"; + }; + + try { + decode(r, { + dump: true + }); + } catch (e) { + console.error(bufferR); + console.error(e); + throw e; + } + + console.log = oldConsoleLog; + var out = diff(bufferL, bufferR); + + if (out !== null && out !== NO_DIFF_MESSAGE) { + throw new Error("\n" + out); + } +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..9ade8d5775ffda844af7566a21ffebbe708603fe --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/esm/index.js @@ -0,0 +1,78 @@ +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function concatUint8Arrays() { + for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) { + arrays[_key] = arguments[_key]; + } + + var totalLength = arrays.reduce(function (a, b) { + return a + b.length; + }, 0); + var result = new Uint8Array(totalLength); + var offset = 0; + + for (var _i = 0, _arrays = arrays; _i < _arrays.length; _i++) { + var arr = _arrays[_i]; + + if (arr instanceof Uint8Array === false) { + throw new Error("arr must be of type Uint8Array"); + } + + result.set(arr, offset); + offset += arr.length; + } + + return result; +} + +export function overrideBytesInBuffer(buffer, startLoc, endLoc, newBytes) { + var beforeBytes = buffer.slice(0, startLoc); + var afterBytes = buffer.slice(endLoc, buffer.length); // replacement is empty, we can omit it + + if (newBytes.length === 0) { + return concatUint8Arrays(beforeBytes, afterBytes); + } + + var replacement = Uint8Array.from(newBytes); + return concatUint8Arrays(beforeBytes, replacement, afterBytes); +} +export function makeBuffer() { + for (var _len2 = arguments.length, splitedBytes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + splitedBytes[_key2] = arguments[_key2]; + } + + // $FlowIgnore + var bytes = [].concat.apply([], splitedBytes); + return new Uint8Array(bytes).buffer; +} +export function fromHexdump(str) { + var lines = str.split("\n"); // remove any leading left whitespace + + lines = lines.map(function (line) { + return line.trim(); + }); + var bytes = lines.reduce(function (acc, line) { + var cols = line.split(" "); // remove the offset, left column + + cols.shift(); + cols = cols.filter(function (x) { + return x !== ""; + }); + var bytes = cols.map(function (x) { + return parseInt(x, 16); + }); + acc.push.apply(acc, _toConsumableArray(bytes)); + return acc; + }, []); + return new Uint8Array(bytes); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/lib/compare.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/lib/compare.js new file mode 100644 index 0000000000000000000000000000000000000000..b30dc071b496a6822d037ae1c7ab3d3106bb2215 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/lib/compare.js @@ -0,0 +1,73 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.compareArrayBuffers = compareArrayBuffers; + +// this are dev dependencies +var diff = require("jest-diff"); + +var _require = require("jest-diff/build/constants"), + NO_DIFF_MESSAGE = _require.NO_DIFF_MESSAGE; + +var _require2 = require("@webassemblyjs/wasm-parser"), + decode = _require2.decode; + +var oldConsoleLog = console.log; + +function compareArrayBuffers(l, r) { + /** + * Decode left + */ + var bufferL = ""; + + console.log = function () { + for (var _len = arguments.length, texts = new Array(_len), _key = 0; _key < _len; _key++) { + texts[_key] = arguments[_key]; + } + + return bufferL += texts.join("") + "\n"; + }; + + try { + decode(l, { + dump: true + }); + } catch (e) { + console.error(bufferL); + console.error(e); + throw e; + } + /** + * Decode right + */ + + + var bufferR = ""; + + console.log = function () { + for (var _len2 = arguments.length, texts = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + texts[_key2] = arguments[_key2]; + } + + return bufferR += texts.join("") + "\n"; + }; + + try { + decode(r, { + dump: true + }); + } catch (e) { + console.error(bufferR); + console.error(e); + throw e; + } + + console.log = oldConsoleLog; + var out = diff(bufferL, bufferR); + + if (out !== null && out !== NO_DIFF_MESSAGE) { + throw new Error("\n" + out); + } +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..022907c7c52d604c886bc8387d5dbb0fcba62292 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/lib/index.js @@ -0,0 +1,89 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.overrideBytesInBuffer = overrideBytesInBuffer; +exports.makeBuffer = makeBuffer; +exports.fromHexdump = fromHexdump; + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function concatUint8Arrays() { + for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) { + arrays[_key] = arguments[_key]; + } + + var totalLength = arrays.reduce(function (a, b) { + return a + b.length; + }, 0); + var result = new Uint8Array(totalLength); + var offset = 0; + + for (var _i = 0, _arrays = arrays; _i < _arrays.length; _i++) { + var arr = _arrays[_i]; + + if (arr instanceof Uint8Array === false) { + throw new Error("arr must be of type Uint8Array"); + } + + result.set(arr, offset); + offset += arr.length; + } + + return result; +} + +function overrideBytesInBuffer(buffer, startLoc, endLoc, newBytes) { + var beforeBytes = buffer.slice(0, startLoc); + var afterBytes = buffer.slice(endLoc, buffer.length); // replacement is empty, we can omit it + + if (newBytes.length === 0) { + return concatUint8Arrays(beforeBytes, afterBytes); + } + + var replacement = Uint8Array.from(newBytes); + return concatUint8Arrays(beforeBytes, replacement, afterBytes); +} + +function makeBuffer() { + for (var _len2 = arguments.length, splitedBytes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + splitedBytes[_key2] = arguments[_key2]; + } + + // $FlowIgnore + var bytes = [].concat.apply([], splitedBytes); + return new Uint8Array(bytes).buffer; +} + +function fromHexdump(str) { + var lines = str.split("\n"); // remove any leading left whitespace + + lines = lines.map(function (line) { + return line.trim(); + }); + var bytes = lines.reduce(function (acc, line) { + var cols = line.split(" "); // remove the offset, left column + + cols.shift(); + cols = cols.filter(function (x) { + return x !== ""; + }); + var bytes = cols.map(function (x) { + return parseInt(x, 16); + }); + acc.push.apply(acc, _toConsumableArray(bytes)); + return acc; + }, []); + return new Uint8Array(bytes); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e56d004da61ec3f85917543143d5f53fef4328c9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-buffer/package.json @@ -0,0 +1,24 @@ +{ + "name": "@webassemblyjs/helper-buffer", + "version": "1.14.1", + "description": "Buffer manipulation utility", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "author": "Sven Sauleau", + "license": "MIT", + "devDependencies": { + "@webassemblyjs/wasm-parser": "1.14.1", + "jest-diff": "^24.0.0" + }, + "gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8b33bd35aa89540be269fe32229f8583396a10bb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/esm/index.js @@ -0,0 +1,92 @@ +import Long from "@xtuc/long"; +import parseHexFloat from "@webassemblyjs/floating-point-hex-parser"; +import { CompileError } from "@webassemblyjs/helper-api-error"; +export function parse32F(sourceString) { + if (isHexLiteral(sourceString)) { + return parseHexFloat(sourceString); + } + + if (isInfLiteral(sourceString)) { + return sourceString[0] === "-" ? -1 : 1; + } + + if (isNanLiteral(sourceString)) { + return (sourceString[0] === "-" ? -1 : 1) * (sourceString.includes(":") ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) : 0x400000); + } + + return parseFloat(sourceString); +} +export function parse64F(sourceString) { + if (isHexLiteral(sourceString)) { + return parseHexFloat(sourceString); + } + + if (isInfLiteral(sourceString)) { + return sourceString[0] === "-" ? -1 : 1; + } + + if (isNanLiteral(sourceString)) { + return (sourceString[0] === "-" ? -1 : 1) * (sourceString.includes(":") ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) : 0x8000000000000); + } + + if (isHexLiteral(sourceString)) { + return parseHexFloat(sourceString); + } + + return parseFloat(sourceString); +} +export function parse32I(sourceString) { + var value = 0; + + if (isHexLiteral(sourceString)) { + value = ~~parseInt(sourceString, 16); + } else if (isDecimalExponentLiteral(sourceString)) { + throw new Error("This number literal format is yet to be implemented."); + } else { + value = parseInt(sourceString, 10); + } + + return value; +} +export function parseU32(sourceString) { + var value = parse32I(sourceString); + + if (value < 0) { + throw new CompileError("Illegal value for u32: " + sourceString); + } + + return value; +} +export function parse64I(sourceString) { + // $FlowIgnore + var _long; + + if (isHexLiteral(sourceString)) { + _long = Long.fromString(sourceString, false, 16); + } else if (isDecimalExponentLiteral(sourceString)) { + throw new Error("This number literal format is yet to be implemented."); + } else { + _long = Long.fromString(sourceString); + } + + return { + high: _long.high, + low: _long.low + }; +} +var NAN_WORD = /^\+?-?nan/; +var INF_WORD = /^\+?-?inf/; +export function isInfLiteral(sourceString) { + return INF_WORD.test(sourceString.toLowerCase()); +} +export function isNanLiteral(sourceString) { + return NAN_WORD.test(sourceString.toLowerCase()); +} + +function isDecimalExponentLiteral(sourceString) { + return !isHexLiteral(sourceString) && sourceString.toUpperCase().includes("E"); +} + +function isHexLiteral(sourceString) { + return sourceString.substring(0, 2).toUpperCase() === "0X" || sourceString.substring(0, 3).toUpperCase() === "-0X"; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..76604047b33cdeee8dc9283537335e4c0b393567 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/lib/index.js @@ -0,0 +1,117 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.parse32F = parse32F; +exports.parse64F = parse64F; +exports.parse32I = parse32I; +exports.parseU32 = parseU32; +exports.parse64I = parse64I; +exports.isInfLiteral = isInfLiteral; +exports.isNanLiteral = isNanLiteral; + +var _long2 = _interopRequireDefault(require("@xtuc/long")); + +var _floatingPointHexParser = _interopRequireDefault(require("@webassemblyjs/floating-point-hex-parser")); + +var _helperApiError = require("@webassemblyjs/helper-api-error"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function parse32F(sourceString) { + if (isHexLiteral(sourceString)) { + return (0, _floatingPointHexParser["default"])(sourceString); + } + + if (isInfLiteral(sourceString)) { + return sourceString[0] === "-" ? -1 : 1; + } + + if (isNanLiteral(sourceString)) { + return (sourceString[0] === "-" ? -1 : 1) * (sourceString.includes(":") ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) : 0x400000); + } + + return parseFloat(sourceString); +} + +function parse64F(sourceString) { + if (isHexLiteral(sourceString)) { + return (0, _floatingPointHexParser["default"])(sourceString); + } + + if (isInfLiteral(sourceString)) { + return sourceString[0] === "-" ? -1 : 1; + } + + if (isNanLiteral(sourceString)) { + return (sourceString[0] === "-" ? -1 : 1) * (sourceString.includes(":") ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) : 0x8000000000000); + } + + if (isHexLiteral(sourceString)) { + return (0, _floatingPointHexParser["default"])(sourceString); + } + + return parseFloat(sourceString); +} + +function parse32I(sourceString) { + var value = 0; + + if (isHexLiteral(sourceString)) { + value = ~~parseInt(sourceString, 16); + } else if (isDecimalExponentLiteral(sourceString)) { + throw new Error("This number literal format is yet to be implemented."); + } else { + value = parseInt(sourceString, 10); + } + + return value; +} + +function parseU32(sourceString) { + var value = parse32I(sourceString); + + if (value < 0) { + throw new _helperApiError.CompileError("Illegal value for u32: " + sourceString); + } + + return value; +} + +function parse64I(sourceString) { + // $FlowIgnore + var _long; + + if (isHexLiteral(sourceString)) { + _long = _long2["default"].fromString(sourceString, false, 16); + } else if (isDecimalExponentLiteral(sourceString)) { + throw new Error("This number literal format is yet to be implemented."); + } else { + _long = _long2["default"].fromString(sourceString); + } + + return { + high: _long.high, + low: _long.low + }; +} + +var NAN_WORD = /^\+?-?nan/; +var INF_WORD = /^\+?-?inf/; + +function isInfLiteral(sourceString) { + return INF_WORD.test(sourceString.toLowerCase()); +} + +function isNanLiteral(sourceString) { + return NAN_WORD.test(sourceString.toLowerCase()); +} + +function isDecimalExponentLiteral(sourceString) { + return !isHexLiteral(sourceString) && sourceString.toUpperCase().includes("E"); +} + +function isHexLiteral(sourceString) { + return sourceString.substring(0, 2).toUpperCase() === "0X" || sourceString.substring(0, 3).toUpperCase() === "-0X"; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ae2d348e16f8063fdb3e1f5cfaab2ebb827c228a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/package.json @@ -0,0 +1,25 @@ +{ + "name": "@webassemblyjs/helper-numbers", + "version": "1.13.2", + "description": "Number parsing utility", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", + "@xtuc/long": "4.2.2" + }, + "author": "Sven Sauleau", + "license": "MIT", + "gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/src/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..773402e4d3fa642f8f7a2a76f18183b061f1c4af --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-numbers/src/index.js @@ -0,0 +1,106 @@ +// @flow + +import Long from "@xtuc/long"; +import parseHexFloat from "@webassemblyjs/floating-point-hex-parser"; +import { CompileError } from "@webassemblyjs/helper-api-error"; + +export function parse32F(sourceString: string): number { + if (isHexLiteral(sourceString)) { + return parseHexFloat(sourceString); + } + if (isInfLiteral(sourceString)) { + return sourceString[0] === "-" ? -1 : 1; + } + if (isNanLiteral(sourceString)) { + return ( + (sourceString[0] === "-" ? -1 : 1) * + (sourceString.includes(":") + ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) + : 0x400000) + ); + } + return parseFloat(sourceString); +} + +export function parse64F(sourceString: string): number { + if (isHexLiteral(sourceString)) { + return parseHexFloat(sourceString); + } + if (isInfLiteral(sourceString)) { + return sourceString[0] === "-" ? -1 : 1; + } + if (isNanLiteral(sourceString)) { + return ( + (sourceString[0] === "-" ? -1 : 1) * + (sourceString.includes(":") + ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) + : 0x8000000000000) + ); + } + if (isHexLiteral(sourceString)) { + return parseHexFloat(sourceString); + } + return parseFloat(sourceString); +} + +export function parse32I(sourceString: string): number { + let value = 0; + if (isHexLiteral(sourceString)) { + value = ~~parseInt(sourceString, 16); + } else if (isDecimalExponentLiteral(sourceString)) { + throw new Error("This number literal format is yet to be implemented."); + } else { + value = parseInt(sourceString, 10); + } + + return value; +} + +export function parseU32(sourceString: string): number { + const value = parse32I(sourceString); + if (value < 0) { + throw new CompileError("Illegal value for u32: " + sourceString); + } + return value; +} + +export function parse64I(sourceString: string): LongNumber { + // $FlowIgnore + let long: Long; + if (isHexLiteral(sourceString)) { + long = Long.fromString(sourceString, false, 16); + } else if (isDecimalExponentLiteral(sourceString)) { + throw new Error("This number literal format is yet to be implemented."); + } else { + long = Long.fromString(sourceString); + } + + return { + high: long.high, + low: long.low, + }; +} + +const NAN_WORD = /^\+?-?nan/; +const INF_WORD = /^\+?-?inf/; + +export function isInfLiteral(sourceString: string): boolean { + return INF_WORD.test(sourceString.toLowerCase()); +} + +export function isNanLiteral(sourceString: string): boolean { + return NAN_WORD.test(sourceString.toLowerCase()); +} + +function isDecimalExponentLiteral(sourceString: string): boolean { + return ( + !isHexLiteral(sourceString) && sourceString.toUpperCase().includes("E") + ); +} + +function isHexLiteral(sourceString: string): boolean { + return ( + sourceString.substring(0, 2).toUpperCase() === "0X" || + sourceString.substring(0, 3).toUpperCase() === "-0X" + ); +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1dc03cb5bb33ebe2982f59a5a412864bbbc2c4f0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/esm/index.js @@ -0,0 +1,415 @@ +var illegalop = "illegal"; +var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d]; +var moduleVersion = [0x01, 0x00, 0x00, 0x00]; + +function invertMap(obj) { + var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) { + return k; + }; + var result = {}; + var keys = Object.keys(obj); + + for (var i = 0, length = keys.length; i < length; i++) { + result[keyModifierFn(obj[keys[i]])] = keys[i]; + } + + return result; +} + +function createSymbolObject(name +/*: string */ +, object +/*: string */ +) +/*: Symbol*/ +{ + var numberOfArgs + /*: number*/ + = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + return { + name: name, + object: object, + numberOfArgs: numberOfArgs + }; +} + +function createSymbol(name +/*: string */ +) +/*: Symbol*/ +{ + var numberOfArgs + /*: number*/ + = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + return { + name: name, + numberOfArgs: numberOfArgs + }; +} + +var types = { + func: 0x60, + result: 0x40 +}; +var exportTypes = { + 0x00: "Func", + 0x01: "Table", + 0x02: "Memory", + 0x03: "Global" +}; +var exportTypesByName = invertMap(exportTypes); +var valtypes = { + // numtype + 0x7f: "i32", + 0x7e: "i64", + 0x7d: "f32", + 0x7c: "f64", + // vectype + 0x7b: "v128", + // reftype + 0x70: "anyfunc", + 0x6f: "externref" +}; +var valtypesByString = invertMap(valtypes); +var tableTypes = { + 0x70: "anyfunc", + 0x6f: "externref" +}; +var blockTypes = Object.assign({}, valtypes, { + // https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype + 0x40: null, + // https://webassembly.github.io/spec/core/binary/types.html#binary-valtype + 0x7f: "i32", + 0x7e: "i64", + 0x7d: "f32", + 0x7c: "f64" +}); +var globalTypes = { + 0x00: "const", + 0x01: "var" +}; +var globalTypesByString = invertMap(globalTypes); +var importTypes = { + 0x00: "func", + 0x01: "table", + 0x02: "memory", + 0x03: "global" +}; +var sections = { + custom: 0, + type: 1, + "import": 2, + func: 3, + table: 4, + memory: 5, + global: 6, + "export": 7, + start: 8, + element: 9, + code: 10, + data: 11 +}; +var symbolsByByte = { + 0x00: createSymbol("unreachable"), + 0x01: createSymbol("nop"), + 0x02: createSymbol("block"), + 0x03: createSymbol("loop"), + 0x04: createSymbol("if"), + 0x05: createSymbol("else"), + 0x06: illegalop, + 0x07: illegalop, + 0x08: illegalop, + 0x09: illegalop, + 0x0a: illegalop, + 0x0b: createSymbol("end"), + 0x0c: createSymbol("br", 1), + 0x0d: createSymbol("br_if", 1), + 0x0e: createSymbol("br_table"), + 0x0f: createSymbol("return"), + 0x10: createSymbol("call", 1), + 0x11: createSymbol("call_indirect", 2), + 0x12: illegalop, + 0x13: illegalop, + 0x14: illegalop, + 0x15: illegalop, + 0x16: illegalop, + 0x17: illegalop, + 0x18: illegalop, + 0x19: illegalop, + 0x1a: createSymbol("drop"), + 0x1b: createSymbol("select"), + 0x1c: illegalop, + 0x1d: illegalop, + 0x1e: illegalop, + 0x1f: illegalop, + 0x20: createSymbol("get_local", 1), + 0x21: createSymbol("set_local", 1), + 0x22: createSymbol("tee_local", 1), + 0x23: createSymbol("get_global", 1), + 0x24: createSymbol("set_global", 1), + 0x25: createSymbol("table.get", 1), + 0x26: createSymbol("table.set", 1), + 0x27: illegalop, + 0x28: createSymbolObject("load", "u32", 1), + 0x29: createSymbolObject("load", "u64", 1), + 0x2a: createSymbolObject("load", "f32", 1), + 0x2b: createSymbolObject("load", "f64", 1), + 0x2c: createSymbolObject("load8_s", "u32", 1), + 0x2d: createSymbolObject("load8_u", "u32", 1), + 0x2e: createSymbolObject("load16_s", "u32", 1), + 0x2f: createSymbolObject("load16_u", "u32", 1), + 0x30: createSymbolObject("load8_s", "u64", 1), + 0x31: createSymbolObject("load8_u", "u64", 1), + 0x32: createSymbolObject("load16_s", "u64", 1), + 0x33: createSymbolObject("load16_u", "u64", 1), + 0x34: createSymbolObject("load32_s", "u64", 1), + 0x35: createSymbolObject("load32_u", "u64", 1), + 0x36: createSymbolObject("store", "u32", 1), + 0x37: createSymbolObject("store", "u64", 1), + 0x38: createSymbolObject("store", "f32", 1), + 0x39: createSymbolObject("store", "f64", 1), + 0x3a: createSymbolObject("store8", "u32", 1), + 0x3b: createSymbolObject("store16", "u32", 1), + 0x3c: createSymbolObject("store8", "u64", 1), + 0x3d: createSymbolObject("store16", "u64", 1), + 0x3e: createSymbolObject("store32", "u64", 1), + 0x3f: createSymbolObject("current_memory"), + 0x40: createSymbolObject("grow_memory"), + 0x41: createSymbolObject("const", "i32", 1), + 0x42: createSymbolObject("const", "i64", 1), + 0x43: createSymbolObject("const", "f32", 1), + 0x44: createSymbolObject("const", "f64", 1), + 0x45: createSymbolObject("eqz", "i32"), + 0x46: createSymbolObject("eq", "i32"), + 0x47: createSymbolObject("ne", "i32"), + 0x48: createSymbolObject("lt_s", "i32"), + 0x49: createSymbolObject("lt_u", "i32"), + 0x4a: createSymbolObject("gt_s", "i32"), + 0x4b: createSymbolObject("gt_u", "i32"), + 0x4c: createSymbolObject("le_s", "i32"), + 0x4d: createSymbolObject("le_u", "i32"), + 0x4e: createSymbolObject("ge_s", "i32"), + 0x4f: createSymbolObject("ge_u", "i32"), + 0x50: createSymbolObject("eqz", "i64"), + 0x51: createSymbolObject("eq", "i64"), + 0x52: createSymbolObject("ne", "i64"), + 0x53: createSymbolObject("lt_s", "i64"), + 0x54: createSymbolObject("lt_u", "i64"), + 0x55: createSymbolObject("gt_s", "i64"), + 0x56: createSymbolObject("gt_u", "i64"), + 0x57: createSymbolObject("le_s", "i64"), + 0x58: createSymbolObject("le_u", "i64"), + 0x59: createSymbolObject("ge_s", "i64"), + 0x5a: createSymbolObject("ge_u", "i64"), + 0x5b: createSymbolObject("eq", "f32"), + 0x5c: createSymbolObject("ne", "f32"), + 0x5d: createSymbolObject("lt", "f32"), + 0x5e: createSymbolObject("gt", "f32"), + 0x5f: createSymbolObject("le", "f32"), + 0x60: createSymbolObject("ge", "f32"), + 0x61: createSymbolObject("eq", "f64"), + 0x62: createSymbolObject("ne", "f64"), + 0x63: createSymbolObject("lt", "f64"), + 0x64: createSymbolObject("gt", "f64"), + 0x65: createSymbolObject("le", "f64"), + 0x66: createSymbolObject("ge", "f64"), + 0x67: createSymbolObject("clz", "i32"), + 0x68: createSymbolObject("ctz", "i32"), + 0x69: createSymbolObject("popcnt", "i32"), + 0x6a: createSymbolObject("add", "i32"), + 0x6b: createSymbolObject("sub", "i32"), + 0x6c: createSymbolObject("mul", "i32"), + 0x6d: createSymbolObject("div_s", "i32"), + 0x6e: createSymbolObject("div_u", "i32"), + 0x6f: createSymbolObject("rem_s", "i32"), + 0x70: createSymbolObject("rem_u", "i32"), + 0x71: createSymbolObject("and", "i32"), + 0x72: createSymbolObject("or", "i32"), + 0x73: createSymbolObject("xor", "i32"), + 0x74: createSymbolObject("shl", "i32"), + 0x75: createSymbolObject("shr_s", "i32"), + 0x76: createSymbolObject("shr_u", "i32"), + 0x77: createSymbolObject("rotl", "i32"), + 0x78: createSymbolObject("rotr", "i32"), + 0x79: createSymbolObject("clz", "i64"), + 0x7a: createSymbolObject("ctz", "i64"), + 0x7b: createSymbolObject("popcnt", "i64"), + 0x7c: createSymbolObject("add", "i64"), + 0x7d: createSymbolObject("sub", "i64"), + 0x7e: createSymbolObject("mul", "i64"), + 0x7f: createSymbolObject("div_s", "i64"), + 0x80: createSymbolObject("div_u", "i64"), + 0x81: createSymbolObject("rem_s", "i64"), + 0x82: createSymbolObject("rem_u", "i64"), + 0x83: createSymbolObject("and", "i64"), + 0x84: createSymbolObject("or", "i64"), + 0x85: createSymbolObject("xor", "i64"), + 0x86: createSymbolObject("shl", "i64"), + 0x87: createSymbolObject("shr_s", "i64"), + 0x88: createSymbolObject("shr_u", "i64"), + 0x89: createSymbolObject("rotl", "i64"), + 0x8a: createSymbolObject("rotr", "i64"), + 0x8b: createSymbolObject("abs", "f32"), + 0x8c: createSymbolObject("neg", "f32"), + 0x8d: createSymbolObject("ceil", "f32"), + 0x8e: createSymbolObject("floor", "f32"), + 0x8f: createSymbolObject("trunc", "f32"), + 0x90: createSymbolObject("nearest", "f32"), + 0x91: createSymbolObject("sqrt", "f32"), + 0x92: createSymbolObject("add", "f32"), + 0x93: createSymbolObject("sub", "f32"), + 0x94: createSymbolObject("mul", "f32"), + 0x95: createSymbolObject("div", "f32"), + 0x96: createSymbolObject("min", "f32"), + 0x97: createSymbolObject("max", "f32"), + 0x98: createSymbolObject("copysign", "f32"), + 0x99: createSymbolObject("abs", "f64"), + 0x9a: createSymbolObject("neg", "f64"), + 0x9b: createSymbolObject("ceil", "f64"), + 0x9c: createSymbolObject("floor", "f64"), + 0x9d: createSymbolObject("trunc", "f64"), + 0x9e: createSymbolObject("nearest", "f64"), + 0x9f: createSymbolObject("sqrt", "f64"), + 0xa0: createSymbolObject("add", "f64"), + 0xa1: createSymbolObject("sub", "f64"), + 0xa2: createSymbolObject("mul", "f64"), + 0xa3: createSymbolObject("div", "f64"), + 0xa4: createSymbolObject("min", "f64"), + 0xa5: createSymbolObject("max", "f64"), + 0xa6: createSymbolObject("copysign", "f64"), + 0xa7: createSymbolObject("wrap/i64", "i32"), + 0xa8: createSymbolObject("trunc_s/f32", "i32"), + 0xa9: createSymbolObject("trunc_u/f32", "i32"), + 0xaa: createSymbolObject("trunc_s/f64", "i32"), + 0xab: createSymbolObject("trunc_u/f64", "i32"), + 0xac: createSymbolObject("extend_s/i32", "i64"), + 0xad: createSymbolObject("extend_u/i32", "i64"), + 0xae: createSymbolObject("trunc_s/f32", "i64"), + 0xaf: createSymbolObject("trunc_u/f32", "i64"), + 0xb0: createSymbolObject("trunc_s/f64", "i64"), + 0xb1: createSymbolObject("trunc_u/f64", "i64"), + 0xb2: createSymbolObject("convert_s/i32", "f32"), + 0xb3: createSymbolObject("convert_u/i32", "f32"), + 0xb4: createSymbolObject("convert_s/i64", "f32"), + 0xb5: createSymbolObject("convert_u/i64", "f32"), + 0xb6: createSymbolObject("demote/f64", "f32"), + 0xb7: createSymbolObject("convert_s/i32", "f64"), + 0xb8: createSymbolObject("convert_u/i32", "f64"), + 0xb9: createSymbolObject("convert_s/i64", "f64"), + 0xba: createSymbolObject("convert_u/i64", "f64"), + 0xbb: createSymbolObject("promote/f32", "f64"), + 0xbc: createSymbolObject("reinterpret/f32", "i32"), + 0xbd: createSymbolObject("reinterpret/f64", "i64"), + 0xbe: createSymbolObject("reinterpret/i32", "f32"), + 0xbf: createSymbolObject("reinterpret/i64", "f64"), + 0xc0: createSymbolObject("extend8_s", "i32"), + 0xc1: createSymbolObject("extend16_s", "i32"), + 0xc2: createSymbolObject("extend8_s", "i64"), + 0xc3: createSymbolObject("extend16_s", "i64"), + 0xc4: createSymbolObject("extend32_s", "i64"), + 0xd0: createSymbol("ref.null"), + 0xd1: createSymbol("ref.is_null"), + 0xd2: createSymbol("ref.func", 1), + 0xfc0a: createSymbol("memory.copy"), + 0xfc0b: createSymbol("memory.fill"), + // Table instructions + // https://webassembly.github.io/spec/core/binary/instructions.html#table-instructions + 0xfc0c: createSymbol("table.init", 2), + 0xfc0d: createSymbol("elem.drop", 1), + 0xfc0e: createSymbol("table.copy", 2), + 0xfc0f: createSymbol("table.grow", 1), + 0xfc10: createSymbol("table.size", 1), + 0xfc11: createSymbol("table.fill", 1), + // Atomic Memory Instructions + 0xfe00: createSymbol("memory.atomic.notify", 1), + 0xfe01: createSymbol("memory.atomic.wait32", 1), + 0xfe02: createSymbol("memory.atomic.wait64", 1), + 0xfe10: createSymbolObject("atomic.load", "i32", 1), + 0xfe11: createSymbolObject("atomic.load", "i64", 1), + 0xfe12: createSymbolObject("atomic.load8_u", "i32", 1), + 0xfe13: createSymbolObject("atomic.load16_u", "i32", 1), + 0xfe14: createSymbolObject("atomic.load8_u", "i64", 1), + 0xfe15: createSymbolObject("atomic.load16_u", "i64", 1), + 0xfe16: createSymbolObject("atomic.load32_u", "i64", 1), + 0xfe17: createSymbolObject("atomic.store", "i32", 1), + 0xfe18: createSymbolObject("atomic.store", "i64", 1), + 0xfe19: createSymbolObject("atomic.store8_u", "i32", 1), + 0xfe1a: createSymbolObject("atomic.store16_u", "i32", 1), + 0xfe1b: createSymbolObject("atomic.store8_u", "i64", 1), + 0xfe1c: createSymbolObject("atomic.store16_u", "i64", 1), + 0xfe1d: createSymbolObject("atomic.store32_u", "i64", 1), + 0xfe1e: createSymbolObject("atomic.rmw.add", "i32", 1), + 0xfe1f: createSymbolObject("atomic.rmw.add", "i64", 1), + 0xfe20: createSymbolObject("atomic.rmw8_u.add_u", "i32", 1), + 0xfe21: createSymbolObject("atomic.rmw16_u.add_u", "i32", 1), + 0xfe22: createSymbolObject("atomic.rmw8_u.add_u", "i64", 1), + 0xfe23: createSymbolObject("atomic.rmw16_u.add_u", "i64", 1), + 0xfe24: createSymbolObject("atomic.rmw32_u.add_u", "i64", 1), + 0xfe25: createSymbolObject("atomic.rmw.sub", "i32", 1), + 0xfe26: createSymbolObject("atomic.rmw.sub", "i64", 1), + 0xfe27: createSymbolObject("atomic.rmw8_u.sub_u", "i32", 1), + 0xfe28: createSymbolObject("atomic.rmw16_u.sub_u", "i32", 1), + 0xfe29: createSymbolObject("atomic.rmw8_u.sub_u", "i64", 1), + 0xfe2a: createSymbolObject("atomic.rmw16_u.sub_u", "i64", 1), + 0xfe2b: createSymbolObject("atomic.rmw32_u.sub_u", "i64", 1), + 0xfe2c: createSymbolObject("atomic.rmw.and", "i32", 1), + 0xfe2d: createSymbolObject("atomic.rmw.and", "i64", 1), + 0xfe2e: createSymbolObject("atomic.rmw8_u.and_u", "i32", 1), + 0xfe2f: createSymbolObject("atomic.rmw16_u.and_u", "i32", 1), + 0xfe30: createSymbolObject("atomic.rmw8_u.and_u", "i64", 1), + 0xfe31: createSymbolObject("atomic.rmw16_u.and_u", "i64", 1), + 0xfe32: createSymbolObject("atomic.rmw32_u.and_u", "i64", 1), + 0xfe33: createSymbolObject("atomic.rmw.or", "i32", 1), + 0xfe34: createSymbolObject("atomic.rmw.or", "i64", 1), + 0xfe35: createSymbolObject("atomic.rmw8_u.or_u", "i32", 1), + 0xfe36: createSymbolObject("atomic.rmw16_u.or_u", "i32", 1), + 0xfe37: createSymbolObject("atomic.rmw8_u.or_u", "i64", 1), + 0xfe38: createSymbolObject("atomic.rmw16_u.or_u", "i64", 1), + 0xfe39: createSymbolObject("atomic.rmw32_u.or_u", "i64", 1), + 0xfe3a: createSymbolObject("atomic.rmw.xor", "i32", 1), + 0xfe3b: createSymbolObject("atomic.rmw.xor", "i64", 1), + 0xfe3c: createSymbolObject("atomic.rmw8_u.xor_u", "i32", 1), + 0xfe3d: createSymbolObject("atomic.rmw16_u.xor_u", "i32", 1), + 0xfe3e: createSymbolObject("atomic.rmw8_u.xor_u", "i64", 1), + 0xfe3f: createSymbolObject("atomic.rmw16_u.xor_u", "i64", 1), + 0xfe40: createSymbolObject("atomic.rmw32_u.xor_u", "i64", 1), + 0xfe41: createSymbolObject("atomic.rmw.xchg", "i32", 1), + 0xfe42: createSymbolObject("atomic.rmw.xchg", "i64", 1), + 0xfe43: createSymbolObject("atomic.rmw8_u.xchg_u", "i32", 1), + 0xfe44: createSymbolObject("atomic.rmw16_u.xchg_u", "i32", 1), + 0xfe45: createSymbolObject("atomic.rmw8_u.xchg_u", "i64", 1), + 0xfe46: createSymbolObject("atomic.rmw16_u.xchg_u", "i64", 1), + 0xfe47: createSymbolObject("atomic.rmw32_u.xchg_u", "i64", 1), + 0xfe48: createSymbolObject("atomic.rmw.cmpxchg", "i32", 1), + 0xfe49: createSymbolObject("atomic.rmw.cmpxchg", "i64", 1), + 0xfe4a: createSymbolObject("atomic.rmw8_u.cmpxchg_u", "i32", 1), + 0xfe4b: createSymbolObject("atomic.rmw16_u.cmpxchg_u", "i32", 1), + 0xfe4c: createSymbolObject("atomic.rmw8_u.cmpxchg_u", "i64", 1), + 0xfe4d: createSymbolObject("atomic.rmw16_u.cmpxchg_u", "i64", 1), + 0xfe4e: createSymbolObject("atomic.rmw32_u.cmpxchg_u", "i64", 1) +}; +var symbolsByName = invertMap(symbolsByByte, function (obj) { + if (typeof obj.object === "string") { + return "".concat(obj.object, ".").concat(obj.name); + } + + return obj.name; +}); +export default { + symbolsByByte: symbolsByByte, + sections: sections, + magicModuleHeader: magicModuleHeader, + moduleVersion: moduleVersion, + types: types, + valtypes: valtypes, + exportTypes: exportTypes, + blockTypes: blockTypes, + tableTypes: tableTypes, + globalTypes: globalTypes, + importTypes: importTypes, + valtypesByString: valtypesByString, + globalTypesByString: globalTypesByString, + exportTypesByName: exportTypesByName, + symbolsByName: symbolsByName +}; +export { getSectionForNode } from "./section"; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/esm/section.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/esm/section.js new file mode 100644 index 0000000000000000000000000000000000000000..abdc4cf76778adcefe01fb8975489de1e7450fe1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/esm/section.js @@ -0,0 +1,31 @@ +export function getSectionForNode(n) { + switch (n.type) { + case "ModuleImport": + return "import"; + + case "CallInstruction": + case "CallIndirectInstruction": + case "Func": + case "Instr": + return "code"; + + case "ModuleExport": + return "export"; + + case "Start": + return "start"; + + case "TypeInstruction": + return "type"; + + case "IndexInFuncSection": + return "func"; + + case "Global": + return "global"; + // No section + + default: + return; + } +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7390d66de519bc3c9a8b0cadb6ff35176d54a32d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js @@ -0,0 +1,430 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getSectionForNode", { + enumerable: true, + get: function get() { + return _section.getSectionForNode; + } +}); +exports["default"] = void 0; + +var _section = require("./section"); + +var illegalop = "illegal"; +var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d]; +var moduleVersion = [0x01, 0x00, 0x00, 0x00]; + +function invertMap(obj) { + var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) { + return k; + }; + var result = {}; + var keys = Object.keys(obj); + + for (var i = 0, length = keys.length; i < length; i++) { + result[keyModifierFn(obj[keys[i]])] = keys[i]; + } + + return result; +} + +function createSymbolObject(name +/*: string */ +, object +/*: string */ +) +/*: Symbol*/ +{ + var numberOfArgs + /*: number*/ + = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + return { + name: name, + object: object, + numberOfArgs: numberOfArgs + }; +} + +function createSymbol(name +/*: string */ +) +/*: Symbol*/ +{ + var numberOfArgs + /*: number*/ + = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + return { + name: name, + numberOfArgs: numberOfArgs + }; +} + +var types = { + func: 0x60, + result: 0x40 +}; +var exportTypes = { + 0x00: "Func", + 0x01: "Table", + 0x02: "Memory", + 0x03: "Global" +}; +var exportTypesByName = invertMap(exportTypes); +var valtypes = { + // numtype + 0x7f: "i32", + 0x7e: "i64", + 0x7d: "f32", + 0x7c: "f64", + // vectype + 0x7b: "v128", + // reftype + 0x70: "anyfunc", + 0x6f: "externref" +}; +var valtypesByString = invertMap(valtypes); +var tableTypes = { + 0x70: "anyfunc", + 0x6f: "externref" +}; +var blockTypes = Object.assign({}, valtypes, { + // https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype + 0x40: null, + // https://webassembly.github.io/spec/core/binary/types.html#binary-valtype + 0x7f: "i32", + 0x7e: "i64", + 0x7d: "f32", + 0x7c: "f64" +}); +var globalTypes = { + 0x00: "const", + 0x01: "var" +}; +var globalTypesByString = invertMap(globalTypes); +var importTypes = { + 0x00: "func", + 0x01: "table", + 0x02: "memory", + 0x03: "global" +}; +var sections = { + custom: 0, + type: 1, + "import": 2, + func: 3, + table: 4, + memory: 5, + global: 6, + "export": 7, + start: 8, + element: 9, + code: 10, + data: 11 +}; +var symbolsByByte = { + 0x00: createSymbol("unreachable"), + 0x01: createSymbol("nop"), + 0x02: createSymbol("block"), + 0x03: createSymbol("loop"), + 0x04: createSymbol("if"), + 0x05: createSymbol("else"), + 0x06: illegalop, + 0x07: illegalop, + 0x08: illegalop, + 0x09: illegalop, + 0x0a: illegalop, + 0x0b: createSymbol("end"), + 0x0c: createSymbol("br", 1), + 0x0d: createSymbol("br_if", 1), + 0x0e: createSymbol("br_table"), + 0x0f: createSymbol("return"), + 0x10: createSymbol("call", 1), + 0x11: createSymbol("call_indirect", 2), + 0x12: illegalop, + 0x13: illegalop, + 0x14: illegalop, + 0x15: illegalop, + 0x16: illegalop, + 0x17: illegalop, + 0x18: illegalop, + 0x19: illegalop, + 0x1a: createSymbol("drop"), + 0x1b: createSymbol("select"), + 0x1c: illegalop, + 0x1d: illegalop, + 0x1e: illegalop, + 0x1f: illegalop, + 0x20: createSymbol("get_local", 1), + 0x21: createSymbol("set_local", 1), + 0x22: createSymbol("tee_local", 1), + 0x23: createSymbol("get_global", 1), + 0x24: createSymbol("set_global", 1), + 0x25: createSymbol("table.get", 1), + 0x26: createSymbol("table.set", 1), + 0x27: illegalop, + 0x28: createSymbolObject("load", "u32", 1), + 0x29: createSymbolObject("load", "u64", 1), + 0x2a: createSymbolObject("load", "f32", 1), + 0x2b: createSymbolObject("load", "f64", 1), + 0x2c: createSymbolObject("load8_s", "u32", 1), + 0x2d: createSymbolObject("load8_u", "u32", 1), + 0x2e: createSymbolObject("load16_s", "u32", 1), + 0x2f: createSymbolObject("load16_u", "u32", 1), + 0x30: createSymbolObject("load8_s", "u64", 1), + 0x31: createSymbolObject("load8_u", "u64", 1), + 0x32: createSymbolObject("load16_s", "u64", 1), + 0x33: createSymbolObject("load16_u", "u64", 1), + 0x34: createSymbolObject("load32_s", "u64", 1), + 0x35: createSymbolObject("load32_u", "u64", 1), + 0x36: createSymbolObject("store", "u32", 1), + 0x37: createSymbolObject("store", "u64", 1), + 0x38: createSymbolObject("store", "f32", 1), + 0x39: createSymbolObject("store", "f64", 1), + 0x3a: createSymbolObject("store8", "u32", 1), + 0x3b: createSymbolObject("store16", "u32", 1), + 0x3c: createSymbolObject("store8", "u64", 1), + 0x3d: createSymbolObject("store16", "u64", 1), + 0x3e: createSymbolObject("store32", "u64", 1), + 0x3f: createSymbolObject("current_memory"), + 0x40: createSymbolObject("grow_memory"), + 0x41: createSymbolObject("const", "i32", 1), + 0x42: createSymbolObject("const", "i64", 1), + 0x43: createSymbolObject("const", "f32", 1), + 0x44: createSymbolObject("const", "f64", 1), + 0x45: createSymbolObject("eqz", "i32"), + 0x46: createSymbolObject("eq", "i32"), + 0x47: createSymbolObject("ne", "i32"), + 0x48: createSymbolObject("lt_s", "i32"), + 0x49: createSymbolObject("lt_u", "i32"), + 0x4a: createSymbolObject("gt_s", "i32"), + 0x4b: createSymbolObject("gt_u", "i32"), + 0x4c: createSymbolObject("le_s", "i32"), + 0x4d: createSymbolObject("le_u", "i32"), + 0x4e: createSymbolObject("ge_s", "i32"), + 0x4f: createSymbolObject("ge_u", "i32"), + 0x50: createSymbolObject("eqz", "i64"), + 0x51: createSymbolObject("eq", "i64"), + 0x52: createSymbolObject("ne", "i64"), + 0x53: createSymbolObject("lt_s", "i64"), + 0x54: createSymbolObject("lt_u", "i64"), + 0x55: createSymbolObject("gt_s", "i64"), + 0x56: createSymbolObject("gt_u", "i64"), + 0x57: createSymbolObject("le_s", "i64"), + 0x58: createSymbolObject("le_u", "i64"), + 0x59: createSymbolObject("ge_s", "i64"), + 0x5a: createSymbolObject("ge_u", "i64"), + 0x5b: createSymbolObject("eq", "f32"), + 0x5c: createSymbolObject("ne", "f32"), + 0x5d: createSymbolObject("lt", "f32"), + 0x5e: createSymbolObject("gt", "f32"), + 0x5f: createSymbolObject("le", "f32"), + 0x60: createSymbolObject("ge", "f32"), + 0x61: createSymbolObject("eq", "f64"), + 0x62: createSymbolObject("ne", "f64"), + 0x63: createSymbolObject("lt", "f64"), + 0x64: createSymbolObject("gt", "f64"), + 0x65: createSymbolObject("le", "f64"), + 0x66: createSymbolObject("ge", "f64"), + 0x67: createSymbolObject("clz", "i32"), + 0x68: createSymbolObject("ctz", "i32"), + 0x69: createSymbolObject("popcnt", "i32"), + 0x6a: createSymbolObject("add", "i32"), + 0x6b: createSymbolObject("sub", "i32"), + 0x6c: createSymbolObject("mul", "i32"), + 0x6d: createSymbolObject("div_s", "i32"), + 0x6e: createSymbolObject("div_u", "i32"), + 0x6f: createSymbolObject("rem_s", "i32"), + 0x70: createSymbolObject("rem_u", "i32"), + 0x71: createSymbolObject("and", "i32"), + 0x72: createSymbolObject("or", "i32"), + 0x73: createSymbolObject("xor", "i32"), + 0x74: createSymbolObject("shl", "i32"), + 0x75: createSymbolObject("shr_s", "i32"), + 0x76: createSymbolObject("shr_u", "i32"), + 0x77: createSymbolObject("rotl", "i32"), + 0x78: createSymbolObject("rotr", "i32"), + 0x79: createSymbolObject("clz", "i64"), + 0x7a: createSymbolObject("ctz", "i64"), + 0x7b: createSymbolObject("popcnt", "i64"), + 0x7c: createSymbolObject("add", "i64"), + 0x7d: createSymbolObject("sub", "i64"), + 0x7e: createSymbolObject("mul", "i64"), + 0x7f: createSymbolObject("div_s", "i64"), + 0x80: createSymbolObject("div_u", "i64"), + 0x81: createSymbolObject("rem_s", "i64"), + 0x82: createSymbolObject("rem_u", "i64"), + 0x83: createSymbolObject("and", "i64"), + 0x84: createSymbolObject("or", "i64"), + 0x85: createSymbolObject("xor", "i64"), + 0x86: createSymbolObject("shl", "i64"), + 0x87: createSymbolObject("shr_s", "i64"), + 0x88: createSymbolObject("shr_u", "i64"), + 0x89: createSymbolObject("rotl", "i64"), + 0x8a: createSymbolObject("rotr", "i64"), + 0x8b: createSymbolObject("abs", "f32"), + 0x8c: createSymbolObject("neg", "f32"), + 0x8d: createSymbolObject("ceil", "f32"), + 0x8e: createSymbolObject("floor", "f32"), + 0x8f: createSymbolObject("trunc", "f32"), + 0x90: createSymbolObject("nearest", "f32"), + 0x91: createSymbolObject("sqrt", "f32"), + 0x92: createSymbolObject("add", "f32"), + 0x93: createSymbolObject("sub", "f32"), + 0x94: createSymbolObject("mul", "f32"), + 0x95: createSymbolObject("div", "f32"), + 0x96: createSymbolObject("min", "f32"), + 0x97: createSymbolObject("max", "f32"), + 0x98: createSymbolObject("copysign", "f32"), + 0x99: createSymbolObject("abs", "f64"), + 0x9a: createSymbolObject("neg", "f64"), + 0x9b: createSymbolObject("ceil", "f64"), + 0x9c: createSymbolObject("floor", "f64"), + 0x9d: createSymbolObject("trunc", "f64"), + 0x9e: createSymbolObject("nearest", "f64"), + 0x9f: createSymbolObject("sqrt", "f64"), + 0xa0: createSymbolObject("add", "f64"), + 0xa1: createSymbolObject("sub", "f64"), + 0xa2: createSymbolObject("mul", "f64"), + 0xa3: createSymbolObject("div", "f64"), + 0xa4: createSymbolObject("min", "f64"), + 0xa5: createSymbolObject("max", "f64"), + 0xa6: createSymbolObject("copysign", "f64"), + 0xa7: createSymbolObject("wrap/i64", "i32"), + 0xa8: createSymbolObject("trunc_s/f32", "i32"), + 0xa9: createSymbolObject("trunc_u/f32", "i32"), + 0xaa: createSymbolObject("trunc_s/f64", "i32"), + 0xab: createSymbolObject("trunc_u/f64", "i32"), + 0xac: createSymbolObject("extend_s/i32", "i64"), + 0xad: createSymbolObject("extend_u/i32", "i64"), + 0xae: createSymbolObject("trunc_s/f32", "i64"), + 0xaf: createSymbolObject("trunc_u/f32", "i64"), + 0xb0: createSymbolObject("trunc_s/f64", "i64"), + 0xb1: createSymbolObject("trunc_u/f64", "i64"), + 0xb2: createSymbolObject("convert_s/i32", "f32"), + 0xb3: createSymbolObject("convert_u/i32", "f32"), + 0xb4: createSymbolObject("convert_s/i64", "f32"), + 0xb5: createSymbolObject("convert_u/i64", "f32"), + 0xb6: createSymbolObject("demote/f64", "f32"), + 0xb7: createSymbolObject("convert_s/i32", "f64"), + 0xb8: createSymbolObject("convert_u/i32", "f64"), + 0xb9: createSymbolObject("convert_s/i64", "f64"), + 0xba: createSymbolObject("convert_u/i64", "f64"), + 0xbb: createSymbolObject("promote/f32", "f64"), + 0xbc: createSymbolObject("reinterpret/f32", "i32"), + 0xbd: createSymbolObject("reinterpret/f64", "i64"), + 0xbe: createSymbolObject("reinterpret/i32", "f32"), + 0xbf: createSymbolObject("reinterpret/i64", "f64"), + 0xc0: createSymbolObject("extend8_s", "i32"), + 0xc1: createSymbolObject("extend16_s", "i32"), + 0xc2: createSymbolObject("extend8_s", "i64"), + 0xc3: createSymbolObject("extend16_s", "i64"), + 0xc4: createSymbolObject("extend32_s", "i64"), + 0xd0: createSymbol("ref.null"), + 0xd1: createSymbol("ref.is_null"), + 0xd2: createSymbol("ref.func", 1), + 0xfc0a: createSymbol("memory.copy"), + 0xfc0b: createSymbol("memory.fill"), + // Table instructions + // https://webassembly.github.io/spec/core/binary/instructions.html#table-instructions + 0xfc0c: createSymbol("table.init", 2), + 0xfc0d: createSymbol("elem.drop", 1), + 0xfc0e: createSymbol("table.copy", 2), + 0xfc0f: createSymbol("table.grow", 1), + 0xfc10: createSymbol("table.size", 1), + 0xfc11: createSymbol("table.fill", 1), + // Atomic Memory Instructions + 0xfe00: createSymbol("memory.atomic.notify", 1), + 0xfe01: createSymbol("memory.atomic.wait32", 1), + 0xfe02: createSymbol("memory.atomic.wait64", 1), + 0xfe10: createSymbolObject("atomic.load", "i32", 1), + 0xfe11: createSymbolObject("atomic.load", "i64", 1), + 0xfe12: createSymbolObject("atomic.load8_u", "i32", 1), + 0xfe13: createSymbolObject("atomic.load16_u", "i32", 1), + 0xfe14: createSymbolObject("atomic.load8_u", "i64", 1), + 0xfe15: createSymbolObject("atomic.load16_u", "i64", 1), + 0xfe16: createSymbolObject("atomic.load32_u", "i64", 1), + 0xfe17: createSymbolObject("atomic.store", "i32", 1), + 0xfe18: createSymbolObject("atomic.store", "i64", 1), + 0xfe19: createSymbolObject("atomic.store8_u", "i32", 1), + 0xfe1a: createSymbolObject("atomic.store16_u", "i32", 1), + 0xfe1b: createSymbolObject("atomic.store8_u", "i64", 1), + 0xfe1c: createSymbolObject("atomic.store16_u", "i64", 1), + 0xfe1d: createSymbolObject("atomic.store32_u", "i64", 1), + 0xfe1e: createSymbolObject("atomic.rmw.add", "i32", 1), + 0xfe1f: createSymbolObject("atomic.rmw.add", "i64", 1), + 0xfe20: createSymbolObject("atomic.rmw8_u.add_u", "i32", 1), + 0xfe21: createSymbolObject("atomic.rmw16_u.add_u", "i32", 1), + 0xfe22: createSymbolObject("atomic.rmw8_u.add_u", "i64", 1), + 0xfe23: createSymbolObject("atomic.rmw16_u.add_u", "i64", 1), + 0xfe24: createSymbolObject("atomic.rmw32_u.add_u", "i64", 1), + 0xfe25: createSymbolObject("atomic.rmw.sub", "i32", 1), + 0xfe26: createSymbolObject("atomic.rmw.sub", "i64", 1), + 0xfe27: createSymbolObject("atomic.rmw8_u.sub_u", "i32", 1), + 0xfe28: createSymbolObject("atomic.rmw16_u.sub_u", "i32", 1), + 0xfe29: createSymbolObject("atomic.rmw8_u.sub_u", "i64", 1), + 0xfe2a: createSymbolObject("atomic.rmw16_u.sub_u", "i64", 1), + 0xfe2b: createSymbolObject("atomic.rmw32_u.sub_u", "i64", 1), + 0xfe2c: createSymbolObject("atomic.rmw.and", "i32", 1), + 0xfe2d: createSymbolObject("atomic.rmw.and", "i64", 1), + 0xfe2e: createSymbolObject("atomic.rmw8_u.and_u", "i32", 1), + 0xfe2f: createSymbolObject("atomic.rmw16_u.and_u", "i32", 1), + 0xfe30: createSymbolObject("atomic.rmw8_u.and_u", "i64", 1), + 0xfe31: createSymbolObject("atomic.rmw16_u.and_u", "i64", 1), + 0xfe32: createSymbolObject("atomic.rmw32_u.and_u", "i64", 1), + 0xfe33: createSymbolObject("atomic.rmw.or", "i32", 1), + 0xfe34: createSymbolObject("atomic.rmw.or", "i64", 1), + 0xfe35: createSymbolObject("atomic.rmw8_u.or_u", "i32", 1), + 0xfe36: createSymbolObject("atomic.rmw16_u.or_u", "i32", 1), + 0xfe37: createSymbolObject("atomic.rmw8_u.or_u", "i64", 1), + 0xfe38: createSymbolObject("atomic.rmw16_u.or_u", "i64", 1), + 0xfe39: createSymbolObject("atomic.rmw32_u.or_u", "i64", 1), + 0xfe3a: createSymbolObject("atomic.rmw.xor", "i32", 1), + 0xfe3b: createSymbolObject("atomic.rmw.xor", "i64", 1), + 0xfe3c: createSymbolObject("atomic.rmw8_u.xor_u", "i32", 1), + 0xfe3d: createSymbolObject("atomic.rmw16_u.xor_u", "i32", 1), + 0xfe3e: createSymbolObject("atomic.rmw8_u.xor_u", "i64", 1), + 0xfe3f: createSymbolObject("atomic.rmw16_u.xor_u", "i64", 1), + 0xfe40: createSymbolObject("atomic.rmw32_u.xor_u", "i64", 1), + 0xfe41: createSymbolObject("atomic.rmw.xchg", "i32", 1), + 0xfe42: createSymbolObject("atomic.rmw.xchg", "i64", 1), + 0xfe43: createSymbolObject("atomic.rmw8_u.xchg_u", "i32", 1), + 0xfe44: createSymbolObject("atomic.rmw16_u.xchg_u", "i32", 1), + 0xfe45: createSymbolObject("atomic.rmw8_u.xchg_u", "i64", 1), + 0xfe46: createSymbolObject("atomic.rmw16_u.xchg_u", "i64", 1), + 0xfe47: createSymbolObject("atomic.rmw32_u.xchg_u", "i64", 1), + 0xfe48: createSymbolObject("atomic.rmw.cmpxchg", "i32", 1), + 0xfe49: createSymbolObject("atomic.rmw.cmpxchg", "i64", 1), + 0xfe4a: createSymbolObject("atomic.rmw8_u.cmpxchg_u", "i32", 1), + 0xfe4b: createSymbolObject("atomic.rmw16_u.cmpxchg_u", "i32", 1), + 0xfe4c: createSymbolObject("atomic.rmw8_u.cmpxchg_u", "i64", 1), + 0xfe4d: createSymbolObject("atomic.rmw16_u.cmpxchg_u", "i64", 1), + 0xfe4e: createSymbolObject("atomic.rmw32_u.cmpxchg_u", "i64", 1) +}; +var symbolsByName = invertMap(symbolsByByte, function (obj) { + if (typeof obj.object === "string") { + return "".concat(obj.object, ".").concat(obj.name); + } + + return obj.name; +}); +var _default = { + symbolsByByte: symbolsByByte, + sections: sections, + magicModuleHeader: magicModuleHeader, + moduleVersion: moduleVersion, + types: types, + valtypes: valtypes, + exportTypes: exportTypes, + blockTypes: blockTypes, + tableTypes: tableTypes, + globalTypes: globalTypes, + importTypes: importTypes, + valtypesByString: valtypesByString, + globalTypesByString: globalTypesByString, + exportTypesByName: exportTypesByName, + symbolsByName: symbolsByName +}; +exports["default"] = _default; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/section.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/section.js new file mode 100644 index 0000000000000000000000000000000000000000..23f6b2b9e6b51c9a956533ae6c249094e26327e3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/section.js @@ -0,0 +1,38 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getSectionForNode = getSectionForNode; + +function getSectionForNode(n) { + switch (n.type) { + case "ModuleImport": + return "import"; + + case "CallInstruction": + case "CallIndirectInstruction": + case "Func": + case "Instr": + return "code"; + + case "ModuleExport": + return "export"; + + case "Start": + return "start"; + + case "TypeInstruction": + return "type"; + + case "IndexInFuncSection": + return "func"; + + case "Global": + return "global"; + // No section + + default: + return; + } +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3921f1f14259588289cb485248868132633b4b0d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-bytecode/package.json @@ -0,0 +1,20 @@ +{ + "name": "@webassemblyjs/helper-wasm-bytecode", + "version": "1.13.2", + "description": "WASM's Bytecode constants", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Sven Sauleau", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/create.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/create.js new file mode 100644 index 0000000000000000000000000000000000000000..124b861972da27a779c5c449b1b76cfc1dace650 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/create.js @@ -0,0 +1,107 @@ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +import { encodeNode } from "@webassemblyjs/wasm-gen"; +import { overrideBytesInBuffer } from "@webassemblyjs/helper-buffer"; +import constants from "@webassemblyjs/helper-wasm-bytecode"; +import * as t from "@webassemblyjs/ast"; + +function findLastSection(ast, forSection) { + var targetSectionId = constants.sections[forSection]; // $FlowIgnore: metadata can not be empty + + var moduleSections = ast.body[0].metadata.sections; + var lastSection; + var lastId = 0; + + for (var i = 0, len = moduleSections.length; i < len; i++) { + var section = moduleSections[i]; // Ignore custom section since they can actually occur everywhere + + if (section.section === "custom") { + continue; + } + + var sectionId = constants.sections[section.section]; + + if (targetSectionId > lastId && targetSectionId < sectionId) { + return lastSection; + } + + lastId = sectionId; + lastSection = section; + } + + return lastSection; +} + +export function createEmptySection(ast, uint8Buffer, section) { + // previous section after which we are going to insert our section + var lastSection = findLastSection(ast, section); + var start, end; + /** + * It's the first section + */ + + if (lastSection == null || lastSection.section === "custom") { + start = 8 + /* wasm header size */ + ; + end = start; + } else { + start = lastSection.startOffset + lastSection.size.value + 1; + end = start; + } // section id + + + start += 1; + var sizeStartLoc = { + line: -1, + column: start + }; + var sizeEndLoc = { + line: -1, + column: start + 1 + }; // 1 byte for the empty vector + + var size = t.withLoc(t.numberLiteralFromRaw(1), sizeEndLoc, sizeStartLoc); + var vectorOfSizeStartLoc = { + line: -1, + column: sizeEndLoc.column + }; + var vectorOfSizeEndLoc = { + line: -1, + column: sizeEndLoc.column + 1 + }; + var vectorOfSize = t.withLoc(t.numberLiteralFromRaw(0), vectorOfSizeEndLoc, vectorOfSizeStartLoc); + var sectionMetadata = t.sectionMetadata(section, start, size, vectorOfSize); + var sectionBytes = encodeNode(sectionMetadata); + uint8Buffer = overrideBytesInBuffer(uint8Buffer, start - 1, end, sectionBytes); // Add section into the AST for later lookups + + if (_typeof(ast.body[0].metadata) === "object") { + // $FlowIgnore: metadata can not be empty + ast.body[0].metadata.sections.push(sectionMetadata); + t.sortSectionMetadata(ast.body[0]); + } + /** + * Update AST + */ + // Once we hit our section every that is after needs to be shifted by the delta + + + var deltaBytes = +sectionBytes.length; + var encounteredSection = false; + t.traverse(ast, { + SectionMetadata: function SectionMetadata(path) { + if (path.node.section === section) { + encounteredSection = true; + return; + } + + if (encounteredSection === true) { + t.shiftSection(ast, path.node, deltaBytes); + } + } + }); + return { + uint8Buffer: uint8Buffer, + sectionMetadata: sectionMetadata + }; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..91afb0a15830adf1f49c0fe9afb60f4665886ceb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/index.js @@ -0,0 +1,3 @@ +export { resizeSectionByteSize, resizeSectionVecSize } from "./resize"; +export { createEmptySection } from "./create"; +export { removeSections } from "./remove"; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/remove.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/remove.js new file mode 100644 index 0000000000000000000000000000000000000000..3ed85a0bb330ec44b2f41208739a5891a22ab2c0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/remove.js @@ -0,0 +1,36 @@ +import { traverse, getSectionMetadatas, shiftSection } from "@webassemblyjs/ast"; +import { overrideBytesInBuffer } from "@webassemblyjs/helper-buffer"; +export function removeSections(ast, uint8Buffer, section) { + var sectionMetadatas = getSectionMetadatas(ast, section); + + if (sectionMetadatas.length === 0) { + throw new Error("Section metadata not found"); + } + + return sectionMetadatas.reverse().reduce(function (uint8Buffer, sectionMetadata) { + var startsIncludingId = sectionMetadata.startOffset - 1; + var ends = section === "start" ? sectionMetadata.size.loc.end.column + 1 : sectionMetadata.startOffset + sectionMetadata.size.value + 1; + var delta = -(ends - startsIncludingId); + /** + * update AST + */ + // Once we hit our section every that is after needs to be shifted by the delta + + var encounteredSection = false; + traverse(ast, { + SectionMetadata: function SectionMetadata(path) { + if (path.node.section === section) { + encounteredSection = true; + return path.remove(); + } + + if (encounteredSection === true) { + shiftSection(ast, path.node, delta); + } + } + }); // replacement is nothing + + var replacement = []; + return overrideBytesInBuffer(uint8Buffer, startsIncludingId, ends, replacement); + }, uint8Buffer); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/resize.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/resize.js new file mode 100644 index 0000000000000000000000000000000000000000..9792078302a7a98cb5114366b6c7828623a0ba78 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/esm/resize.js @@ -0,0 +1,78 @@ +import { encodeU32 } from "@webassemblyjs/wasm-gen"; +import { getSectionMetadata, traverse, shiftSection } from "@webassemblyjs/ast"; +import { overrideBytesInBuffer } from "@webassemblyjs/helper-buffer"; +export function resizeSectionByteSize(ast, uint8Buffer, section, deltaBytes) { + var sectionMetadata = getSectionMetadata(ast, section); + + if (typeof sectionMetadata === "undefined") { + throw new Error("Section metadata not found"); + } + + if (typeof sectionMetadata.size.loc === "undefined") { + throw new Error("SectionMetadata " + section + " has no loc"); + } // keep old node location to be overriden + + + var start = sectionMetadata.size.loc.start.column; + var end = sectionMetadata.size.loc.end.column; + var newSectionSize = sectionMetadata.size.value + deltaBytes; + var newBytes = encodeU32(newSectionSize); + /** + * update AST + */ + + sectionMetadata.size.value = newSectionSize; + var oldu32EncodedLen = end - start; + var newu32EncodedLen = newBytes.length; // the new u32 has a different encoded length + + if (newu32EncodedLen !== oldu32EncodedLen) { + var deltaInSizeEncoding = newu32EncodedLen - oldu32EncodedLen; + sectionMetadata.size.loc.end.column = start + newu32EncodedLen; + deltaBytes += deltaInSizeEncoding; // move the vec size pointer size the section size is now smaller + + sectionMetadata.vectorOfSize.loc.start.column += deltaInSizeEncoding; + sectionMetadata.vectorOfSize.loc.end.column += deltaInSizeEncoding; + } // Once we hit our section every that is after needs to be shifted by the delta + + + var encounteredSection = false; + traverse(ast, { + SectionMetadata: function SectionMetadata(path) { + if (path.node.section === section) { + encounteredSection = true; + return; + } + + if (encounteredSection === true) { + shiftSection(ast, path.node, deltaBytes); + } + } + }); + return overrideBytesInBuffer(uint8Buffer, start, end, newBytes); +} +export function resizeSectionVecSize(ast, uint8Buffer, section, deltaElements) { + var sectionMetadata = getSectionMetadata(ast, section); + + if (typeof sectionMetadata === "undefined") { + throw new Error("Section metadata not found"); + } + + if (typeof sectionMetadata.vectorOfSize.loc === "undefined") { + throw new Error("SectionMetadata " + section + " has no loc"); + } // Section has no vector + + + if (sectionMetadata.vectorOfSize.value === -1) { + return uint8Buffer; + } // keep old node location to be overriden + + + var start = sectionMetadata.vectorOfSize.loc.start.column; + var end = sectionMetadata.vectorOfSize.loc.end.column; + var newValue = sectionMetadata.vectorOfSize.value + deltaElements; + var newBytes = encodeU32(newValue); // Update AST + + sectionMetadata.vectorOfSize.value = newValue; + sectionMetadata.vectorOfSize.loc.end.column = start + newBytes.length; + return overrideBytesInBuffer(uint8Buffer, start, end, newBytes); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/create.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/create.js new file mode 100644 index 0000000000000000000000000000000000000000..f2856aef6709441a9bab685b4aaa2695ae571fbe --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/create.js @@ -0,0 +1,123 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createEmptySection = createEmptySection; + +var _wasmGen = require("@webassemblyjs/wasm-gen"); + +var _helperBuffer = require("@webassemblyjs/helper-buffer"); + +var _helperWasmBytecode = _interopRequireDefault(require("@webassemblyjs/helper-wasm-bytecode")); + +var t = _interopRequireWildcard(require("@webassemblyjs/ast")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function findLastSection(ast, forSection) { + var targetSectionId = _helperWasmBytecode["default"].sections[forSection]; // $FlowIgnore: metadata can not be empty + + var moduleSections = ast.body[0].metadata.sections; + var lastSection; + var lastId = 0; + + for (var i = 0, len = moduleSections.length; i < len; i++) { + var section = moduleSections[i]; // Ignore custom section since they can actually occur everywhere + + if (section.section === "custom") { + continue; + } + + var sectionId = _helperWasmBytecode["default"].sections[section.section]; + + if (targetSectionId > lastId && targetSectionId < sectionId) { + return lastSection; + } + + lastId = sectionId; + lastSection = section; + } + + return lastSection; +} + +function createEmptySection(ast, uint8Buffer, section) { + // previous section after which we are going to insert our section + var lastSection = findLastSection(ast, section); + var start, end; + /** + * It's the first section + */ + + if (lastSection == null || lastSection.section === "custom") { + start = 8 + /* wasm header size */ + ; + end = start; + } else { + start = lastSection.startOffset + lastSection.size.value + 1; + end = start; + } // section id + + + start += 1; + var sizeStartLoc = { + line: -1, + column: start + }; + var sizeEndLoc = { + line: -1, + column: start + 1 + }; // 1 byte for the empty vector + + var size = t.withLoc(t.numberLiteralFromRaw(1), sizeEndLoc, sizeStartLoc); + var vectorOfSizeStartLoc = { + line: -1, + column: sizeEndLoc.column + }; + var vectorOfSizeEndLoc = { + line: -1, + column: sizeEndLoc.column + 1 + }; + var vectorOfSize = t.withLoc(t.numberLiteralFromRaw(0), vectorOfSizeEndLoc, vectorOfSizeStartLoc); + var sectionMetadata = t.sectionMetadata(section, start, size, vectorOfSize); + var sectionBytes = (0, _wasmGen.encodeNode)(sectionMetadata); + uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start - 1, end, sectionBytes); // Add section into the AST for later lookups + + if (_typeof(ast.body[0].metadata) === "object") { + // $FlowIgnore: metadata can not be empty + ast.body[0].metadata.sections.push(sectionMetadata); + t.sortSectionMetadata(ast.body[0]); + } + /** + * Update AST + */ + // Once we hit our section every that is after needs to be shifted by the delta + + + var deltaBytes = +sectionBytes.length; + var encounteredSection = false; + t.traverse(ast, { + SectionMetadata: function SectionMetadata(path) { + if (path.node.section === section) { + encounteredSection = true; + return; + } + + if (encounteredSection === true) { + t.shiftSection(ast, path.node, deltaBytes); + } + } + }); + return { + uint8Buffer: uint8Buffer, + sectionMetadata: sectionMetadata + }; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3c7963c4304dd3fd54495f7847e269de5dc2f022 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/index.js @@ -0,0 +1,35 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "resizeSectionByteSize", { + enumerable: true, + get: function get() { + return _resize.resizeSectionByteSize; + } +}); +Object.defineProperty(exports, "resizeSectionVecSize", { + enumerable: true, + get: function get() { + return _resize.resizeSectionVecSize; + } +}); +Object.defineProperty(exports, "createEmptySection", { + enumerable: true, + get: function get() { + return _create.createEmptySection; + } +}); +Object.defineProperty(exports, "removeSections", { + enumerable: true, + get: function get() { + return _remove.removeSections; + } +}); + +var _resize = require("./resize"); + +var _create = require("./create"); + +var _remove = require("./remove"); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/remove.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/remove.js new file mode 100644 index 0000000000000000000000000000000000000000..008f5d69cd91d52225c79f82761f2a1d52dfab4c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/remove.js @@ -0,0 +1,45 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.removeSections = removeSections; + +var _ast = require("@webassemblyjs/ast"); + +var _helperBuffer = require("@webassemblyjs/helper-buffer"); + +function removeSections(ast, uint8Buffer, section) { + var sectionMetadatas = (0, _ast.getSectionMetadatas)(ast, section); + + if (sectionMetadatas.length === 0) { + throw new Error("Section metadata not found"); + } + + return sectionMetadatas.reverse().reduce(function (uint8Buffer, sectionMetadata) { + var startsIncludingId = sectionMetadata.startOffset - 1; + var ends = section === "start" ? sectionMetadata.size.loc.end.column + 1 : sectionMetadata.startOffset + sectionMetadata.size.value + 1; + var delta = -(ends - startsIncludingId); + /** + * update AST + */ + // Once we hit our section every that is after needs to be shifted by the delta + + var encounteredSection = false; + (0, _ast.traverse)(ast, { + SectionMetadata: function SectionMetadata(path) { + if (path.node.section === section) { + encounteredSection = true; + return path.remove(); + } + + if (encounteredSection === true) { + (0, _ast.shiftSection)(ast, path.node, delta); + } + } + }); // replacement is nothing + + var replacement = []; + return (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, startsIncludingId, ends, replacement); + }, uint8Buffer); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/resize.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/resize.js new file mode 100644 index 0000000000000000000000000000000000000000..524cacb9c42cd9138cfdc0e8f934cc983146ff50 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/lib/resize.js @@ -0,0 +1,90 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.resizeSectionByteSize = resizeSectionByteSize; +exports.resizeSectionVecSize = resizeSectionVecSize; + +var _wasmGen = require("@webassemblyjs/wasm-gen"); + +var _ast = require("@webassemblyjs/ast"); + +var _helperBuffer = require("@webassemblyjs/helper-buffer"); + +function resizeSectionByteSize(ast, uint8Buffer, section, deltaBytes) { + var sectionMetadata = (0, _ast.getSectionMetadata)(ast, section); + + if (typeof sectionMetadata === "undefined") { + throw new Error("Section metadata not found"); + } + + if (typeof sectionMetadata.size.loc === "undefined") { + throw new Error("SectionMetadata " + section + " has no loc"); + } // keep old node location to be overriden + + + var start = sectionMetadata.size.loc.start.column; + var end = sectionMetadata.size.loc.end.column; + var newSectionSize = sectionMetadata.size.value + deltaBytes; + var newBytes = (0, _wasmGen.encodeU32)(newSectionSize); + /** + * update AST + */ + + sectionMetadata.size.value = newSectionSize; + var oldu32EncodedLen = end - start; + var newu32EncodedLen = newBytes.length; // the new u32 has a different encoded length + + if (newu32EncodedLen !== oldu32EncodedLen) { + var deltaInSizeEncoding = newu32EncodedLen - oldu32EncodedLen; + sectionMetadata.size.loc.end.column = start + newu32EncodedLen; + deltaBytes += deltaInSizeEncoding; // move the vec size pointer size the section size is now smaller + + sectionMetadata.vectorOfSize.loc.start.column += deltaInSizeEncoding; + sectionMetadata.vectorOfSize.loc.end.column += deltaInSizeEncoding; + } // Once we hit our section every that is after needs to be shifted by the delta + + + var encounteredSection = false; + (0, _ast.traverse)(ast, { + SectionMetadata: function SectionMetadata(path) { + if (path.node.section === section) { + encounteredSection = true; + return; + } + + if (encounteredSection === true) { + (0, _ast.shiftSection)(ast, path.node, deltaBytes); + } + } + }); + return (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newBytes); +} + +function resizeSectionVecSize(ast, uint8Buffer, section, deltaElements) { + var sectionMetadata = (0, _ast.getSectionMetadata)(ast, section); + + if (typeof sectionMetadata === "undefined") { + throw new Error("Section metadata not found"); + } + + if (typeof sectionMetadata.vectorOfSize.loc === "undefined") { + throw new Error("SectionMetadata " + section + " has no loc"); + } // Section has no vector + + + if (sectionMetadata.vectorOfSize.value === -1) { + return uint8Buffer; + } // keep old node location to be overriden + + + var start = sectionMetadata.vectorOfSize.loc.start.column; + var end = sectionMetadata.vectorOfSize.loc.end.column; + var newValue = sectionMetadata.vectorOfSize.value + deltaElements; + var newBytes = (0, _wasmGen.encodeU32)(newValue); // Update AST + + sectionMetadata.vectorOfSize.value = newValue; + sectionMetadata.vectorOfSize.loc.end.column = start + newBytes.length; + return (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newBytes); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d102365d0b2476bb516667359381c0f2e672e531 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/helper-wasm-section/package.json @@ -0,0 +1,29 @@ +{ + "name": "@webassemblyjs/helper-wasm-section", + "version": "1.14.1", + "description": "", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "author": "Sven Sauleau", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" + }, + "devDependencies": { + "@webassemblyjs/wasm-parser": "1.14.1" + }, + "gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..76ec6153e970b71ef4978a95b062c29472b56dfd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/esm/index.js @@ -0,0 +1,33 @@ +import { write, read } from "@xtuc/ieee754"; +/** + * According to https://webassembly.github.io/spec/binary/values.html#binary-float + * n = 32/8 + */ + +export var NUMBER_OF_BYTE_F32 = 4; +/** + * According to https://webassembly.github.io/spec/binary/values.html#binary-float + * n = 64/8 + */ + +export var NUMBER_OF_BYTE_F64 = 8; +export var SINGLE_PRECISION_MANTISSA = 23; +export var DOUBLE_PRECISION_MANTISSA = 52; +export function encodeF32(v) { + var buffer = []; + write(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32); + return buffer; +} +export function encodeF64(v) { + var buffer = []; + write(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64); + return buffer; +} +export function decodeF32(bytes) { + var buffer = new Uint8Array(bytes); + return read(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32); +} +export function decodeF64(bytes) { + var buffer = new Uint8Array(bytes); + return read(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..187ea69b1986289e20cdc0835c31bc5811f102c4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/lib/index.js @@ -0,0 +1,52 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.encodeF32 = encodeF32; +exports.encodeF64 = encodeF64; +exports.decodeF32 = decodeF32; +exports.decodeF64 = decodeF64; +exports.DOUBLE_PRECISION_MANTISSA = exports.SINGLE_PRECISION_MANTISSA = exports.NUMBER_OF_BYTE_F64 = exports.NUMBER_OF_BYTE_F32 = void 0; + +var _ieee = require("@xtuc/ieee754"); + +/** + * According to https://webassembly.github.io/spec/binary/values.html#binary-float + * n = 32/8 + */ +var NUMBER_OF_BYTE_F32 = 4; +/** + * According to https://webassembly.github.io/spec/binary/values.html#binary-float + * n = 64/8 + */ + +exports.NUMBER_OF_BYTE_F32 = NUMBER_OF_BYTE_F32; +var NUMBER_OF_BYTE_F64 = 8; +exports.NUMBER_OF_BYTE_F64 = NUMBER_OF_BYTE_F64; +var SINGLE_PRECISION_MANTISSA = 23; +exports.SINGLE_PRECISION_MANTISSA = SINGLE_PRECISION_MANTISSA; +var DOUBLE_PRECISION_MANTISSA = 52; +exports.DOUBLE_PRECISION_MANTISSA = DOUBLE_PRECISION_MANTISSA; + +function encodeF32(v) { + var buffer = []; + (0, _ieee.write)(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32); + return buffer; +} + +function encodeF64(v) { + var buffer = []; + (0, _ieee.write)(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64); + return buffer; +} + +function decodeF32(bytes) { + var buffer = new Uint8Array(bytes); + return (0, _ieee.read)(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32); +} + +function decodeF64(bytes) { + var buffer = new Uint8Array(bytes); + return (0, _ieee.read)(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b41ab4e33378723051276ba044f5a6f925d116be --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/package.json @@ -0,0 +1,23 @@ +{ + "name": "@webassemblyjs/ieee754", + "version": "1.13.2", + "description": "IEEE754 decoder and encoder", + "license": "MIT", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git", + "directory": "packages/ieee754" + }, + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + }, + "gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/src/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..585eb054394a2316763d6882be1e1d881c5241c2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/ieee754/src/index.js @@ -0,0 +1,47 @@ +// @flow + +import { write, read } from "@xtuc/ieee754"; + +/** + * According to https://webassembly.github.io/spec/binary/values.html#binary-float + * n = 32/8 + */ +export const NUMBER_OF_BYTE_F32 = 4; + +/** + * According to https://webassembly.github.io/spec/binary/values.html#binary-float + * n = 64/8 + */ +export const NUMBER_OF_BYTE_F64 = 8; + +export const SINGLE_PRECISION_MANTISSA = 23; + +export const DOUBLE_PRECISION_MANTISSA = 52; + +export function encodeF32(v: number): Array { + const buffer = []; + + write(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32); + + return buffer; +} + +export function encodeF64(v: number): Array { + const buffer = []; + + write(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64); + + return buffer; +} + +export function decodeF32(bytes: Array): number { + const buffer = new Uint8Array(bytes); + + return read(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32); +} + +export function decodeF64(bytes: Array): number { + const buffer = new Uint8Array(bytes); + + return read(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64); +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/LICENSE.txt b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..55e332a8f3018192b239b1dbc98762a46ae1c6c4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/LICENSE.txt @@ -0,0 +1,194 @@ +Copyright 2012 The Obvious Corporation. +http://obvious.com/ + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +------------------------------------------------------------------------- + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/bits.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/bits.js new file mode 100644 index 0000000000000000000000000000000000000000..4c763cd33c9ae61c28a672fad5d39831bf932ca5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/bits.js @@ -0,0 +1,145 @@ +// Copyright 2012 The Obvious Corporation. + +/* + * bits: Bitwise buffer utilities. The utilities here treat a buffer + * as a little-endian bigint, so the lowest-order bit is bit #0 of + * `buffer[0]`, and the highest-order bit is bit #7 of + * `buffer[buffer.length - 1]`. + */ + +/* + * Modules used + */ +"use strict"; +/* + * Exported bindings + */ + +/** + * Extracts the given number of bits from the buffer at the indicated + * index, returning a simple number as the result. If bits are requested + * that aren't covered by the buffer, the `defaultBit` is used as their + * value. + * + * The `bitLength` must be no more than 32. The `defaultBit` if not + * specified is taken to be `0`. + */ + +export function extract(buffer, bitIndex, bitLength, defaultBit) { + if (bitLength < 0 || bitLength > 32) { + throw new Error("Bad value for bitLength."); + } + + if (defaultBit === undefined) { + defaultBit = 0; + } else if (defaultBit !== 0 && defaultBit !== 1) { + throw new Error("Bad value for defaultBit."); + } + + var defaultByte = defaultBit * 0xff; + var result = 0; // All starts are inclusive. The {endByte, endBit} pair is exclusive, but + // if endBit !== 0, then endByte is inclusive. + + var lastBit = bitIndex + bitLength; + var startByte = Math.floor(bitIndex / 8); + var startBit = bitIndex % 8; + var endByte = Math.floor(lastBit / 8); + var endBit = lastBit % 8; + + if (endBit !== 0) { + // `(1 << endBit) - 1` is the mask of all bits up to but not including + // the endBit. + result = get(endByte) & (1 << endBit) - 1; + } + + while (endByte > startByte) { + endByte--; + result = result << 8 | get(endByte); + } + + result >>>= startBit; + return result; + + function get(index) { + var result = buffer[index]; + return result === undefined ? defaultByte : result; + } +} +/** + * Injects the given bits into the given buffer at the given index. Any + * bits in the value beyond the length to set are ignored. + */ + +export function inject(buffer, bitIndex, bitLength, value) { + if (bitLength < 0 || bitLength > 32) { + throw new Error("Bad value for bitLength."); + } + + var lastByte = Math.floor((bitIndex + bitLength - 1) / 8); + + if (bitIndex < 0 || lastByte >= buffer.length) { + throw new Error("Index out of range."); + } // Just keeping it simple, until / unless profiling shows that this + // is a problem. + + + var atByte = Math.floor(bitIndex / 8); + var atBit = bitIndex % 8; + + while (bitLength > 0) { + if (value & 1) { + buffer[atByte] |= 1 << atBit; + } else { + buffer[atByte] &= ~(1 << atBit); + } + + value >>= 1; + bitLength--; + atBit = (atBit + 1) % 8; + + if (atBit === 0) { + atByte++; + } + } +} +/** + * Gets the sign bit of the given buffer. + */ + +export function getSign(buffer) { + return buffer[buffer.length - 1] >>> 7; +} +/** + * Gets the zero-based bit number of the highest-order bit with the + * given value in the given buffer. + * + * If the buffer consists entirely of the other bit value, then this returns + * `-1`. + */ + +export function highOrder(bit, buffer) { + var length = buffer.length; + var fullyWrongByte = (bit ^ 1) * 0xff; // the other-bit extended to a full byte + + while (length > 0 && buffer[length - 1] === fullyWrongByte) { + length--; + } + + if (length === 0) { + // Degenerate case. The buffer consists entirely of ~bit. + return -1; + } + + var byteToCheck = buffer[length - 1]; + var result = length * 8 - 1; + + for (var i = 7; i > 0; i--) { + if ((byteToCheck >> i & 1) === bit) { + break; + } + + result--; + } + + return result; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/bufs.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/bufs.js new file mode 100644 index 0000000000000000000000000000000000000000..51fb55414906bf727d6bcff00549f9e34ffc7b9f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/bufs.js @@ -0,0 +1,228 @@ +// Copyright 2012 The Obvious Corporation. + +/* + * bufs: Buffer utilities. + */ + +/* + * Module variables + */ + +/** Pool of buffers, where `bufPool[x].length === x`. */ +var bufPool = []; +/** Maximum length of kept temporary buffers. */ + +var TEMP_BUF_MAXIMUM_LENGTH = 20; +/** Minimum exactly-representable 64-bit int. */ + +var MIN_EXACT_INT64 = -0x8000000000000000; +/** Maximum exactly-representable 64-bit int. */ + +var MAX_EXACT_INT64 = 0x7ffffffffffffc00; +/** Maximum exactly-representable 64-bit uint. */ + +var MAX_EXACT_UINT64 = 0xfffffffffffff800; +/** + * The int value consisting just of a 1 in bit #32 (that is, one more + * than the maximum 32-bit unsigned value). + */ + +var BIT_32 = 0x100000000; +/** + * The int value consisting just of a 1 in bit #64 (that is, one more + * than the maximum 64-bit unsigned value). + */ + +var BIT_64 = 0x10000000000000000; +/* + * Helper functions + */ + +/** + * Masks off all but the lowest bit set of the given number. + */ + +function lowestBit(num) { + return num & -num; +} +/** + * Gets whether trying to add the second number to the first is lossy + * (inexact). The first number is meant to be an accumulated result. + */ + + +function isLossyToAdd(accum, num) { + if (num === 0) { + return false; + } + + var lowBit = lowestBit(num); + var added = accum + lowBit; + + if (added === accum) { + return true; + } + + if (added - lowBit !== accum) { + return true; + } + + return false; +} +/* + * Exported functions + */ + +/** + * Allocates a buffer of the given length, which is initialized + * with all zeroes. This returns a buffer from the pool if it is + * available, or a freshly-allocated buffer if not. + */ + + +export function alloc(length) { + var result = bufPool[length]; + + if (result) { + bufPool[length] = undefined; + } else { + result = new Uint8Array(length); + } + + result.fill(0); + return result; +} +/** + * Releases a buffer back to the pool. + */ + +export function free(buffer) { + var length = buffer.length; + + if (length < TEMP_BUF_MAXIMUM_LENGTH) { + bufPool[length] = buffer; + } +} +/** + * Resizes a buffer, returning a new buffer. Returns the argument if + * the length wouldn't actually change. This function is only safe to + * use if the given buffer was allocated within this module (since + * otherwise the buffer might possibly be shared externally). + */ + +export function resize(buffer, length) { + if (length === buffer.length) { + return buffer; + } + + var newBuf = alloc(length); + + for (var i = 0; i <= buffer.length; i++) { + newBuf[i] = buffer[i]; + } + + free(buffer); + return newBuf; +} +/** + * Reads an arbitrary signed int from a buffer. + */ + +export function readInt(buffer) { + var length = buffer.length; + var positive = buffer[length - 1] < 0x80; + var result = positive ? 0 : -1; + var lossy = false; // Note: We can't use bit manipulation here, since that stops + // working if the result won't fit in a 32-bit int. + + if (length < 7) { + // Common case which can't possibly be lossy (because the result has + // no more than 48 bits, and loss only happens with 54 or more). + for (var i = length - 1; i >= 0; i--) { + result = result * 0x100 + buffer[i]; + } + } else { + for (var _i = length - 1; _i >= 0; _i--) { + var one = buffer[_i]; + result *= 0x100; + + if (isLossyToAdd(result, one)) { + lossy = true; + } + + result += one; + } + } + + return { + value: result, + lossy: lossy + }; +} +/** + * Reads an arbitrary unsigned int from a buffer. + */ + +export function readUInt(buffer) { + var length = buffer.length; + var result = 0; + var lossy = false; // Note: See above in re bit manipulation. + + if (length < 7) { + // Common case which can't possibly be lossy (see above). + for (var i = length - 1; i >= 0; i--) { + result = result * 0x100 + buffer[i]; + } + } else { + for (var _i2 = length - 1; _i2 >= 0; _i2--) { + var one = buffer[_i2]; + result *= 0x100; + + if (isLossyToAdd(result, one)) { + lossy = true; + } + + result += one; + } + } + + return { + value: result, + lossy: lossy + }; +} +/** + * Writes a little-endian 64-bit signed int into a buffer. + */ + +export function writeInt64(value, buffer) { + if (value < MIN_EXACT_INT64 || value > MAX_EXACT_INT64) { + throw new Error("Value out of range."); + } + + if (value < 0) { + value += BIT_64; + } + + writeUInt64(value, buffer); +} +/** + * Writes a little-endian 64-bit unsigned int into a buffer. + */ + +export function writeUInt64(value, buffer) { + if (value < 0 || value > MAX_EXACT_UINT64) { + throw new Error("Value out of range."); + } + + var lowWord = value % BIT_32; + var highWord = Math.floor(value / BIT_32); + buffer[0] = lowWord & 0xff; + buffer[1] = lowWord >> 8 & 0xff; + buffer[2] = lowWord >> 16 & 0xff; + buffer[3] = lowWord >> 24 & 0xff; + buffer[4] = highWord & 0xff; + buffer[5] = highWord >> 8 & 0xff; + buffer[6] = highWord >> 16 & 0xff; + buffer[7] = highWord >> 24 & 0xff; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7ee23fafafb1e02fd97dd6ff6efa315b7643c5ea --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/index.js @@ -0,0 +1,34 @@ +import leb from "./leb"; +/** + * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int + * max = ceil(32/7) + */ + +export var MAX_NUMBER_OF_BYTE_U32 = 5; +/** + * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int + * max = ceil(64/7) + */ + +export var MAX_NUMBER_OF_BYTE_U64 = 10; +export function decodeInt64(encodedBuffer, index) { + return leb.decodeInt64(encodedBuffer, index); +} +export function decodeUInt64(encodedBuffer, index) { + return leb.decodeUInt64(encodedBuffer, index); +} +export function decodeInt32(encodedBuffer, index) { + return leb.decodeInt32(encodedBuffer, index); +} +export function decodeUInt32(encodedBuffer, index) { + return leb.decodeUInt32(encodedBuffer, index); +} +export function encodeU32(v) { + return leb.encodeUInt32(v); +} +export function encodeI32(v) { + return leb.encodeInt32(v); +} +export function encodeI64(v) { + return leb.encodeInt64(v); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/leb.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/leb.js new file mode 100644 index 0000000000000000000000000000000000000000..adeac141f87eb57fa06aea296a0e608daf4047d0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/esm/leb.js @@ -0,0 +1,328 @@ +// Copyright 2012 The Obvious Corporation. + +/* + * leb: LEB128 utilities. + */ + +/* + * Modules used + */ +"use strict"; + +import Long from "@xtuc/long"; +import * as bits from "./bits"; +import * as bufs from "./bufs"; +/* + * Module variables + */ + +/** The minimum possible 32-bit signed int. */ + +var MIN_INT32 = -0x80000000; +/** The maximum possible 32-bit signed int. */ + +var MAX_INT32 = 0x7fffffff; +/** The maximum possible 32-bit unsigned int. */ + +var MAX_UINT32 = 0xffffffff; +/** The minimum possible 64-bit signed int. */ +// const MIN_INT64 = -0x8000000000000000; + +/** + * The maximum possible 64-bit signed int that is representable as a + * JavaScript number. + */ +// const MAX_INT64 = 0x7ffffffffffffc00; + +/** + * The maximum possible 64-bit unsigned int that is representable as a + * JavaScript number. + */ +// const MAX_UINT64 = 0xfffffffffffff800; + +/* + * Helper functions + */ + +/** + * Determines the number of bits required to encode the number + * represented in the given buffer as a signed value. The buffer is + * taken to represent a signed number in little-endian form. + * + * The number of bits to encode is the (zero-based) bit number of the + * highest-order non-sign-matching bit, plus two. For example: + * + * 11111011 01110101 + * high low + * + * The sign bit here is 1 (that is, it's a negative number). The highest + * bit number that doesn't match the sign is bit #10 (where the lowest-order + * bit is bit #0). So, we have to encode at least 12 bits total. + * + * As a special degenerate case, the numbers 0 and -1 each require just one bit. + */ + +function signedBitCount(buffer) { + return bits.highOrder(bits.getSign(buffer) ^ 1, buffer) + 2; +} +/** + * Determines the number of bits required to encode the number + * represented in the given buffer as an unsigned value. The buffer is + * taken to represent an unsigned number in little-endian form. + * + * The number of bits to encode is the (zero-based) bit number of the + * highest-order 1 bit, plus one. For example: + * + * 00011000 01010011 + * high low + * + * The highest-order 1 bit here is bit #12 (where the lowest-order bit + * is bit #0). So, we have to encode at least 13 bits total. + * + * As a special degenerate case, the number 0 requires 1 bit. + */ + + +function unsignedBitCount(buffer) { + var result = bits.highOrder(1, buffer) + 1; + return result ? result : 1; +} +/** + * Common encoder for both signed and unsigned ints. This takes a + * bigint-ish buffer, returning an LEB128-encoded buffer. + */ + + +function encodeBufferCommon(buffer, signed) { + var signBit; + var bitCount; + + if (signed) { + signBit = bits.getSign(buffer); + bitCount = signedBitCount(buffer); + } else { + signBit = 0; + bitCount = unsignedBitCount(buffer); + } + + var byteCount = Math.ceil(bitCount / 7); + var result = bufs.alloc(byteCount); + + for (var i = 0; i < byteCount; i++) { + var payload = bits.extract(buffer, i * 7, 7, signBit); + result[i] = payload | 0x80; + } // Mask off the top bit of the last byte, to indicate the end of the + // encoding. + + + result[byteCount - 1] &= 0x7f; + return result; +} +/** + * Gets the byte-length of the value encoded in the given buffer at + * the given index. + */ + + +function encodedLength(encodedBuffer, index) { + var result = 0; + + while (encodedBuffer[index + result] >= 0x80) { + result++; + } + + result++; // to account for the last byte + + if (index + result > encodedBuffer.length) {// FIXME(sven): seems to cause false positives + // throw new Error("integer representation too long"); + } + + return result; +} +/** + * Common decoder for both signed and unsigned ints. This takes an + * LEB128-encoded buffer, returning a bigint-ish buffer. + */ + + +function decodeBufferCommon(encodedBuffer, index, signed) { + index = index === undefined ? 0 : index; + var length = encodedLength(encodedBuffer, index); + var bitLength = length * 7; + var byteLength = Math.ceil(bitLength / 8); + var result = bufs.alloc(byteLength); + var outIndex = 0; + + while (length > 0) { + bits.inject(result, outIndex, 7, encodedBuffer[index]); + outIndex += 7; + index++; + length--; + } + + var signBit; + var signByte; + + if (signed) { + // Sign-extend the last byte. + var lastByte = result[byteLength - 1]; + var endBit = outIndex % 8; + + if (endBit !== 0) { + var shift = 32 - endBit; // 32 because JS bit ops work on 32-bit ints. + + lastByte = result[byteLength - 1] = lastByte << shift >> shift & 0xff; + } + + signBit = lastByte >> 7; + signByte = signBit * 0xff; + } else { + signBit = 0; + signByte = 0; + } // Slice off any superfluous bytes, that is, ones that add no meaningful + // bits (because the value would be the same if they were removed). + + + while (byteLength > 1 && result[byteLength - 1] === signByte && (!signed || result[byteLength - 2] >> 7 === signBit)) { + byteLength--; + } + + result = bufs.resize(result, byteLength); + return { + value: result, + nextIndex: index + }; +} +/* + * Exported bindings + */ + + +function encodeIntBuffer(buffer) { + return encodeBufferCommon(buffer, true); +} + +function decodeIntBuffer(encodedBuffer, index) { + return decodeBufferCommon(encodedBuffer, index, true); +} + +function encodeInt32(num) { + var buf = new Uint8Array(4); + buf[0] = num & 0xff; + buf[1] = num >> 8 & 0xff; + buf[2] = num >> 16 & 0xff; + buf[3] = num >> 24 & 0xff; + var result = encodeIntBuffer(buf); + return result; +} + +function decodeInt32(encodedBuffer, index) { + var result = decodeIntBuffer(encodedBuffer, index); + var parsed = bufs.readInt(result.value); + var value = parsed.value; + bufs.free(result.value); + + if (value < MIN_INT32 || value > MAX_INT32) { + throw new Error("integer too large"); + } + + return { + value: value, + nextIndex: result.nextIndex + }; +} + +function encodeInt64(num) { + var buf = bufs.alloc(8); + bufs.writeInt64(num, buf); + var result = encodeIntBuffer(buf); + bufs.free(buf); + return result; +} + +function decodeInt64(encodedBuffer, index) { + var result = decodeIntBuffer(encodedBuffer, index); // sign-extend if necessary + + var length = result.value.length; + + if (result.value[length - 1] >> 7) { + result.value = bufs.resize(result.value, 8); + result.value.fill(255, length); + } + + var value = Long.fromBytesLE(result.value, false); + bufs.free(result.value); + return { + value: value, + nextIndex: result.nextIndex, + lossy: false + }; +} + +function encodeUIntBuffer(buffer) { + return encodeBufferCommon(buffer, false); +} + +function decodeUIntBuffer(encodedBuffer, index) { + return decodeBufferCommon(encodedBuffer, index, false); +} + +function encodeUInt32(num) { + var buf = new Uint8Array(4); + buf[0] = num & 0xff; + buf[1] = num >> 8 & 0xff; + buf[2] = num >> 16 & 0xff; + buf[3] = num >> 24 & 0xff; + var result = encodeUIntBuffer(buf); + return result; +} + +function decodeUInt32(encodedBuffer, index) { + var result = decodeUIntBuffer(encodedBuffer, index); + var parsed = bufs.readUInt(result.value); + var value = parsed.value; + bufs.free(result.value); + + if (value > MAX_UINT32) { + throw new Error("integer too large"); + } + + return { + value: value, + nextIndex: result.nextIndex + }; +} + +function encodeUInt64(num) { + var buf = bufs.alloc(8); + bufs.writeUInt64(num, buf); + var result = encodeUIntBuffer(buf); + bufs.free(buf); + return result; +} + +function decodeUInt64(encodedBuffer, index) { + var result = decodeUIntBuffer(encodedBuffer, index); + var value = Long.fromBytesLE(result.value, true); + bufs.free(result.value); + return { + value: value, + nextIndex: result.nextIndex, + lossy: false + }; +} + +export default { + decodeInt32: decodeInt32, + decodeInt64: decodeInt64, + decodeIntBuffer: decodeIntBuffer, + decodeUInt32: decodeUInt32, + decodeUInt64: decodeUInt64, + decodeUIntBuffer: decodeUIntBuffer, + encodeInt32: encodeInt32, + encodeInt64: encodeInt64, + encodeIntBuffer: encodeIntBuffer, + encodeUInt32: encodeUInt32, + encodeUInt64: encodeUInt64, + encodeUIntBuffer: encodeUIntBuffer +}; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/bits.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/bits.js new file mode 100644 index 0000000000000000000000000000000000000000..5acf24604ad7efaf0f78f2004acaee35ac5d39b8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/bits.js @@ -0,0 +1,156 @@ +// Copyright 2012 The Obvious Corporation. + +/* + * bits: Bitwise buffer utilities. The utilities here treat a buffer + * as a little-endian bigint, so the lowest-order bit is bit #0 of + * `buffer[0]`, and the highest-order bit is bit #7 of + * `buffer[buffer.length - 1]`. + */ + +/* + * Modules used + */ +"use strict"; +/* + * Exported bindings + */ + +/** + * Extracts the given number of bits from the buffer at the indicated + * index, returning a simple number as the result. If bits are requested + * that aren't covered by the buffer, the `defaultBit` is used as their + * value. + * + * The `bitLength` must be no more than 32. The `defaultBit` if not + * specified is taken to be `0`. + */ + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.extract = extract; +exports.inject = inject; +exports.getSign = getSign; +exports.highOrder = highOrder; + +function extract(buffer, bitIndex, bitLength, defaultBit) { + if (bitLength < 0 || bitLength > 32) { + throw new Error("Bad value for bitLength."); + } + + if (defaultBit === undefined) { + defaultBit = 0; + } else if (defaultBit !== 0 && defaultBit !== 1) { + throw new Error("Bad value for defaultBit."); + } + + var defaultByte = defaultBit * 0xff; + var result = 0; // All starts are inclusive. The {endByte, endBit} pair is exclusive, but + // if endBit !== 0, then endByte is inclusive. + + var lastBit = bitIndex + bitLength; + var startByte = Math.floor(bitIndex / 8); + var startBit = bitIndex % 8; + var endByte = Math.floor(lastBit / 8); + var endBit = lastBit % 8; + + if (endBit !== 0) { + // `(1 << endBit) - 1` is the mask of all bits up to but not including + // the endBit. + result = get(endByte) & (1 << endBit) - 1; + } + + while (endByte > startByte) { + endByte--; + result = result << 8 | get(endByte); + } + + result >>>= startBit; + return result; + + function get(index) { + var result = buffer[index]; + return result === undefined ? defaultByte : result; + } +} +/** + * Injects the given bits into the given buffer at the given index. Any + * bits in the value beyond the length to set are ignored. + */ + + +function inject(buffer, bitIndex, bitLength, value) { + if (bitLength < 0 || bitLength > 32) { + throw new Error("Bad value for bitLength."); + } + + var lastByte = Math.floor((bitIndex + bitLength - 1) / 8); + + if (bitIndex < 0 || lastByte >= buffer.length) { + throw new Error("Index out of range."); + } // Just keeping it simple, until / unless profiling shows that this + // is a problem. + + + var atByte = Math.floor(bitIndex / 8); + var atBit = bitIndex % 8; + + while (bitLength > 0) { + if (value & 1) { + buffer[atByte] |= 1 << atBit; + } else { + buffer[atByte] &= ~(1 << atBit); + } + + value >>= 1; + bitLength--; + atBit = (atBit + 1) % 8; + + if (atBit === 0) { + atByte++; + } + } +} +/** + * Gets the sign bit of the given buffer. + */ + + +function getSign(buffer) { + return buffer[buffer.length - 1] >>> 7; +} +/** + * Gets the zero-based bit number of the highest-order bit with the + * given value in the given buffer. + * + * If the buffer consists entirely of the other bit value, then this returns + * `-1`. + */ + + +function highOrder(bit, buffer) { + var length = buffer.length; + var fullyWrongByte = (bit ^ 1) * 0xff; // the other-bit extended to a full byte + + while (length > 0 && buffer[length - 1] === fullyWrongByte) { + length--; + } + + if (length === 0) { + // Degenerate case. The buffer consists entirely of ~bit. + return -1; + } + + var byteToCheck = buffer[length - 1]; + var result = length * 8 - 1; + + for (var i = 7; i > 0; i--) { + if ((byteToCheck >> i & 1) === bit) { + break; + } + + result--; + } + + return result; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/bufs.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/bufs.js new file mode 100644 index 0000000000000000000000000000000000000000..9480292ea348d4815006bd3d3f296082234d53ec --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/bufs.js @@ -0,0 +1,246 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.alloc = alloc; +exports.free = free; +exports.resize = resize; +exports.readInt = readInt; +exports.readUInt = readUInt; +exports.writeInt64 = writeInt64; +exports.writeUInt64 = writeUInt64; +// Copyright 2012 The Obvious Corporation. + +/* + * bufs: Buffer utilities. + */ + +/* + * Module variables + */ + +/** Pool of buffers, where `bufPool[x].length === x`. */ +var bufPool = []; +/** Maximum length of kept temporary buffers. */ + +var TEMP_BUF_MAXIMUM_LENGTH = 20; +/** Minimum exactly-representable 64-bit int. */ + +var MIN_EXACT_INT64 = -0x8000000000000000; +/** Maximum exactly-representable 64-bit int. */ + +var MAX_EXACT_INT64 = 0x7ffffffffffffc00; +/** Maximum exactly-representable 64-bit uint. */ + +var MAX_EXACT_UINT64 = 0xfffffffffffff800; +/** + * The int value consisting just of a 1 in bit #32 (that is, one more + * than the maximum 32-bit unsigned value). + */ + +var BIT_32 = 0x100000000; +/** + * The int value consisting just of a 1 in bit #64 (that is, one more + * than the maximum 64-bit unsigned value). + */ + +var BIT_64 = 0x10000000000000000; +/* + * Helper functions + */ + +/** + * Masks off all but the lowest bit set of the given number. + */ + +function lowestBit(num) { + return num & -num; +} +/** + * Gets whether trying to add the second number to the first is lossy + * (inexact). The first number is meant to be an accumulated result. + */ + + +function isLossyToAdd(accum, num) { + if (num === 0) { + return false; + } + + var lowBit = lowestBit(num); + var added = accum + lowBit; + + if (added === accum) { + return true; + } + + if (added - lowBit !== accum) { + return true; + } + + return false; +} +/* + * Exported functions + */ + +/** + * Allocates a buffer of the given length, which is initialized + * with all zeroes. This returns a buffer from the pool if it is + * available, or a freshly-allocated buffer if not. + */ + + +function alloc(length) { + var result = bufPool[length]; + + if (result) { + bufPool[length] = undefined; + } else { + result = new Uint8Array(length); + } + + result.fill(0); + return result; +} +/** + * Releases a buffer back to the pool. + */ + + +function free(buffer) { + var length = buffer.length; + + if (length < TEMP_BUF_MAXIMUM_LENGTH) { + bufPool[length] = buffer; + } +} +/** + * Resizes a buffer, returning a new buffer. Returns the argument if + * the length wouldn't actually change. This function is only safe to + * use if the given buffer was allocated within this module (since + * otherwise the buffer might possibly be shared externally). + */ + + +function resize(buffer, length) { + if (length === buffer.length) { + return buffer; + } + + var newBuf = alloc(length); + + for (var i = 0; i <= buffer.length; i++) { + newBuf[i] = buffer[i]; + } + + free(buffer); + return newBuf; +} +/** + * Reads an arbitrary signed int from a buffer. + */ + + +function readInt(buffer) { + var length = buffer.length; + var positive = buffer[length - 1] < 0x80; + var result = positive ? 0 : -1; + var lossy = false; // Note: We can't use bit manipulation here, since that stops + // working if the result won't fit in a 32-bit int. + + if (length < 7) { + // Common case which can't possibly be lossy (because the result has + // no more than 48 bits, and loss only happens with 54 or more). + for (var i = length - 1; i >= 0; i--) { + result = result * 0x100 + buffer[i]; + } + } else { + for (var _i = length - 1; _i >= 0; _i--) { + var one = buffer[_i]; + result *= 0x100; + + if (isLossyToAdd(result, one)) { + lossy = true; + } + + result += one; + } + } + + return { + value: result, + lossy: lossy + }; +} +/** + * Reads an arbitrary unsigned int from a buffer. + */ + + +function readUInt(buffer) { + var length = buffer.length; + var result = 0; + var lossy = false; // Note: See above in re bit manipulation. + + if (length < 7) { + // Common case which can't possibly be lossy (see above). + for (var i = length - 1; i >= 0; i--) { + result = result * 0x100 + buffer[i]; + } + } else { + for (var _i2 = length - 1; _i2 >= 0; _i2--) { + var one = buffer[_i2]; + result *= 0x100; + + if (isLossyToAdd(result, one)) { + lossy = true; + } + + result += one; + } + } + + return { + value: result, + lossy: lossy + }; +} +/** + * Writes a little-endian 64-bit signed int into a buffer. + */ + + +function writeInt64(value, buffer) { + if (value < MIN_EXACT_INT64 || value > MAX_EXACT_INT64) { + throw new Error("Value out of range."); + } + + if (value < 0) { + value += BIT_64; + } + + writeUInt64(value, buffer); +} +/** + * Writes a little-endian 64-bit unsigned int into a buffer. + */ + + +function writeUInt64(value, buffer) { + if (value < 0 || value > MAX_EXACT_UINT64) { + throw new Error("Value out of range."); + } + + var lowWord = value % BIT_32; + var highWord = Math.floor(value / BIT_32); + buffer[0] = lowWord & 0xff; + buffer[1] = lowWord >> 8 & 0xff; + buffer[2] = lowWord >> 16 & 0xff; + buffer[3] = lowWord >> 24 & 0xff; + buffer[4] = highWord & 0xff; + buffer[5] = highWord >> 8 & 0xff; + buffer[6] = highWord >> 16 & 0xff; + buffer[7] = highWord >> 24 & 0xff; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c9c7481cf985d34d277687b51db4fc8dad9846a9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/index.js @@ -0,0 +1,59 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.decodeInt64 = decodeInt64; +exports.decodeUInt64 = decodeUInt64; +exports.decodeInt32 = decodeInt32; +exports.decodeUInt32 = decodeUInt32; +exports.encodeU32 = encodeU32; +exports.encodeI32 = encodeI32; +exports.encodeI64 = encodeI64; +exports.MAX_NUMBER_OF_BYTE_U64 = exports.MAX_NUMBER_OF_BYTE_U32 = void 0; + +var _leb = _interopRequireDefault(require("./leb")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +/** + * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int + * max = ceil(32/7) + */ +var MAX_NUMBER_OF_BYTE_U32 = 5; +/** + * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int + * max = ceil(64/7) + */ + +exports.MAX_NUMBER_OF_BYTE_U32 = MAX_NUMBER_OF_BYTE_U32; +var MAX_NUMBER_OF_BYTE_U64 = 10; +exports.MAX_NUMBER_OF_BYTE_U64 = MAX_NUMBER_OF_BYTE_U64; + +function decodeInt64(encodedBuffer, index) { + return _leb["default"].decodeInt64(encodedBuffer, index); +} + +function decodeUInt64(encodedBuffer, index) { + return _leb["default"].decodeUInt64(encodedBuffer, index); +} + +function decodeInt32(encodedBuffer, index) { + return _leb["default"].decodeInt32(encodedBuffer, index); +} + +function decodeUInt32(encodedBuffer, index) { + return _leb["default"].decodeUInt32(encodedBuffer, index); +} + +function encodeU32(v) { + return _leb["default"].encodeUInt32(v); +} + +function encodeI32(v) { + return _leb["default"].encodeInt32(v); +} + +function encodeI64(v) { + return _leb["default"].encodeInt64(v); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/leb.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/leb.js new file mode 100644 index 0000000000000000000000000000000000000000..7339c1b6672998594d58b65789b5abd706df75db --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/lib/leb.js @@ -0,0 +1,347 @@ +// Copyright 2012 The Obvious Corporation. + +/* + * leb: LEB128 utilities. + */ + +/* + * Modules used + */ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _long = _interopRequireDefault(require("@xtuc/long")); + +var bits = _interopRequireWildcard(require("./bits")); + +var bufs = _interopRequireWildcard(require("./bufs")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +/* + * Module variables + */ + +/** The minimum possible 32-bit signed int. */ +var MIN_INT32 = -0x80000000; +/** The maximum possible 32-bit signed int. */ + +var MAX_INT32 = 0x7fffffff; +/** The maximum possible 32-bit unsigned int. */ + +var MAX_UINT32 = 0xffffffff; +/** The minimum possible 64-bit signed int. */ +// const MIN_INT64 = -0x8000000000000000; + +/** + * The maximum possible 64-bit signed int that is representable as a + * JavaScript number. + */ +// const MAX_INT64 = 0x7ffffffffffffc00; + +/** + * The maximum possible 64-bit unsigned int that is representable as a + * JavaScript number. + */ +// const MAX_UINT64 = 0xfffffffffffff800; + +/* + * Helper functions + */ + +/** + * Determines the number of bits required to encode the number + * represented in the given buffer as a signed value. The buffer is + * taken to represent a signed number in little-endian form. + * + * The number of bits to encode is the (zero-based) bit number of the + * highest-order non-sign-matching bit, plus two. For example: + * + * 11111011 01110101 + * high low + * + * The sign bit here is 1 (that is, it's a negative number). The highest + * bit number that doesn't match the sign is bit #10 (where the lowest-order + * bit is bit #0). So, we have to encode at least 12 bits total. + * + * As a special degenerate case, the numbers 0 and -1 each require just one bit. + */ + +function signedBitCount(buffer) { + return bits.highOrder(bits.getSign(buffer) ^ 1, buffer) + 2; +} +/** + * Determines the number of bits required to encode the number + * represented in the given buffer as an unsigned value. The buffer is + * taken to represent an unsigned number in little-endian form. + * + * The number of bits to encode is the (zero-based) bit number of the + * highest-order 1 bit, plus one. For example: + * + * 00011000 01010011 + * high low + * + * The highest-order 1 bit here is bit #12 (where the lowest-order bit + * is bit #0). So, we have to encode at least 13 bits total. + * + * As a special degenerate case, the number 0 requires 1 bit. + */ + + +function unsignedBitCount(buffer) { + var result = bits.highOrder(1, buffer) + 1; + return result ? result : 1; +} +/** + * Common encoder for both signed and unsigned ints. This takes a + * bigint-ish buffer, returning an LEB128-encoded buffer. + */ + + +function encodeBufferCommon(buffer, signed) { + var signBit; + var bitCount; + + if (signed) { + signBit = bits.getSign(buffer); + bitCount = signedBitCount(buffer); + } else { + signBit = 0; + bitCount = unsignedBitCount(buffer); + } + + var byteCount = Math.ceil(bitCount / 7); + var result = bufs.alloc(byteCount); + + for (var i = 0; i < byteCount; i++) { + var payload = bits.extract(buffer, i * 7, 7, signBit); + result[i] = payload | 0x80; + } // Mask off the top bit of the last byte, to indicate the end of the + // encoding. + + + result[byteCount - 1] &= 0x7f; + return result; +} +/** + * Gets the byte-length of the value encoded in the given buffer at + * the given index. + */ + + +function encodedLength(encodedBuffer, index) { + var result = 0; + + while (encodedBuffer[index + result] >= 0x80) { + result++; + } + + result++; // to account for the last byte + + if (index + result > encodedBuffer.length) {// FIXME(sven): seems to cause false positives + // throw new Error("integer representation too long"); + } + + return result; +} +/** + * Common decoder for both signed and unsigned ints. This takes an + * LEB128-encoded buffer, returning a bigint-ish buffer. + */ + + +function decodeBufferCommon(encodedBuffer, index, signed) { + index = index === undefined ? 0 : index; + var length = encodedLength(encodedBuffer, index); + var bitLength = length * 7; + var byteLength = Math.ceil(bitLength / 8); + var result = bufs.alloc(byteLength); + var outIndex = 0; + + while (length > 0) { + bits.inject(result, outIndex, 7, encodedBuffer[index]); + outIndex += 7; + index++; + length--; + } + + var signBit; + var signByte; + + if (signed) { + // Sign-extend the last byte. + var lastByte = result[byteLength - 1]; + var endBit = outIndex % 8; + + if (endBit !== 0) { + var shift = 32 - endBit; // 32 because JS bit ops work on 32-bit ints. + + lastByte = result[byteLength - 1] = lastByte << shift >> shift & 0xff; + } + + signBit = lastByte >> 7; + signByte = signBit * 0xff; + } else { + signBit = 0; + signByte = 0; + } // Slice off any superfluous bytes, that is, ones that add no meaningful + // bits (because the value would be the same if they were removed). + + + while (byteLength > 1 && result[byteLength - 1] === signByte && (!signed || result[byteLength - 2] >> 7 === signBit)) { + byteLength--; + } + + result = bufs.resize(result, byteLength); + return { + value: result, + nextIndex: index + }; +} +/* + * Exported bindings + */ + + +function encodeIntBuffer(buffer) { + return encodeBufferCommon(buffer, true); +} + +function decodeIntBuffer(encodedBuffer, index) { + return decodeBufferCommon(encodedBuffer, index, true); +} + +function encodeInt32(num) { + var buf = new Uint8Array(4); + buf[0] = num & 0xff; + buf[1] = num >> 8 & 0xff; + buf[2] = num >> 16 & 0xff; + buf[3] = num >> 24 & 0xff; + var result = encodeIntBuffer(buf); + return result; +} + +function decodeInt32(encodedBuffer, index) { + var result = decodeIntBuffer(encodedBuffer, index); + var parsed = bufs.readInt(result.value); + var value = parsed.value; + bufs.free(result.value); + + if (value < MIN_INT32 || value > MAX_INT32) { + throw new Error("integer too large"); + } + + return { + value: value, + nextIndex: result.nextIndex + }; +} + +function encodeInt64(num) { + var buf = bufs.alloc(8); + bufs.writeInt64(num, buf); + var result = encodeIntBuffer(buf); + bufs.free(buf); + return result; +} + +function decodeInt64(encodedBuffer, index) { + var result = decodeIntBuffer(encodedBuffer, index); // sign-extend if necessary + + var length = result.value.length; + + if (result.value[length - 1] >> 7) { + result.value = bufs.resize(result.value, 8); + result.value.fill(255, length); + } + + var value = _long["default"].fromBytesLE(result.value, false); + + bufs.free(result.value); + return { + value: value, + nextIndex: result.nextIndex, + lossy: false + }; +} + +function encodeUIntBuffer(buffer) { + return encodeBufferCommon(buffer, false); +} + +function decodeUIntBuffer(encodedBuffer, index) { + return decodeBufferCommon(encodedBuffer, index, false); +} + +function encodeUInt32(num) { + var buf = new Uint8Array(4); + buf[0] = num & 0xff; + buf[1] = num >> 8 & 0xff; + buf[2] = num >> 16 & 0xff; + buf[3] = num >> 24 & 0xff; + var result = encodeUIntBuffer(buf); + return result; +} + +function decodeUInt32(encodedBuffer, index) { + var result = decodeUIntBuffer(encodedBuffer, index); + var parsed = bufs.readUInt(result.value); + var value = parsed.value; + bufs.free(result.value); + + if (value > MAX_UINT32) { + throw new Error("integer too large"); + } + + return { + value: value, + nextIndex: result.nextIndex + }; +} + +function encodeUInt64(num) { + var buf = bufs.alloc(8); + bufs.writeUInt64(num, buf); + var result = encodeUIntBuffer(buf); + bufs.free(buf); + return result; +} + +function decodeUInt64(encodedBuffer, index) { + var result = decodeUIntBuffer(encodedBuffer, index); + + var value = _long["default"].fromBytesLE(result.value, true); + + bufs.free(result.value); + return { + value: value, + nextIndex: result.nextIndex, + lossy: false + }; +} + +var _default = { + decodeInt32: decodeInt32, + decodeInt64: decodeInt64, + decodeIntBuffer: decodeIntBuffer, + decodeUInt32: decodeUInt32, + decodeUInt64: decodeUInt64, + decodeUIntBuffer: decodeUIntBuffer, + encodeInt32: encodeInt32, + encodeInt64: encodeInt64, + encodeIntBuffer: encodeIntBuffer, + encodeUInt32: encodeUInt32, + encodeUInt64: encodeUInt64, + encodeUIntBuffer: encodeUIntBuffer +}; +exports["default"] = _default; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/package.json new file mode 100644 index 0000000000000000000000000000000000000000..bc77e317c4eb4a425d1c6427140343bcd8b496d4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/leb128/package.json @@ -0,0 +1,23 @@ +{ + "name": "@webassemblyjs/leb128", + "version": "1.13.2", + "description": "LEB128 decoder and encoder", + "license": "Apache-2.0", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git", + "directory": "packages/leb128" + }, + "dependencies": { + "@xtuc/long": "4.2.2" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/esm/decoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/esm/decoder.js new file mode 100644 index 0000000000000000000000000000000000000000..787cabbb4e0e78ae4fa4aea8306523b16a408182 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/esm/decoder.js @@ -0,0 +1,67 @@ +function con(b) { + if ((b & 0xc0) === 0x80) { + return b & 0x3f; + } else { + throw new Error("invalid UTF-8 encoding"); + } +} + +function code(min, n) { + if (n < min || 0xd800 <= n && n < 0xe000 || n >= 0x10000) { + throw new Error("invalid UTF-8 encoding"); + } else { + return n; + } +} + +export function decode(bytes) { + return _decode(bytes).map(function (x) { + return String.fromCharCode(x); + }).join(""); +} + +function _decode(bytes) { + var result = []; + + while (bytes.length > 0) { + var b1 = bytes[0]; + + if (b1 < 0x80) { + result.push(code(0x0, b1)); + bytes = bytes.slice(1); + continue; + } + + if (b1 < 0xc0) { + throw new Error("invalid UTF-8 encoding"); + } + + var b2 = bytes[1]; + + if (b1 < 0xe0) { + result.push(code(0x80, ((b1 & 0x1f) << 6) + con(b2))); + bytes = bytes.slice(2); + continue; + } + + var b3 = bytes[2]; + + if (b1 < 0xf0) { + result.push(code(0x800, ((b1 & 0x0f) << 12) + (con(b2) << 6) + con(b3))); + bytes = bytes.slice(3); + continue; + } + + var b4 = bytes[3]; + + if (b1 < 0xf8) { + result.push(code(0x10000, (((b1 & 0x07) << 18) + con(b2) << 12) + (con(b3) << 6) + con(b4))); + bytes = bytes.slice(4); + continue; + } + + throw new Error("invalid UTF-8 encoding"); + } + + return result; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/esm/encoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/esm/encoder.js new file mode 100644 index 0000000000000000000000000000000000000000..f7aab09b875067f6558293358c4e9cffabcb48bf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/esm/encoder.js @@ -0,0 +1,60 @@ +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function con(n) { + return 0x80 | n & 0x3f; +} + +export function encode(str) { + var arr = str.split("").map(function (x) { + return x.charCodeAt(0); + }); + return _encode(arr); +} + +function _encode(arr) { + if (arr.length === 0) { + return []; + } + + var _arr = _toArray(arr), + n = _arr[0], + ns = _arr.slice(1); + + if (n < 0) { + throw new Error("utf8"); + } + + if (n < 0x80) { + return [n].concat(_toConsumableArray(_encode(ns))); + } + + if (n < 0x800) { + return [0xc0 | n >>> 6, con(n)].concat(_toConsumableArray(_encode(ns))); + } + + if (n < 0x10000) { + return [0xe0 | n >>> 12, con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns))); + } + + if (n < 0x110000) { + return [0xf0 | n >>> 18, con(n >>> 12), con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns))); + } + + throw new Error("utf8"); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2e31357aa171f65bb95cda6ce2d7a7297299f1fe --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/esm/index.js @@ -0,0 +1,2 @@ +export { decode } from "./decoder"; +export { encode } from "./encoder"; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/lib/decoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/lib/decoder.js new file mode 100644 index 0000000000000000000000000000000000000000..305a2b6ebbf58d95701c0606eb3d33c3a94c5433 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/lib/decoder.js @@ -0,0 +1,74 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.decode = decode; + +function con(b) { + if ((b & 0xc0) === 0x80) { + return b & 0x3f; + } else { + throw new Error("invalid UTF-8 encoding"); + } +} + +function code(min, n) { + if (n < min || 0xd800 <= n && n < 0xe000 || n >= 0x10000) { + throw new Error("invalid UTF-8 encoding"); + } else { + return n; + } +} + +function decode(bytes) { + return _decode(bytes).map(function (x) { + return String.fromCharCode(x); + }).join(""); +} + +function _decode(bytes) { + var result = []; + + while (bytes.length > 0) { + var b1 = bytes[0]; + + if (b1 < 0x80) { + result.push(code(0x0, b1)); + bytes = bytes.slice(1); + continue; + } + + if (b1 < 0xc0) { + throw new Error("invalid UTF-8 encoding"); + } + + var b2 = bytes[1]; + + if (b1 < 0xe0) { + result.push(code(0x80, ((b1 & 0x1f) << 6) + con(b2))); + bytes = bytes.slice(2); + continue; + } + + var b3 = bytes[2]; + + if (b1 < 0xf0) { + result.push(code(0x800, ((b1 & 0x0f) << 12) + (con(b2) << 6) + con(b3))); + bytes = bytes.slice(3); + continue; + } + + var b4 = bytes[3]; + + if (b1 < 0xf8) { + result.push(code(0x10000, (((b1 & 0x07) << 18) + con(b2) << 12) + (con(b3) << 6) + con(b4))); + bytes = bytes.slice(4); + continue; + } + + throw new Error("invalid UTF-8 encoding"); + } + + return result; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/lib/encoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/lib/encoder.js new file mode 100644 index 0000000000000000000000000000000000000000..5ed0f03d44ece9c088f8bcbd463729158c0888de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/lib/encoder.js @@ -0,0 +1,67 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.encode = encode; + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function con(n) { + return 0x80 | n & 0x3f; +} + +function encode(str) { + var arr = str.split("").map(function (x) { + return x.charCodeAt(0); + }); + return _encode(arr); +} + +function _encode(arr) { + if (arr.length === 0) { + return []; + } + + var _arr = _toArray(arr), + n = _arr[0], + ns = _arr.slice(1); + + if (n < 0) { + throw new Error("utf8"); + } + + if (n < 0x80) { + return [n].concat(_toConsumableArray(_encode(ns))); + } + + if (n < 0x800) { + return [0xc0 | n >>> 6, con(n)].concat(_toConsumableArray(_encode(ns))); + } + + if (n < 0x10000) { + return [0xe0 | n >>> 12, con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns))); + } + + if (n < 0x110000) { + return [0xf0 | n >>> 18, con(n >>> 12), con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns))); + } + + throw new Error("utf8"); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..fef9470173995f1c7262e5d9678ebf35827f6890 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/lib/index.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "decode", { + enumerable: true, + get: function get() { + return _decoder.decode; + } +}); +Object.defineProperty(exports, "encode", { + enumerable: true, + get: function get() { + return _encoder.encode; + } +}); + +var _decoder = require("./decoder"); + +var _encoder = require("./encoder"); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e3b70e1756fa77d0e03a1b38ad40a76307a3d905 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/package.json @@ -0,0 +1,20 @@ +{ + "name": "@webassemblyjs/utf8", + "version": "1.13.2", + "description": "UTF8 encoder/decoder for WASM", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "author": "Sven Sauleau", + "license": "MIT", + "gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/src/decoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/src/decoder.js new file mode 100644 index 0000000000000000000000000000000000000000..de80d1252e39c2e0d08f18459e2f91d884c96b4f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/src/decoder.js @@ -0,0 +1,67 @@ +function con(b) { + if ((b & 0xc0) === 0x80) { + return b & 0x3f; + } else { + throw new Error("invalid UTF-8 encoding"); + } +} + +function code(min, n) { + if (n < min || (0xd800 <= n && n < 0xe000) || n >= 0x10000) { + throw new Error("invalid UTF-8 encoding"); + } else { + return n; + } +} + +export function decode(bytes) { + return _decode(bytes) + .map((x) => String.fromCharCode(x)) + .join(""); +} + +function _decode(bytes) { + const result = []; + while (bytes.length > 0) { + const b1 = bytes[0]; + if (b1 < 0x80) { + result.push(code(0x0, b1)); + bytes = bytes.slice(1); + continue; + } + + if (b1 < 0xc0) { + throw new Error("invalid UTF-8 encoding"); + } + + const b2 = bytes[1]; + if (b1 < 0xe0) { + result.push(code(0x80, ((b1 & 0x1f) << 6) + con(b2))); + bytes = bytes.slice(2); + continue; + } + + const b3 = bytes[2]; + if (b1 < 0xf0) { + result.push(code(0x800, ((b1 & 0x0f) << 12) + (con(b2) << 6) + con(b3))); + bytes = bytes.slice(3); + continue; + } + + const b4 = bytes[3]; + if (b1 < 0xf8) { + result.push( + code( + 0x10000, + ((((b1 & 0x07) << 18) + con(b2)) << 12) + (con(b3) << 6) + con(b4) + ) + ); + bytes = bytes.slice(4); + continue; + } + + throw new Error("invalid UTF-8 encoding"); + } + + return result; +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/src/encoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/src/encoder.js new file mode 100644 index 0000000000000000000000000000000000000000..b17951fd2a68754609f4fe7e321fb3a233cc63c0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/src/encoder.js @@ -0,0 +1,44 @@ +function con(n) { + return 0x80 | (n & 0x3f); +} + +export function encode(str) { + const arr = str.split("").map((x) => x.charCodeAt(0)); + return _encode(arr); +} + +function _encode(arr) { + if (arr.length === 0) { + return []; + } + + const [n, ...ns] = arr; + + if (n < 0) { + throw new Error("utf8"); + } + + if (n < 0x80) { + return [n, ..._encode(ns)]; + } + + if (n < 0x800) { + return [0xc0 | (n >>> 6), con(n), ..._encode(ns)]; + } + + if (n < 0x10000) { + return [0xe0 | (n >>> 12), con(n >>> 6), con(n), ..._encode(ns)]; + } + + if (n < 0x110000) { + return [ + 0xf0 | (n >>> 18), + con(n >>> 12), + con(n >>> 6), + con(n), + ..._encode(ns), + ]; + } + + throw new Error("utf8"); +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/src/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..82cf9a70124d057f906c1363a90c03e1c1666abd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/src/index.js @@ -0,0 +1,4 @@ +// @flow + +export { decode } from "./decoder"; +export { encode } from "./encoder"; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/test/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/test/index.js new file mode 100644 index 0000000000000000000000000000000000000000..dabdc6cab54ec2b25d4321ddecfd2f2e92599109 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/utf8/test/index.js @@ -0,0 +1,13 @@ +const { assert } = require("chai"); + +const { decode, encode } = require("../lib"); + +describe("UTF8", () => { + it("should f-1(f(x)) = x", () => { + assert.equal(decode(encode("foo")), "foo"); + assert.equal(decode(encode("éé")), "éé"); + + // TODO(sven): utf8 encoder fails here + // assert.equal(decode(encode("🤣见見")), "🤣见見"); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f03462fbdab2f450d718176c8962f9cfe71855b3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/README.md @@ -0,0 +1,86 @@ +# @webassemblyjs/wasm-edit + +> Rewrite a WASM binary + +Replace in-place an AST node in the binary. + +## Installation + +```sh +yarn add @webassemblyjs/wasm-edit +``` + +## Usage + +Update: + +```js +import { edit } from "@webassemblyjs/wasm-edit"; + +const binary = [/*...*/]; + +const visitors = { + ModuleImport({ node }) { + node.module = "foo"; + node.name = "bar"; + } +}; + +const newBinary = edit(binary, visitors); +``` + +Replace: + +```js +import { edit } from "@webassemblyjs/wasm-edit"; + +const binary = [/*...*/]; + +const visitors = { + Instr(path) { + const newNode = t.callInstruction(t.indexLiteral(0)); + path.replaceWith(newNode); + } +}; + +const newBinary = edit(binary, visitors); +``` + +Remove: + +```js +import { edit } from "@webassemblyjs/wasm-edit"; + +const binary = [/*...*/]; + +const visitors = { + ModuleExport({ node }) { + path.remove() + } +}; + +const newBinary = edit(binary, visitors); +``` + +Insert: + +```js +import { add } from "@webassemblyjs/wasm-edit"; + +const binary = [/*...*/]; + +const newBinary = add(actualBinary, [ + t.moduleImport("env", "mem", t.memory(t.limit(1))) +]); +``` + +## Providing the AST + +Providing an AST allows you to handle the decoding yourself, here is the API: + +```js +addWithAST(Program, ArrayBuffer, Array): ArrayBuffer; +editWithAST(Program, ArrayBuffer, visitors): ArrayBuffer; +``` + +Note that the AST will be updated in-place. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/esm/apply.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/esm/apply.js new file mode 100644 index 0000000000000000000000000000000000000000..e4c68ce5b87c8453339c9e8c9019584cdcefd274 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/esm/apply.js @@ -0,0 +1,306 @@ +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +import { encodeNode } from "@webassemblyjs/wasm-gen"; +import { encodeU32 } from "@webassemblyjs/wasm-gen/lib/encoder"; +import { isFunc, isGlobal, assertHasLoc, orderedInsertNode, getSectionMetadata, traverse, getEndOfSection } from "@webassemblyjs/ast"; +import { resizeSectionByteSize, resizeSectionVecSize, createEmptySection, removeSections } from "@webassemblyjs/helper-wasm-section"; +import { overrideBytesInBuffer } from "@webassemblyjs/helper-buffer"; +import { getSectionForNode } from "@webassemblyjs/helper-wasm-bytecode"; + +function shiftLocNodeByDelta(node, delta) { + assertHasLoc(node); // $FlowIgnore: assertHasLoc ensures that + + node.loc.start.column += delta; // $FlowIgnore: assertHasLoc ensures that + + node.loc.end.column += delta; +} + +function applyUpdate(ast, uint8Buffer, _ref) { + var _ref2 = _slicedToArray(_ref, 2), + oldNode = _ref2[0], + newNode = _ref2[1]; + + var deltaElements = 0; + assertHasLoc(oldNode); + var sectionName = getSectionForNode(newNode); + var replacementByteArray = encodeNode(newNode); + /** + * Replace new node as bytes + */ + + uint8Buffer = overrideBytesInBuffer(uint8Buffer, // $FlowIgnore: assertHasLoc ensures that + oldNode.loc.start.column, // $FlowIgnore: assertHasLoc ensures that + oldNode.loc.end.column, replacementByteArray); + /** + * Update function body size if needed + */ + + if (sectionName === "code") { + // Find the parent func + traverse(ast, { + Func: function Func(_ref3) { + var node = _ref3.node; + var funcHasThisIntr = node.body.find(function (n) { + return n === newNode; + }) !== undefined; // Update func's body size if needed + + if (funcHasThisIntr === true) { + // These are the old functions locations informations + assertHasLoc(node); + var oldNodeSize = encodeNode(oldNode).length; + var bodySizeDeltaBytes = replacementByteArray.length - oldNodeSize; + + if (bodySizeDeltaBytes !== 0) { + var newValue = node.metadata.bodySize + bodySizeDeltaBytes; + var newByteArray = encodeU32(newValue); // function body size byte + // FIXME(sven): only handles one byte u32 + + var start = node.loc.start.column; + var end = start + 1; + uint8Buffer = overrideBytesInBuffer(uint8Buffer, start, end, newByteArray); + } + } + } + }); + } + /** + * Update section size + */ + + + var deltaBytes = replacementByteArray.length - (oldNode.loc.end.column - oldNode.loc.start.column); // Init location informations + + newNode.loc = { + start: { + line: -1, + column: -1 + }, + end: { + line: -1, + column: -1 + } + }; // Update new node end position + // $FlowIgnore: assertHasLoc ensures that + + newNode.loc.start.column = oldNode.loc.start.column; // $FlowIgnore: assertHasLoc ensures that + + newNode.loc.end.column = // $FlowIgnore: assertHasLoc ensures that + oldNode.loc.start.column + replacementByteArray.length; + return { + uint8Buffer: uint8Buffer, + deltaBytes: deltaBytes, + deltaElements: deltaElements + }; +} + +function applyDelete(ast, uint8Buffer, node) { + var deltaElements = -1; // since we removed an element + + assertHasLoc(node); + var sectionName = getSectionForNode(node); + + if (sectionName === "start") { + var sectionMetadata = getSectionMetadata(ast, "start"); + /** + * The start section only contains one element, + * we need to remove the whole section + */ + + uint8Buffer = removeSections(ast, uint8Buffer, "start"); + + var _deltaBytes = -(sectionMetadata.size.value + 1); + /* section id */ + + + return { + uint8Buffer: uint8Buffer, + deltaBytes: _deltaBytes, + deltaElements: deltaElements + }; + } // replacement is nothing + + + var replacement = []; + uint8Buffer = overrideBytesInBuffer(uint8Buffer, // $FlowIgnore: assertHasLoc ensures that + node.loc.start.column, // $FlowIgnore: assertHasLoc ensures that + node.loc.end.column, replacement); + /** + * Update section + */ + // $FlowIgnore: assertHasLoc ensures that + + var deltaBytes = -(node.loc.end.column - node.loc.start.column); + return { + uint8Buffer: uint8Buffer, + deltaBytes: deltaBytes, + deltaElements: deltaElements + }; +} + +function applyAdd(ast, uint8Buffer, node) { + var deltaElements = +1; // since we added an element + + var sectionName = getSectionForNode(node); + var sectionMetadata = getSectionMetadata(ast, sectionName); // Section doesn't exists, we create an empty one + + if (typeof sectionMetadata === "undefined") { + var res = createEmptySection(ast, uint8Buffer, sectionName); + uint8Buffer = res.uint8Buffer; + sectionMetadata = res.sectionMetadata; + } + /** + * check that the expressions were ended + */ + + + if (isFunc(node)) { + // $FlowIgnore + var body = node.body; + + if (body.length === 0 || body[body.length - 1].id !== "end") { + throw new Error("expressions must be ended"); + } + } + + if (isGlobal(node)) { + // $FlowIgnore + var body = node.init; + + if (body.length === 0 || body[body.length - 1].id !== "end") { + throw new Error("expressions must be ended"); + } + } + /** + * Add nodes + */ + + + var newByteArray = encodeNode(node); // The size of the section doesn't include the storage of the size itself + // we need to manually add it here + + var start = getEndOfSection(sectionMetadata); + var end = start; + /** + * Update section + */ + + var deltaBytes = newByteArray.length; + uint8Buffer = overrideBytesInBuffer(uint8Buffer, start, end, newByteArray); + node.loc = { + start: { + line: -1, + column: start + }, + end: { + line: -1, + column: start + deltaBytes + } + }; // for func add the additional metadata in the AST + + if (node.type === "Func") { + // the size is the first byte + // FIXME(sven): handle LEB128 correctly here + var bodySize = newByteArray[0]; + node.metadata = { + bodySize: bodySize + }; + } + + if (node.type !== "IndexInFuncSection") { + orderedInsertNode(ast.body[0], node); + } + + return { + uint8Buffer: uint8Buffer, + deltaBytes: deltaBytes, + deltaElements: deltaElements + }; +} + +export function applyOperations(ast, uint8Buffer, ops) { + ops.forEach(function (op) { + var state; + var sectionName; + + switch (op.kind) { + case "update": + state = applyUpdate(ast, uint8Buffer, [op.oldNode, op.node]); + sectionName = getSectionForNode(op.node); + break; + + case "delete": + state = applyDelete(ast, uint8Buffer, op.node); + sectionName = getSectionForNode(op.node); + break; + + case "add": + state = applyAdd(ast, uint8Buffer, op.node); + sectionName = getSectionForNode(op.node); + break; + + default: + throw new Error("Unknown operation"); + } + /** + * Resize section vec size. + * If the length of the LEB-encoded size changes, this can change + * the byte length of the section and the offset for nodes in the + * section. So we do this first before resizing section byte size + * or shifting following operations' nodes. + */ + + + if (state.deltaElements !== 0 && sectionName !== "start") { + var oldBufferLength = state.uint8Buffer.length; + state.uint8Buffer = resizeSectionVecSize(ast, state.uint8Buffer, sectionName, state.deltaElements); // Infer bytes added/removed by comparing buffer lengths + + state.deltaBytes += state.uint8Buffer.length - oldBufferLength; + } + /** + * Resize section byte size. + * If the length of the LEB-encoded size changes, this can change + * the offset for nodes in the section. So we do this before + * shifting following operations' nodes. + */ + + + if (state.deltaBytes !== 0 && sectionName !== "start") { + var _oldBufferLength = state.uint8Buffer.length; + state.uint8Buffer = resizeSectionByteSize(ast, state.uint8Buffer, sectionName, state.deltaBytes); // Infer bytes added/removed by comparing buffer lengths + + state.deltaBytes += state.uint8Buffer.length - _oldBufferLength; + } + /** + * Shift following operation's nodes + */ + + + if (state.deltaBytes !== 0) { + ops.forEach(function (op) { + // We don't need to handle add ops, they are positioning independent + switch (op.kind) { + case "update": + shiftLocNodeByDelta(op.oldNode, state.deltaBytes); + break; + + case "delete": + shiftLocNodeByDelta(op.node, state.deltaBytes); + break; + } + }); + } + + uint8Buffer = state.uint8Buffer; + }); + return uint8Buffer; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..347be0cd8857ee8286ae194614147f59655e861a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/esm/index.js @@ -0,0 +1,111 @@ +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +import { decode } from "@webassemblyjs/wasm-parser"; +import { traverse } from "@webassemblyjs/ast"; +import { cloneNode } from "@webassemblyjs/ast/lib/clone"; +import { shrinkPaddedLEB128 } from "@webassemblyjs/wasm-opt"; +import { getSectionForNode } from "@webassemblyjs/helper-wasm-bytecode"; +import constants from "@webassemblyjs/helper-wasm-bytecode"; +import { applyOperations } from "./apply"; + +function hashNode(node) { + return JSON.stringify(node); +} + +function preprocess(ab) { + var optBin = shrinkPaddedLEB128(new Uint8Array(ab)); + return optBin.buffer; +} + +function sortBySectionOrder(nodes) { + var originalOrder = new Map(); + + var _iterator = _createForOfIteratorHelper(nodes), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var node = _step.value; + originalOrder.set(node, originalOrder.size); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + nodes.sort(function (a, b) { + var sectionA = getSectionForNode(a); + var sectionB = getSectionForNode(b); + var aId = constants.sections[sectionA]; + var bId = constants.sections[sectionB]; + + if (typeof aId !== "number" || typeof bId !== "number") { + throw new Error("Section id not found"); + } + + if (aId === bId) { + // $FlowIgnore originalOrder is filled for all nodes + return originalOrder.get(a) - originalOrder.get(b); + } + + return aId - bId; + }); +} + +export function edit(ab, visitors) { + ab = preprocess(ab); + var ast = decode(ab); + return editWithAST(ast, ab, visitors); +} +export function editWithAST(ast, ab, visitors) { + var operations = []; + var uint8Buffer = new Uint8Array(ab); + var nodeBefore; + + function before(type, path) { + nodeBefore = cloneNode(path.node); + } + + function after(type, path) { + if (path.node._deleted === true) { + operations.push({ + kind: "delete", + node: path.node + }); // $FlowIgnore + } else if (hashNode(nodeBefore) !== hashNode(path.node)) { + operations.push({ + kind: "update", + oldNode: nodeBefore, + node: path.node + }); + } + } + + traverse(ast, visitors, before, after); + uint8Buffer = applyOperations(ast, uint8Buffer, operations); + return uint8Buffer.buffer; +} +export function add(ab, newNodes) { + ab = preprocess(ab); + var ast = decode(ab); + return addWithAST(ast, ab, newNodes); +} +export function addWithAST(ast, ab, newNodes) { + // Sort nodes by insertion order + sortBySectionOrder(newNodes); + var uint8Buffer = new Uint8Array(ab); // Map node into operations + + var operations = newNodes.map(function (n) { + return { + kind: "add", + node: n + }; + }); + uint8Buffer = applyOperations(ast, uint8Buffer, operations); + return uint8Buffer.buffer; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/lib/apply.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/lib/apply.js new file mode 100644 index 0000000000000000000000000000000000000000..cdb6d1bc8f7f1919429ac9de9d5e470c4ddbc32a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/lib/apply.js @@ -0,0 +1,318 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.applyOperations = applyOperations; + +var _wasmGen = require("@webassemblyjs/wasm-gen"); + +var _encoder = require("@webassemblyjs/wasm-gen/lib/encoder"); + +var _ast = require("@webassemblyjs/ast"); + +var _helperWasmSection = require("@webassemblyjs/helper-wasm-section"); + +var _helperBuffer = require("@webassemblyjs/helper-buffer"); + +var _helperWasmBytecode = require("@webassemblyjs/helper-wasm-bytecode"); + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function shiftLocNodeByDelta(node, delta) { + (0, _ast.assertHasLoc)(node); // $FlowIgnore: assertHasLoc ensures that + + node.loc.start.column += delta; // $FlowIgnore: assertHasLoc ensures that + + node.loc.end.column += delta; +} + +function applyUpdate(ast, uint8Buffer, _ref) { + var _ref2 = _slicedToArray(_ref, 2), + oldNode = _ref2[0], + newNode = _ref2[1]; + + var deltaElements = 0; + (0, _ast.assertHasLoc)(oldNode); + var sectionName = (0, _helperWasmBytecode.getSectionForNode)(newNode); + var replacementByteArray = (0, _wasmGen.encodeNode)(newNode); + /** + * Replace new node as bytes + */ + + uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, // $FlowIgnore: assertHasLoc ensures that + oldNode.loc.start.column, // $FlowIgnore: assertHasLoc ensures that + oldNode.loc.end.column, replacementByteArray); + /** + * Update function body size if needed + */ + + if (sectionName === "code") { + // Find the parent func + (0, _ast.traverse)(ast, { + Func: function Func(_ref3) { + var node = _ref3.node; + var funcHasThisIntr = node.body.find(function (n) { + return n === newNode; + }) !== undefined; // Update func's body size if needed + + if (funcHasThisIntr === true) { + // These are the old functions locations informations + (0, _ast.assertHasLoc)(node); + var oldNodeSize = (0, _wasmGen.encodeNode)(oldNode).length; + var bodySizeDeltaBytes = replacementByteArray.length - oldNodeSize; + + if (bodySizeDeltaBytes !== 0) { + var newValue = node.metadata.bodySize + bodySizeDeltaBytes; + var newByteArray = (0, _encoder.encodeU32)(newValue); // function body size byte + // FIXME(sven): only handles one byte u32 + + var start = node.loc.start.column; + var end = start + 1; + uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newByteArray); + } + } + } + }); + } + /** + * Update section size + */ + + + var deltaBytes = replacementByteArray.length - (oldNode.loc.end.column - oldNode.loc.start.column); // Init location informations + + newNode.loc = { + start: { + line: -1, + column: -1 + }, + end: { + line: -1, + column: -1 + } + }; // Update new node end position + // $FlowIgnore: assertHasLoc ensures that + + newNode.loc.start.column = oldNode.loc.start.column; // $FlowIgnore: assertHasLoc ensures that + + newNode.loc.end.column = // $FlowIgnore: assertHasLoc ensures that + oldNode.loc.start.column + replacementByteArray.length; + return { + uint8Buffer: uint8Buffer, + deltaBytes: deltaBytes, + deltaElements: deltaElements + }; +} + +function applyDelete(ast, uint8Buffer, node) { + var deltaElements = -1; // since we removed an element + + (0, _ast.assertHasLoc)(node); + var sectionName = (0, _helperWasmBytecode.getSectionForNode)(node); + + if (sectionName === "start") { + var sectionMetadata = (0, _ast.getSectionMetadata)(ast, "start"); + /** + * The start section only contains one element, + * we need to remove the whole section + */ + + uint8Buffer = (0, _helperWasmSection.removeSections)(ast, uint8Buffer, "start"); + + var _deltaBytes = -(sectionMetadata.size.value + 1); + /* section id */ + + + return { + uint8Buffer: uint8Buffer, + deltaBytes: _deltaBytes, + deltaElements: deltaElements + }; + } // replacement is nothing + + + var replacement = []; + uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, // $FlowIgnore: assertHasLoc ensures that + node.loc.start.column, // $FlowIgnore: assertHasLoc ensures that + node.loc.end.column, replacement); + /** + * Update section + */ + // $FlowIgnore: assertHasLoc ensures that + + var deltaBytes = -(node.loc.end.column - node.loc.start.column); + return { + uint8Buffer: uint8Buffer, + deltaBytes: deltaBytes, + deltaElements: deltaElements + }; +} + +function applyAdd(ast, uint8Buffer, node) { + var deltaElements = +1; // since we added an element + + var sectionName = (0, _helperWasmBytecode.getSectionForNode)(node); + var sectionMetadata = (0, _ast.getSectionMetadata)(ast, sectionName); // Section doesn't exists, we create an empty one + + if (typeof sectionMetadata === "undefined") { + var res = (0, _helperWasmSection.createEmptySection)(ast, uint8Buffer, sectionName); + uint8Buffer = res.uint8Buffer; + sectionMetadata = res.sectionMetadata; + } + /** + * check that the expressions were ended + */ + + + if ((0, _ast.isFunc)(node)) { + // $FlowIgnore + var body = node.body; + + if (body.length === 0 || body[body.length - 1].id !== "end") { + throw new Error("expressions must be ended"); + } + } + + if ((0, _ast.isGlobal)(node)) { + // $FlowIgnore + var body = node.init; + + if (body.length === 0 || body[body.length - 1].id !== "end") { + throw new Error("expressions must be ended"); + } + } + /** + * Add nodes + */ + + + var newByteArray = (0, _wasmGen.encodeNode)(node); // The size of the section doesn't include the storage of the size itself + // we need to manually add it here + + var start = (0, _ast.getEndOfSection)(sectionMetadata); + var end = start; + /** + * Update section + */ + + var deltaBytes = newByteArray.length; + uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newByteArray); + node.loc = { + start: { + line: -1, + column: start + }, + end: { + line: -1, + column: start + deltaBytes + } + }; // for func add the additional metadata in the AST + + if (node.type === "Func") { + // the size is the first byte + // FIXME(sven): handle LEB128 correctly here + var bodySize = newByteArray[0]; + node.metadata = { + bodySize: bodySize + }; + } + + if (node.type !== "IndexInFuncSection") { + (0, _ast.orderedInsertNode)(ast.body[0], node); + } + + return { + uint8Buffer: uint8Buffer, + deltaBytes: deltaBytes, + deltaElements: deltaElements + }; +} + +function applyOperations(ast, uint8Buffer, ops) { + ops.forEach(function (op) { + var state; + var sectionName; + + switch (op.kind) { + case "update": + state = applyUpdate(ast, uint8Buffer, [op.oldNode, op.node]); + sectionName = (0, _helperWasmBytecode.getSectionForNode)(op.node); + break; + + case "delete": + state = applyDelete(ast, uint8Buffer, op.node); + sectionName = (0, _helperWasmBytecode.getSectionForNode)(op.node); + break; + + case "add": + state = applyAdd(ast, uint8Buffer, op.node); + sectionName = (0, _helperWasmBytecode.getSectionForNode)(op.node); + break; + + default: + throw new Error("Unknown operation"); + } + /** + * Resize section vec size. + * If the length of the LEB-encoded size changes, this can change + * the byte length of the section and the offset for nodes in the + * section. So we do this first before resizing section byte size + * or shifting following operations' nodes. + */ + + + if (state.deltaElements !== 0 && sectionName !== "start") { + var oldBufferLength = state.uint8Buffer.length; + state.uint8Buffer = (0, _helperWasmSection.resizeSectionVecSize)(ast, state.uint8Buffer, sectionName, state.deltaElements); // Infer bytes added/removed by comparing buffer lengths + + state.deltaBytes += state.uint8Buffer.length - oldBufferLength; + } + /** + * Resize section byte size. + * If the length of the LEB-encoded size changes, this can change + * the offset for nodes in the section. So we do this before + * shifting following operations' nodes. + */ + + + if (state.deltaBytes !== 0 && sectionName !== "start") { + var _oldBufferLength = state.uint8Buffer.length; + state.uint8Buffer = (0, _helperWasmSection.resizeSectionByteSize)(ast, state.uint8Buffer, sectionName, state.deltaBytes); // Infer bytes added/removed by comparing buffer lengths + + state.deltaBytes += state.uint8Buffer.length - _oldBufferLength; + } + /** + * Shift following operation's nodes + */ + + + if (state.deltaBytes !== 0) { + ops.forEach(function (op) { + // We don't need to handle add ops, they are positioning independent + switch (op.kind) { + case "update": + shiftLocNodeByDelta(op.oldNode, state.deltaBytes); + break; + + case "delete": + shiftLocNodeByDelta(op.node, state.deltaBytes); + break; + } + }); + } + + uint8Buffer = state.uint8Buffer; + }); + return uint8Buffer; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..02f6c5e0d9545678bc1215bfcb7f805bc061e61f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/lib/index.js @@ -0,0 +1,134 @@ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.edit = edit; +exports.editWithAST = editWithAST; +exports.add = add; +exports.addWithAST = addWithAST; + +var _wasmParser = require("@webassemblyjs/wasm-parser"); + +var _ast = require("@webassemblyjs/ast"); + +var _clone = require("@webassemblyjs/ast/lib/clone"); + +var _wasmOpt = require("@webassemblyjs/wasm-opt"); + +var _helperWasmBytecode = _interopRequireWildcard(require("@webassemblyjs/helper-wasm-bytecode")); + +var _apply = require("./apply"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function hashNode(node) { + return JSON.stringify(node); +} + +function preprocess(ab) { + var optBin = (0, _wasmOpt.shrinkPaddedLEB128)(new Uint8Array(ab)); + return optBin.buffer; +} + +function sortBySectionOrder(nodes) { + var originalOrder = new Map(); + + var _iterator = _createForOfIteratorHelper(nodes), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var node = _step.value; + originalOrder.set(node, originalOrder.size); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + nodes.sort(function (a, b) { + var sectionA = (0, _helperWasmBytecode.getSectionForNode)(a); + var sectionB = (0, _helperWasmBytecode.getSectionForNode)(b); + var aId = _helperWasmBytecode["default"].sections[sectionA]; + var bId = _helperWasmBytecode["default"].sections[sectionB]; + + if (typeof aId !== "number" || typeof bId !== "number") { + throw new Error("Section id not found"); + } + + if (aId === bId) { + // $FlowIgnore originalOrder is filled for all nodes + return originalOrder.get(a) - originalOrder.get(b); + } + + return aId - bId; + }); +} + +function edit(ab, visitors) { + ab = preprocess(ab); + var ast = (0, _wasmParser.decode)(ab); + return editWithAST(ast, ab, visitors); +} + +function editWithAST(ast, ab, visitors) { + var operations = []; + var uint8Buffer = new Uint8Array(ab); + var nodeBefore; + + function before(type, path) { + nodeBefore = (0, _clone.cloneNode)(path.node); + } + + function after(type, path) { + if (path.node._deleted === true) { + operations.push({ + kind: "delete", + node: path.node + }); // $FlowIgnore + } else if (hashNode(nodeBefore) !== hashNode(path.node)) { + operations.push({ + kind: "update", + oldNode: nodeBefore, + node: path.node + }); + } + } + + (0, _ast.traverse)(ast, visitors, before, after); + uint8Buffer = (0, _apply.applyOperations)(ast, uint8Buffer, operations); + return uint8Buffer.buffer; +} + +function add(ab, newNodes) { + ab = preprocess(ab); + var ast = (0, _wasmParser.decode)(ab); + return addWithAST(ast, ab, newNodes); +} + +function addWithAST(ast, ab, newNodes) { + // Sort nodes by insertion order + sortBySectionOrder(newNodes); + var uint8Buffer = new Uint8Array(ab); // Map node into operations + + var operations = newNodes.map(function (n) { + return { + kind: "add", + node: n + }; + }); + uint8Buffer = (0, _apply.applyOperations)(ast, uint8Buffer, operations); + return uint8Buffer.buffer; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8ef73bcee07150c3f9300601d773f1be8ec863c7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-edit/package.json @@ -0,0 +1,33 @@ +{ + "name": "@webassemblyjs/wasm-edit", + "version": "1.14.1", + "description": "", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "author": "Sven Sauleau", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/helper-wasm-section": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-opt": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1", + "@webassemblyjs/wast-printer": "1.14.1" + }, + "devDependencies": { + "@webassemblyjs/helper-test-framework": "1.14.1" + }, + "gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/esm/encoder/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/esm/encoder/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3d921a0e9e3dc2aba839257657d387393d2436e2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/esm/encoder/index.js @@ -0,0 +1,312 @@ +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +import * as leb from "@webassemblyjs/leb128"; +import * as ieee754 from "@webassemblyjs/ieee754"; +import * as utf8 from "@webassemblyjs/utf8"; +import constants from "@webassemblyjs/helper-wasm-bytecode"; +import { encodeNode } from "../index"; + +function assertNotIdentifierNode(n) { + if (n.type === "Identifier") { + throw new Error("Unsupported node Identifier"); + } +} + +export function encodeVersion(v) { + var bytes = constants.moduleVersion; + bytes[0] = v; + return bytes; +} +export function encodeHeader() { + return constants.magicModuleHeader; +} +export function encodeU32(v) { + var uint8view = new Uint8Array(leb.encodeU32(v)); + + var array = _toConsumableArray(uint8view); + + return array; +} +export function encodeI32(v) { + var uint8view = new Uint8Array(leb.encodeI32(v)); + + var array = _toConsumableArray(uint8view); + + return array; +} +export function encodeI64(v) { + var uint8view = new Uint8Array(leb.encodeI64(v)); + + var array = _toConsumableArray(uint8view); + + return array; +} +export function encodeVec(elements) { + var size = encodeU32(elements.length); + return [].concat(_toConsumableArray(size), _toConsumableArray(elements)); +} +export function encodeValtype(v) { + var _byte = constants.valtypesByString[v]; + + if (typeof _byte === "undefined") { + throw new Error("Unknown valtype: " + v); + } + + return parseInt(_byte, 10); +} +export function encodeMutability(v) { + var _byte2 = constants.globalTypesByString[v]; + + if (typeof _byte2 === "undefined") { + throw new Error("Unknown mutability: " + v); + } + + return parseInt(_byte2, 10); +} +export function encodeUTF8Vec(str) { + return encodeVec(utf8.encode(str)); +} +export function encodeLimits(n) { + var out = []; + + if (typeof n.max === "number") { + out.push(0x01); + out.push.apply(out, _toConsumableArray(encodeU32(n.min))); // $FlowIgnore: ensured by the typeof + + out.push.apply(out, _toConsumableArray(encodeU32(n.max))); + } else { + out.push(0x00); + out.push.apply(out, _toConsumableArray(encodeU32(n.min))); + } + + return out; +} +export function encodeModuleImport(n) { + var out = []; + out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.module))); + out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name))); + + switch (n.descr.type) { + case "GlobalType": + { + out.push(0x03); // $FlowIgnore: GlobalType ensure that these props exists + + out.push(encodeValtype(n.descr.valtype)); // $FlowIgnore: GlobalType ensure that these props exists + + out.push(encodeMutability(n.descr.mutability)); + break; + } + + case "Memory": + { + out.push(0x02); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits))); + break; + } + + case "Table": + { + out.push(0x01); + out.push(0x70); // element type + // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits))); + break; + } + + case "FuncImportDescr": + { + out.push(0x00); // $FlowIgnore + + assertNotIdentifierNode(n.descr.id); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value))); + break; + } + + default: + throw new Error("Unsupport operation: encode module import of type: " + n.descr.type); + } + + return out; +} +export function encodeSectionMetadata(n) { + var out = []; + var sectionId = constants.sections[n.section]; + + if (typeof sectionId === "undefined") { + throw new Error("Unknown section: " + n.section); + } + + if (n.section === "start") { + /** + * This is not implemented yet because it's a special case which + * doesn't have a vector in its section. + */ + throw new Error("Unsupported section encoding of type start"); + } + + out.push(sectionId); + out.push.apply(out, _toConsumableArray(encodeU32(n.size.value))); + out.push.apply(out, _toConsumableArray(encodeU32(n.vectorOfSize.value))); + return out; +} +export function encodeCallInstruction(n) { + var out = []; + assertNotIdentifierNode(n.index); + out.push(0x10); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.index.value))); + return out; +} +export function encodeCallIndirectInstruction(n) { + var out = []; // $FlowIgnore + + assertNotIdentifierNode(n.index); + out.push(0x11); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.index.value))); // add a reserved byte + + out.push(0x00); + return out; +} +export function encodeModuleExport(n) { + var out = []; + assertNotIdentifierNode(n.descr.id); + var exportTypeByteString = constants.exportTypesByName[n.descr.exportType]; + + if (typeof exportTypeByteString === "undefined") { + throw new Error("Unknown export of type: " + n.descr.exportType); + } + + var exportTypeByte = parseInt(exportTypeByteString, 10); + out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name))); + out.push(exportTypeByte); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value))); + return out; +} +export function encodeTypeInstruction(n) { + var out = [0x60]; + var params = n.functype.params.map(function (x) { + return x.valtype; + }).map(encodeValtype); + var results = n.functype.results.map(encodeValtype); + out.push.apply(out, _toConsumableArray(encodeVec(params))); + out.push.apply(out, _toConsumableArray(encodeVec(results))); + return out; +} +export function encodeInstr(n) { + var out = []; + var instructionName = n.id; + + if (typeof n.object === "string") { + instructionName = "".concat(n.object, ".").concat(String(n.id)); + } + + var byteString = constants.symbolsByName[instructionName]; + + if (typeof byteString === "undefined") { + throw new Error("encodeInstr: unknown instruction " + JSON.stringify(instructionName)); + } + + var _byte3 = parseInt(byteString, 10); + + out.push(_byte3); + + if (n.args) { + n.args.forEach(function (arg) { + var encoder = encodeU32; // find correct encoder + + if (n.object === "i32") { + encoder = encodeI32; + } + + if (n.object === "i64") { + encoder = encodeI64; + } + + if (n.object === "f32") { + encoder = ieee754.encodeF32; + } + + if (n.object === "f64") { + encoder = ieee754.encodeF64; + } + + if (arg.type === "NumberLiteral" || arg.type === "FloatLiteral" || arg.type === "LongNumberLiteral") { + // $FlowIgnore + out.push.apply(out, _toConsumableArray(encoder(arg.value))); + } else { + throw new Error("Unsupported instruction argument encoding " + JSON.stringify(arg.type)); + } + }); + } + + return out; +} + +function encodeExpr(instrs) { + var out = []; + instrs.forEach(function (instr) { + // $FlowIgnore + var n = encodeNode(instr); + out.push.apply(out, _toConsumableArray(n)); + }); + return out; +} + +export function encodeStringLiteral(n) { + return encodeUTF8Vec(n.value); +} +export function encodeGlobal(n) { + var out = []; + var _n$globalType = n.globalType, + valtype = _n$globalType.valtype, + mutability = _n$globalType.mutability; + out.push(encodeValtype(valtype)); + out.push(encodeMutability(mutability)); + out.push.apply(out, _toConsumableArray(encodeExpr(n.init))); + return out; +} +export function encodeFuncBody(n) { + var out = []; + out.push(-1); // temporary function body size + // FIXME(sven): get the func locals? + + var localBytes = encodeVec([]); + out.push.apply(out, _toConsumableArray(localBytes)); + var funcBodyBytes = encodeExpr(n.body); + out[0] = funcBodyBytes.length + localBytes.length; + out.push.apply(out, _toConsumableArray(funcBodyBytes)); + return out; +} +export function encodeIndexInFuncSection(n) { + assertNotIdentifierNode(n.index); // $FlowIgnore + + return encodeU32(n.index.value); +} +export function encodeElem(n) { + var out = []; + assertNotIdentifierNode(n.table); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.table.value))); + out.push.apply(out, _toConsumableArray(encodeExpr(n.offset))); // $FlowIgnore + + var funcs = n.funcs.reduce(function (acc, x) { + return [].concat(_toConsumableArray(acc), _toConsumableArray(encodeU32(x.value))); + }, []); + out.push.apply(out, _toConsumableArray(encodeVec(funcs))); + return out; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..83bc19faead104ba89ac2e89fa28419e4d7d185d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/esm/index.js @@ -0,0 +1,51 @@ +import * as encoder from "./encoder"; +export function encodeNode(n) { + switch (n.type) { + case "ModuleImport": + // $FlowIgnore: ModuleImport ensure that the node is well formated + return encoder.encodeModuleImport(n); + + case "SectionMetadata": + // $FlowIgnore: SectionMetadata ensure that the node is well formated + return encoder.encodeSectionMetadata(n); + + case "CallInstruction": + // $FlowIgnore: SectionMetadata ensure that the node is well formated + return encoder.encodeCallInstruction(n); + + case "CallIndirectInstruction": + // $FlowIgnore: SectionMetadata ensure that the node is well formated + return encoder.encodeCallIndirectInstruction(n); + + case "TypeInstruction": + return encoder.encodeTypeInstruction(n); + + case "Instr": + // $FlowIgnore + return encoder.encodeInstr(n); + + case "ModuleExport": + // $FlowIgnore: SectionMetadata ensure that the node is well formated + return encoder.encodeModuleExport(n); + + case "Global": + // $FlowIgnore + return encoder.encodeGlobal(n); + + case "Func": + return encoder.encodeFuncBody(n); + + case "IndexInFuncSection": + return encoder.encodeIndexInFuncSection(n); + + case "StringLiteral": + return encoder.encodeStringLiteral(n); + + case "Elem": + return encoder.encodeElem(n); + + default: + throw new Error("Unsupported encoding for node of type: " + JSON.stringify(n.type)); + } +} +export var encodeU32 = encoder.encodeU32; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/lib/encoder/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/lib/encoder/index.js new file mode 100644 index 0000000000000000000000000000000000000000..94972d19d2c187539d6ca05076952ee22ef63581 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/lib/encoder/index.js @@ -0,0 +1,372 @@ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.encodeVersion = encodeVersion; +exports.encodeHeader = encodeHeader; +exports.encodeU32 = encodeU32; +exports.encodeI32 = encodeI32; +exports.encodeI64 = encodeI64; +exports.encodeVec = encodeVec; +exports.encodeValtype = encodeValtype; +exports.encodeMutability = encodeMutability; +exports.encodeUTF8Vec = encodeUTF8Vec; +exports.encodeLimits = encodeLimits; +exports.encodeModuleImport = encodeModuleImport; +exports.encodeSectionMetadata = encodeSectionMetadata; +exports.encodeCallInstruction = encodeCallInstruction; +exports.encodeCallIndirectInstruction = encodeCallIndirectInstruction; +exports.encodeModuleExport = encodeModuleExport; +exports.encodeTypeInstruction = encodeTypeInstruction; +exports.encodeInstr = encodeInstr; +exports.encodeStringLiteral = encodeStringLiteral; +exports.encodeGlobal = encodeGlobal; +exports.encodeFuncBody = encodeFuncBody; +exports.encodeIndexInFuncSection = encodeIndexInFuncSection; +exports.encodeElem = encodeElem; + +var leb = _interopRequireWildcard(require("@webassemblyjs/leb128")); + +var ieee754 = _interopRequireWildcard(require("@webassemblyjs/ieee754")); + +var utf8 = _interopRequireWildcard(require("@webassemblyjs/utf8")); + +var _helperWasmBytecode = _interopRequireDefault(require("@webassemblyjs/helper-wasm-bytecode")); + +var _index = require("../index"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function assertNotIdentifierNode(n) { + if (n.type === "Identifier") { + throw new Error("Unsupported node Identifier"); + } +} + +function encodeVersion(v) { + var bytes = _helperWasmBytecode["default"].moduleVersion; + bytes[0] = v; + return bytes; +} + +function encodeHeader() { + return _helperWasmBytecode["default"].magicModuleHeader; +} + +function encodeU32(v) { + var uint8view = new Uint8Array(leb.encodeU32(v)); + + var array = _toConsumableArray(uint8view); + + return array; +} + +function encodeI32(v) { + var uint8view = new Uint8Array(leb.encodeI32(v)); + + var array = _toConsumableArray(uint8view); + + return array; +} + +function encodeI64(v) { + var uint8view = new Uint8Array(leb.encodeI64(v)); + + var array = _toConsumableArray(uint8view); + + return array; +} + +function encodeVec(elements) { + var size = encodeU32(elements.length); + return [].concat(_toConsumableArray(size), _toConsumableArray(elements)); +} + +function encodeValtype(v) { + var _byte = _helperWasmBytecode["default"].valtypesByString[v]; + + if (typeof _byte === "undefined") { + throw new Error("Unknown valtype: " + v); + } + + return parseInt(_byte, 10); +} + +function encodeMutability(v) { + var _byte2 = _helperWasmBytecode["default"].globalTypesByString[v]; + + if (typeof _byte2 === "undefined") { + throw new Error("Unknown mutability: " + v); + } + + return parseInt(_byte2, 10); +} + +function encodeUTF8Vec(str) { + return encodeVec(utf8.encode(str)); +} + +function encodeLimits(n) { + var out = []; + + if (typeof n.max === "number") { + out.push(0x01); + out.push.apply(out, _toConsumableArray(encodeU32(n.min))); // $FlowIgnore: ensured by the typeof + + out.push.apply(out, _toConsumableArray(encodeU32(n.max))); + } else { + out.push(0x00); + out.push.apply(out, _toConsumableArray(encodeU32(n.min))); + } + + return out; +} + +function encodeModuleImport(n) { + var out = []; + out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.module))); + out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name))); + + switch (n.descr.type) { + case "GlobalType": + { + out.push(0x03); // $FlowIgnore: GlobalType ensure that these props exists + + out.push(encodeValtype(n.descr.valtype)); // $FlowIgnore: GlobalType ensure that these props exists + + out.push(encodeMutability(n.descr.mutability)); + break; + } + + case "Memory": + { + out.push(0x02); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits))); + break; + } + + case "Table": + { + out.push(0x01); + out.push(0x70); // element type + // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits))); + break; + } + + case "FuncImportDescr": + { + out.push(0x00); // $FlowIgnore + + assertNotIdentifierNode(n.descr.id); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value))); + break; + } + + default: + throw new Error("Unsupport operation: encode module import of type: " + n.descr.type); + } + + return out; +} + +function encodeSectionMetadata(n) { + var out = []; + var sectionId = _helperWasmBytecode["default"].sections[n.section]; + + if (typeof sectionId === "undefined") { + throw new Error("Unknown section: " + n.section); + } + + if (n.section === "start") { + /** + * This is not implemented yet because it's a special case which + * doesn't have a vector in its section. + */ + throw new Error("Unsupported section encoding of type start"); + } + + out.push(sectionId); + out.push.apply(out, _toConsumableArray(encodeU32(n.size.value))); + out.push.apply(out, _toConsumableArray(encodeU32(n.vectorOfSize.value))); + return out; +} + +function encodeCallInstruction(n) { + var out = []; + assertNotIdentifierNode(n.index); + out.push(0x10); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.index.value))); + return out; +} + +function encodeCallIndirectInstruction(n) { + var out = []; // $FlowIgnore + + assertNotIdentifierNode(n.index); + out.push(0x11); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.index.value))); // add a reserved byte + + out.push(0x00); + return out; +} + +function encodeModuleExport(n) { + var out = []; + assertNotIdentifierNode(n.descr.id); + var exportTypeByteString = _helperWasmBytecode["default"].exportTypesByName[n.descr.exportType]; + + if (typeof exportTypeByteString === "undefined") { + throw new Error("Unknown export of type: " + n.descr.exportType); + } + + var exportTypeByte = parseInt(exportTypeByteString, 10); + out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name))); + out.push(exportTypeByte); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value))); + return out; +} + +function encodeTypeInstruction(n) { + var out = [0x60]; + var params = n.functype.params.map(function (x) { + return x.valtype; + }).map(encodeValtype); + var results = n.functype.results.map(encodeValtype); + out.push.apply(out, _toConsumableArray(encodeVec(params))); + out.push.apply(out, _toConsumableArray(encodeVec(results))); + return out; +} + +function encodeInstr(n) { + var out = []; + var instructionName = n.id; + + if (typeof n.object === "string") { + instructionName = "".concat(n.object, ".").concat(String(n.id)); + } + + var byteString = _helperWasmBytecode["default"].symbolsByName[instructionName]; + + if (typeof byteString === "undefined") { + throw new Error("encodeInstr: unknown instruction " + JSON.stringify(instructionName)); + } + + var _byte3 = parseInt(byteString, 10); + + out.push(_byte3); + + if (n.args) { + n.args.forEach(function (arg) { + var encoder = encodeU32; // find correct encoder + + if (n.object === "i32") { + encoder = encodeI32; + } + + if (n.object === "i64") { + encoder = encodeI64; + } + + if (n.object === "f32") { + encoder = ieee754.encodeF32; + } + + if (n.object === "f64") { + encoder = ieee754.encodeF64; + } + + if (arg.type === "NumberLiteral" || arg.type === "FloatLiteral" || arg.type === "LongNumberLiteral") { + // $FlowIgnore + out.push.apply(out, _toConsumableArray(encoder(arg.value))); + } else { + throw new Error("Unsupported instruction argument encoding " + JSON.stringify(arg.type)); + } + }); + } + + return out; +} + +function encodeExpr(instrs) { + var out = []; + instrs.forEach(function (instr) { + // $FlowIgnore + var n = (0, _index.encodeNode)(instr); + out.push.apply(out, _toConsumableArray(n)); + }); + return out; +} + +function encodeStringLiteral(n) { + return encodeUTF8Vec(n.value); +} + +function encodeGlobal(n) { + var out = []; + var _n$globalType = n.globalType, + valtype = _n$globalType.valtype, + mutability = _n$globalType.mutability; + out.push(encodeValtype(valtype)); + out.push(encodeMutability(mutability)); + out.push.apply(out, _toConsumableArray(encodeExpr(n.init))); + return out; +} + +function encodeFuncBody(n) { + var out = []; + out.push(-1); // temporary function body size + // FIXME(sven): get the func locals? + + var localBytes = encodeVec([]); + out.push.apply(out, _toConsumableArray(localBytes)); + var funcBodyBytes = encodeExpr(n.body); + out[0] = funcBodyBytes.length + localBytes.length; + out.push.apply(out, _toConsumableArray(funcBodyBytes)); + return out; +} + +function encodeIndexInFuncSection(n) { + assertNotIdentifierNode(n.index); // $FlowIgnore + + return encodeU32(n.index.value); +} + +function encodeElem(n) { + var out = []; + assertNotIdentifierNode(n.table); // $FlowIgnore + + out.push.apply(out, _toConsumableArray(encodeU32(n.table.value))); + out.push.apply(out, _toConsumableArray(encodeExpr(n.offset))); // $FlowIgnore + + var funcs = n.funcs.reduce(function (acc, x) { + return [].concat(_toConsumableArray(acc), _toConsumableArray(encodeU32(x.value))); + }, []); + out.push.apply(out, _toConsumableArray(encodeVec(funcs))); + return out; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e3ce78cc3ca98097ceec3190d836e571468548b2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/lib/index.js @@ -0,0 +1,68 @@ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.encodeNode = encodeNode; +exports.encodeU32 = void 0; + +var encoder = _interopRequireWildcard(require("./encoder")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function encodeNode(n) { + switch (n.type) { + case "ModuleImport": + // $FlowIgnore: ModuleImport ensure that the node is well formated + return encoder.encodeModuleImport(n); + + case "SectionMetadata": + // $FlowIgnore: SectionMetadata ensure that the node is well formated + return encoder.encodeSectionMetadata(n); + + case "CallInstruction": + // $FlowIgnore: SectionMetadata ensure that the node is well formated + return encoder.encodeCallInstruction(n); + + case "CallIndirectInstruction": + // $FlowIgnore: SectionMetadata ensure that the node is well formated + return encoder.encodeCallIndirectInstruction(n); + + case "TypeInstruction": + return encoder.encodeTypeInstruction(n); + + case "Instr": + // $FlowIgnore + return encoder.encodeInstr(n); + + case "ModuleExport": + // $FlowIgnore: SectionMetadata ensure that the node is well formated + return encoder.encodeModuleExport(n); + + case "Global": + // $FlowIgnore + return encoder.encodeGlobal(n); + + case "Func": + return encoder.encodeFuncBody(n); + + case "IndexInFuncSection": + return encoder.encodeIndexInFuncSection(n); + + case "StringLiteral": + return encoder.encodeStringLiteral(n); + + case "Elem": + return encoder.encodeElem(n); + + default: + throw new Error("Unsupported encoding for node of type: " + JSON.stringify(n.type)); + } +} + +var encodeU32 = encoder.encodeU32; +exports.encodeU32 = encodeU32; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/package.json new file mode 100644 index 0000000000000000000000000000000000000000..84b9093d83e31b9cd0f027e96b71e033e403a2bd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-gen/package.json @@ -0,0 +1,27 @@ +{ + "name": "@webassemblyjs/wasm-gen", + "version": "1.14.1", + "description": "WebAssembly binary format printer", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "author": "Sven Sauleau", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + }, + "gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f52d4abc4d6ec1c4d0904f7de7a71306af45998c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/esm/index.js @@ -0,0 +1,57 @@ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } + +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +import { decode } from "@webassemblyjs/wasm-parser"; +import { shrinkPaddedLEB128 as makeShrinkPaddedLEB128 } from "./leb128.js"; + +var OptimizerError = /*#__PURE__*/function (_Error) { + _inherits(OptimizerError, _Error); + + var _super = _createSuper(OptimizerError); + + function OptimizerError(name, initalError) { + var _this; + + _classCallCheck(this, OptimizerError); + + _this = _super.call(this, "Error while optimizing: " + name + ": " + initalError.message); + _this.stack = initalError.stack; + return _this; + } + + return OptimizerError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); + +var decoderOpts = { + ignoreCodeSection: true, + ignoreDataSection: true +}; +export function shrinkPaddedLEB128(uint8Buffer) { + try { + var ast = decode(uint8Buffer.buffer, decoderOpts); + return makeShrinkPaddedLEB128(ast, uint8Buffer); + } catch (e) { + throw new OptimizerError("shrinkPaddedLEB128", e); + } +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/esm/leb128.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/esm/leb128.js new file mode 100644 index 0000000000000000000000000000000000000000..3150c9eccdbda11e1d5a0c7a7d742cd4d9f5ae51 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/esm/leb128.js @@ -0,0 +1,47 @@ +import { traverse, shiftSection } from "@webassemblyjs/ast"; +import { encodeU32 } from "@webassemblyjs/wasm-gen/lib/encoder"; +import { overrideBytesInBuffer } from "@webassemblyjs/helper-buffer"; + +function shiftFollowingSections(ast, _ref, deltaInSizeEncoding) { + var section = _ref.section; + // Once we hit our section every that is after needs to be shifted by the delta + var encounteredSection = false; + traverse(ast, { + SectionMetadata: function SectionMetadata(path) { + if (path.node.section === section) { + encounteredSection = true; + return; + } + + if (encounteredSection === true) { + shiftSection(ast, path.node, deltaInSizeEncoding); + } + } + }); +} + +export function shrinkPaddedLEB128(ast, uint8Buffer) { + traverse(ast, { + SectionMetadata: function SectionMetadata(_ref2) { + var node = _ref2.node; + + /** + * Section size + */ + { + var newu32Encoded = encodeU32(node.size.value); + var newu32EncodedLen = newu32Encoded.length; + var start = node.size.loc.start.column; + var end = node.size.loc.end.column; + var oldu32EncodedLen = end - start; + + if (newu32EncodedLen !== oldu32EncodedLen) { + var deltaInSizeEncoding = oldu32EncodedLen - newu32EncodedLen; + uint8Buffer = overrideBytesInBuffer(uint8Buffer, start, end, newu32Encoded); + shiftFollowingSections(ast, node, -deltaInSizeEncoding); + } + } + } + }); + return uint8Buffer; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6409f0c6ca94e25a909fb854eac9084e6559917b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/lib/index.js @@ -0,0 +1,66 @@ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.shrinkPaddedLEB128 = shrinkPaddedLEB128; + +var _wasmParser = require("@webassemblyjs/wasm-parser"); + +var _leb = require("./leb128.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } + +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var OptimizerError = /*#__PURE__*/function (_Error) { + _inherits(OptimizerError, _Error); + + var _super = _createSuper(OptimizerError); + + function OptimizerError(name, initalError) { + var _this; + + _classCallCheck(this, OptimizerError); + + _this = _super.call(this, "Error while optimizing: " + name + ": " + initalError.message); + _this.stack = initalError.stack; + return _this; + } + + return OptimizerError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); + +var decoderOpts = { + ignoreCodeSection: true, + ignoreDataSection: true +}; + +function shrinkPaddedLEB128(uint8Buffer) { + try { + var ast = (0, _wasmParser.decode)(uint8Buffer.buffer, decoderOpts); + return (0, _leb.shrinkPaddedLEB128)(ast, uint8Buffer); + } catch (e) { + throw new OptimizerError("shrinkPaddedLEB128", e); + } +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/lib/leb128.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/lib/leb128.js new file mode 100644 index 0000000000000000000000000000000000000000..e4a0e85d439d93a18442f30834545f443dcac18d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/lib/leb128.js @@ -0,0 +1,56 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.shrinkPaddedLEB128 = shrinkPaddedLEB128; + +var _ast = require("@webassemblyjs/ast"); + +var _encoder = require("@webassemblyjs/wasm-gen/lib/encoder"); + +var _helperBuffer = require("@webassemblyjs/helper-buffer"); + +function shiftFollowingSections(ast, _ref, deltaInSizeEncoding) { + var section = _ref.section; + // Once we hit our section every that is after needs to be shifted by the delta + var encounteredSection = false; + (0, _ast.traverse)(ast, { + SectionMetadata: function SectionMetadata(path) { + if (path.node.section === section) { + encounteredSection = true; + return; + } + + if (encounteredSection === true) { + (0, _ast.shiftSection)(ast, path.node, deltaInSizeEncoding); + } + } + }); +} + +function shrinkPaddedLEB128(ast, uint8Buffer) { + (0, _ast.traverse)(ast, { + SectionMetadata: function SectionMetadata(_ref2) { + var node = _ref2.node; + + /** + * Section size + */ + { + var newu32Encoded = (0, _encoder.encodeU32)(node.size.value); + var newu32EncodedLen = newu32Encoded.length; + var start = node.size.loc.start.column; + var end = node.size.loc.end.column; + var oldu32EncodedLen = end - start; + + if (newu32EncodedLen !== oldu32EncodedLen) { + var deltaInSizeEncoding = oldu32EncodedLen - newu32EncodedLen; + uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newu32Encoded); + shiftFollowingSections(ast, node, -deltaInSizeEncoding); + } + } + } + }); + return uint8Buffer; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f2326a937b8a3128dd1d49d4331d0947a54501db --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-opt/package.json @@ -0,0 +1,26 @@ +{ + "name": "@webassemblyjs/wasm-opt", + "version": "1.14.1", + "description": "", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "author": "Sven Sauleau", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1" + }, + "gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/README.md new file mode 100644 index 0000000000000000000000000000000000000000..98add5fb65b70748aeef8a138b74f5d5a0d10807 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/README.md @@ -0,0 +1,28 @@ +# @webassemblyjs/wasm-parser + +> WebAssembly binary format parser + +## Installation + +```sh +yarn add @webassemblyjs/wasm-parser +``` + +## Usage + +```js +import { decode } from "@webassemblyjs/wasm-parser"; +import { readFileSync } from "fs"; + +const binary = readFileSync("/path/to/module.wasm"); + +const decoderOpts = {}; +const ast = decode(binary, decoderOpts); +``` + +### Decoder options + +- `dump`: print dump information while decoding (default `false`) +- `ignoreCodeSection`: ignore the code section (default `false`) +- `ignoreDataSection`: ignore the data section (default `false`) + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/esm/decoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/esm/decoder.js new file mode 100644 index 0000000000000000000000000000000000000000..ed40ba9340bee62a62e5aa8f2d2d91e99061377c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/esm/decoder.js @@ -0,0 +1,1950 @@ +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +import { CompileError } from "@webassemblyjs/helper-api-error"; +import * as ieee754 from "@webassemblyjs/ieee754"; +import * as utf8 from "@webassemblyjs/utf8"; +import * as t from "@webassemblyjs/ast"; +import { decodeInt32, decodeUInt32, MAX_NUMBER_OF_BYTE_U32, decodeInt64, decodeUInt64, MAX_NUMBER_OF_BYTE_U64 } from "@webassemblyjs/leb128"; +import constants from "@webassemblyjs/helper-wasm-bytecode"; + +function toHex(n) { + return "0x" + Number(n).toString(16); +} + +function byteArrayEq(l, r) { + if (l.length !== r.length) { + return false; + } + + for (var i = 0; i < l.length; i++) { + if (l[i] !== r[i]) { + return false; + } + } + + return true; +} + +export function decode(ab, opts) { + var buf = new Uint8Array(ab); + var getUniqueName = t.getUniqueNameGenerator(); + var offset = 0; + + function getPosition() { + return { + line: -1, + column: offset + }; + } + + function dump(b, msg) { + if (opts.dump === false) return; + var pad = "\t\t\t\t\t\t\t\t\t\t"; + var str = ""; + + if (b.length < 5) { + str = b.map(toHex).join(" "); + } else { + str = "..."; + } + + console.log(toHex(offset) + ":\t", str, pad, ";", msg); + } + + function dumpSep(msg) { + if (opts.dump === false) return; + console.log(";", msg); + } + /** + * TODO(sven): we can atually use a same structure + * we are adding incrementally new features + */ + + + var state = { + elementsInFuncSection: [], + elementsInExportSection: [], + elementsInCodeSection: [], + + /** + * Decode memory from: + * - Memory section + */ + memoriesInModule: [], + + /** + * Decoded types from: + * - Type section + */ + typesInModule: [], + + /** + * Decoded functions from: + * - Function section + * - Import section + */ + functionsInModule: [], + + /** + * Decoded tables from: + * - Table section + */ + tablesInModule: [], + + /** + * Decoded globals from: + * - Global section + */ + globalsInModule: [] + }; + + function isEOF() { + return offset >= buf.length; + } + + function eatBytes(n) { + offset = offset + n; + } + + function readBytesAtOffset(_offset, numberOfBytes) { + var arr = []; + + for (var i = 0; i < numberOfBytes; i++) { + arr.push(buf[_offset + i]); + } + + return arr; + } + + function readBytes(numberOfBytes) { + return readBytesAtOffset(offset, numberOfBytes); + } + + function readF64() { + var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F64); + var value = ieee754.decodeF64(bytes); + + if (Math.sign(value) * value === Infinity) { + return { + value: Math.sign(value), + inf: true, + nextIndex: ieee754.NUMBER_OF_BYTE_F64 + }; + } + + if (isNaN(value)) { + var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1; + var mantissa = 0; + + for (var i = 0; i < bytes.length - 2; ++i) { + mantissa += bytes[i] * Math.pow(256, i); + } + + mantissa += bytes[bytes.length - 2] % 16 * Math.pow(256, bytes.length - 2); + return { + value: sign * mantissa, + nan: true, + nextIndex: ieee754.NUMBER_OF_BYTE_F64 + }; + } + + return { + value: value, + nextIndex: ieee754.NUMBER_OF_BYTE_F64 + }; + } + + function readF32() { + var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F32); + var value = ieee754.decodeF32(bytes); + + if (Math.sign(value) * value === Infinity) { + return { + value: Math.sign(value), + inf: true, + nextIndex: ieee754.NUMBER_OF_BYTE_F32 + }; + } + + if (isNaN(value)) { + var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1; + var mantissa = 0; + + for (var i = 0; i < bytes.length - 2; ++i) { + mantissa += bytes[i] * Math.pow(256, i); + } + + mantissa += bytes[bytes.length - 2] % 128 * Math.pow(256, bytes.length - 2); + return { + value: sign * mantissa, + nan: true, + nextIndex: ieee754.NUMBER_OF_BYTE_F32 + }; + } + + return { + value: value, + nextIndex: ieee754.NUMBER_OF_BYTE_F32 + }; + } + + function readUTF8String() { + var lenu32 = readU32(); // Don't eat any bytes. Instead, peek ahead of the current offset using + // readBytesAtOffset below. This keeps readUTF8String neutral with respect + // to the current offset, just like the other readX functions. + + var strlen = lenu32.value; + dump([strlen], "string length"); + var bytes = readBytesAtOffset(offset + lenu32.nextIndex, strlen); + var value = utf8.decode(bytes); + return { + value: value, + nextIndex: strlen + lenu32.nextIndex + }; + } + /** + * Decode an unsigned 32bits integer + * + * The length will be handled by the leb librairy, we pass the max number of + * byte. + */ + + + function readU32() { + var bytes = readBytes(MAX_NUMBER_OF_BYTE_U32); + var buffer = new Uint8Array(bytes); + return decodeUInt32(buffer); + } + + function readVaruint32() { + // where 32 bits = max 4 bytes + var bytes = readBytes(4); + var buffer = new Uint8Array(bytes); + return decodeUInt32(buffer); + } + + function readVaruint7() { + // where 7 bits = max 1 bytes + var bytes = readBytes(1); + var buffer = new Uint8Array(bytes); + return decodeUInt32(buffer); + } + /** + * Decode a signed 32bits interger + */ + + + function read32() { + var bytes = readBytes(MAX_NUMBER_OF_BYTE_U32); + var buffer = new Uint8Array(bytes); + return decodeInt32(buffer); + } + /** + * Decode a signed 64bits integer + */ + + + function read64() { + var bytes = readBytes(MAX_NUMBER_OF_BYTE_U64); + var buffer = new Uint8Array(bytes); + return decodeInt64(buffer); + } + + function readU64() { + var bytes = readBytes(MAX_NUMBER_OF_BYTE_U64); + var buffer = new Uint8Array(bytes); + return decodeUInt64(buffer); + } + + function readByte() { + return readBytes(1)[0]; + } + + function parseModuleHeader() { + if (isEOF() === true || offset + 4 > buf.length) { + throw new Error("unexpected end"); + } + + var header = readBytes(4); + + if (byteArrayEq(constants.magicModuleHeader, header) === false) { + throw new CompileError("magic header not detected"); + } + + dump(header, "wasm magic header"); + eatBytes(4); + } + + function parseVersion() { + if (isEOF() === true || offset + 4 > buf.length) { + throw new Error("unexpected end"); + } + + var version = readBytes(4); + + if (byteArrayEq(constants.moduleVersion, version) === false) { + throw new CompileError("unknown binary version"); + } + + dump(version, "wasm version"); + eatBytes(4); + } + + function parseVec(cast) { + var u32 = readU32(); + var length = u32.value; + eatBytes(u32.nextIndex); + dump([length], "number"); + + if (length === 0) { + return []; + } + + var elements = []; + + for (var i = 0; i < length; i++) { + var _byte = readByte(); + + eatBytes(1); + var value = cast(_byte); + dump([_byte], value); + + if (typeof value === "undefined") { + throw new CompileError("Internal failure: parseVec could not cast the value"); + } + + elements.push(value); + } + + return elements; + } // Type section + // https://webassembly.github.io/spec/binary/modules.html#binary-typesec + + + function parseTypeSection(numberOfTypes) { + var typeInstructionNodes = []; + dump([numberOfTypes], "num types"); + + for (var i = 0; i < numberOfTypes; i++) { + var _startLoc = getPosition(); + + dumpSep("type " + i); + var type = readByte(); + eatBytes(1); + + if (type == constants.types.func) { + dump([type], "func"); + var paramValtypes = parseVec(function (b) { + var valtype = constants.valtypes[b]; + + if (valtype === undefined) { + throw new Error("unexpected value type ".concat(b)); + } + + return valtype; + }); + var params = paramValtypes.map(function (v) { + return t.funcParam( + /*valtype*/ + v); + }); + var result = parseVec(function (b) { + return constants.valtypes[b]; + }); + typeInstructionNodes.push(function () { + var endLoc = getPosition(); + return t.withLoc(t.typeInstruction(undefined, t.signature(params, result)), endLoc, _startLoc); + }()); + state.typesInModule.push({ + params: params, + result: result + }); + } else { + throw new Error("Unsupported type: " + toHex(type)); + } + } + + return typeInstructionNodes; + } // Import section + // https://webassembly.github.io/spec/binary/modules.html#binary-importsec + + + function parseImportSection(numberOfImports) { + var imports = []; + + for (var i = 0; i < numberOfImports; i++) { + dumpSep("import header " + i); + + var _startLoc2 = getPosition(); + /** + * Module name + */ + + + var moduleName = readUTF8String(); + eatBytes(moduleName.nextIndex); + dump([], "module name (".concat(moduleName.value, ")")); + /** + * Name + */ + + var name = readUTF8String(); + eatBytes(name.nextIndex); + dump([], "name (".concat(name.value, ")")); + /** + * Import descr + */ + + var descrTypeByte = readByte(); + eatBytes(1); + var descrType = constants.importTypes[descrTypeByte]; + dump([descrTypeByte], "import kind"); + + if (typeof descrType === "undefined") { + throw new CompileError("Unknown import description type: " + toHex(descrTypeByte)); + } + + var importDescr = void 0; + + if (descrType === "func") { + var indexU32 = readU32(); + var typeindex = indexU32.value; + eatBytes(indexU32.nextIndex); + dump([typeindex], "type index"); + var signature = state.typesInModule[typeindex]; + + if (typeof signature === "undefined") { + throw new CompileError("function signature not found (".concat(typeindex, ")")); + } + + var id = getUniqueName("func"); + importDescr = t.funcImportDescr(id, t.signature(signature.params, signature.result)); + state.functionsInModule.push({ + id: t.identifier(name.value), + signature: signature, + isExternal: true + }); + } else if (descrType === "global") { + importDescr = parseGlobalType(); + var globalNode = t.global(importDescr, []); + state.globalsInModule.push(globalNode); + } else if (descrType === "table") { + importDescr = parseTableType(i); + } else if (descrType === "memory") { + var memoryNode = parseMemoryType(0); + state.memoriesInModule.push(memoryNode); + importDescr = memoryNode; + } else { + throw new CompileError("Unsupported import of type: " + descrType); + } + + imports.push(function () { + var endLoc = getPosition(); + return t.withLoc(t.moduleImport(moduleName.value, name.value, importDescr), endLoc, _startLoc2); + }()); + } + + return imports; + } // Function section + // https://webassembly.github.io/spec/binary/modules.html#function-section + + + function parseFuncSection(numberOfFunctions) { + dump([numberOfFunctions], "num funcs"); + + for (var i = 0; i < numberOfFunctions; i++) { + var indexU32 = readU32(); + var typeindex = indexU32.value; + eatBytes(indexU32.nextIndex); + dump([typeindex], "type index"); + var signature = state.typesInModule[typeindex]; + + if (typeof signature === "undefined") { + throw new CompileError("function signature not found (".concat(typeindex, ")")); + } // preserve anonymous, a name might be resolved later + + + var id = t.withRaw(t.identifier(getUniqueName("func")), ""); + state.functionsInModule.push({ + id: id, + signature: signature, + isExternal: false + }); + } + } // Export section + // https://webassembly.github.io/spec/binary/modules.html#export-section + + + function parseExportSection(numberOfExport) { + dump([numberOfExport], "num exports"); // Parse vector of exports + + for (var i = 0; i < numberOfExport; i++) { + var _startLoc3 = getPosition(); + /** + * Name + */ + + + var name = readUTF8String(); + eatBytes(name.nextIndex); + dump([], "export name (".concat(name.value, ")")); + /** + * exportdescr + */ + + var typeIndex = readByte(); + eatBytes(1); + dump([typeIndex], "export kind"); + var indexu32 = readU32(); + var index = indexu32.value; + eatBytes(indexu32.nextIndex); + dump([index], "export index"); + var id = void 0, + signature = void 0; + + if (constants.exportTypes[typeIndex] === "Func") { + var func = state.functionsInModule[index]; + + if (typeof func === "undefined") { + throw new CompileError("unknown function (".concat(index, ")")); + } + + id = t.numberLiteralFromRaw(index, String(index)); + signature = func.signature; + } else if (constants.exportTypes[typeIndex] === "Table") { + var table = state.tablesInModule[index]; + + if (typeof table === "undefined") { + throw new CompileError("unknown table ".concat(index)); + } + + id = t.numberLiteralFromRaw(index, String(index)); + signature = null; + } else if (constants.exportTypes[typeIndex] === "Memory") { + var memNode = state.memoriesInModule[index]; + + if (typeof memNode === "undefined") { + throw new CompileError("unknown memory ".concat(index)); + } + + id = t.numberLiteralFromRaw(index, String(index)); + signature = null; + } else if (constants.exportTypes[typeIndex] === "Global") { + var global = state.globalsInModule[index]; + + if (typeof global === "undefined") { + throw new CompileError("unknown global ".concat(index)); + } + + id = t.numberLiteralFromRaw(index, String(index)); + signature = null; + } else { + console.warn("Unsupported export type: " + toHex(typeIndex)); + return; + } + + var endLoc = getPosition(); + state.elementsInExportSection.push({ + name: name.value, + type: constants.exportTypes[typeIndex], + signature: signature, + id: id, + index: index, + endLoc: endLoc, + startLoc: _startLoc3 + }); + } + } // Code section + // https://webassembly.github.io/spec/binary/modules.html#code-section + + + function parseCodeSection(numberOfFuncs) { + dump([numberOfFuncs], "number functions"); // Parse vector of function + + for (var i = 0; i < numberOfFuncs; i++) { + var _startLoc4 = getPosition(); + + dumpSep("function body " + i); // the u32 size of the function code in bytes + // Ignore it for now + + var bodySizeU32 = readU32(); + eatBytes(bodySizeU32.nextIndex); + dump([bodySizeU32.value], "function body size"); + var code = []; // Parse locals + + var funcLocalNumU32 = readU32(); + var funcLocalNum = funcLocalNumU32.value; + eatBytes(funcLocalNumU32.nextIndex); + dump([funcLocalNum], "num locals"); + var locals = []; + + for (var _i = 0; _i < funcLocalNum; _i++) { + var _startLoc5 = getPosition(); + + var localCountU32 = readU32(); + var localCount = localCountU32.value; + eatBytes(localCountU32.nextIndex); + dump([localCount], "num local"); + var valtypeByte = readByte(); + eatBytes(1); + var type = constants.valtypes[valtypeByte]; + var args = []; + + for (var _i2 = 0; _i2 < localCount; _i2++) { + args.push(t.valtypeLiteral(type)); + } + + var localNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.instruction("local", args), endLoc, _startLoc5); + }(); + + locals.push(localNode); + dump([valtypeByte], type); + + if (typeof type === "undefined") { + throw new CompileError("Unexpected valtype: " + toHex(valtypeByte)); + } + } + + code.push.apply(code, locals); // Decode instructions until the end + + parseInstructionBlock(code); + var endLoc = getPosition(); + state.elementsInCodeSection.push({ + code: code, + locals: locals, + endLoc: endLoc, + startLoc: _startLoc4, + bodySize: bodySizeU32.value + }); + } + } + + function parseInstructionBlock(code) { + while (true) { + var _startLoc6 = getPosition(); + + var instructionAlreadyCreated = false; + var instructionByte = readByte(); + eatBytes(1); + + if (instructionByte === 0xfe) { + instructionByte = 0xfe00 + readByte(); + eatBytes(1); + } // Table instructions + // https://webassembly.github.io/spec/core/binary/instructions.html#table-instructions + + + if (instructionByte === 0xfc) { + instructionByte = 0xfc00 + readByte(); + eatBytes(1); + } + + var instruction = constants.symbolsByByte[instructionByte]; + + if (typeof instruction === "undefined") { + throw new CompileError("Unexpected instruction: " + toHex(instructionByte)); + } + + if (instruction === "illegal") { + throw new Error("tried to decode an illegal bytecode: ".concat(toHex(instructionByte))); + } + + if (typeof instruction.object === "string") { + dump([instructionByte], "".concat(instruction.object, ".").concat(instruction.name)); + } else { + dump([instructionByte], instruction.name); + } + /** + * End of the function + */ + + + if (instruction.name === "end") { + var node = function () { + var endLoc = getPosition(); + return t.withLoc(t.instruction(instruction.name), endLoc, _startLoc6); + }(); + + code.push(node); + break; + } + + var args = []; + var namedArgs = void 0; + + if (instruction.name === "loop") { + var _startLoc7 = getPosition(); + + var blocktype = parseBlockType(); + var instr = []; + parseInstructionBlock(instr); // preserve anonymous + + var label = t.withRaw(t.identifier(getUniqueName("loop")), ""); + + var loopNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.loopInstruction(label, blocktype, instr), endLoc, _startLoc7); + }(); + + code.push(loopNode); + instructionAlreadyCreated = true; + } else if (instruction.name === "if") { + var _startLoc8 = getPosition(); + + var _blocktype = parseBlockType(); + + var testIndex = t.withRaw(t.identifier(getUniqueName("if")), ""); + var ifBody = []; + parseInstructionBlock(ifBody); // Defaults to no alternate + + var elseIndex = 0; + + for (elseIndex = 0; elseIndex < ifBody.length; ++elseIndex) { + var _instr = ifBody[elseIndex]; + + if (_instr.type === "Instr" && _instr.id === "else") { + break; + } + } + + var consequentInstr = ifBody.slice(0, elseIndex); + var alternate = ifBody.slice(elseIndex + 1); // wast sugar + + var testInstrs = []; + + var ifNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.ifInstruction(testIndex, testInstrs, _blocktype, consequentInstr, alternate), endLoc, _startLoc8); + }(); + + code.push(ifNode); + instructionAlreadyCreated = true; + } else if (instruction.name === "block") { + var _startLoc9 = getPosition(); + + var _blocktype2 = parseBlockType(); + + var _instr2 = []; + parseInstructionBlock(_instr2); // preserve anonymous + + var _label = t.withRaw(t.identifier(getUniqueName("block")), ""); + + var blockNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.blockInstruction(_label, _instr2, _blocktype2), endLoc, _startLoc9); + }(); + + code.push(blockNode); + instructionAlreadyCreated = true; + } else if (instruction.name === "call") { + var indexu32 = readU32(); + var index = indexu32.value; + eatBytes(indexu32.nextIndex); + dump([index], "index"); + + var callNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.callInstruction(t.indexLiteral(index)), endLoc, _startLoc6); + }(); + + code.push(callNode); + instructionAlreadyCreated = true; + } else if (instruction.name === "call_indirect") { + var _startLoc10 = getPosition(); + + var indexU32 = readU32(); + var typeindex = indexU32.value; + eatBytes(indexU32.nextIndex); + dump([typeindex], "type index"); + var signature = state.typesInModule[typeindex]; + + if (typeof signature === "undefined") { + throw new CompileError("call_indirect signature not found (".concat(typeindex, ")")); + } + + var _callNode = t.callIndirectInstruction(t.signature(signature.params, signature.result), []); + + var flagU32 = readU32(); + var flag = flagU32.value; // 0x00 - reserved byte + + eatBytes(flagU32.nextIndex); + + if (flag !== 0) { + throw new CompileError("zero flag expected"); + } + + code.push(function () { + var endLoc = getPosition(); + return t.withLoc(_callNode, endLoc, _startLoc10); + }()); + instructionAlreadyCreated = true; + } else if (instruction.name === "br_table") { + var indicesu32 = readU32(); + var indices = indicesu32.value; + eatBytes(indicesu32.nextIndex); + dump([indices], "num indices"); + + for (var i = 0; i <= indices; i++) { + var _indexu = readU32(); + + var _index = _indexu.value; + eatBytes(_indexu.nextIndex); + dump([_index], "index"); + args.push(t.numberLiteralFromRaw(_indexu.value.toString(), "u32")); + } + } else if (instructionByte >= 0x28 && instructionByte <= 0x40) { + /** + * Memory instructions + */ + if (instruction.name === "grow_memory" || instruction.name === "current_memory") { + var _indexU = readU32(); + + var _index2 = _indexU.value; + eatBytes(_indexU.nextIndex); + + if (_index2 !== 0) { + throw new Error("zero flag expected"); + } + + dump([_index2], "index"); + } else { + var aligun32 = readU32(); + var align = aligun32.value; + eatBytes(aligun32.nextIndex); + dump([align], "align"); + var offsetu32 = readU32(); + var _offset2 = offsetu32.value; + eatBytes(offsetu32.nextIndex); + dump([_offset2], "offset"); + if (namedArgs === undefined) namedArgs = {}; + namedArgs.offset = t.numberLiteralFromRaw(_offset2); + } + } else if (instructionByte >= 0x41 && instructionByte <= 0x44) { + /** + * Numeric instructions + */ + if (instruction.object === "i32") { + var value32 = read32(); + var value = value32.value; + eatBytes(value32.nextIndex); + dump([value], "i32 value"); + args.push(t.numberLiteralFromRaw(value)); + } + + if (instruction.object === "u32") { + var valueu32 = readU32(); + var _value = valueu32.value; + eatBytes(valueu32.nextIndex); + dump([_value], "u32 value"); + args.push(t.numberLiteralFromRaw(_value)); + } + + if (instruction.object === "i64") { + var value64 = read64(); + var _value2 = value64.value; + eatBytes(value64.nextIndex); + dump([Number(_value2.toString())], "i64 value"); + var high = _value2.high, + low = _value2.low; + var _node = { + type: "LongNumberLiteral", + value: { + high: high, + low: low + } + }; + args.push(_node); + } + + if (instruction.object === "u64") { + var valueu64 = readU64(); + var _value3 = valueu64.value; + eatBytes(valueu64.nextIndex); + dump([Number(_value3.toString())], "u64 value"); + var _high = _value3.high, + _low = _value3.low; + var _node2 = { + type: "LongNumberLiteral", + value: { + high: _high, + low: _low + } + }; + args.push(_node2); + } + + if (instruction.object === "f32") { + var valuef32 = readF32(); + var _value4 = valuef32.value; + eatBytes(valuef32.nextIndex); + dump([_value4], "f32 value"); + args.push( // $FlowIgnore + t.floatLiteral(_value4, valuef32.nan, valuef32.inf, String(_value4))); + } + + if (instruction.object === "f64") { + var valuef64 = readF64(); + var _value5 = valuef64.value; + eatBytes(valuef64.nextIndex); + dump([_value5], "f64 value"); + args.push( // $FlowIgnore + t.floatLiteral(_value5, valuef64.nan, valuef64.inf, String(_value5))); + } + } else if (instructionByte >= 0xfe00 && instructionByte <= 0xfeff) { + /** + * Atomic memory instructions + */ + var align32 = readU32(); + var _align = align32.value; + eatBytes(align32.nextIndex); + dump([_align], "align"); + + var _offsetu = readU32(); + + var _offset3 = _offsetu.value; + eatBytes(_offsetu.nextIndex); + dump([_offset3], "offset"); + } else { + for (var _i3 = 0; _i3 < instruction.numberOfArgs; _i3++) { + var u32 = readU32(); + eatBytes(u32.nextIndex); + dump([u32.value], "argument " + _i3); + args.push(t.numberLiteralFromRaw(u32.value)); + } + } + + if (instructionAlreadyCreated === false) { + if (typeof instruction.object === "string") { + var _node3 = function () { + var endLoc = getPosition(); + return t.withLoc(t.objectInstruction(instruction.name, instruction.object, args, namedArgs), endLoc, _startLoc6); + }(); + + code.push(_node3); + } else { + var _node4 = function () { + var endLoc = getPosition(); + return t.withLoc(t.instruction(instruction.name, args, namedArgs), endLoc, _startLoc6); + }(); + + code.push(_node4); + } + } + } + } // https://webassembly.github.io/spec/core/binary/types.html#limits + + + function parseLimits() { + var limitType = readByte(); + eatBytes(1); + var shared = limitType === 0x03; + dump([limitType], "limit type" + (shared ? " (shared)" : "")); + var min, max; + + if (limitType === 0x01 || limitType === 0x03 // shared limits + ) { + var u32min = readU32(); + min = parseInt(u32min.value); + eatBytes(u32min.nextIndex); + dump([min], "min"); + var u32max = readU32(); + max = parseInt(u32max.value); + eatBytes(u32max.nextIndex); + dump([max], "max"); + } + + if (limitType === 0x00) { + var _u32min = readU32(); + + min = parseInt(_u32min.value); + eatBytes(_u32min.nextIndex); + dump([min], "min"); + } + + return t.limit(min, max, shared); + } // https://webassembly.github.io/spec/core/binary/types.html#binary-tabletype + + + function parseTableType(index) { + var name = t.withRaw(t.identifier(getUniqueName("table")), String(index)); + var elementTypeByte = readByte(); + eatBytes(1); + dump([elementTypeByte], "element type"); + var elementType = constants.tableTypes[elementTypeByte]; + + if (typeof elementType === "undefined") { + throw new CompileError("Unknown element type in table: " + toHex(elementTypeByte)); + } + + var limits = parseLimits(); + return t.table(elementType, limits, name); + } // https://webassembly.github.io/spec/binary/types.html#global-types + + + function parseGlobalType() { + var valtypeByte = readByte(); + eatBytes(1); + var type = constants.valtypes[valtypeByte]; + dump([valtypeByte], type); + + if (typeof type === "undefined") { + throw new CompileError("Unknown valtype: " + toHex(valtypeByte)); + } + + var globalTypeByte = readByte(); + eatBytes(1); + var globalType = constants.globalTypes[globalTypeByte]; + dump([globalTypeByte], "global type (".concat(globalType, ")")); + + if (typeof globalType === "undefined") { + throw new CompileError("Invalid mutability: " + toHex(globalTypeByte)); + } + + return t.globalType(type, globalType); + } // function parseNameModule() { + // const lenu32 = readVaruint32(); + // eatBytes(lenu32.nextIndex); + // console.log("len", lenu32); + // const strlen = lenu32.value; + // dump([strlen], "string length"); + // const bytes = readBytes(strlen); + // eatBytes(strlen); + // const value = utf8.decode(bytes); + // return [t.moduleNameMetadata(value)]; + // } + // this section contains an array of function names and indices + + + function parseNameSectionFunctions() { + var functionNames = []; + var numberOfFunctionsu32 = readU32(); + var numbeOfFunctions = numberOfFunctionsu32.value; + eatBytes(numberOfFunctionsu32.nextIndex); + + for (var i = 0; i < numbeOfFunctions; i++) { + var indexu32 = readU32(); + var index = indexu32.value; + eatBytes(indexu32.nextIndex); + var name = readUTF8String(); + eatBytes(name.nextIndex); + functionNames.push(t.functionNameMetadata(name.value, index)); + } + + return functionNames; + } + + function parseNameSectionLocals() { + var localNames = []; + var numbeOfFunctionsu32 = readU32(); + var numbeOfFunctions = numbeOfFunctionsu32.value; + eatBytes(numbeOfFunctionsu32.nextIndex); + + for (var i = 0; i < numbeOfFunctions; i++) { + var functionIndexu32 = readU32(); + var functionIndex = functionIndexu32.value; + eatBytes(functionIndexu32.nextIndex); + var numLocalsu32 = readU32(); + var numLocals = numLocalsu32.value; + eatBytes(numLocalsu32.nextIndex); + + for (var _i4 = 0; _i4 < numLocals; _i4++) { + var localIndexu32 = readU32(); + var localIndex = localIndexu32.value; + eatBytes(localIndexu32.nextIndex); + var name = readUTF8String(); + eatBytes(name.nextIndex); + localNames.push(t.localNameMetadata(name.value, localIndex, functionIndex)); + } + } + + return localNames; + } // this is a custom section used for name resolution + // https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section + + + function parseNameSection(remainingBytes) { + var nameMetadata = []; + var initialOffset = offset; + + while (offset - initialOffset < remainingBytes) { + // name_type + var sectionTypeByte = readVaruint7(); + eatBytes(sectionTypeByte.nextIndex); // name_payload_len + + var subSectionSizeInBytesu32 = readVaruint32(); + eatBytes(subSectionSizeInBytesu32.nextIndex); + + switch (sectionTypeByte.value) { + // case 0: { + // TODO(sven): re-enable that + // Current status: it seems that when we decode the module's name + // no name_payload_len is used. + // + // See https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section + // + // nameMetadata.push(...parseNameModule()); + // break; + // } + case 1: + { + nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionFunctions())); + break; + } + + case 2: + { + nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionLocals())); + break; + } + + default: + { + // skip unknown subsection + eatBytes(subSectionSizeInBytesu32.value); + } + } + } + + return nameMetadata; + } // this is a custom section used for information about the producers + // https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md + + + function parseProducersSection() { + var metadata = t.producersSectionMetadata([]); // field_count + + var sectionTypeByte = readVaruint32(); + eatBytes(sectionTypeByte.nextIndex); + dump([sectionTypeByte.value], "num of producers"); + var fields = { + language: [], + "processed-by": [], + sdk: [] + }; // fields + + for (var fieldI = 0; fieldI < sectionTypeByte.value; fieldI++) { + // field_name + var fieldName = readUTF8String(); + eatBytes(fieldName.nextIndex); // field_value_count + + var valueCount = readVaruint32(); + eatBytes(valueCount.nextIndex); // field_values + + for (var producerI = 0; producerI < valueCount.value; producerI++) { + var producerName = readUTF8String(); + eatBytes(producerName.nextIndex); + var producerVersion = readUTF8String(); + eatBytes(producerVersion.nextIndex); + fields[fieldName.value].push(t.producerMetadataVersionedName(producerName.value, producerVersion.value)); + } + + metadata.producers.push(fields[fieldName.value]); + } + + return metadata; + } + + function parseGlobalSection(numberOfGlobals) { + var globals = []; + dump([numberOfGlobals], "num globals"); + + for (var i = 0; i < numberOfGlobals; i++) { + var _startLoc11 = getPosition(); + + var globalType = parseGlobalType(); + /** + * Global expressions + */ + + var init = []; + parseInstructionBlock(init); + + var node = function () { + var endLoc = getPosition(); + return t.withLoc(t.global(globalType, init), endLoc, _startLoc11); + }(); + + globals.push(node); + state.globalsInModule.push(node); + } + + return globals; + } + + function parseElemSection(numberOfElements) { + var elems = []; + dump([numberOfElements], "num elements"); + + for (var i = 0; i < numberOfElements; i++) { + var _startLoc12 = getPosition(); + + var tableindexu32 = readU32(); + var bitfield = tableindexu32.value; + eatBytes(tableindexu32.nextIndex); + dump([bitfield], "bitfield"); + + if (bitfield === 0) { + // Parse instructions + var instr = []; + parseInstructionBlock(instr); // Parse ( vector function index ) * + + var indicesu32 = readU32(); + var indices = indicesu32.value; + eatBytes(indicesu32.nextIndex); + dump([indices], "num indices"); + var indexValues = []; + + for (var _i5 = 0; _i5 < indices; _i5++) { + var indexu32 = readU32(); + var index = indexu32.value; + eatBytes(indexu32.nextIndex); + dump([index], "index"); + indexValues.push(t.indexLiteral(index)); + } + + var elemNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.elem(t.indexLiteral(bitfield), instr, indexValues), endLoc, _startLoc12); + }(); + + elems.push(elemNode); + } else if (bitfield === 1) { + var elemKind = readByte(); + eatBytes(1); + + if (elemKind !== 0) { + throw new Error("unexpected Elem kind: ".concat(toHex(elemKind))); + } // Parse ( vector function index ) * + + + var _indicesu = readU32(); + + var _indices = _indicesu.value; + eatBytes(_indicesu.nextIndex); + dump([_indices], "num indices"); + var _indexValues = []; + + for (var _i6 = 0; _i6 < _indices; _i6++) { + var _indexu2 = readU32(); + + var _index3 = _indexu2.value; + eatBytes(_indexu2.nextIndex); + dump([_index3], "index"); + + _indexValues.push(t.indexLiteral(_index3)); + } // TODO: emit a AST node, for now just make it parse. + + } else if (bitfield === 2) { + var u32 = readU32(); + var tableidx = u32.value; + eatBytes(u32.nextIndex); + dump([tableidx], "tableidx"); // Parse instructions + + var _instr3 = []; + parseInstructionBlock(_instr3); + + var _elemKind = readByte(); + + eatBytes(1); + + if (_elemKind !== 0) { + throw new Error("unexpected Elem kind: ".concat(toHex(_elemKind))); + } // Parse ( vector function index ) * + + + var _indicesu2 = readU32(); + + var _indices2 = _indicesu2.value; + eatBytes(_indicesu2.nextIndex); + dump([_indices2], "num indices"); + var _indexValues2 = []; + + for (var _i7 = 0; _i7 < _indices2; _i7++) { + var _indexu3 = readU32(); + + var _index4 = _indexu3.value; + eatBytes(_indexu3.nextIndex); + dump([_index4], "index"); + + _indexValues2.push(t.indexLiteral(_index4)); + } + + var _elemNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.elem(t.indexLiteral(bitfield), _instr3, _indexValues2), endLoc, _startLoc12); + }(); + + elems.push(_elemNode); + } else if (bitfield === 3) { + var _elemKind2 = readByte(); + + eatBytes(1); + + if (_elemKind2 !== 0) { + throw new Error("unexpected Elem kind: ".concat(toHex(_elemKind2))); + } // Parse ( vector function index ) * + + + var countU32 = readU32(); + var count = countU32.value; + eatBytes(countU32.nextIndex); + dump([count], "count"); + + for (var _i8 = 0; _i8 < count; _i8++) { + var _indexu4 = readU32(); + + var _index5 = _indexu4.value; + eatBytes(_indexu4.nextIndex); + dump([_index5], "index"); + } // TODO: emit a AST node, for now just make it parse. + + } else if (bitfield === 4) { + var expr = []; + parseInstructionBlock(expr); + + var _countU = readU32(); + + var _count = _countU.value; + eatBytes(_countU.nextIndex); + dump([_count], "count"); + + for (var _i9 = 0; _i9 < _count; _i9++) { + var code = []; + parseInstructionBlock(code); + } // TODO: emit a AST node, for now just make it parse. + + } else if (bitfield === 5) { + var reftype = readByte(); + eatBytes(1); + dump([reftype], "reftype"); + + var _countU2 = readU32(); + + var _count2 = _countU2.value; + eatBytes(_countU2.nextIndex); + dump([_count2], "count"); + + for (var _i10 = 0; _i10 < _count2; _i10++) { + var _code = []; + parseInstructionBlock(_code); + } // TODO: emit a AST node, for now just make it parse. + + } else if (bitfield === 7) { + var _reftype = readByte(); + + eatBytes(1); + dump([_reftype], "reftype"); + + var _countU3 = readU32(); + + var _count3 = _countU3.value; + eatBytes(_countU3.nextIndex); + dump([_count3], "count"); + + for (var _i11 = 0; _i11 < _count3; _i11++) { + var _code2 = []; + parseInstructionBlock(_code2); + } // TODO: emit a AST node, for now just make it parse. + + } else { + throw new Error("unexpected Elem with bitfield ".concat(toHex(bitfield))); + } + } + + return elems; + } // https://webassembly.github.io/spec/core/binary/types.html#memory-types + + + function parseMemoryType(i) { + var limits = parseLimits(); + return t.memory(limits, t.indexLiteral(i)); + } // https://webassembly.github.io/spec/binary/modules.html#table-section + + + function parseTableSection(numberOfElements) { + var tables = []; + dump([numberOfElements], "num elements"); + + for (var i = 0; i < numberOfElements; i++) { + var tablesNode = parseTableType(i); + state.tablesInModule.push(tablesNode); + tables.push(tablesNode); + } + + return tables; + } // https://webassembly.github.io/spec/binary/modules.html#memory-section + + + function parseMemorySection(numberOfElements) { + var memories = []; + dump([numberOfElements], "num elements"); + + for (var i = 0; i < numberOfElements; i++) { + var memoryNode = parseMemoryType(i); + state.memoriesInModule.push(memoryNode); + memories.push(memoryNode); + } + + return memories; + } // https://webassembly.github.io/spec/binary/modules.html#binary-startsec + + + function parseStartSection() { + var startLoc = getPosition(); + var u32 = readU32(); + var startFuncIndex = u32.value; + eatBytes(u32.nextIndex); + dump([startFuncIndex], "index"); + return function () { + var endLoc = getPosition(); + return t.withLoc(t.start(t.indexLiteral(startFuncIndex)), endLoc, startLoc); + }(); + } // https://webassembly.github.io/spec/binary/modules.html#data-section + + + function parseDataSection(numberOfElements) { + var dataEntries = []; + dump([numberOfElements], "num elements"); + + for (var i = 0; i < numberOfElements; i++) { + var memoryIndexu32 = readU32(); + var memoryIndex = memoryIndexu32.value; + eatBytes(memoryIndexu32.nextIndex); + dump([memoryIndex], "memory index"); + var instrs = []; + parseInstructionBlock(instrs); + var hasExtraInstrs = instrs.filter(function (i) { + return i.id !== "end"; + }).length !== 1; + + if (hasExtraInstrs) { + throw new CompileError("data section offset must be a single instruction"); + } + + var bytes = parseVec(function (b) { + return b; + }); + dump([], "init"); + dataEntries.push(t.data(t.memIndexLiteral(memoryIndex), instrs[0], t.byteArray(bytes))); + } + + return dataEntries; + } // https://webassembly.github.io/spec/binary/modules.html#binary-section + + + function parseSection(sectionIndex) { + var sectionId = readByte(); + eatBytes(1); + + if (sectionId >= sectionIndex || sectionIndex === constants.sections.custom) { + sectionIndex = sectionId + 1; + } else { + if (sectionId !== constants.sections.custom) throw new CompileError("Unexpected section: " + toHex(sectionId)); + } + + var nextSectionIndex = sectionIndex; + var startOffset = offset; + var startLoc = getPosition(); + var u32 = readU32(); + var sectionSizeInBytes = u32.value; + eatBytes(u32.nextIndex); + + var sectionSizeInBytesNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(sectionSizeInBytes), endLoc, startLoc); + }(); + + switch (sectionId) { + case constants.sections.type: + { + dumpSep("section Type"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc13 = getPosition(); + + var _u = readU32(); + + var numberOfTypes = _u.value; + eatBytes(_u.nextIndex); + var metadata = t.sectionMetadata("type", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfTypes), endLoc, _startLoc13); + }()); + var nodes = parseTypeSection(numberOfTypes); + return { + nodes: nodes, + metadata: metadata, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections.table: + { + dumpSep("section Table"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc14 = getPosition(); + + var _u2 = readU32(); + + var numberOfTable = _u2.value; + eatBytes(_u2.nextIndex); + dump([numberOfTable], "num tables"); + + var _metadata = t.sectionMetadata("table", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfTable), endLoc, _startLoc14); + }()); + + var _nodes = parseTableSection(numberOfTable); + + return { + nodes: _nodes, + metadata: _metadata, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections["import"]: + { + dumpSep("section Import"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc15 = getPosition(); + + var numberOfImportsu32 = readU32(); + var numberOfImports = numberOfImportsu32.value; + eatBytes(numberOfImportsu32.nextIndex); + dump([numberOfImports], "number of imports"); + + var _metadata2 = t.sectionMetadata("import", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfImports), endLoc, _startLoc15); + }()); + + var _nodes2 = parseImportSection(numberOfImports); + + return { + nodes: _nodes2, + metadata: _metadata2, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections.func: + { + dumpSep("section Function"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc16 = getPosition(); + + var numberOfFunctionsu32 = readU32(); + var numberOfFunctions = numberOfFunctionsu32.value; + eatBytes(numberOfFunctionsu32.nextIndex); + + var _metadata3 = t.sectionMetadata("func", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfFunctions), endLoc, _startLoc16); + }()); + + parseFuncSection(numberOfFunctions); + var _nodes3 = []; + return { + nodes: _nodes3, + metadata: _metadata3, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections["export"]: + { + dumpSep("section Export"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc17 = getPosition(); + + var _u3 = readU32(); + + var numberOfExport = _u3.value; + eatBytes(_u3.nextIndex); + + var _metadata4 = t.sectionMetadata("export", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfExport), endLoc, _startLoc17); + }()); + + parseExportSection(numberOfExport); + var _nodes4 = []; + return { + nodes: _nodes4, + metadata: _metadata4, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections.code: + { + dumpSep("section Code"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc18 = getPosition(); + + var _u4 = readU32(); + + var numberOfFuncs = _u4.value; + eatBytes(_u4.nextIndex); + + var _metadata5 = t.sectionMetadata("code", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfFuncs), endLoc, _startLoc18); + }()); + + if (opts.ignoreCodeSection === true) { + var remainingBytes = sectionSizeInBytes - _u4.nextIndex; + eatBytes(remainingBytes); // eat the entire section + } else { + parseCodeSection(numberOfFuncs); + } + + var _nodes5 = []; + return { + nodes: _nodes5, + metadata: _metadata5, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections.start: + { + dumpSep("section Start"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _metadata6 = t.sectionMetadata("start", startOffset, sectionSizeInBytesNode); + + var _nodes6 = [parseStartSection()]; + return { + nodes: _nodes6, + metadata: _metadata6, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections.element: + { + dumpSep("section Element"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc19 = getPosition(); + + var numberOfElementsu32 = readU32(); + var numberOfElements = numberOfElementsu32.value; + eatBytes(numberOfElementsu32.nextIndex); + + var _metadata7 = t.sectionMetadata("element", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfElements), endLoc, _startLoc19); + }()); + + var _nodes7 = parseElemSection(numberOfElements); + + return { + nodes: _nodes7, + metadata: _metadata7, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections.global: + { + dumpSep("section Global"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc20 = getPosition(); + + var numberOfGlobalsu32 = readU32(); + var numberOfGlobals = numberOfGlobalsu32.value; + eatBytes(numberOfGlobalsu32.nextIndex); + + var _metadata8 = t.sectionMetadata("global", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfGlobals), endLoc, _startLoc20); + }()); + + var _nodes8 = parseGlobalSection(numberOfGlobals); + + return { + nodes: _nodes8, + metadata: _metadata8, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections.memory: + { + dumpSep("section Memory"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc21 = getPosition(); + + var _numberOfElementsu = readU32(); + + var _numberOfElements = _numberOfElementsu.value; + eatBytes(_numberOfElementsu.nextIndex); + + var _metadata9 = t.sectionMetadata("memory", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(_numberOfElements), endLoc, _startLoc21); + }()); + + var _nodes9 = parseMemorySection(_numberOfElements); + + return { + nodes: _nodes9, + metadata: _metadata9, + nextSectionIndex: nextSectionIndex + }; + } + + case constants.sections.data: + { + dumpSep("section Data"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _metadata10 = t.sectionMetadata("data", startOffset, sectionSizeInBytesNode); + + var _startLoc22 = getPosition(); + + var _numberOfElementsu2 = readU32(); + + var _numberOfElements2 = _numberOfElementsu2.value; + eatBytes(_numberOfElementsu2.nextIndex); + + _metadata10.vectorOfSize = function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(_numberOfElements2), endLoc, _startLoc22); + }(); + + if (opts.ignoreDataSection === true) { + var _remainingBytes = sectionSizeInBytes - _numberOfElementsu2.nextIndex; + + eatBytes(_remainingBytes); // eat the entire section + + dumpSep("ignore data (" + sectionSizeInBytes + " bytes)"); + return { + nodes: [], + metadata: _metadata10, + nextSectionIndex: nextSectionIndex + }; + } else { + var _nodes10 = parseDataSection(_numberOfElements2); + + return { + nodes: _nodes10, + metadata: _metadata10, + nextSectionIndex: nextSectionIndex + }; + } + } + + case constants.sections.custom: + { + dumpSep("section Custom"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + var _metadata11 = [t.sectionMetadata("custom", startOffset, sectionSizeInBytesNode)]; + var sectionName = readUTF8String(); + eatBytes(sectionName.nextIndex); + dump([], "section name (".concat(sectionName.value, ")")); + + var _remainingBytes2 = sectionSizeInBytes - sectionName.nextIndex; + + if (sectionName.value === "name") { + var initialOffset = offset; + + try { + _metadata11.push.apply(_metadata11, _toConsumableArray(parseNameSection(_remainingBytes2))); + } catch (e) { + console.warn("Failed to decode custom \"name\" section @".concat(offset, "; ignoring (").concat(e.message, ").")); + eatBytes(offset - (initialOffset + _remainingBytes2)); + } + } else if (sectionName.value === "producers") { + var _initialOffset = offset; + + try { + _metadata11.push(parseProducersSection()); + } catch (e) { + console.warn("Failed to decode custom \"producers\" section @".concat(offset, "; ignoring (").concat(e.message, ").")); + eatBytes(offset - (_initialOffset + _remainingBytes2)); + } + } else { + // We don't parse the custom section + eatBytes(_remainingBytes2); + dumpSep("ignore custom " + JSON.stringify(sectionName.value) + " section (" + _remainingBytes2 + " bytes)"); + } + + return { + nodes: [], + metadata: _metadata11, + nextSectionIndex: nextSectionIndex + }; + } + } + + if (opts.errorOnUnknownSection) { + throw new CompileError("Unexpected section: " + toHex(sectionId)); + } else { + dumpSep("section " + toHex(sectionId)); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + eatBytes(sectionSizeInBytes); + dumpSep("ignoring (" + sectionSizeInBytes + " bytes)"); + return { + nodes: [], + metadata: [], + nextSectionIndex: 0 + }; + } + } + + function parseBlockType() { + var blocktypeByte = readByte(); + var blocktype = constants.blockTypes[blocktypeByte]; + + if (typeof blocktype !== "undefined") { + eatBytes(1); + dump([blocktypeByte], "blocktype"); // value type + + return blocktype; + } else { + // type index + var u32 = readU32(); + eatBytes(u32.nextIndex); + var signature = state.typesInModule[u32.value]; + console.log({ + signature: signature + }); + dump([u32.value], "typeidx"); + return u32.value; + } + } + + parseModuleHeader(); + parseVersion(); + var moduleFields = []; + var sectionIndex = 0; + var moduleMetadata = { + sections: [], + functionNames: [], + localNames: [], + producers: [] + }; + /** + * All the generate declaration are going to be stored in our state + */ + + while (offset < buf.length) { + var _parseSection = parseSection(sectionIndex), + nodes = _parseSection.nodes, + metadata = _parseSection.metadata, + nextSectionIndex = _parseSection.nextSectionIndex; + + moduleFields.push.apply(moduleFields, _toConsumableArray(nodes)); + var metadataArray = Array.isArray(metadata) ? metadata : [metadata]; + metadataArray.forEach(function (metadataItem) { + // $FlowIgnore + if (metadataItem.type === "FunctionNameMetadata") { + moduleMetadata.functionNames.push(metadataItem); // $FlowIgnore + } else if (metadataItem.type === "LocalNameMetadata") { + moduleMetadata.localNames.push(metadataItem); // $FlowIgnore + } else if (metadataItem.type === "ProducersSectionMetadata") { + moduleMetadata.producers.push(metadataItem); + } else { + moduleMetadata.sections.push(metadataItem); + } + }); // Ignore custom section + + if (nextSectionIndex) { + sectionIndex = nextSectionIndex; + } + } + /** + * Transform the state into AST nodes + */ + + + var funcIndex = 0; + state.functionsInModule.forEach(function (func) { + var params = func.signature.params; + var result = func.signature.result; + var body = []; // External functions doesn't provide any code, can skip it here + + if (func.isExternal === true) { + return; + } + + var decodedElementInCodeSection = state.elementsInCodeSection[funcIndex]; + + if (opts.ignoreCodeSection === false) { + if (typeof decodedElementInCodeSection === "undefined") { + throw new CompileError("func " + toHex(funcIndex) + " code not found"); + } + + body = decodedElementInCodeSection.code; + } + + funcIndex++; + var funcNode = t.func(func.id, t.signature(params, result), body); + + if (func.isExternal === true) { + funcNode.isExternal = func.isExternal; + } // Add function position in the binary if possible + + + if (opts.ignoreCodeSection === false) { + var _startLoc23 = decodedElementInCodeSection.startLoc, + endLoc = decodedElementInCodeSection.endLoc, + bodySize = decodedElementInCodeSection.bodySize; + funcNode = t.withLoc(funcNode, endLoc, _startLoc23); + funcNode.metadata = { + bodySize: bodySize + }; + } + + moduleFields.push(funcNode); + }); + state.elementsInExportSection.forEach(function (moduleExport) { + /** + * If the export has no id, we won't be able to call it from the outside + * so we can omit it + */ + if (moduleExport.id != null) { + moduleFields.push(t.withLoc(t.moduleExport(moduleExport.name, t.moduleExportDescr(moduleExport.type, moduleExport.id)), moduleExport.endLoc, moduleExport.startLoc)); + } + }); + dumpSep("end of program"); + var module = t.module(null, moduleFields, t.moduleMetadata(moduleMetadata.sections, moduleMetadata.functionNames, moduleMetadata.localNames, moduleMetadata.producers)); + return t.program([module]); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c7e2064d0526eb2b47cae36d6ea2a61413780ebc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/esm/index.js @@ -0,0 +1,248 @@ +import * as decoder from "./decoder"; +import * as t from "@webassemblyjs/ast"; +/** + * TODO(sven): I added initial props, but we should rather fix + * https://github.com/xtuc/webassemblyjs/issues/405 + */ + +var defaultDecoderOpts = { + dump: false, + ignoreCodeSection: false, + ignoreDataSection: false, + ignoreCustomNameSection: false +}; // traverses the AST, locating function name metadata, which is then +// used to update index-based identifiers with function names + +function restoreFunctionNames(ast) { + var functionNames = []; + t.traverse(ast, { + FunctionNameMetadata: function FunctionNameMetadata(_ref) { + var node = _ref.node; + functionNames.push({ + name: node.value, + index: node.index + }); + } + }); + + if (functionNames.length === 0) { + return; + } + + t.traverse(ast, { + Func: function (_Func) { + function Func(_x) { + return _Func.apply(this, arguments); + } + + Func.toString = function () { + return _Func.toString(); + }; + + return Func; + }(function (_ref2) { + var node = _ref2.node; + // $FlowIgnore + var nodeName = node.name; + var indexBasedFunctionName = nodeName.value; + var index = Number(indexBasedFunctionName.replace("func_", "")); + var functionName = functionNames.find(function (f) { + return f.index === index; + }); + + if (functionName) { + var oldValue = nodeName.value; + nodeName.value = functionName.name; // $FlowIgnore + + nodeName.numeric = oldValue; // $FlowIgnore + + delete nodeName.raw; + } + }), + // Also update the reference in the export + ModuleExport: function (_ModuleExport) { + function ModuleExport(_x2) { + return _ModuleExport.apply(this, arguments); + } + + ModuleExport.toString = function () { + return _ModuleExport.toString(); + }; + + return ModuleExport; + }(function (_ref3) { + var node = _ref3.node; + + if (node.descr.exportType === "Func") { + // $FlowIgnore + var nodeName = node.descr.id; + var index = nodeName.value; + var functionName = functionNames.find(function (f) { + return f.index === index; + }); + + if (functionName) { + node.descr.id = t.identifier(functionName.name); + } + } + }), + ModuleImport: function (_ModuleImport) { + function ModuleImport(_x3) { + return _ModuleImport.apply(this, arguments); + } + + ModuleImport.toString = function () { + return _ModuleImport.toString(); + }; + + return ModuleImport; + }(function (_ref4) { + var node = _ref4.node; + + if (node.descr.type === "FuncImportDescr") { + // $FlowIgnore + var indexBasedFunctionName = node.descr.id; + var index = Number(indexBasedFunctionName.replace("func_", "")); + var functionName = functionNames.find(function (f) { + return f.index === index; + }); + + if (functionName) { + // $FlowIgnore + node.descr.id = t.identifier(functionName.name); + } + } + }), + CallInstruction: function (_CallInstruction) { + function CallInstruction(_x4) { + return _CallInstruction.apply(this, arguments); + } + + CallInstruction.toString = function () { + return _CallInstruction.toString(); + }; + + return CallInstruction; + }(function (nodePath) { + var node = nodePath.node; + var index = node.index.value; + var functionName = functionNames.find(function (f) { + return f.index === index; + }); + + if (functionName) { + var oldValue = node.index; + node.index = t.identifier(functionName.name); + node.numeric = oldValue; // $FlowIgnore + + delete node.raw; + } + }) + }); +} + +function restoreLocalNames(ast) { + var localNames = []; + t.traverse(ast, { + LocalNameMetadata: function LocalNameMetadata(_ref5) { + var node = _ref5.node; + localNames.push({ + name: node.value, + localIndex: node.localIndex, + functionIndex: node.functionIndex + }); + } + }); + + if (localNames.length === 0) { + return; + } + + t.traverse(ast, { + Func: function (_Func2) { + function Func(_x5) { + return _Func2.apply(this, arguments); + } + + Func.toString = function () { + return _Func2.toString(); + }; + + return Func; + }(function (_ref6) { + var node = _ref6.node; + var signature = node.signature; + + if (signature.type !== "Signature") { + return; + } // $FlowIgnore + + + var nodeName = node.name; + var indexBasedFunctionName = nodeName.value; + var functionIndex = Number(indexBasedFunctionName.replace("func_", "")); + signature.params.forEach(function (param, paramIndex) { + var paramName = localNames.find(function (f) { + return f.localIndex === paramIndex && f.functionIndex === functionIndex; + }); + + if (paramName && paramName.name !== "") { + param.id = paramName.name; + } + }); + }) + }); +} + +function restoreModuleName(ast) { + t.traverse(ast, { + ModuleNameMetadata: function (_ModuleNameMetadata) { + function ModuleNameMetadata(_x6) { + return _ModuleNameMetadata.apply(this, arguments); + } + + ModuleNameMetadata.toString = function () { + return _ModuleNameMetadata.toString(); + }; + + return ModuleNameMetadata; + }(function (moduleNameMetadataPath) { + // update module + t.traverse(ast, { + Module: function (_Module) { + function Module(_x7) { + return _Module.apply(this, arguments); + } + + Module.toString = function () { + return _Module.toString(); + }; + + return Module; + }(function (_ref7) { + var node = _ref7.node; + var name = moduleNameMetadataPath.node.value; // compatiblity with wast-parser + + if (name === "") { + name = null; + } + + node.id = name; + }) + }); + }) + }); +} + +export function decode(buf, customOpts) { + var opts = Object.assign({}, defaultDecoderOpts, customOpts); + var ast = decoder.decode(buf, opts); + + if (opts.ignoreCustomNameSection === false) { + restoreFunctionNames(ast); + restoreLocalNames(ast); + restoreModuleName(ast); + } + + return ast; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/esm/types/decoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/esm/types/decoder.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js new file mode 100644 index 0000000000000000000000000000000000000000..4abc90ae1d0db204ef61c26e18a25ac7f7b0f5b7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js @@ -0,0 +1,1970 @@ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.decode = decode; + +var _helperApiError = require("@webassemblyjs/helper-api-error"); + +var ieee754 = _interopRequireWildcard(require("@webassemblyjs/ieee754")); + +var utf8 = _interopRequireWildcard(require("@webassemblyjs/utf8")); + +var t = _interopRequireWildcard(require("@webassemblyjs/ast")); + +var _leb = require("@webassemblyjs/leb128"); + +var _helperWasmBytecode = _interopRequireDefault(require("@webassemblyjs/helper-wasm-bytecode")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function toHex(n) { + return "0x" + Number(n).toString(16); +} + +function byteArrayEq(l, r) { + if (l.length !== r.length) { + return false; + } + + for (var i = 0; i < l.length; i++) { + if (l[i] !== r[i]) { + return false; + } + } + + return true; +} + +function decode(ab, opts) { + var buf = new Uint8Array(ab); + var getUniqueName = t.getUniqueNameGenerator(); + var offset = 0; + + function getPosition() { + return { + line: -1, + column: offset + }; + } + + function dump(b, msg) { + if (opts.dump === false) return; + var pad = "\t\t\t\t\t\t\t\t\t\t"; + var str = ""; + + if (b.length < 5) { + str = b.map(toHex).join(" "); + } else { + str = "..."; + } + + console.log(toHex(offset) + ":\t", str, pad, ";", msg); + } + + function dumpSep(msg) { + if (opts.dump === false) return; + console.log(";", msg); + } + /** + * TODO(sven): we can atually use a same structure + * we are adding incrementally new features + */ + + + var state = { + elementsInFuncSection: [], + elementsInExportSection: [], + elementsInCodeSection: [], + + /** + * Decode memory from: + * - Memory section + */ + memoriesInModule: [], + + /** + * Decoded types from: + * - Type section + */ + typesInModule: [], + + /** + * Decoded functions from: + * - Function section + * - Import section + */ + functionsInModule: [], + + /** + * Decoded tables from: + * - Table section + */ + tablesInModule: [], + + /** + * Decoded globals from: + * - Global section + */ + globalsInModule: [] + }; + + function isEOF() { + return offset >= buf.length; + } + + function eatBytes(n) { + offset = offset + n; + } + + function readBytesAtOffset(_offset, numberOfBytes) { + var arr = []; + + for (var i = 0; i < numberOfBytes; i++) { + arr.push(buf[_offset + i]); + } + + return arr; + } + + function readBytes(numberOfBytes) { + return readBytesAtOffset(offset, numberOfBytes); + } + + function readF64() { + var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F64); + var value = ieee754.decodeF64(bytes); + + if (Math.sign(value) * value === Infinity) { + return { + value: Math.sign(value), + inf: true, + nextIndex: ieee754.NUMBER_OF_BYTE_F64 + }; + } + + if (isNaN(value)) { + var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1; + var mantissa = 0; + + for (var i = 0; i < bytes.length - 2; ++i) { + mantissa += bytes[i] * Math.pow(256, i); + } + + mantissa += bytes[bytes.length - 2] % 16 * Math.pow(256, bytes.length - 2); + return { + value: sign * mantissa, + nan: true, + nextIndex: ieee754.NUMBER_OF_BYTE_F64 + }; + } + + return { + value: value, + nextIndex: ieee754.NUMBER_OF_BYTE_F64 + }; + } + + function readF32() { + var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F32); + var value = ieee754.decodeF32(bytes); + + if (Math.sign(value) * value === Infinity) { + return { + value: Math.sign(value), + inf: true, + nextIndex: ieee754.NUMBER_OF_BYTE_F32 + }; + } + + if (isNaN(value)) { + var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1; + var mantissa = 0; + + for (var i = 0; i < bytes.length - 2; ++i) { + mantissa += bytes[i] * Math.pow(256, i); + } + + mantissa += bytes[bytes.length - 2] % 128 * Math.pow(256, bytes.length - 2); + return { + value: sign * mantissa, + nan: true, + nextIndex: ieee754.NUMBER_OF_BYTE_F32 + }; + } + + return { + value: value, + nextIndex: ieee754.NUMBER_OF_BYTE_F32 + }; + } + + function readUTF8String() { + var lenu32 = readU32(); // Don't eat any bytes. Instead, peek ahead of the current offset using + // readBytesAtOffset below. This keeps readUTF8String neutral with respect + // to the current offset, just like the other readX functions. + + var strlen = lenu32.value; + dump([strlen], "string length"); + var bytes = readBytesAtOffset(offset + lenu32.nextIndex, strlen); + var value = utf8.decode(bytes); + return { + value: value, + nextIndex: strlen + lenu32.nextIndex + }; + } + /** + * Decode an unsigned 32bits integer + * + * The length will be handled by the leb librairy, we pass the max number of + * byte. + */ + + + function readU32() { + var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U32); + var buffer = new Uint8Array(bytes); + return (0, _leb.decodeUInt32)(buffer); + } + + function readVaruint32() { + // where 32 bits = max 4 bytes + var bytes = readBytes(4); + var buffer = new Uint8Array(bytes); + return (0, _leb.decodeUInt32)(buffer); + } + + function readVaruint7() { + // where 7 bits = max 1 bytes + var bytes = readBytes(1); + var buffer = new Uint8Array(bytes); + return (0, _leb.decodeUInt32)(buffer); + } + /** + * Decode a signed 32bits interger + */ + + + function read32() { + var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U32); + var buffer = new Uint8Array(bytes); + return (0, _leb.decodeInt32)(buffer); + } + /** + * Decode a signed 64bits integer + */ + + + function read64() { + var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64); + var buffer = new Uint8Array(bytes); + return (0, _leb.decodeInt64)(buffer); + } + + function readU64() { + var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64); + var buffer = new Uint8Array(bytes); + return (0, _leb.decodeUInt64)(buffer); + } + + function readByte() { + return readBytes(1)[0]; + } + + function parseModuleHeader() { + if (isEOF() === true || offset + 4 > buf.length) { + throw new Error("unexpected end"); + } + + var header = readBytes(4); + + if (byteArrayEq(_helperWasmBytecode["default"].magicModuleHeader, header) === false) { + throw new _helperApiError.CompileError("magic header not detected"); + } + + dump(header, "wasm magic header"); + eatBytes(4); + } + + function parseVersion() { + if (isEOF() === true || offset + 4 > buf.length) { + throw new Error("unexpected end"); + } + + var version = readBytes(4); + + if (byteArrayEq(_helperWasmBytecode["default"].moduleVersion, version) === false) { + throw new _helperApiError.CompileError("unknown binary version"); + } + + dump(version, "wasm version"); + eatBytes(4); + } + + function parseVec(cast) { + var u32 = readU32(); + var length = u32.value; + eatBytes(u32.nextIndex); + dump([length], "number"); + + if (length === 0) { + return []; + } + + var elements = []; + + for (var i = 0; i < length; i++) { + var _byte = readByte(); + + eatBytes(1); + var value = cast(_byte); + dump([_byte], value); + + if (typeof value === "undefined") { + throw new _helperApiError.CompileError("Internal failure: parseVec could not cast the value"); + } + + elements.push(value); + } + + return elements; + } // Type section + // https://webassembly.github.io/spec/binary/modules.html#binary-typesec + + + function parseTypeSection(numberOfTypes) { + var typeInstructionNodes = []; + dump([numberOfTypes], "num types"); + + for (var i = 0; i < numberOfTypes; i++) { + var _startLoc = getPosition(); + + dumpSep("type " + i); + var type = readByte(); + eatBytes(1); + + if (type == _helperWasmBytecode["default"].types.func) { + dump([type], "func"); + var paramValtypes = parseVec(function (b) { + var valtype = _helperWasmBytecode["default"].valtypes[b]; + + if (valtype === undefined) { + throw new Error("unexpected value type ".concat(b)); + } + + return valtype; + }); + var params = paramValtypes.map(function (v) { + return t.funcParam( + /*valtype*/ + v); + }); + var result = parseVec(function (b) { + return _helperWasmBytecode["default"].valtypes[b]; + }); + typeInstructionNodes.push(function () { + var endLoc = getPosition(); + return t.withLoc(t.typeInstruction(undefined, t.signature(params, result)), endLoc, _startLoc); + }()); + state.typesInModule.push({ + params: params, + result: result + }); + } else { + throw new Error("Unsupported type: " + toHex(type)); + } + } + + return typeInstructionNodes; + } // Import section + // https://webassembly.github.io/spec/binary/modules.html#binary-importsec + + + function parseImportSection(numberOfImports) { + var imports = []; + + for (var i = 0; i < numberOfImports; i++) { + dumpSep("import header " + i); + + var _startLoc2 = getPosition(); + /** + * Module name + */ + + + var moduleName = readUTF8String(); + eatBytes(moduleName.nextIndex); + dump([], "module name (".concat(moduleName.value, ")")); + /** + * Name + */ + + var name = readUTF8String(); + eatBytes(name.nextIndex); + dump([], "name (".concat(name.value, ")")); + /** + * Import descr + */ + + var descrTypeByte = readByte(); + eatBytes(1); + var descrType = _helperWasmBytecode["default"].importTypes[descrTypeByte]; + dump([descrTypeByte], "import kind"); + + if (typeof descrType === "undefined") { + throw new _helperApiError.CompileError("Unknown import description type: " + toHex(descrTypeByte)); + } + + var importDescr = void 0; + + if (descrType === "func") { + var indexU32 = readU32(); + var typeindex = indexU32.value; + eatBytes(indexU32.nextIndex); + dump([typeindex], "type index"); + var signature = state.typesInModule[typeindex]; + + if (typeof signature === "undefined") { + throw new _helperApiError.CompileError("function signature not found (".concat(typeindex, ")")); + } + + var id = getUniqueName("func"); + importDescr = t.funcImportDescr(id, t.signature(signature.params, signature.result)); + state.functionsInModule.push({ + id: t.identifier(name.value), + signature: signature, + isExternal: true + }); + } else if (descrType === "global") { + importDescr = parseGlobalType(); + var globalNode = t.global(importDescr, []); + state.globalsInModule.push(globalNode); + } else if (descrType === "table") { + importDescr = parseTableType(i); + } else if (descrType === "memory") { + var memoryNode = parseMemoryType(0); + state.memoriesInModule.push(memoryNode); + importDescr = memoryNode; + } else { + throw new _helperApiError.CompileError("Unsupported import of type: " + descrType); + } + + imports.push(function () { + var endLoc = getPosition(); + return t.withLoc(t.moduleImport(moduleName.value, name.value, importDescr), endLoc, _startLoc2); + }()); + } + + return imports; + } // Function section + // https://webassembly.github.io/spec/binary/modules.html#function-section + + + function parseFuncSection(numberOfFunctions) { + dump([numberOfFunctions], "num funcs"); + + for (var i = 0; i < numberOfFunctions; i++) { + var indexU32 = readU32(); + var typeindex = indexU32.value; + eatBytes(indexU32.nextIndex); + dump([typeindex], "type index"); + var signature = state.typesInModule[typeindex]; + + if (typeof signature === "undefined") { + throw new _helperApiError.CompileError("function signature not found (".concat(typeindex, ")")); + } // preserve anonymous, a name might be resolved later + + + var id = t.withRaw(t.identifier(getUniqueName("func")), ""); + state.functionsInModule.push({ + id: id, + signature: signature, + isExternal: false + }); + } + } // Export section + // https://webassembly.github.io/spec/binary/modules.html#export-section + + + function parseExportSection(numberOfExport) { + dump([numberOfExport], "num exports"); // Parse vector of exports + + for (var i = 0; i < numberOfExport; i++) { + var _startLoc3 = getPosition(); + /** + * Name + */ + + + var name = readUTF8String(); + eatBytes(name.nextIndex); + dump([], "export name (".concat(name.value, ")")); + /** + * exportdescr + */ + + var typeIndex = readByte(); + eatBytes(1); + dump([typeIndex], "export kind"); + var indexu32 = readU32(); + var index = indexu32.value; + eatBytes(indexu32.nextIndex); + dump([index], "export index"); + var id = void 0, + signature = void 0; + + if (_helperWasmBytecode["default"].exportTypes[typeIndex] === "Func") { + var func = state.functionsInModule[index]; + + if (typeof func === "undefined") { + throw new _helperApiError.CompileError("unknown function (".concat(index, ")")); + } + + id = t.numberLiteralFromRaw(index, String(index)); + signature = func.signature; + } else if (_helperWasmBytecode["default"].exportTypes[typeIndex] === "Table") { + var table = state.tablesInModule[index]; + + if (typeof table === "undefined") { + throw new _helperApiError.CompileError("unknown table ".concat(index)); + } + + id = t.numberLiteralFromRaw(index, String(index)); + signature = null; + } else if (_helperWasmBytecode["default"].exportTypes[typeIndex] === "Memory") { + var memNode = state.memoriesInModule[index]; + + if (typeof memNode === "undefined") { + throw new _helperApiError.CompileError("unknown memory ".concat(index)); + } + + id = t.numberLiteralFromRaw(index, String(index)); + signature = null; + } else if (_helperWasmBytecode["default"].exportTypes[typeIndex] === "Global") { + var global = state.globalsInModule[index]; + + if (typeof global === "undefined") { + throw new _helperApiError.CompileError("unknown global ".concat(index)); + } + + id = t.numberLiteralFromRaw(index, String(index)); + signature = null; + } else { + console.warn("Unsupported export type: " + toHex(typeIndex)); + return; + } + + var endLoc = getPosition(); + state.elementsInExportSection.push({ + name: name.value, + type: _helperWasmBytecode["default"].exportTypes[typeIndex], + signature: signature, + id: id, + index: index, + endLoc: endLoc, + startLoc: _startLoc3 + }); + } + } // Code section + // https://webassembly.github.io/spec/binary/modules.html#code-section + + + function parseCodeSection(numberOfFuncs) { + dump([numberOfFuncs], "number functions"); // Parse vector of function + + for (var i = 0; i < numberOfFuncs; i++) { + var _startLoc4 = getPosition(); + + dumpSep("function body " + i); // the u32 size of the function code in bytes + // Ignore it for now + + var bodySizeU32 = readU32(); + eatBytes(bodySizeU32.nextIndex); + dump([bodySizeU32.value], "function body size"); + var code = []; // Parse locals + + var funcLocalNumU32 = readU32(); + var funcLocalNum = funcLocalNumU32.value; + eatBytes(funcLocalNumU32.nextIndex); + dump([funcLocalNum], "num locals"); + var locals = []; + + for (var _i = 0; _i < funcLocalNum; _i++) { + var _startLoc5 = getPosition(); + + var localCountU32 = readU32(); + var localCount = localCountU32.value; + eatBytes(localCountU32.nextIndex); + dump([localCount], "num local"); + var valtypeByte = readByte(); + eatBytes(1); + var type = _helperWasmBytecode["default"].valtypes[valtypeByte]; + var args = []; + + for (var _i2 = 0; _i2 < localCount; _i2++) { + args.push(t.valtypeLiteral(type)); + } + + var localNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.instruction("local", args), endLoc, _startLoc5); + }(); + + locals.push(localNode); + dump([valtypeByte], type); + + if (typeof type === "undefined") { + throw new _helperApiError.CompileError("Unexpected valtype: " + toHex(valtypeByte)); + } + } + + code.push.apply(code, locals); // Decode instructions until the end + + parseInstructionBlock(code); + var endLoc = getPosition(); + state.elementsInCodeSection.push({ + code: code, + locals: locals, + endLoc: endLoc, + startLoc: _startLoc4, + bodySize: bodySizeU32.value + }); + } + } + + function parseInstructionBlock(code) { + while (true) { + var _startLoc6 = getPosition(); + + var instructionAlreadyCreated = false; + var instructionByte = readByte(); + eatBytes(1); + + if (instructionByte === 0xfe) { + instructionByte = 0xfe00 + readByte(); + eatBytes(1); + } // Table instructions + // https://webassembly.github.io/spec/core/binary/instructions.html#table-instructions + + + if (instructionByte === 0xfc) { + instructionByte = 0xfc00 + readByte(); + eatBytes(1); + } + + var instruction = _helperWasmBytecode["default"].symbolsByByte[instructionByte]; + + if (typeof instruction === "undefined") { + throw new _helperApiError.CompileError("Unexpected instruction: " + toHex(instructionByte)); + } + + if (instruction === "illegal") { + throw new Error("tried to decode an illegal bytecode: ".concat(toHex(instructionByte))); + } + + if (typeof instruction.object === "string") { + dump([instructionByte], "".concat(instruction.object, ".").concat(instruction.name)); + } else { + dump([instructionByte], instruction.name); + } + /** + * End of the function + */ + + + if (instruction.name === "end") { + var node = function () { + var endLoc = getPosition(); + return t.withLoc(t.instruction(instruction.name), endLoc, _startLoc6); + }(); + + code.push(node); + break; + } + + var args = []; + var namedArgs = void 0; + + if (instruction.name === "loop") { + var _startLoc7 = getPosition(); + + var blocktype = parseBlockType(); + var instr = []; + parseInstructionBlock(instr); // preserve anonymous + + var label = t.withRaw(t.identifier(getUniqueName("loop")), ""); + + var loopNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.loopInstruction(label, blocktype, instr), endLoc, _startLoc7); + }(); + + code.push(loopNode); + instructionAlreadyCreated = true; + } else if (instruction.name === "if") { + var _startLoc8 = getPosition(); + + var _blocktype = parseBlockType(); + + var testIndex = t.withRaw(t.identifier(getUniqueName("if")), ""); + var ifBody = []; + parseInstructionBlock(ifBody); // Defaults to no alternate + + var elseIndex = 0; + + for (elseIndex = 0; elseIndex < ifBody.length; ++elseIndex) { + var _instr = ifBody[elseIndex]; + + if (_instr.type === "Instr" && _instr.id === "else") { + break; + } + } + + var consequentInstr = ifBody.slice(0, elseIndex); + var alternate = ifBody.slice(elseIndex + 1); // wast sugar + + var testInstrs = []; + + var ifNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.ifInstruction(testIndex, testInstrs, _blocktype, consequentInstr, alternate), endLoc, _startLoc8); + }(); + + code.push(ifNode); + instructionAlreadyCreated = true; + } else if (instruction.name === "block") { + var _startLoc9 = getPosition(); + + var _blocktype2 = parseBlockType(); + + var _instr2 = []; + parseInstructionBlock(_instr2); // preserve anonymous + + var _label = t.withRaw(t.identifier(getUniqueName("block")), ""); + + var blockNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.blockInstruction(_label, _instr2, _blocktype2), endLoc, _startLoc9); + }(); + + code.push(blockNode); + instructionAlreadyCreated = true; + } else if (instruction.name === "call") { + var indexu32 = readU32(); + var index = indexu32.value; + eatBytes(indexu32.nextIndex); + dump([index], "index"); + + var callNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.callInstruction(t.indexLiteral(index)), endLoc, _startLoc6); + }(); + + code.push(callNode); + instructionAlreadyCreated = true; + } else if (instruction.name === "call_indirect") { + var _startLoc10 = getPosition(); + + var indexU32 = readU32(); + var typeindex = indexU32.value; + eatBytes(indexU32.nextIndex); + dump([typeindex], "type index"); + var signature = state.typesInModule[typeindex]; + + if (typeof signature === "undefined") { + throw new _helperApiError.CompileError("call_indirect signature not found (".concat(typeindex, ")")); + } + + var _callNode = t.callIndirectInstruction(t.signature(signature.params, signature.result), []); + + var flagU32 = readU32(); + var flag = flagU32.value; // 0x00 - reserved byte + + eatBytes(flagU32.nextIndex); + + if (flag !== 0) { + throw new _helperApiError.CompileError("zero flag expected"); + } + + code.push(function () { + var endLoc = getPosition(); + return t.withLoc(_callNode, endLoc, _startLoc10); + }()); + instructionAlreadyCreated = true; + } else if (instruction.name === "br_table") { + var indicesu32 = readU32(); + var indices = indicesu32.value; + eatBytes(indicesu32.nextIndex); + dump([indices], "num indices"); + + for (var i = 0; i <= indices; i++) { + var _indexu = readU32(); + + var _index = _indexu.value; + eatBytes(_indexu.nextIndex); + dump([_index], "index"); + args.push(t.numberLiteralFromRaw(_indexu.value.toString(), "u32")); + } + } else if (instructionByte >= 0x28 && instructionByte <= 0x40) { + /** + * Memory instructions + */ + if (instruction.name === "grow_memory" || instruction.name === "current_memory") { + var _indexU = readU32(); + + var _index2 = _indexU.value; + eatBytes(_indexU.nextIndex); + + if (_index2 !== 0) { + throw new Error("zero flag expected"); + } + + dump([_index2], "index"); + } else { + var aligun32 = readU32(); + var align = aligun32.value; + eatBytes(aligun32.nextIndex); + dump([align], "align"); + var offsetu32 = readU32(); + var _offset2 = offsetu32.value; + eatBytes(offsetu32.nextIndex); + dump([_offset2], "offset"); + if (namedArgs === undefined) namedArgs = {}; + namedArgs.offset = t.numberLiteralFromRaw(_offset2); + } + } else if (instructionByte >= 0x41 && instructionByte <= 0x44) { + /** + * Numeric instructions + */ + if (instruction.object === "i32") { + var value32 = read32(); + var value = value32.value; + eatBytes(value32.nextIndex); + dump([value], "i32 value"); + args.push(t.numberLiteralFromRaw(value)); + } + + if (instruction.object === "u32") { + var valueu32 = readU32(); + var _value = valueu32.value; + eatBytes(valueu32.nextIndex); + dump([_value], "u32 value"); + args.push(t.numberLiteralFromRaw(_value)); + } + + if (instruction.object === "i64") { + var value64 = read64(); + var _value2 = value64.value; + eatBytes(value64.nextIndex); + dump([Number(_value2.toString())], "i64 value"); + var high = _value2.high, + low = _value2.low; + var _node = { + type: "LongNumberLiteral", + value: { + high: high, + low: low + } + }; + args.push(_node); + } + + if (instruction.object === "u64") { + var valueu64 = readU64(); + var _value3 = valueu64.value; + eatBytes(valueu64.nextIndex); + dump([Number(_value3.toString())], "u64 value"); + var _high = _value3.high, + _low = _value3.low; + var _node2 = { + type: "LongNumberLiteral", + value: { + high: _high, + low: _low + } + }; + args.push(_node2); + } + + if (instruction.object === "f32") { + var valuef32 = readF32(); + var _value4 = valuef32.value; + eatBytes(valuef32.nextIndex); + dump([_value4], "f32 value"); + args.push( // $FlowIgnore + t.floatLiteral(_value4, valuef32.nan, valuef32.inf, String(_value4))); + } + + if (instruction.object === "f64") { + var valuef64 = readF64(); + var _value5 = valuef64.value; + eatBytes(valuef64.nextIndex); + dump([_value5], "f64 value"); + args.push( // $FlowIgnore + t.floatLiteral(_value5, valuef64.nan, valuef64.inf, String(_value5))); + } + } else if (instructionByte >= 0xfe00 && instructionByte <= 0xfeff) { + /** + * Atomic memory instructions + */ + var align32 = readU32(); + var _align = align32.value; + eatBytes(align32.nextIndex); + dump([_align], "align"); + + var _offsetu = readU32(); + + var _offset3 = _offsetu.value; + eatBytes(_offsetu.nextIndex); + dump([_offset3], "offset"); + } else { + for (var _i3 = 0; _i3 < instruction.numberOfArgs; _i3++) { + var u32 = readU32(); + eatBytes(u32.nextIndex); + dump([u32.value], "argument " + _i3); + args.push(t.numberLiteralFromRaw(u32.value)); + } + } + + if (instructionAlreadyCreated === false) { + if (typeof instruction.object === "string") { + var _node3 = function () { + var endLoc = getPosition(); + return t.withLoc(t.objectInstruction(instruction.name, instruction.object, args, namedArgs), endLoc, _startLoc6); + }(); + + code.push(_node3); + } else { + var _node4 = function () { + var endLoc = getPosition(); + return t.withLoc(t.instruction(instruction.name, args, namedArgs), endLoc, _startLoc6); + }(); + + code.push(_node4); + } + } + } + } // https://webassembly.github.io/spec/core/binary/types.html#limits + + + function parseLimits() { + var limitType = readByte(); + eatBytes(1); + var shared = limitType === 0x03; + dump([limitType], "limit type" + (shared ? " (shared)" : "")); + var min, max; + + if (limitType === 0x01 || limitType === 0x03 // shared limits + ) { + var u32min = readU32(); + min = parseInt(u32min.value); + eatBytes(u32min.nextIndex); + dump([min], "min"); + var u32max = readU32(); + max = parseInt(u32max.value); + eatBytes(u32max.nextIndex); + dump([max], "max"); + } + + if (limitType === 0x00) { + var _u32min = readU32(); + + min = parseInt(_u32min.value); + eatBytes(_u32min.nextIndex); + dump([min], "min"); + } + + return t.limit(min, max, shared); + } // https://webassembly.github.io/spec/core/binary/types.html#binary-tabletype + + + function parseTableType(index) { + var name = t.withRaw(t.identifier(getUniqueName("table")), String(index)); + var elementTypeByte = readByte(); + eatBytes(1); + dump([elementTypeByte], "element type"); + var elementType = _helperWasmBytecode["default"].tableTypes[elementTypeByte]; + + if (typeof elementType === "undefined") { + throw new _helperApiError.CompileError("Unknown element type in table: " + toHex(elementTypeByte)); + } + + var limits = parseLimits(); + return t.table(elementType, limits, name); + } // https://webassembly.github.io/spec/binary/types.html#global-types + + + function parseGlobalType() { + var valtypeByte = readByte(); + eatBytes(1); + var type = _helperWasmBytecode["default"].valtypes[valtypeByte]; + dump([valtypeByte], type); + + if (typeof type === "undefined") { + throw new _helperApiError.CompileError("Unknown valtype: " + toHex(valtypeByte)); + } + + var globalTypeByte = readByte(); + eatBytes(1); + var globalType = _helperWasmBytecode["default"].globalTypes[globalTypeByte]; + dump([globalTypeByte], "global type (".concat(globalType, ")")); + + if (typeof globalType === "undefined") { + throw new _helperApiError.CompileError("Invalid mutability: " + toHex(globalTypeByte)); + } + + return t.globalType(type, globalType); + } // function parseNameModule() { + // const lenu32 = readVaruint32(); + // eatBytes(lenu32.nextIndex); + // console.log("len", lenu32); + // const strlen = lenu32.value; + // dump([strlen], "string length"); + // const bytes = readBytes(strlen); + // eatBytes(strlen); + // const value = utf8.decode(bytes); + // return [t.moduleNameMetadata(value)]; + // } + // this section contains an array of function names and indices + + + function parseNameSectionFunctions() { + var functionNames = []; + var numberOfFunctionsu32 = readU32(); + var numbeOfFunctions = numberOfFunctionsu32.value; + eatBytes(numberOfFunctionsu32.nextIndex); + + for (var i = 0; i < numbeOfFunctions; i++) { + var indexu32 = readU32(); + var index = indexu32.value; + eatBytes(indexu32.nextIndex); + var name = readUTF8String(); + eatBytes(name.nextIndex); + functionNames.push(t.functionNameMetadata(name.value, index)); + } + + return functionNames; + } + + function parseNameSectionLocals() { + var localNames = []; + var numbeOfFunctionsu32 = readU32(); + var numbeOfFunctions = numbeOfFunctionsu32.value; + eatBytes(numbeOfFunctionsu32.nextIndex); + + for (var i = 0; i < numbeOfFunctions; i++) { + var functionIndexu32 = readU32(); + var functionIndex = functionIndexu32.value; + eatBytes(functionIndexu32.nextIndex); + var numLocalsu32 = readU32(); + var numLocals = numLocalsu32.value; + eatBytes(numLocalsu32.nextIndex); + + for (var _i4 = 0; _i4 < numLocals; _i4++) { + var localIndexu32 = readU32(); + var localIndex = localIndexu32.value; + eatBytes(localIndexu32.nextIndex); + var name = readUTF8String(); + eatBytes(name.nextIndex); + localNames.push(t.localNameMetadata(name.value, localIndex, functionIndex)); + } + } + + return localNames; + } // this is a custom section used for name resolution + // https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section + + + function parseNameSection(remainingBytes) { + var nameMetadata = []; + var initialOffset = offset; + + while (offset - initialOffset < remainingBytes) { + // name_type + var sectionTypeByte = readVaruint7(); + eatBytes(sectionTypeByte.nextIndex); // name_payload_len + + var subSectionSizeInBytesu32 = readVaruint32(); + eatBytes(subSectionSizeInBytesu32.nextIndex); + + switch (sectionTypeByte.value) { + // case 0: { + // TODO(sven): re-enable that + // Current status: it seems that when we decode the module's name + // no name_payload_len is used. + // + // See https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section + // + // nameMetadata.push(...parseNameModule()); + // break; + // } + case 1: + { + nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionFunctions())); + break; + } + + case 2: + { + nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionLocals())); + break; + } + + default: + { + // skip unknown subsection + eatBytes(subSectionSizeInBytesu32.value); + } + } + } + + return nameMetadata; + } // this is a custom section used for information about the producers + // https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md + + + function parseProducersSection() { + var metadata = t.producersSectionMetadata([]); // field_count + + var sectionTypeByte = readVaruint32(); + eatBytes(sectionTypeByte.nextIndex); + dump([sectionTypeByte.value], "num of producers"); + var fields = { + language: [], + "processed-by": [], + sdk: [] + }; // fields + + for (var fieldI = 0; fieldI < sectionTypeByte.value; fieldI++) { + // field_name + var fieldName = readUTF8String(); + eatBytes(fieldName.nextIndex); // field_value_count + + var valueCount = readVaruint32(); + eatBytes(valueCount.nextIndex); // field_values + + for (var producerI = 0; producerI < valueCount.value; producerI++) { + var producerName = readUTF8String(); + eatBytes(producerName.nextIndex); + var producerVersion = readUTF8String(); + eatBytes(producerVersion.nextIndex); + fields[fieldName.value].push(t.producerMetadataVersionedName(producerName.value, producerVersion.value)); + } + + metadata.producers.push(fields[fieldName.value]); + } + + return metadata; + } + + function parseGlobalSection(numberOfGlobals) { + var globals = []; + dump([numberOfGlobals], "num globals"); + + for (var i = 0; i < numberOfGlobals; i++) { + var _startLoc11 = getPosition(); + + var globalType = parseGlobalType(); + /** + * Global expressions + */ + + var init = []; + parseInstructionBlock(init); + + var node = function () { + var endLoc = getPosition(); + return t.withLoc(t.global(globalType, init), endLoc, _startLoc11); + }(); + + globals.push(node); + state.globalsInModule.push(node); + } + + return globals; + } + + function parseElemSection(numberOfElements) { + var elems = []; + dump([numberOfElements], "num elements"); + + for (var i = 0; i < numberOfElements; i++) { + var _startLoc12 = getPosition(); + + var tableindexu32 = readU32(); + var bitfield = tableindexu32.value; + eatBytes(tableindexu32.nextIndex); + dump([bitfield], "bitfield"); + + if (bitfield === 0) { + // Parse instructions + var instr = []; + parseInstructionBlock(instr); // Parse ( vector function index ) * + + var indicesu32 = readU32(); + var indices = indicesu32.value; + eatBytes(indicesu32.nextIndex); + dump([indices], "num indices"); + var indexValues = []; + + for (var _i5 = 0; _i5 < indices; _i5++) { + var indexu32 = readU32(); + var index = indexu32.value; + eatBytes(indexu32.nextIndex); + dump([index], "index"); + indexValues.push(t.indexLiteral(index)); + } + + var elemNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.elem(t.indexLiteral(bitfield), instr, indexValues), endLoc, _startLoc12); + }(); + + elems.push(elemNode); + } else if (bitfield === 1) { + var elemKind = readByte(); + eatBytes(1); + + if (elemKind !== 0) { + throw new Error("unexpected Elem kind: ".concat(toHex(elemKind))); + } // Parse ( vector function index ) * + + + var _indicesu = readU32(); + + var _indices = _indicesu.value; + eatBytes(_indicesu.nextIndex); + dump([_indices], "num indices"); + var _indexValues = []; + + for (var _i6 = 0; _i6 < _indices; _i6++) { + var _indexu2 = readU32(); + + var _index3 = _indexu2.value; + eatBytes(_indexu2.nextIndex); + dump([_index3], "index"); + + _indexValues.push(t.indexLiteral(_index3)); + } // TODO: emit a AST node, for now just make it parse. + + } else if (bitfield === 2) { + var u32 = readU32(); + var tableidx = u32.value; + eatBytes(u32.nextIndex); + dump([tableidx], "tableidx"); // Parse instructions + + var _instr3 = []; + parseInstructionBlock(_instr3); + + var _elemKind = readByte(); + + eatBytes(1); + + if (_elemKind !== 0) { + throw new Error("unexpected Elem kind: ".concat(toHex(_elemKind))); + } // Parse ( vector function index ) * + + + var _indicesu2 = readU32(); + + var _indices2 = _indicesu2.value; + eatBytes(_indicesu2.nextIndex); + dump([_indices2], "num indices"); + var _indexValues2 = []; + + for (var _i7 = 0; _i7 < _indices2; _i7++) { + var _indexu3 = readU32(); + + var _index4 = _indexu3.value; + eatBytes(_indexu3.nextIndex); + dump([_index4], "index"); + + _indexValues2.push(t.indexLiteral(_index4)); + } + + var _elemNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.elem(t.indexLiteral(bitfield), _instr3, _indexValues2), endLoc, _startLoc12); + }(); + + elems.push(_elemNode); + } else if (bitfield === 3) { + var _elemKind2 = readByte(); + + eatBytes(1); + + if (_elemKind2 !== 0) { + throw new Error("unexpected Elem kind: ".concat(toHex(_elemKind2))); + } // Parse ( vector function index ) * + + + var countU32 = readU32(); + var count = countU32.value; + eatBytes(countU32.nextIndex); + dump([count], "count"); + + for (var _i8 = 0; _i8 < count; _i8++) { + var _indexu4 = readU32(); + + var _index5 = _indexu4.value; + eatBytes(_indexu4.nextIndex); + dump([_index5], "index"); + } // TODO: emit a AST node, for now just make it parse. + + } else if (bitfield === 4) { + var expr = []; + parseInstructionBlock(expr); + + var _countU = readU32(); + + var _count = _countU.value; + eatBytes(_countU.nextIndex); + dump([_count], "count"); + + for (var _i9 = 0; _i9 < _count; _i9++) { + var code = []; + parseInstructionBlock(code); + } // TODO: emit a AST node, for now just make it parse. + + } else if (bitfield === 5) { + var reftype = readByte(); + eatBytes(1); + dump([reftype], "reftype"); + + var _countU2 = readU32(); + + var _count2 = _countU2.value; + eatBytes(_countU2.nextIndex); + dump([_count2], "count"); + + for (var _i10 = 0; _i10 < _count2; _i10++) { + var _code = []; + parseInstructionBlock(_code); + } // TODO: emit a AST node, for now just make it parse. + + } else if (bitfield === 7) { + var _reftype = readByte(); + + eatBytes(1); + dump([_reftype], "reftype"); + + var _countU3 = readU32(); + + var _count3 = _countU3.value; + eatBytes(_countU3.nextIndex); + dump([_count3], "count"); + + for (var _i11 = 0; _i11 < _count3; _i11++) { + var _code2 = []; + parseInstructionBlock(_code2); + } // TODO: emit a AST node, for now just make it parse. + + } else { + throw new Error("unexpected Elem with bitfield ".concat(toHex(bitfield))); + } + } + + return elems; + } // https://webassembly.github.io/spec/core/binary/types.html#memory-types + + + function parseMemoryType(i) { + var limits = parseLimits(); + return t.memory(limits, t.indexLiteral(i)); + } // https://webassembly.github.io/spec/binary/modules.html#table-section + + + function parseTableSection(numberOfElements) { + var tables = []; + dump([numberOfElements], "num elements"); + + for (var i = 0; i < numberOfElements; i++) { + var tablesNode = parseTableType(i); + state.tablesInModule.push(tablesNode); + tables.push(tablesNode); + } + + return tables; + } // https://webassembly.github.io/spec/binary/modules.html#memory-section + + + function parseMemorySection(numberOfElements) { + var memories = []; + dump([numberOfElements], "num elements"); + + for (var i = 0; i < numberOfElements; i++) { + var memoryNode = parseMemoryType(i); + state.memoriesInModule.push(memoryNode); + memories.push(memoryNode); + } + + return memories; + } // https://webassembly.github.io/spec/binary/modules.html#binary-startsec + + + function parseStartSection() { + var startLoc = getPosition(); + var u32 = readU32(); + var startFuncIndex = u32.value; + eatBytes(u32.nextIndex); + dump([startFuncIndex], "index"); + return function () { + var endLoc = getPosition(); + return t.withLoc(t.start(t.indexLiteral(startFuncIndex)), endLoc, startLoc); + }(); + } // https://webassembly.github.io/spec/binary/modules.html#data-section + + + function parseDataSection(numberOfElements) { + var dataEntries = []; + dump([numberOfElements], "num elements"); + + for (var i = 0; i < numberOfElements; i++) { + var memoryIndexu32 = readU32(); + var memoryIndex = memoryIndexu32.value; + eatBytes(memoryIndexu32.nextIndex); + dump([memoryIndex], "memory index"); + var instrs = []; + parseInstructionBlock(instrs); + var hasExtraInstrs = instrs.filter(function (i) { + return i.id !== "end"; + }).length !== 1; + + if (hasExtraInstrs) { + throw new _helperApiError.CompileError("data section offset must be a single instruction"); + } + + var bytes = parseVec(function (b) { + return b; + }); + dump([], "init"); + dataEntries.push(t.data(t.memIndexLiteral(memoryIndex), instrs[0], t.byteArray(bytes))); + } + + return dataEntries; + } // https://webassembly.github.io/spec/binary/modules.html#binary-section + + + function parseSection(sectionIndex) { + var sectionId = readByte(); + eatBytes(1); + + if (sectionId >= sectionIndex || sectionIndex === _helperWasmBytecode["default"].sections.custom) { + sectionIndex = sectionId + 1; + } else { + if (sectionId !== _helperWasmBytecode["default"].sections.custom) throw new _helperApiError.CompileError("Unexpected section: " + toHex(sectionId)); + } + + var nextSectionIndex = sectionIndex; + var startOffset = offset; + var startLoc = getPosition(); + var u32 = readU32(); + var sectionSizeInBytes = u32.value; + eatBytes(u32.nextIndex); + + var sectionSizeInBytesNode = function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(sectionSizeInBytes), endLoc, startLoc); + }(); + + switch (sectionId) { + case _helperWasmBytecode["default"].sections.type: + { + dumpSep("section Type"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc13 = getPosition(); + + var _u = readU32(); + + var numberOfTypes = _u.value; + eatBytes(_u.nextIndex); + var metadata = t.sectionMetadata("type", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfTypes), endLoc, _startLoc13); + }()); + var nodes = parseTypeSection(numberOfTypes); + return { + nodes: nodes, + metadata: metadata, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections.table: + { + dumpSep("section Table"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc14 = getPosition(); + + var _u2 = readU32(); + + var numberOfTable = _u2.value; + eatBytes(_u2.nextIndex); + dump([numberOfTable], "num tables"); + + var _metadata = t.sectionMetadata("table", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfTable), endLoc, _startLoc14); + }()); + + var _nodes = parseTableSection(numberOfTable); + + return { + nodes: _nodes, + metadata: _metadata, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections["import"]: + { + dumpSep("section Import"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc15 = getPosition(); + + var numberOfImportsu32 = readU32(); + var numberOfImports = numberOfImportsu32.value; + eatBytes(numberOfImportsu32.nextIndex); + dump([numberOfImports], "number of imports"); + + var _metadata2 = t.sectionMetadata("import", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfImports), endLoc, _startLoc15); + }()); + + var _nodes2 = parseImportSection(numberOfImports); + + return { + nodes: _nodes2, + metadata: _metadata2, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections.func: + { + dumpSep("section Function"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc16 = getPosition(); + + var numberOfFunctionsu32 = readU32(); + var numberOfFunctions = numberOfFunctionsu32.value; + eatBytes(numberOfFunctionsu32.nextIndex); + + var _metadata3 = t.sectionMetadata("func", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfFunctions), endLoc, _startLoc16); + }()); + + parseFuncSection(numberOfFunctions); + var _nodes3 = []; + return { + nodes: _nodes3, + metadata: _metadata3, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections["export"]: + { + dumpSep("section Export"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc17 = getPosition(); + + var _u3 = readU32(); + + var numberOfExport = _u3.value; + eatBytes(_u3.nextIndex); + + var _metadata4 = t.sectionMetadata("export", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfExport), endLoc, _startLoc17); + }()); + + parseExportSection(numberOfExport); + var _nodes4 = []; + return { + nodes: _nodes4, + metadata: _metadata4, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections.code: + { + dumpSep("section Code"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc18 = getPosition(); + + var _u4 = readU32(); + + var numberOfFuncs = _u4.value; + eatBytes(_u4.nextIndex); + + var _metadata5 = t.sectionMetadata("code", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfFuncs), endLoc, _startLoc18); + }()); + + if (opts.ignoreCodeSection === true) { + var remainingBytes = sectionSizeInBytes - _u4.nextIndex; + eatBytes(remainingBytes); // eat the entire section + } else { + parseCodeSection(numberOfFuncs); + } + + var _nodes5 = []; + return { + nodes: _nodes5, + metadata: _metadata5, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections.start: + { + dumpSep("section Start"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _metadata6 = t.sectionMetadata("start", startOffset, sectionSizeInBytesNode); + + var _nodes6 = [parseStartSection()]; + return { + nodes: _nodes6, + metadata: _metadata6, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections.element: + { + dumpSep("section Element"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc19 = getPosition(); + + var numberOfElementsu32 = readU32(); + var numberOfElements = numberOfElementsu32.value; + eatBytes(numberOfElementsu32.nextIndex); + + var _metadata7 = t.sectionMetadata("element", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfElements), endLoc, _startLoc19); + }()); + + var _nodes7 = parseElemSection(numberOfElements); + + return { + nodes: _nodes7, + metadata: _metadata7, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections.global: + { + dumpSep("section Global"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc20 = getPosition(); + + var numberOfGlobalsu32 = readU32(); + var numberOfGlobals = numberOfGlobalsu32.value; + eatBytes(numberOfGlobalsu32.nextIndex); + + var _metadata8 = t.sectionMetadata("global", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(numberOfGlobals), endLoc, _startLoc20); + }()); + + var _nodes8 = parseGlobalSection(numberOfGlobals); + + return { + nodes: _nodes8, + metadata: _metadata8, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections.memory: + { + dumpSep("section Memory"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _startLoc21 = getPosition(); + + var _numberOfElementsu = readU32(); + + var _numberOfElements = _numberOfElementsu.value; + eatBytes(_numberOfElementsu.nextIndex); + + var _metadata9 = t.sectionMetadata("memory", startOffset, sectionSizeInBytesNode, function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(_numberOfElements), endLoc, _startLoc21); + }()); + + var _nodes9 = parseMemorySection(_numberOfElements); + + return { + nodes: _nodes9, + metadata: _metadata9, + nextSectionIndex: nextSectionIndex + }; + } + + case _helperWasmBytecode["default"].sections.data: + { + dumpSep("section Data"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + + var _metadata10 = t.sectionMetadata("data", startOffset, sectionSizeInBytesNode); + + var _startLoc22 = getPosition(); + + var _numberOfElementsu2 = readU32(); + + var _numberOfElements2 = _numberOfElementsu2.value; + eatBytes(_numberOfElementsu2.nextIndex); + + _metadata10.vectorOfSize = function () { + var endLoc = getPosition(); + return t.withLoc(t.numberLiteralFromRaw(_numberOfElements2), endLoc, _startLoc22); + }(); + + if (opts.ignoreDataSection === true) { + var _remainingBytes = sectionSizeInBytes - _numberOfElementsu2.nextIndex; + + eatBytes(_remainingBytes); // eat the entire section + + dumpSep("ignore data (" + sectionSizeInBytes + " bytes)"); + return { + nodes: [], + metadata: _metadata10, + nextSectionIndex: nextSectionIndex + }; + } else { + var _nodes10 = parseDataSection(_numberOfElements2); + + return { + nodes: _nodes10, + metadata: _metadata10, + nextSectionIndex: nextSectionIndex + }; + } + } + + case _helperWasmBytecode["default"].sections.custom: + { + dumpSep("section Custom"); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + var _metadata11 = [t.sectionMetadata("custom", startOffset, sectionSizeInBytesNode)]; + var sectionName = readUTF8String(); + eatBytes(sectionName.nextIndex); + dump([], "section name (".concat(sectionName.value, ")")); + + var _remainingBytes2 = sectionSizeInBytes - sectionName.nextIndex; + + if (sectionName.value === "name") { + var initialOffset = offset; + + try { + _metadata11.push.apply(_metadata11, _toConsumableArray(parseNameSection(_remainingBytes2))); + } catch (e) { + console.warn("Failed to decode custom \"name\" section @".concat(offset, "; ignoring (").concat(e.message, ").")); + eatBytes(offset - (initialOffset + _remainingBytes2)); + } + } else if (sectionName.value === "producers") { + var _initialOffset = offset; + + try { + _metadata11.push(parseProducersSection()); + } catch (e) { + console.warn("Failed to decode custom \"producers\" section @".concat(offset, "; ignoring (").concat(e.message, ").")); + eatBytes(offset - (_initialOffset + _remainingBytes2)); + } + } else { + // We don't parse the custom section + eatBytes(_remainingBytes2); + dumpSep("ignore custom " + JSON.stringify(sectionName.value) + " section (" + _remainingBytes2 + " bytes)"); + } + + return { + nodes: [], + metadata: _metadata11, + nextSectionIndex: nextSectionIndex + }; + } + } + + if (opts.errorOnUnknownSection) { + throw new _helperApiError.CompileError("Unexpected section: " + toHex(sectionId)); + } else { + dumpSep("section " + toHex(sectionId)); + dump([sectionId], "section code"); + dump([sectionSizeInBytes], "section size"); + eatBytes(sectionSizeInBytes); + dumpSep("ignoring (" + sectionSizeInBytes + " bytes)"); + return { + nodes: [], + metadata: [], + nextSectionIndex: 0 + }; + } + } + + function parseBlockType() { + var blocktypeByte = readByte(); + var blocktype = _helperWasmBytecode["default"].blockTypes[blocktypeByte]; + + if (typeof blocktype !== "undefined") { + eatBytes(1); + dump([blocktypeByte], "blocktype"); // value type + + return blocktype; + } else { + // type index + var u32 = readU32(); + eatBytes(u32.nextIndex); + var signature = state.typesInModule[u32.value]; + console.log({ + signature: signature + }); + dump([u32.value], "typeidx"); + return u32.value; + } + } + + parseModuleHeader(); + parseVersion(); + var moduleFields = []; + var sectionIndex = 0; + var moduleMetadata = { + sections: [], + functionNames: [], + localNames: [], + producers: [] + }; + /** + * All the generate declaration are going to be stored in our state + */ + + while (offset < buf.length) { + var _parseSection = parseSection(sectionIndex), + nodes = _parseSection.nodes, + metadata = _parseSection.metadata, + nextSectionIndex = _parseSection.nextSectionIndex; + + moduleFields.push.apply(moduleFields, _toConsumableArray(nodes)); + var metadataArray = Array.isArray(metadata) ? metadata : [metadata]; + metadataArray.forEach(function (metadataItem) { + // $FlowIgnore + if (metadataItem.type === "FunctionNameMetadata") { + moduleMetadata.functionNames.push(metadataItem); // $FlowIgnore + } else if (metadataItem.type === "LocalNameMetadata") { + moduleMetadata.localNames.push(metadataItem); // $FlowIgnore + } else if (metadataItem.type === "ProducersSectionMetadata") { + moduleMetadata.producers.push(metadataItem); + } else { + moduleMetadata.sections.push(metadataItem); + } + }); // Ignore custom section + + if (nextSectionIndex) { + sectionIndex = nextSectionIndex; + } + } + /** + * Transform the state into AST nodes + */ + + + var funcIndex = 0; + state.functionsInModule.forEach(function (func) { + var params = func.signature.params; + var result = func.signature.result; + var body = []; // External functions doesn't provide any code, can skip it here + + if (func.isExternal === true) { + return; + } + + var decodedElementInCodeSection = state.elementsInCodeSection[funcIndex]; + + if (opts.ignoreCodeSection === false) { + if (typeof decodedElementInCodeSection === "undefined") { + throw new _helperApiError.CompileError("func " + toHex(funcIndex) + " code not found"); + } + + body = decodedElementInCodeSection.code; + } + + funcIndex++; + var funcNode = t.func(func.id, t.signature(params, result), body); + + if (func.isExternal === true) { + funcNode.isExternal = func.isExternal; + } // Add function position in the binary if possible + + + if (opts.ignoreCodeSection === false) { + var _startLoc23 = decodedElementInCodeSection.startLoc, + endLoc = decodedElementInCodeSection.endLoc, + bodySize = decodedElementInCodeSection.bodySize; + funcNode = t.withLoc(funcNode, endLoc, _startLoc23); + funcNode.metadata = { + bodySize: bodySize + }; + } + + moduleFields.push(funcNode); + }); + state.elementsInExportSection.forEach(function (moduleExport) { + /** + * If the export has no id, we won't be able to call it from the outside + * so we can omit it + */ + if (moduleExport.id != null) { + moduleFields.push(t.withLoc(t.moduleExport(moduleExport.name, t.moduleExportDescr(moduleExport.type, moduleExport.id)), moduleExport.endLoc, moduleExport.startLoc)); + } + }); + dumpSep("end of program"); + var module = t.module(null, moduleFields, t.moduleMetadata(moduleMetadata.sections, moduleMetadata.functionNames, moduleMetadata.localNames, moduleMetadata.producers)); + return t.program([module]); +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..fc9cbcb05ebeb40950b4bc5cf678d449fad6f374 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/lib/index.js @@ -0,0 +1,262 @@ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.decode = decode; + +var decoder = _interopRequireWildcard(require("./decoder")); + +var t = _interopRequireWildcard(require("@webassemblyjs/ast")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +/** + * TODO(sven): I added initial props, but we should rather fix + * https://github.com/xtuc/webassemblyjs/issues/405 + */ +var defaultDecoderOpts = { + dump: false, + ignoreCodeSection: false, + ignoreDataSection: false, + ignoreCustomNameSection: false +}; // traverses the AST, locating function name metadata, which is then +// used to update index-based identifiers with function names + +function restoreFunctionNames(ast) { + var functionNames = []; + t.traverse(ast, { + FunctionNameMetadata: function FunctionNameMetadata(_ref) { + var node = _ref.node; + functionNames.push({ + name: node.value, + index: node.index + }); + } + }); + + if (functionNames.length === 0) { + return; + } + + t.traverse(ast, { + Func: function (_Func) { + function Func(_x) { + return _Func.apply(this, arguments); + } + + Func.toString = function () { + return _Func.toString(); + }; + + return Func; + }(function (_ref2) { + var node = _ref2.node; + // $FlowIgnore + var nodeName = node.name; + var indexBasedFunctionName = nodeName.value; + var index = Number(indexBasedFunctionName.replace("func_", "")); + var functionName = functionNames.find(function (f) { + return f.index === index; + }); + + if (functionName) { + var oldValue = nodeName.value; + nodeName.value = functionName.name; // $FlowIgnore + + nodeName.numeric = oldValue; // $FlowIgnore + + delete nodeName.raw; + } + }), + // Also update the reference in the export + ModuleExport: function (_ModuleExport) { + function ModuleExport(_x2) { + return _ModuleExport.apply(this, arguments); + } + + ModuleExport.toString = function () { + return _ModuleExport.toString(); + }; + + return ModuleExport; + }(function (_ref3) { + var node = _ref3.node; + + if (node.descr.exportType === "Func") { + // $FlowIgnore + var nodeName = node.descr.id; + var index = nodeName.value; + var functionName = functionNames.find(function (f) { + return f.index === index; + }); + + if (functionName) { + node.descr.id = t.identifier(functionName.name); + } + } + }), + ModuleImport: function (_ModuleImport) { + function ModuleImport(_x3) { + return _ModuleImport.apply(this, arguments); + } + + ModuleImport.toString = function () { + return _ModuleImport.toString(); + }; + + return ModuleImport; + }(function (_ref4) { + var node = _ref4.node; + + if (node.descr.type === "FuncImportDescr") { + // $FlowIgnore + var indexBasedFunctionName = node.descr.id; + var index = Number(indexBasedFunctionName.replace("func_", "")); + var functionName = functionNames.find(function (f) { + return f.index === index; + }); + + if (functionName) { + // $FlowIgnore + node.descr.id = t.identifier(functionName.name); + } + } + }), + CallInstruction: function (_CallInstruction) { + function CallInstruction(_x4) { + return _CallInstruction.apply(this, arguments); + } + + CallInstruction.toString = function () { + return _CallInstruction.toString(); + }; + + return CallInstruction; + }(function (nodePath) { + var node = nodePath.node; + var index = node.index.value; + var functionName = functionNames.find(function (f) { + return f.index === index; + }); + + if (functionName) { + var oldValue = node.index; + node.index = t.identifier(functionName.name); + node.numeric = oldValue; // $FlowIgnore + + delete node.raw; + } + }) + }); +} + +function restoreLocalNames(ast) { + var localNames = []; + t.traverse(ast, { + LocalNameMetadata: function LocalNameMetadata(_ref5) { + var node = _ref5.node; + localNames.push({ + name: node.value, + localIndex: node.localIndex, + functionIndex: node.functionIndex + }); + } + }); + + if (localNames.length === 0) { + return; + } + + t.traverse(ast, { + Func: function (_Func2) { + function Func(_x5) { + return _Func2.apply(this, arguments); + } + + Func.toString = function () { + return _Func2.toString(); + }; + + return Func; + }(function (_ref6) { + var node = _ref6.node; + var signature = node.signature; + + if (signature.type !== "Signature") { + return; + } // $FlowIgnore + + + var nodeName = node.name; + var indexBasedFunctionName = nodeName.value; + var functionIndex = Number(indexBasedFunctionName.replace("func_", "")); + signature.params.forEach(function (param, paramIndex) { + var paramName = localNames.find(function (f) { + return f.localIndex === paramIndex && f.functionIndex === functionIndex; + }); + + if (paramName && paramName.name !== "") { + param.id = paramName.name; + } + }); + }) + }); +} + +function restoreModuleName(ast) { + t.traverse(ast, { + ModuleNameMetadata: function (_ModuleNameMetadata) { + function ModuleNameMetadata(_x6) { + return _ModuleNameMetadata.apply(this, arguments); + } + + ModuleNameMetadata.toString = function () { + return _ModuleNameMetadata.toString(); + }; + + return ModuleNameMetadata; + }(function (moduleNameMetadataPath) { + // update module + t.traverse(ast, { + Module: function (_Module) { + function Module(_x7) { + return _Module.apply(this, arguments); + } + + Module.toString = function () { + return _Module.toString(); + }; + + return Module; + }(function (_ref7) { + var node = _ref7.node; + var name = moduleNameMetadataPath.node.value; // compatiblity with wast-parser + + if (name === "") { + name = null; + } + + node.id = name; + }) + }); + }) + }); +} + +function decode(buf, customOpts) { + var opts = Object.assign({}, defaultDecoderOpts, customOpts); + var ast = decoder.decode(buf, opts); + + if (opts.ignoreCustomNameSection === false) { + restoreFunctionNames(ast); + restoreLocalNames(ast); + restoreModuleName(ast); + } + + return ast; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/lib/types/decoder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/lib/types/decoder.js new file mode 100644 index 0000000000000000000000000000000000000000..9a390c31f71bc7eae1522a280a2dc8f6723185bf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/lib/types/decoder.js @@ -0,0 +1 @@ +"use strict"; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a00615bd742e44a69765c906eedf177934ae651c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wasm-parser/package.json @@ -0,0 +1,44 @@ +{ + "name": "@webassemblyjs/wasm-parser", + "version": "1.14.1", + "keywords": [ + "webassembly", + "javascript", + "ast", + "parser", + "wasm" + ], + "description": "WebAssembly binary format parser", + "main": "lib/index.js", + "module": "esm/index.js", + "scripts": { + "test": "mocha" + }, + "author": "Sven Sauleau", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-api-error": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-test-framework": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wast-parser": "1.14.1", + "mamacro": "^0.0.7", + "wabt": "1.0.12" + }, + "gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..87e7e1ff1bb50251e6cc4754d686303c694e543c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Sven Sauleau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ed4cd4e476b542070d626f0aee5e7a46bc5ef79e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/README.md @@ -0,0 +1,17 @@ +# @webassemblyjs/wast-parser + +> WebAssembly text format printer + +## Installation + +```sh +yarn add @webassemblyjs/wast-printer +``` + +## Usage + +```js +import { print } from "@webassemblyjs/wast-printer" + +console.log(print(ast)); +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/esm/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..03b5d9ee20ed58dd2a77980865c8cd3ff3d44f6c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/esm/index.js @@ -0,0 +1,920 @@ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +import { isAnonymous, isInstruction } from "@webassemblyjs/ast"; +import Long from "@xtuc/long"; +var compact = false; +var space = " "; + +var quote = function quote(str) { + return "\"".concat(str, "\""); +}; + +function indent(nb) { + return Array(nb).fill(space + space).join(""); +} // TODO(sven): allow arbitrary ast nodes + + +export function print(n) { + if (n.type === "Program") { + return printProgram(n, 0); + } else { + throw new Error("Unsupported node in print of type: " + String(n.type)); + } +} + +function printProgram(n, depth) { + return n.body.reduce(function (acc, child) { + if (child.type === "Module") { + acc += printModule(child, depth + 1); + } + + if (child.type === "Func") { + acc += printFunc(child, depth + 1); + } + + if (child.type === "BlockComment") { + acc += printBlockComment(child); + } + + if (child.type === "LeadingComment") { + acc += printLeadingComment(child); + } + + if (compact === false) { + acc += "\n"; + } + + return acc; + }, ""); +} + +function printTypeInstruction(n) { + var out = ""; + out += "("; + out += "type"; + out += space; + + if (n.id != null) { + out += printIndex(n.id); + out += space; + } + + out += "("; + out += "func"; + n.functype.params.forEach(function (param) { + out += space; + out += "("; + out += "param"; + out += space; + out += printFuncParam(param); + out += ")"; + }); + n.functype.results.forEach(function (result) { + out += space; + out += "("; + out += "result"; + out += space; + out += result; + out += ")"; + }); + out += ")"; // func + + out += ")"; + return out; +} + +function printModule(n, depth) { + var out = "("; + out += "module"; + + if (typeof n.id === "string") { + out += space; + out += n.id; + } + + if (compact === false) { + out += "\n"; + } else { + out += space; + } + + n.fields.forEach(function (field) { + if (compact === false) { + out += indent(depth); + } + + switch (field.type) { + case "Func": + { + out += printFunc(field, depth + 1); + break; + } + + case "TypeInstruction": + { + out += printTypeInstruction(field); + break; + } + + case "Table": + { + out += printTable(field); + break; + } + + case "Global": + { + out += printGlobal(field, depth + 1); + break; + } + + case "ModuleExport": + { + out += printModuleExport(field); + break; + } + + case "ModuleImport": + { + out += printModuleImport(field); + break; + } + + case "Memory": + { + out += printMemory(field); + break; + } + + case "BlockComment": + { + out += printBlockComment(field); + break; + } + + case "LeadingComment": + { + out += printLeadingComment(field); + break; + } + + case "Start": + { + out += printStart(field); + break; + } + + case "Elem": + { + out += printElem(field, depth); + break; + } + + case "Data": + { + out += printData(field, depth); + break; + } + + default: + throw new Error("Unsupported node in printModule: " + String(field.type)); + } + + if (compact === false) { + out += "\n"; + } + }); + out += ")"; + return out; +} + +function printData(n, depth) { + var out = ""; + out += "("; + out += "data"; + out += space; + out += printIndex(n.memoryIndex); + out += space; + out += printInstruction(n.offset, depth); + out += space; + out += '"'; + n.init.values.forEach(function (_byte) { + // Avoid non-displayable characters + if (_byte <= 31 || _byte == 34 || _byte == 92 || _byte >= 127) { + out += "\\"; + out += ("00" + _byte.toString(16)).substr(-2); + } else if (_byte > 255) { + throw new Error("Unsupported byte in data segment: " + _byte); + } else { + out += String.fromCharCode(_byte); + } + }); + out += '"'; + out += ")"; + return out; +} + +function printElem(n, depth) { + var out = ""; + out += "("; + out += "elem"; + out += space; + out += printIndex(n.table); + + var _n$offset = _slicedToArray(n.offset, 1), + firstOffset = _n$offset[0]; + + out += space; + out += "("; + out += "offset"; + out += space; + out += printInstruction(firstOffset, depth); + out += ")"; + n.funcs.forEach(function (func) { + out += space; + out += printIndex(func); + }); + out += ")"; + return out; +} + +function printStart(n) { + var out = ""; + out += "("; + out += "start"; + out += space; + out += printIndex(n.index); + out += ")"; + return out; +} + +function printLeadingComment(n) { + // Don't print leading comments in compact mode + if (compact === true) { + return ""; + } + + var out = ""; + out += ";;"; + out += n.value; + out += "\n"; + return out; +} + +function printBlockComment(n) { + // Don't print block comments in compact mode + if (compact === true) { + return ""; + } + + var out = ""; + out += "(;"; + out += n.value; + out += ";)"; + out += "\n"; + return out; +} + +function printSignature(n) { + var out = ""; + n.params.forEach(function (param) { + out += space; + out += "("; + out += "param"; + out += space; + out += printFuncParam(param); + out += ")"; + }); + n.results.forEach(function (result) { + out += space; + out += "("; + out += "result"; + out += space; + out += result; + out += ")"; + }); + return out; +} + +function printModuleImportDescr(n) { + var out = ""; + + if (n.type === "FuncImportDescr") { + out += "("; + out += "func"; + + if (isAnonymous(n.id) === false) { + out += space; + out += printIdentifier(n.id); + } + + out += printSignature(n.signature); + out += ")"; + } + + if (n.type === "GlobalType") { + out += "("; + out += "global"; + out += space; + out += printGlobalType(n); + out += ")"; + } + + if (n.type === "Table") { + out += printTable(n); + } + + return out; +} + +function printModuleImport(n) { + var out = ""; + out += "("; + out += "import"; + out += space; + out += quote(n.module); + out += space; + out += quote(n.name); + out += space; + out += printModuleImportDescr(n.descr); + out += ")"; + return out; +} + +function printGlobalType(n) { + var out = ""; + + if (n.mutability === "var") { + out += "("; + out += "mut"; + out += space; + out += n.valtype; + out += ")"; + } else { + out += n.valtype; + } + + return out; +} + +function printGlobal(n, depth) { + var out = ""; + out += "("; + out += "global"; + out += space; + + if (n.name != null && isAnonymous(n.name) === false) { + out += printIdentifier(n.name); + out += space; + } + + out += printGlobalType(n.globalType); + out += space; + n.init.forEach(function (i) { + out += printInstruction(i, depth + 1); + }); + out += ")"; + return out; +} + +function printTable(n) { + var out = ""; + out += "("; + out += "table"; + out += space; + + if (n.name != null && isAnonymous(n.name) === false) { + out += printIdentifier(n.name); + out += space; + } + + out += printLimit(n.limits); + out += space; + out += n.elementType; + out += ")"; + return out; +} + +function printFuncParam(n) { + var out = ""; + + if (typeof n.id === "string") { + out += "$" + n.id; + out += space; + } + + out += n.valtype; + return out; +} + +function printFunc(n, depth) { + var out = ""; + out += "("; + out += "func"; + + if (n.name != null) { + if (n.name.type === "Identifier" && isAnonymous(n.name) === false) { + out += space; + out += printIdentifier(n.name); + } + } + + if (n.signature.type === "Signature") { + out += printSignature(n.signature); + } else { + var index = n.signature; + out += space; + out += "("; + out += "type"; + out += space; + out += printIndex(index); + out += ")"; + } + + if (n.body.length > 0) { + // func is empty since we ignore the default end instruction + if (n.body.length === 1 && n.body[0].id === "end") { + out += ")"; + return out; + } + + if (compact === false) { + out += "\n"; + } + + n.body.forEach(function (i) { + if (i.id !== "end") { + out += indent(depth); + out += printInstruction(i, depth); + + if (compact === false) { + out += "\n"; + } + } + }); + out += indent(depth - 1) + ")"; + } else { + out += ")"; + } + + return out; +} + +function printInstruction(n, depth) { + switch (n.type) { + case "Instr": + // $FlowIgnore + return printGenericInstruction(n, depth + 1); + + case "BlockInstruction": + // $FlowIgnore + return printBlockInstruction(n, depth + 1); + + case "IfInstruction": + // $FlowIgnore + return printIfInstruction(n, depth + 1); + + case "CallInstruction": + // $FlowIgnore + return printCallInstruction(n, depth + 1); + + case "CallIndirectInstruction": + // $FlowIgnore + return printCallIndirectIntruction(n, depth + 1); + + case "LoopInstruction": + // $FlowIgnore + return printLoopInstruction(n, depth + 1); + + default: + throw new Error("Unsupported instruction: " + JSON.stringify(n.type)); + } +} + +function printCallIndirectIntruction(n, depth) { + var out = ""; + out += "("; + out += "call_indirect"; + + if (n.signature.type === "Signature") { + out += printSignature(n.signature); + } else if (n.signature.type === "Identifier") { + out += space; + out += "("; + out += "type"; + out += space; + out += printIdentifier(n.signature); + out += ")"; + } else { + throw new Error("CallIndirectInstruction: unsupported signature " + JSON.stringify(n.signature.type)); + } + + out += space; + + if (n.intrs != null) { + // $FlowIgnore + n.intrs.forEach(function (i, index) { + // $FlowIgnore + out += printInstruction(i, depth + 1); // $FlowIgnore + + if (index !== n.intrs.length - 1) { + out += space; + } + }); + } + + out += ")"; + return out; +} + +function printLoopInstruction(n, depth) { + var out = ""; + out += "("; + out += "loop"; + + if (n.label != null && isAnonymous(n.label) === false) { + out += space; + out += printIdentifier(n.label); + } + + if (typeof n.resulttype === "string") { + out += space; + out += "("; + out += "result"; + out += space; + out += n.resulttype; + out += ")"; + } + + if (n.instr.length > 0) { + n.instr.forEach(function (e) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += printInstruction(e, depth + 1); + }); + + if (compact === false) { + out += "\n"; + out += indent(depth - 1); + } + } + + out += ")"; + return out; +} + +function printCallInstruction(n, depth) { + var out = ""; + out += "("; + out += "call"; + out += space; + out += printIndex(n.index); + + if (_typeof(n.instrArgs) === "object") { + // $FlowIgnore + n.instrArgs.forEach(function (arg) { + out += space; + out += printFuncInstructionArg(arg, depth + 1); + }); + } + + out += ")"; + return out; +} + +function printIfInstruction(n, depth) { + var out = ""; + out += "("; + out += "if"; + + if (n.testLabel != null && isAnonymous(n.testLabel) === false) { + out += space; + out += printIdentifier(n.testLabel); + } + + if (typeof n.result === "string") { + out += space; + out += "("; + out += "result"; + out += space; + out += n.result; + out += ")"; + } + + if (n.test.length > 0) { + out += space; + n.test.forEach(function (i) { + out += printInstruction(i, depth + 1); + }); + } + + if (n.consequent.length > 0) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += "("; + out += "then"; + depth++; + n.consequent.forEach(function (i) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += printInstruction(i, depth + 1); + }); + depth--; + + if (compact === false) { + out += "\n"; + out += indent(depth); + } + + out += ")"; + } else { + if (compact === false) { + out += "\n"; + out += indent(depth); + } + + out += "("; + out += "then"; + out += ")"; + } + + if (n.alternate.length > 0) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += "("; + out += "else"; + depth++; + n.alternate.forEach(function (i) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += printInstruction(i, depth + 1); + }); + depth--; + + if (compact === false) { + out += "\n"; + out += indent(depth); + } + + out += ")"; + } else { + if (compact === false) { + out += "\n"; + out += indent(depth); + } + + out += "("; + out += "else"; + out += ")"; + } + + if (compact === false) { + out += "\n"; + out += indent(depth - 1); + } + + out += ")"; + return out; +} + +function printBlockInstruction(n, depth) { + var out = ""; + out += "("; + out += "block"; + + if (n.label != null && isAnonymous(n.label) === false) { + out += space; + out += printIdentifier(n.label); + } + + if (typeof n.result === "string") { + out += space; + out += "("; + out += "result"; + out += space; + out += n.result; + out += ")"; + } + + if (n.instr.length > 0) { + n.instr.forEach(function (i) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += printInstruction(i, depth + 1); + }); + + if (compact === false) { + out += "\n"; + } + + out += indent(depth - 1); + out += ")"; + } else { + out += ")"; + } + + return out; +} + +function printGenericInstruction(n, depth) { + var out = ""; + out += "("; + + if (typeof n.object === "string") { + out += n.object; + out += "."; + } + + out += n.id; + n.args.forEach(function (arg) { + out += space; + out += printFuncInstructionArg(arg, depth + 1); + }); + + if (n.namedArgs !== undefined) { + for (var key in n.namedArgs) { + out += space + key + "="; + out += printFuncInstructionArg(n.namedArgs[key], depth + 1); + } + } + + out += ")"; + return out; +} + +function printLongNumberLiteral(n) { + if (typeof n.raw === "string") { + return n.raw; + } + + var _n$value = n.value, + low = _n$value.low, + high = _n$value.high; + var v = new Long(low, high); + return v.toString(); +} + +function printFloatLiteral(n) { + if (typeof n.raw === "string") { + return n.raw; + } + + return String(n.value); +} + +function printFuncInstructionArg(n, depth) { + var out = ""; + + if (n.type === "NumberLiteral") { + out += printNumberLiteral(n); + } + + if (n.type === "LongNumberLiteral") { + out += printLongNumberLiteral(n); + } + + if (n.type === "Identifier" && isAnonymous(n) === false) { + out += printIdentifier(n); + } + + if (n.type === "ValtypeLiteral") { + out += n.name; + } + + if (n.type === "FloatLiteral") { + out += printFloatLiteral(n); + } + + if (isInstruction(n)) { + out += printInstruction(n, depth + 1); + } + + return out; +} + +function printNumberLiteral(n) { + if (typeof n.raw === "string") { + return n.raw; + } + + return String(n.value); +} + +function printModuleExport(n) { + var out = ""; + out += "("; + out += "export"; + out += space; + out += quote(n.name); + + if (n.descr.exportType === "Func") { + out += space; + out += "("; + out += "func"; + out += space; + out += printIndex(n.descr.id); + out += ")"; + } else if (n.descr.exportType === "Global") { + out += space; + out += "("; + out += "global"; + out += space; + out += printIndex(n.descr.id); + out += ")"; + } else if (n.descr.exportType === "Memory") { + out += space; + out += "("; + out += "memory"; + out += space; + out += printIndex(n.descr.id); + out += ")"; + } else if (n.descr.exportType === "Table") { + out += space; + out += "("; + out += "table"; + out += space; + out += printIndex(n.descr.id); + out += ")"; + } else { + throw new Error("printModuleExport: unknown type: " + n.descr.exportType); + } + + out += ")"; + return out; +} + +function printIdentifier(n) { + return "$" + n.value; +} + +function printIndex(n) { + if (n.type === "Identifier") { + return printIdentifier(n); + } else if (n.type === "NumberLiteral") { + return printNumberLiteral(n); + } else { + throw new Error("Unsupported index: " + n.type); + } +} + +function printMemory(n) { + var out = ""; + out += "("; + out += "memory"; + + if (n.id != null) { + out += space; + out += printIndex(n.id); + out += space; + } + + out += printLimit(n.limits); + out += ")"; + return out; +} + +function printLimit(n) { + var out = ""; + out += n.min + ""; + + if (n.max != null) { + out += space; + out += String(n.max); + + if (n.shared === true) { + out += " shared"; + } + } + + return out; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2e4dfaf9483c1579ccdb524e34e49894a1b44485 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/lib/index.js @@ -0,0 +1,931 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.print = print; + +var _ast = require("@webassemblyjs/ast"); + +var _long = _interopRequireDefault(require("@xtuc/long")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +var compact = false; +var space = " "; + +var quote = function quote(str) { + return "\"".concat(str, "\""); +}; + +function indent(nb) { + return Array(nb).fill(space + space).join(""); +} // TODO(sven): allow arbitrary ast nodes + + +function print(n) { + if (n.type === "Program") { + return printProgram(n, 0); + } else { + throw new Error("Unsupported node in print of type: " + String(n.type)); + } +} + +function printProgram(n, depth) { + return n.body.reduce(function (acc, child) { + if (child.type === "Module") { + acc += printModule(child, depth + 1); + } + + if (child.type === "Func") { + acc += printFunc(child, depth + 1); + } + + if (child.type === "BlockComment") { + acc += printBlockComment(child); + } + + if (child.type === "LeadingComment") { + acc += printLeadingComment(child); + } + + if (compact === false) { + acc += "\n"; + } + + return acc; + }, ""); +} + +function printTypeInstruction(n) { + var out = ""; + out += "("; + out += "type"; + out += space; + + if (n.id != null) { + out += printIndex(n.id); + out += space; + } + + out += "("; + out += "func"; + n.functype.params.forEach(function (param) { + out += space; + out += "("; + out += "param"; + out += space; + out += printFuncParam(param); + out += ")"; + }); + n.functype.results.forEach(function (result) { + out += space; + out += "("; + out += "result"; + out += space; + out += result; + out += ")"; + }); + out += ")"; // func + + out += ")"; + return out; +} + +function printModule(n, depth) { + var out = "("; + out += "module"; + + if (typeof n.id === "string") { + out += space; + out += n.id; + } + + if (compact === false) { + out += "\n"; + } else { + out += space; + } + + n.fields.forEach(function (field) { + if (compact === false) { + out += indent(depth); + } + + switch (field.type) { + case "Func": + { + out += printFunc(field, depth + 1); + break; + } + + case "TypeInstruction": + { + out += printTypeInstruction(field); + break; + } + + case "Table": + { + out += printTable(field); + break; + } + + case "Global": + { + out += printGlobal(field, depth + 1); + break; + } + + case "ModuleExport": + { + out += printModuleExport(field); + break; + } + + case "ModuleImport": + { + out += printModuleImport(field); + break; + } + + case "Memory": + { + out += printMemory(field); + break; + } + + case "BlockComment": + { + out += printBlockComment(field); + break; + } + + case "LeadingComment": + { + out += printLeadingComment(field); + break; + } + + case "Start": + { + out += printStart(field); + break; + } + + case "Elem": + { + out += printElem(field, depth); + break; + } + + case "Data": + { + out += printData(field, depth); + break; + } + + default: + throw new Error("Unsupported node in printModule: " + String(field.type)); + } + + if (compact === false) { + out += "\n"; + } + }); + out += ")"; + return out; +} + +function printData(n, depth) { + var out = ""; + out += "("; + out += "data"; + out += space; + out += printIndex(n.memoryIndex); + out += space; + out += printInstruction(n.offset, depth); + out += space; + out += '"'; + n.init.values.forEach(function (_byte) { + // Avoid non-displayable characters + if (_byte <= 31 || _byte == 34 || _byte == 92 || _byte >= 127) { + out += "\\"; + out += ("00" + _byte.toString(16)).substr(-2); + } else if (_byte > 255) { + throw new Error("Unsupported byte in data segment: " + _byte); + } else { + out += String.fromCharCode(_byte); + } + }); + out += '"'; + out += ")"; + return out; +} + +function printElem(n, depth) { + var out = ""; + out += "("; + out += "elem"; + out += space; + out += printIndex(n.table); + + var _n$offset = _slicedToArray(n.offset, 1), + firstOffset = _n$offset[0]; + + out += space; + out += "("; + out += "offset"; + out += space; + out += printInstruction(firstOffset, depth); + out += ")"; + n.funcs.forEach(function (func) { + out += space; + out += printIndex(func); + }); + out += ")"; + return out; +} + +function printStart(n) { + var out = ""; + out += "("; + out += "start"; + out += space; + out += printIndex(n.index); + out += ")"; + return out; +} + +function printLeadingComment(n) { + // Don't print leading comments in compact mode + if (compact === true) { + return ""; + } + + var out = ""; + out += ";;"; + out += n.value; + out += "\n"; + return out; +} + +function printBlockComment(n) { + // Don't print block comments in compact mode + if (compact === true) { + return ""; + } + + var out = ""; + out += "(;"; + out += n.value; + out += ";)"; + out += "\n"; + return out; +} + +function printSignature(n) { + var out = ""; + n.params.forEach(function (param) { + out += space; + out += "("; + out += "param"; + out += space; + out += printFuncParam(param); + out += ")"; + }); + n.results.forEach(function (result) { + out += space; + out += "("; + out += "result"; + out += space; + out += result; + out += ")"; + }); + return out; +} + +function printModuleImportDescr(n) { + var out = ""; + + if (n.type === "FuncImportDescr") { + out += "("; + out += "func"; + + if ((0, _ast.isAnonymous)(n.id) === false) { + out += space; + out += printIdentifier(n.id); + } + + out += printSignature(n.signature); + out += ")"; + } + + if (n.type === "GlobalType") { + out += "("; + out += "global"; + out += space; + out += printGlobalType(n); + out += ")"; + } + + if (n.type === "Table") { + out += printTable(n); + } + + return out; +} + +function printModuleImport(n) { + var out = ""; + out += "("; + out += "import"; + out += space; + out += quote(n.module); + out += space; + out += quote(n.name); + out += space; + out += printModuleImportDescr(n.descr); + out += ")"; + return out; +} + +function printGlobalType(n) { + var out = ""; + + if (n.mutability === "var") { + out += "("; + out += "mut"; + out += space; + out += n.valtype; + out += ")"; + } else { + out += n.valtype; + } + + return out; +} + +function printGlobal(n, depth) { + var out = ""; + out += "("; + out += "global"; + out += space; + + if (n.name != null && (0, _ast.isAnonymous)(n.name) === false) { + out += printIdentifier(n.name); + out += space; + } + + out += printGlobalType(n.globalType); + out += space; + n.init.forEach(function (i) { + out += printInstruction(i, depth + 1); + }); + out += ")"; + return out; +} + +function printTable(n) { + var out = ""; + out += "("; + out += "table"; + out += space; + + if (n.name != null && (0, _ast.isAnonymous)(n.name) === false) { + out += printIdentifier(n.name); + out += space; + } + + out += printLimit(n.limits); + out += space; + out += n.elementType; + out += ")"; + return out; +} + +function printFuncParam(n) { + var out = ""; + + if (typeof n.id === "string") { + out += "$" + n.id; + out += space; + } + + out += n.valtype; + return out; +} + +function printFunc(n, depth) { + var out = ""; + out += "("; + out += "func"; + + if (n.name != null) { + if (n.name.type === "Identifier" && (0, _ast.isAnonymous)(n.name) === false) { + out += space; + out += printIdentifier(n.name); + } + } + + if (n.signature.type === "Signature") { + out += printSignature(n.signature); + } else { + var index = n.signature; + out += space; + out += "("; + out += "type"; + out += space; + out += printIndex(index); + out += ")"; + } + + if (n.body.length > 0) { + // func is empty since we ignore the default end instruction + if (n.body.length === 1 && n.body[0].id === "end") { + out += ")"; + return out; + } + + if (compact === false) { + out += "\n"; + } + + n.body.forEach(function (i) { + if (i.id !== "end") { + out += indent(depth); + out += printInstruction(i, depth); + + if (compact === false) { + out += "\n"; + } + } + }); + out += indent(depth - 1) + ")"; + } else { + out += ")"; + } + + return out; +} + +function printInstruction(n, depth) { + switch (n.type) { + case "Instr": + // $FlowIgnore + return printGenericInstruction(n, depth + 1); + + case "BlockInstruction": + // $FlowIgnore + return printBlockInstruction(n, depth + 1); + + case "IfInstruction": + // $FlowIgnore + return printIfInstruction(n, depth + 1); + + case "CallInstruction": + // $FlowIgnore + return printCallInstruction(n, depth + 1); + + case "CallIndirectInstruction": + // $FlowIgnore + return printCallIndirectIntruction(n, depth + 1); + + case "LoopInstruction": + // $FlowIgnore + return printLoopInstruction(n, depth + 1); + + default: + throw new Error("Unsupported instruction: " + JSON.stringify(n.type)); + } +} + +function printCallIndirectIntruction(n, depth) { + var out = ""; + out += "("; + out += "call_indirect"; + + if (n.signature.type === "Signature") { + out += printSignature(n.signature); + } else if (n.signature.type === "Identifier") { + out += space; + out += "("; + out += "type"; + out += space; + out += printIdentifier(n.signature); + out += ")"; + } else { + throw new Error("CallIndirectInstruction: unsupported signature " + JSON.stringify(n.signature.type)); + } + + out += space; + + if (n.intrs != null) { + // $FlowIgnore + n.intrs.forEach(function (i, index) { + // $FlowIgnore + out += printInstruction(i, depth + 1); // $FlowIgnore + + if (index !== n.intrs.length - 1) { + out += space; + } + }); + } + + out += ")"; + return out; +} + +function printLoopInstruction(n, depth) { + var out = ""; + out += "("; + out += "loop"; + + if (n.label != null && (0, _ast.isAnonymous)(n.label) === false) { + out += space; + out += printIdentifier(n.label); + } + + if (typeof n.resulttype === "string") { + out += space; + out += "("; + out += "result"; + out += space; + out += n.resulttype; + out += ")"; + } + + if (n.instr.length > 0) { + n.instr.forEach(function (e) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += printInstruction(e, depth + 1); + }); + + if (compact === false) { + out += "\n"; + out += indent(depth - 1); + } + } + + out += ")"; + return out; +} + +function printCallInstruction(n, depth) { + var out = ""; + out += "("; + out += "call"; + out += space; + out += printIndex(n.index); + + if (_typeof(n.instrArgs) === "object") { + // $FlowIgnore + n.instrArgs.forEach(function (arg) { + out += space; + out += printFuncInstructionArg(arg, depth + 1); + }); + } + + out += ")"; + return out; +} + +function printIfInstruction(n, depth) { + var out = ""; + out += "("; + out += "if"; + + if (n.testLabel != null && (0, _ast.isAnonymous)(n.testLabel) === false) { + out += space; + out += printIdentifier(n.testLabel); + } + + if (typeof n.result === "string") { + out += space; + out += "("; + out += "result"; + out += space; + out += n.result; + out += ")"; + } + + if (n.test.length > 0) { + out += space; + n.test.forEach(function (i) { + out += printInstruction(i, depth + 1); + }); + } + + if (n.consequent.length > 0) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += "("; + out += "then"; + depth++; + n.consequent.forEach(function (i) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += printInstruction(i, depth + 1); + }); + depth--; + + if (compact === false) { + out += "\n"; + out += indent(depth); + } + + out += ")"; + } else { + if (compact === false) { + out += "\n"; + out += indent(depth); + } + + out += "("; + out += "then"; + out += ")"; + } + + if (n.alternate.length > 0) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += "("; + out += "else"; + depth++; + n.alternate.forEach(function (i) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += printInstruction(i, depth + 1); + }); + depth--; + + if (compact === false) { + out += "\n"; + out += indent(depth); + } + + out += ")"; + } else { + if (compact === false) { + out += "\n"; + out += indent(depth); + } + + out += "("; + out += "else"; + out += ")"; + } + + if (compact === false) { + out += "\n"; + out += indent(depth - 1); + } + + out += ")"; + return out; +} + +function printBlockInstruction(n, depth) { + var out = ""; + out += "("; + out += "block"; + + if (n.label != null && (0, _ast.isAnonymous)(n.label) === false) { + out += space; + out += printIdentifier(n.label); + } + + if (typeof n.result === "string") { + out += space; + out += "("; + out += "result"; + out += space; + out += n.result; + out += ")"; + } + + if (n.instr.length > 0) { + n.instr.forEach(function (i) { + if (compact === false) { + out += "\n"; + } + + out += indent(depth); + out += printInstruction(i, depth + 1); + }); + + if (compact === false) { + out += "\n"; + } + + out += indent(depth - 1); + out += ")"; + } else { + out += ")"; + } + + return out; +} + +function printGenericInstruction(n, depth) { + var out = ""; + out += "("; + + if (typeof n.object === "string") { + out += n.object; + out += "."; + } + + out += n.id; + n.args.forEach(function (arg) { + out += space; + out += printFuncInstructionArg(arg, depth + 1); + }); + + if (n.namedArgs !== undefined) { + for (var key in n.namedArgs) { + out += space + key + "="; + out += printFuncInstructionArg(n.namedArgs[key], depth + 1); + } + } + + out += ")"; + return out; +} + +function printLongNumberLiteral(n) { + if (typeof n.raw === "string") { + return n.raw; + } + + var _n$value = n.value, + low = _n$value.low, + high = _n$value.high; + var v = new _long["default"](low, high); + return v.toString(); +} + +function printFloatLiteral(n) { + if (typeof n.raw === "string") { + return n.raw; + } + + return String(n.value); +} + +function printFuncInstructionArg(n, depth) { + var out = ""; + + if (n.type === "NumberLiteral") { + out += printNumberLiteral(n); + } + + if (n.type === "LongNumberLiteral") { + out += printLongNumberLiteral(n); + } + + if (n.type === "Identifier" && (0, _ast.isAnonymous)(n) === false) { + out += printIdentifier(n); + } + + if (n.type === "ValtypeLiteral") { + out += n.name; + } + + if (n.type === "FloatLiteral") { + out += printFloatLiteral(n); + } + + if ((0, _ast.isInstruction)(n)) { + out += printInstruction(n, depth + 1); + } + + return out; +} + +function printNumberLiteral(n) { + if (typeof n.raw === "string") { + return n.raw; + } + + return String(n.value); +} + +function printModuleExport(n) { + var out = ""; + out += "("; + out += "export"; + out += space; + out += quote(n.name); + + if (n.descr.exportType === "Func") { + out += space; + out += "("; + out += "func"; + out += space; + out += printIndex(n.descr.id); + out += ")"; + } else if (n.descr.exportType === "Global") { + out += space; + out += "("; + out += "global"; + out += space; + out += printIndex(n.descr.id); + out += ")"; + } else if (n.descr.exportType === "Memory") { + out += space; + out += "("; + out += "memory"; + out += space; + out += printIndex(n.descr.id); + out += ")"; + } else if (n.descr.exportType === "Table") { + out += space; + out += "("; + out += "table"; + out += space; + out += printIndex(n.descr.id); + out += ")"; + } else { + throw new Error("printModuleExport: unknown type: " + n.descr.exportType); + } + + out += ")"; + return out; +} + +function printIdentifier(n) { + return "$" + n.value; +} + +function printIndex(n) { + if (n.type === "Identifier") { + return printIdentifier(n); + } else if (n.type === "NumberLiteral") { + return printNumberLiteral(n); + } else { + throw new Error("Unsupported index: " + n.type); + } +} + +function printMemory(n) { + var out = ""; + out += "("; + out += "memory"; + + if (n.id != null) { + out += space; + out += printIndex(n.id); + out += space; + } + + out += printLimit(n.limits); + out += ")"; + return out; +} + +function printLimit(n) { + var out = ""; + out += n.min + ""; + + if (n.max != null) { + out += space; + out += String(n.max); + + if (n.shared === true) { + out += " shared"; + } + } + + return out; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2273053b2f52ce1b1643ca19b5e5f54b3d4b5e34 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@webassemblyjs/wast-printer/package.json @@ -0,0 +1,36 @@ +{ + "name": "@webassemblyjs/wast-printer", + "version": "1.14.1", + "description": "WebAssembly text format printer", + "main": "lib/index.js", + "module": "esm/index.js", + "keywords": [ + "webassembly", + "javascript", + "ast", + "compiler", + "printer", + "wast" + ], + "scripts": { + "test": "mocha" + }, + "author": "Sven Sauleau", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@xtuc/long": "4.2.2" + }, + "devDependencies": { + "@webassemblyjs/helper-test-framework": "1.14.1", + "@webassemblyjs/wast-parser": "1.14.1" + }, + "repository": { + "type": "git", + "url": "https://github.com/xtuc/webassemblyjs.git" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..f37a2ebe2a19df0e230e6429b3bee883363ee067 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2008, Fair Oaks Labs, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/README.md new file mode 100644 index 0000000000000000000000000000000000000000..cb7527b3ce757840111964488b17e8696a1f8f57 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/README.md @@ -0,0 +1,51 @@ +# ieee754 [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/ieee754/master.svg +[travis-url]: https://travis-ci.org/feross/ieee754 +[npm-image]: https://img.shields.io/npm/v/ieee754.svg +[npm-url]: https://npmjs.org/package/ieee754 +[downloads-image]: https://img.shields.io/npm/dm/ieee754.svg +[downloads-url]: https://npmjs.org/package/ieee754 +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +[![saucelabs][saucelabs-image]][saucelabs-url] + +[saucelabs-image]: https://saucelabs.com/browser-matrix/ieee754.svg +[saucelabs-url]: https://saucelabs.com/u/ieee754 + +### Read/write IEEE754 floating point numbers from/to a Buffer or array-like object. + +## install + +``` +npm install ieee754 +``` + +## methods + +`var ieee754 = require('ieee754')` + +The `ieee754` object has the following functions: + +``` +ieee754.read = function (buffer, offset, isLE, mLen, nBytes) +ieee754.write = function (buffer, value, offset, isLE, mLen, nBytes) +``` + +The arguments mean the following: + +- buffer = the buffer +- offset = offset into the buffer +- value = value to set (only for `write`) +- isLe = is little endian? +- mLen = mantissa length +- nBytes = number of bytes + +## what is ieee754? + +The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point computation. [Read more](http://en.wikipedia.org/wiki/IEEE_floating_point). + +## license + +BSD 3 Clause. Copyright (c) 2008, Fair Oaks Labs, Inc. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/dist/.gitkeep b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/dist/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/dist/index.cjs.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/dist/index.cjs.js new file mode 100644 index 0000000000000000000000000000000000000000..46b7381f93e6c142358f3dfc4436e90bab8aeac5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/dist/index.cjs.js @@ -0,0 +1,96 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.read = read; +exports.write = write; + +function read(buffer, offset, isLE, mLen, nBytes) { + var e, m; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = -7; + var i = isLE ? nBytes - 1 : 0; + var d = isLE ? -1 : 1; + var s = buffer[offset + i]; + i += d; + e = s & (1 << -nBits) - 1; + s >>= -nBits; + nBits += eLen; + + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & (1 << -nBits) - 1; + e >>= -nBits; + nBits += mLen; + + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : (s ? -1 : 1) * Infinity; + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); +} + +function write(buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; + var i = isLE ? 0 : nBytes - 1; + var d = isLE ? 1 : -1; + var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = e << mLen | m; + eLen += mLen; + + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128; +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f294ac06b6cdfe3d72e9af7fd3ea79d6dc295067 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/index.js @@ -0,0 +1,84 @@ +export function read(buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + + i += d + + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +export function write(buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f4e33ac26331fc057150ea3ca6206eca8c224531 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/ieee754/package.json @@ -0,0 +1,42 @@ +{ + "name": "@xtuc/ieee754", + "description": "Read/write IEEE754 floating point numbers from/to a Buffer or array-like object", + "version": "1.2.0", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org" + }, + "contributors": [ + "Romain Beauxis " + ], + "devDependencies": { + "airtap": "0.0.7", + "standard": "*", + "tape": "^4.0.0", + "@babel/cli": "^7.0.0-beta.54", + "@babel/core": "^7.0.0-beta.54", + "@babel/plugin-transform-modules-commonjs": "^7.0.0-beta.54" + }, + "keywords": [ + "IEEE 754", + "buffer", + "convert", + "floating point", + "ieee754" + ], + "license": "BSD-3-Clause", + "main": "dist/index.cjs.js", + "module": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/ieee754.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "airtap -- test/*.js", + "test-browser-local": "airtap --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "prepublish": "babel --plugins @babel/plugin-transform-modules-commonjs index.js -o dist/index.cjs.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/README.md new file mode 100644 index 0000000000000000000000000000000000000000..dd96ae6f1778602ead69ebffcf7ef856acc09529 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/README.md @@ -0,0 +1,257 @@ +long.js +======= + +A Long class for representing a 64 bit two's-complement integer value derived from the [Closure Library](https://github.com/google/closure-library) +for stand-alone use and extended with unsigned support. + +[![npm](https://img.shields.io/npm/v/long.svg)](https://www.npmjs.com/package/long) [![Build Status](https://travis-ci.org/dcodeIO/long.js.svg)](https://travis-ci.org/dcodeIO/long.js) + +Background +---------- + +As of [ECMA-262 5th Edition](http://ecma262-5.com/ELS5_HTML.htm#Section_8.5), "all the positive and negative integers +whose magnitude is no greater than 253 are representable in the Number type", which is "representing the +doubleprecision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic". +The [maximum safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) +in JavaScript is 253-1. + +Example: 264-1 is 1844674407370955**1615** but in JavaScript it evaluates to 1844674407370955**2000**. + +Furthermore, bitwise operators in JavaScript "deal only with integers in the range −231 through +231−1, inclusive, or in the range 0 through 232−1, inclusive. These operators accept any value of +the Number type but first convert each such value to one of 232 integer values." + +In some use cases, however, it is required to be able to reliably work with and perform bitwise operations on the full +64 bits. This is where long.js comes into play. + +Usage +----- + +The class is compatible with CommonJS and AMD loaders and is exposed globally as `Long` if neither is available. + +```javascript +var Long = require("long"); + +var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF); + +console.log(longVal.toString()); +... +``` + +API +--- + +### Constructor + +* new **Long**(low: `number`, high: `number`, unsigned?: `boolean`)
+ Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. See the from* functions below for more convenient ways of constructing Longs. + +### Fields + +* Long#**low**: `number`
+ The low 32 bits as a signed value. + +* Long#**high**: `number`
+ The high 32 bits as a signed value. + +* Long#**unsigned**: `boolean`
+ Whether unsigned or not. + +### Constants + +* Long.**ZERO**: `Long`
+ Signed zero. + +* Long.**ONE**: `Long`
+ Signed one. + +* Long.**NEG_ONE**: `Long`
+ Signed negative one. + +* Long.**UZERO**: `Long`
+ Unsigned zero. + +* Long.**UONE**: `Long`
+ Unsigned one. + +* Long.**MAX_VALUE**: `Long`
+ Maximum signed value. + +* Long.**MIN_VALUE**: `Long`
+ Minimum signed value. + +* Long.**MAX_UNSIGNED_VALUE**: `Long`
+ Maximum unsigned value. + +### Utility + +* Long.**isLong**(obj: `*`): `boolean`
+ Tests if the specified object is a Long. + +* Long.**fromBits**(lowBits: `number`, highBits: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. + +* Long.**fromBytes**(bytes: `number[]`, unsigned?: `boolean`, le?: `boolean`): `Long`
+ Creates a Long from its byte representation. + +* Long.**fromBytesLE**(bytes: `number[]`, unsigned?: `boolean`): `Long`
+ Creates a Long from its little endian byte representation. + +* Long.**fromBytesBE**(bytes: `number[]`, unsigned?: `boolean`): `Long`
+ Creates a Long from its big endian byte representation. + +* Long.**fromInt**(value: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given 32 bit integer value. + +* Long.**fromNumber**(value: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + +* Long.**fromString**(str: `string`, unsigned?: `boolean`, radix?: `number`)
+ Long.**fromString**(str: `string`, radix: `number`)
+ Returns a Long representation of the given string, written using the specified radix. + +* Long.**fromValue**(val: `*`, unsigned?: `boolean`): `Long`
+ Converts the specified value to a Long using the appropriate from* function for its type. + +### Methods + +* Long#**add**(addend: `Long | number | string`): `Long`
+ Returns the sum of this and the specified Long. + +* Long#**and**(other: `Long | number | string`): `Long`
+ Returns the bitwise AND of this Long and the specified. + +* Long#**compare**/**comp**(other: `Long | number | string`): `number`
+ Compares this Long's value with the specified's. Returns `0` if they are the same, `1` if the this is greater and `-1` if the given one is greater. + +* Long#**divide**/**div**(divisor: `Long | number | string`): `Long`
+ Returns this Long divided by the specified. + +* Long#**equals**/**eq**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value equals the specified's. + +* Long#**getHighBits**(): `number`
+ Gets the high 32 bits as a signed integer. + +* Long#**getHighBitsUnsigned**(): `number`
+ Gets the high 32 bits as an unsigned integer. + +* Long#**getLowBits**(): `number`
+ Gets the low 32 bits as a signed integer. + +* Long#**getLowBitsUnsigned**(): `number`
+ Gets the low 32 bits as an unsigned integer. + +* Long#**getNumBitsAbs**(): `number`
+ Gets the number of bits needed to represent the absolute value of this Long. + +* Long#**greaterThan**/**gt**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is greater than the specified's. + +* Long#**greaterThanOrEqual**/**gte**/**ge**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is greater than or equal the specified's. + +* Long#**isEven**(): `boolean`
+ Tests if this Long's value is even. + +* Long#**isNegative**(): `boolean`
+ Tests if this Long's value is negative. + +* Long#**isOdd**(): `boolean`
+ Tests if this Long's value is odd. + +* Long#**isPositive**(): `boolean`
+ Tests if this Long's value is positive. + +* Long#**isZero**/**eqz**(): `boolean`
+ Tests if this Long's value equals zero. + +* Long#**lessThan**/**lt**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is less than the specified's. + +* Long#**lessThanOrEqual**/**lte**/**le**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is less than or equal the specified's. + +* Long#**modulo**/**mod**/**rem**(divisor: `Long | number | string`): `Long`
+ Returns this Long modulo the specified. + +* Long#**multiply**/**mul**(multiplier: `Long | number | string`): `Long`
+ Returns the product of this and the specified Long. + +* Long#**negate**/**neg**(): `Long`
+ Negates this Long's value. + +* Long#**not**(): `Long`
+ Returns the bitwise NOT of this Long. + +* Long#**notEquals**/**neq**/**ne**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value differs from the specified's. + +* Long#**or**(other: `Long | number | string`): `Long`
+ Returns the bitwise OR of this Long and the specified. + +* Long#**shiftLeft**/**shl**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits shifted to the left by the given amount. + +* Long#**shiftRight**/**shr**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits arithmetically shifted to the right by the given amount. + +* Long#**shiftRightUnsigned**/**shru**/**shr_u**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits logically shifted to the right by the given amount. + +* Long#**rotateLeft**/**rotl**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits rotated to the left by the given amount. + +* Long#**rotateRight**/**rotr**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits rotated to the right by the given amount. + +* Long#**subtract**/**sub**(subtrahend: `Long | number | string`): `Long`
+ Returns the difference of this and the specified Long. + +* Long#**toBytes**(le?: `boolean`): `number[]`
+ Converts this Long to its byte representation. + +* Long#**toBytesLE**(): `number[]`
+ Converts this Long to its little endian byte representation. + +* Long#**toBytesBE**(): `number[]`
+ Converts this Long to its big endian byte representation. + +* Long#**toInt**(): `number`
+ Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + +* Long#**toNumber**(): `number`
+ Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + +* Long#**toSigned**(): `Long`
+ Converts this Long to signed. + +* Long#**toString**(radix?: `number`): `string`
+ Converts the Long to a string written in the specified radix. + +* Long#**toUnsigned**(): `Long`
+ Converts this Long to unsigned. + +* Long#**xor**(other: `Long | number | string`): `Long`
+ Returns the bitwise XOR of this Long and the given one. + +WebAssembly support +------------------- + +[WebAssembly](http://webassembly.org) supports 64-bit integer arithmetic out of the box, hence a [tiny WebAssembly module](./src/wasm.wat) is used to compute operations like multiplication, division and remainder more efficiently (slow operations like division are around twice as fast), falling back to floating point based computations in JavaScript where WebAssembly is not yet supported, e.g., in older versions of node. + +Building +-------- + +To build an UMD bundle to `dist/long.js`, run: + +``` +$> npm install +$> npm run build +``` + +Running the [tests](./tests): + +``` +$> npm test +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/dist/long.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/dist/long.js new file mode 100644 index 0000000000000000000000000000000000000000..71370a744b4a3063de081a8d1d559acd595e379a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/dist/long.js @@ -0,0 +1,2 @@ +!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.Long=i():t.Long=i()}("undefined"!=typeof self?self:this,function(){return function(t){function i(h){if(n[h])return n[h].exports;var e=n[h]={i:h,l:!1,exports:{}};return t[h].call(e.exports,e,e.exports,i),e.l=!0,e.exports}var n={};return i.m=t,i.c=n,i.d=function(t,n,h){i.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:h})},i.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(n,"a",n),n},i.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},i.p="",i(i.s=0)}([function(t,i){function n(t,i,n){this.low=0|t,this.high=0|i,this.unsigned=!!n}function h(t){return!0===(t&&t.__isLong__)}function e(t,i){var n,h,e;return i?(t>>>=0,(e=0<=t&&t<256)&&(h=l[t])?h:(n=r(t,(0|t)<0?-1:0,!0),e&&(l[t]=n),n)):(t|=0,(e=-128<=t&&t<128)&&(h=f[t])?h:(n=r(t,t<0?-1:0,!1),e&&(f[t]=n),n))}function s(t,i){if(isNaN(t))return i?p:m;if(i){if(t<0)return p;if(t>=c)return q}else{if(t<=-w)return _;if(t+1>=w)return E}return t<0?s(-t,i).neg():r(t%d|0,t/d|0,i)}function r(t,i,h){return new n(t,i,h)}function o(t,i,n){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return m;if("number"==typeof i?(n=i,i=!1):i=!!i,(n=n||10)<2||360)throw Error("interior hyphen");if(0===h)return o(t.substring(1),i,n).neg();for(var e=s(a(n,8)),r=m,u=0;u>>0:this.low},B.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},B.toString=function(t){if((t=t||10)<2||36>>0,f=g.toString(t);if(r=u,r.isZero())return f+o;for(;f.length<6;)f="0"+f;o=""+f+o}},B.getHighBits=function(){return this.high},B.getHighBitsUnsigned=function(){return this.high>>>0},B.getLowBits=function(){return this.low},B.getLowBitsUnsigned=function(){return this.low>>>0},B.getNumBitsAbs=function(){if(this.isNegative())return this.eq(_)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,i=31;i>0&&0==(t&1<=0},B.isOdd=function(){return 1==(1&this.low)},B.isEven=function(){return 0==(1&this.low)},B.equals=function(t){return h(t)||(t=u(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},B.eq=B.equals,B.notEquals=function(t){return!this.eq(t)},B.neq=B.notEquals,B.ne=B.notEquals,B.lessThan=function(t){return this.comp(t)<0},B.lt=B.lessThan,B.lessThanOrEqual=function(t){return this.comp(t)<=0},B.lte=B.lessThanOrEqual,B.le=B.lessThanOrEqual,B.greaterThan=function(t){return this.comp(t)>0},B.gt=B.greaterThan,B.greaterThanOrEqual=function(t){return this.comp(t)>=0},B.gte=B.greaterThanOrEqual,B.ge=B.greaterThanOrEqual,B.compare=function(t){if(h(t)||(t=u(t)),this.eq(t))return 0;var i=this.isNegative(),n=t.isNegative();return i&&!n?-1:!i&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},B.comp=B.compare,B.negate=function(){return!this.unsigned&&this.eq(_)?_:this.not().add(y)},B.neg=B.negate,B.add=function(t){h(t)||(t=u(t));var i=this.high>>>16,n=65535&this.high,e=this.low>>>16,s=65535&this.low,o=t.high>>>16,g=65535&t.high,f=t.low>>>16,l=65535&t.low,a=0,d=0,c=0,w=0;return w+=s+l,c+=w>>>16,w&=65535,c+=e+f,d+=c>>>16,c&=65535,d+=n+g,a+=d>>>16,d&=65535,a+=i+o,a&=65535,r(c<<16|w,a<<16|d,this.unsigned)},B.subtract=function(t){return h(t)||(t=u(t)),this.add(t.neg())},B.sub=B.subtract,B.multiply=function(t){if(this.isZero())return m;if(h(t)||(t=u(t)),g){return r(g.mul(this.low,this.high,t.low,t.high),g.get_high(),this.unsigned)}if(t.isZero())return m;if(this.eq(_))return t.isOdd()?_:m;if(t.eq(_))return this.isOdd()?_:m;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(v)&&t.lt(v))return s(this.toNumber()*t.toNumber(),this.unsigned);var i=this.high>>>16,n=65535&this.high,e=this.low>>>16,o=65535&this.low,f=t.high>>>16,l=65535&t.high,a=t.low>>>16,d=65535&t.low,c=0,w=0,p=0,y=0;return y+=o*d,p+=y>>>16,y&=65535,p+=e*d,w+=p>>>16,p&=65535,p+=o*a,w+=p>>>16,p&=65535,w+=n*d,c+=w>>>16,w&=65535,w+=e*a,c+=w>>>16,w&=65535,w+=o*l,c+=w>>>16,w&=65535,c+=i*d+n*a+e*l+o*f,c&=65535,r(p<<16|y,c<<16|w,this.unsigned)},B.mul=B.multiply,B.divide=function(t){if(h(t)||(t=u(t)),t.isZero())throw Error("division by zero");if(g){if(!this.unsigned&&-2147483648===this.high&&-1===t.low&&-1===t.high)return this;return r((this.unsigned?g.div_u:g.div_s)(this.low,this.high,t.low,t.high),g.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?p:m;var i,n,e;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return p;if(t.gt(this.shru(1)))return b;e=p}else{if(this.eq(_)){if(t.eq(y)||t.eq(N))return _;if(t.eq(_))return y;return i=this.shr(1).div(t).shl(1),i.eq(m)?t.isNegative()?y:N:(n=this.sub(t.mul(i)),e=i.add(n.div(t)))}if(t.eq(_))return this.unsigned?p:m;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();e=m}for(n=this;n.gte(t);){i=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var o=Math.ceil(Math.log(i)/Math.LN2),f=o<=48?1:a(2,o-48),l=s(i),d=l.mul(t);d.isNegative()||d.gt(n);)i-=f,l=s(i,this.unsigned),d=l.mul(t);l.isZero()&&(l=y),e=e.add(l),n=n.sub(d)}return e},B.div=B.divide,B.modulo=function(t){if(h(t)||(t=u(t)),g){return r((this.unsigned?g.rem_u:g.rem_s)(this.low,this.high,t.low,t.high),g.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},B.mod=B.modulo,B.rem=B.modulo,B.not=function(){return r(~this.low,~this.high,this.unsigned)},B.and=function(t){return h(t)||(t=u(t)),r(this.low&t.low,this.high&t.high,this.unsigned)},B.or=function(t){return h(t)||(t=u(t)),r(this.low|t.low,this.high|t.high,this.unsigned)},B.xor=function(t){return h(t)||(t=u(t)),r(this.low^t.low,this.high^t.high,this.unsigned)},B.shiftLeft=function(t){return h(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?r(this.low<>>32-t,this.unsigned):r(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):r(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},B.shr=B.shiftRight,B.shiftRightUnsigned=function(t){return h(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?r(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):32===t?r(this.high,0,this.unsigned):r(this.high>>>t-32,0,this.unsigned)},B.shru=B.shiftRightUnsigned,B.shr_u=B.shiftRightUnsigned,B.rotateLeft=function(t){var i;return h(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?r(this.high,this.low,this.unsigned):t<32?(i=32-t,r(this.low<>>i,this.high<>>i,this.unsigned)):(t-=32,i=32-t,r(this.high<>>i,this.low<>>i,this.unsigned))},B.rotl=B.rotateLeft,B.rotateRight=function(t){var i;return h(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?r(this.high,this.low,this.unsigned):t<32?(i=32-t,r(this.high<>>t,this.low<>>t,this.unsigned)):(t-=32,i=32-t,r(this.low<>>t,this.high<>>t,this.unsigned))},B.rotr=B.rotateRight,B.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},B.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},B.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},B.toBytesLE=function(){var t=this.high,i=this.low;return[255&i,i>>>8&255,i>>>16&255,i>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},B.toBytesBE=function(){var t=this.high,i=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,i>>>24,i>>>16&255,i>>>8&255,255&i]},n.fromBytes=function(t,i,h){return h?n.fromBytesLE(t,i):n.fromBytesBE(t,i)},n.fromBytesLE=function(t,i){return new n(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,i)},n.fromBytesBE=function(t,i){return new n(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],i)}}])}); +//# sourceMappingURL=long.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/dist/long.js.map b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/dist/long.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6a3d70293ac215d6d447b057d08d23c9240b5d42 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/dist/long.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///long.js","webpack:///webpack/bootstrap f96e8d1360c0487f2545","webpack:///./src/long.js"],"names":["root","factory","exports","module","define","amd","self","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","Long","low","high","unsigned","isLong","obj","fromInt","value","cachedObj","cache","UINT_CACHE","fromBits","INT_CACHE","fromNumber","isNaN","UZERO","ZERO","TWO_PWR_64_DBL","MAX_UNSIGNED_VALUE","TWO_PWR_63_DBL","MIN_VALUE","MAX_VALUE","neg","TWO_PWR_32_DBL","lowBits","highBits","fromString","str","radix","length","Error","RangeError","indexOf","substring","radixToPower","pow_dbl","result","size","Math","min","parseInt","power","mul","add","fromValue","val","wasm","WebAssembly","Instance","Module","Uint8Array","e","__isLong__","pow","TWO_PWR_16_DBL","TWO_PWR_24","ONE","UONE","NEG_ONE","LongPrototype","toInt","toNumber","toString","isZero","isNegative","eq","radixLong","div","rem1","sub","rem","remDiv","intval","digits","getHighBits","getHighBitsUnsigned","getLowBits","getLowBitsUnsigned","getNumBitsAbs","bit","eqz","isPositive","isOdd","isEven","equals","other","notEquals","neq","ne","lessThan","comp","lt","lessThanOrEqual","lte","le","greaterThan","gt","greaterThanOrEqual","gte","ge","compare","thisNeg","otherNeg","negate","not","addend","a48","a32","a16","a00","b48","b32","b16","b00","c48","c32","c16","c00","subtract","subtrahend","multiply","multiplier","divide","divisor","approx","res","toUnsigned","shru","shr","shl","max","floor","log2","ceil","log","LN2","delta","approxRes","approxRem","modulo","mod","and","or","xor","shiftLeft","numBits","shiftRight","shiftRightUnsigned","shr_u","rotateLeft","b","rotl","rotateRight","rotr","toSigned","toBytes","toBytesLE","toBytesBE","hi","lo","fromBytes","bytes","fromBytesLE","fromBytesBE"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,KAAAD,IAEAD,EAAA,KAAAC,KACC,mBAAAK,WAAAC,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAR,OAGA,IAAAC,GAAAQ,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAX,WAUA,OANAM,GAAAE,GAAAI,KAAAX,EAAAD,QAAAC,IAAAD,QAAAO,GAGAN,EAAAU,GAAA,EAGAV,EAAAD,QAvBA,GAAAS,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAf,EAAAgB,EAAAC,GACAV,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,SACA9B,KACAsC,EAAAtC,KAAA4B,IAAA5B,KAAA6B,MAAA,IASAyD,EAAAgG,QAAA,SAAA7D,GACA,MAAAA,GAAAzH,KAAAuL,YAAAvL,KAAAwL,aAQAlG,EAAAiG,UAAA,WACA,GAAAE,GAAAzL,KAAA6B,KACA6J,EAAA1L,KAAA4B,GACA,QACA,IAAA8J,EACAA,IAAA,MACAA,IAAA,OACAA,IAAA,GACA,IAAAD,EACAA,IAAA,MACAA,IAAA,OACAA,IAAA,KASAnG,EAAAkG,UAAA,WACA,GAAAC,GAAAzL,KAAA6B,KACA6J,EAAA1L,KAAA4B,GACA,QACA6J,IAAA,GACAA,IAAA,OACAA,IAAA,MACA,IAAAA,EACAC,IAAA,GACAA,IAAA,OACAA,IAAA,MACA,IAAAA,IAWA/J,EAAAgK,UAAA,SAAAC,EAAA9J,EAAA2F,GACA,MAAAA,GAAA9F,EAAAkK,YAAAD,EAAA9J,GAAAH,EAAAmK,YAAAF,EAAA9J,IASAH,EAAAkK,YAAA,SAAAD,EAAA9J,GACA,UAAAH,GACAiK,EAAA,GACAA,EAAA,MACAA,EAAA,OACAA,EAAA,OACAA,EAAA,GACAA,EAAA,MACAA,EAAA,OACAA,EAAA,OACA9J,IAUAH,EAAAmK,YAAA,SAAAF,EAAA9J,GACA,UAAAH,GACAiK,EAAA,OACAA,EAAA,OACAA,EAAA,MACAA,EAAA,GACAA,EAAA,OACAA,EAAA,OACAA,EAAA,MACAA,EAAA,GACA9J","file":"long.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Long\"] = factory();\n\telse\n\t\troot[\"Long\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Long\"] = factory();\n\telse\n\t\troot[\"Long\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = Long;\n\n/**\n * wasm optimizations, to do native i64 multiplication and divide\n */\nvar wasm = null;\n\ntry {\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\n ])), {}).exports;\n} catch (e) {\n // no wasm support :(\n}\n\n/**\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\n * See the from* functions below for more convenient ways of constructing Longs.\n * @exports Long\n * @class A Long class for representing a 64 bit two's-complement integer value.\n * @param {number} low The low (signed) 32 bits of the long\n * @param {number} high The high (signed) 32 bits of the long\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @constructor\n */\nfunction Long(low, high, unsigned) {\n\n /**\n * The low 32 bits as a signed value.\n * @type {number}\n */\n this.low = low | 0;\n\n /**\n * The high 32 bits as a signed value.\n * @type {number}\n */\n this.high = high | 0;\n\n /**\n * Whether unsigned or not.\n * @type {boolean}\n */\n this.unsigned = !!unsigned;\n}\n\n// The internal representation of a long is the two given signed, 32-bit values.\n// We use 32-bit pieces because these are the size of integers on which\n// Javascript performs bit-operations. For operations like addition and\n// multiplication, we split each number into 16 bit pieces, which can easily be\n// multiplied within Javascript's floating-point representation without overflow\n// or change in sign.\n//\n// In the algorithms below, we frequently reduce the negative case to the\n// positive case by negating the input(s) and then post-processing the result.\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n// a positive number, it overflows back into a negative). Not handling this\n// case would often result in infinite recursion.\n//\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\n// methods on which they depend.\n\n/**\n * An indicator used to reliably determine if an object is a Long or not.\n * @type {boolean}\n * @const\n * @private\n */\nLong.prototype.__isLong__;\n\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\n\n/**\n * @function\n * @param {*} obj Object\n * @returns {boolean}\n * @inner\n */\nfunction isLong(obj) {\n return (obj && obj[\"__isLong__\"]) === true;\n}\n\n/**\n * Tests if the specified object is a Long.\n * @function\n * @param {*} obj Object\n * @returns {boolean}\n */\nLong.isLong = isLong;\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {!Object}\n * @inner\n */\nvar INT_CACHE = {};\n\n/**\n * A cache of the Long representations of small unsigned integer values.\n * @type {!Object}\n * @inner\n */\nvar UINT_CACHE = {};\n\n/**\n * @param {number} value\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromInt(value, unsigned) {\n var obj, cachedObj, cache;\n if (unsigned) {\n value >>>= 0;\n if (cache = (0 <= value && value < 256)) {\n cachedObj = UINT_CACHE[value];\n if (cachedObj)\n return cachedObj;\n }\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\n if (cache)\n UINT_CACHE[value] = obj;\n return obj;\n } else {\n value |= 0;\n if (cache = (-128 <= value && value < 128)) {\n cachedObj = INT_CACHE[value];\n if (cachedObj)\n return cachedObj;\n }\n obj = fromBits(value, value < 0 ? -1 : 0, false);\n if (cache)\n INT_CACHE[value] = obj;\n return obj;\n }\n}\n\n/**\n * Returns a Long representing the given 32 bit integer value.\n * @function\n * @param {number} value The 32 bit integer in question\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long} The corresponding Long value\n */\nLong.fromInt = fromInt;\n\n/**\n * @param {number} value\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromNumber(value, unsigned) {\n if (isNaN(value))\n return unsigned ? UZERO : ZERO;\n if (unsigned) {\n if (value < 0)\n return UZERO;\n if (value >= TWO_PWR_64_DBL)\n return MAX_UNSIGNED_VALUE;\n } else {\n if (value <= -TWO_PWR_63_DBL)\n return MIN_VALUE;\n if (value + 1 >= TWO_PWR_63_DBL)\n return MAX_VALUE;\n }\n if (value < 0)\n return fromNumber(-value, unsigned).neg();\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\n}\n\n/**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n * @function\n * @param {number} value The number in question\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long} The corresponding Long value\n */\nLong.fromNumber = fromNumber;\n\n/**\n * @param {number} lowBits\n * @param {number} highBits\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromBits(lowBits, highBits, unsigned) {\n return new Long(lowBits, highBits, unsigned);\n}\n\n/**\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\n * assumed to use 32 bits.\n * @function\n * @param {number} lowBits The low 32 bits\n * @param {number} highBits The high 32 bits\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long} The corresponding Long value\n */\nLong.fromBits = fromBits;\n\n/**\n * @function\n * @param {number} base\n * @param {number} exponent\n * @returns {number}\n * @inner\n */\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\n\n/**\n * @param {string} str\n * @param {(boolean|number)=} unsigned\n * @param {number=} radix\n * @returns {!Long}\n * @inner\n */\nfunction fromString(str, unsigned, radix) {\n if (str.length === 0)\n throw Error('empty string');\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\n return ZERO;\n if (typeof unsigned === 'number') {\n // For goog.math.long compatibility\n radix = unsigned,\n unsigned = false;\n } else {\n unsigned = !! unsigned;\n }\n radix = radix || 10;\n if (radix < 2 || 36 < radix)\n throw RangeError('radix');\n\n var p;\n if ((p = str.indexOf('-')) > 0)\n throw Error('interior hyphen');\n else if (p === 0) {\n return fromString(str.substring(1), unsigned, radix).neg();\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = fromNumber(pow_dbl(radix, 8));\n\n var result = ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i),\n value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = fromNumber(pow_dbl(radix, size));\n result = result.mul(power).add(fromNumber(value));\n } else {\n result = result.mul(radixToPower);\n result = result.add(fromNumber(value));\n }\n }\n result.unsigned = unsigned;\n return result;\n}\n\n/**\n * Returns a Long representation of the given string, written using the specified radix.\n * @function\n * @param {string} str The textual representation of the Long\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\n * @returns {!Long} The corresponding Long value\n */\nLong.fromString = fromString;\n\n/**\n * @function\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromValue(val, unsigned) {\n if (typeof val === 'number')\n return fromNumber(val, unsigned);\n if (typeof val === 'string')\n return fromString(val, unsigned);\n // Throws for non-objects, converts non-instanceof Long:\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\n}\n\n/**\n * Converts the specified value to a Long using the appropriate from* function for its type.\n * @function\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long}\n */\nLong.fromValue = fromValue;\n\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\n// no runtime penalty for these.\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_16_DBL = 1 << 16;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_24_DBL = 1 << 24;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\n\n/**\n * @type {!Long}\n * @const\n * @inner\n */\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\n\n/**\n * @type {!Long}\n * @inner\n */\nvar ZERO = fromInt(0);\n\n/**\n * Signed zero.\n * @type {!Long}\n */\nLong.ZERO = ZERO;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar UZERO = fromInt(0, true);\n\n/**\n * Unsigned zero.\n * @type {!Long}\n */\nLong.UZERO = UZERO;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar ONE = fromInt(1);\n\n/**\n * Signed one.\n * @type {!Long}\n */\nLong.ONE = ONE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar UONE = fromInt(1, true);\n\n/**\n * Unsigned one.\n * @type {!Long}\n */\nLong.UONE = UONE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar NEG_ONE = fromInt(-1);\n\n/**\n * Signed negative one.\n * @type {!Long}\n */\nLong.NEG_ONE = NEG_ONE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\n\n/**\n * Maximum signed value.\n * @type {!Long}\n */\nLong.MAX_VALUE = MAX_VALUE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\n\n/**\n * Maximum unsigned value.\n * @type {!Long}\n */\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\n\n/**\n * Minimum signed value.\n * @type {!Long}\n */\nLong.MIN_VALUE = MIN_VALUE;\n\n/**\n * @alias Long.prototype\n * @inner\n */\nvar LongPrototype = Long.prototype;\n\n/**\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\n * @this {!Long}\n * @returns {number}\n */\nLongPrototype.toInt = function toInt() {\n return this.unsigned ? this.low >>> 0 : this.low;\n};\n\n/**\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\n * @this {!Long}\n * @returns {number}\n */\nLongPrototype.toNumber = function toNumber() {\n if (this.unsigned)\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\n};\n\n/**\n * Converts the Long to a string written in the specified radix.\n * @this {!Long}\n * @param {number=} radix Radix (2-36), defaults to 10\n * @returns {string}\n * @override\n * @throws {RangeError} If `radix` is out of range\n */\nLongPrototype.toString = function toString(radix) {\n radix = radix || 10;\n if (radix < 2 || 36 < radix)\n throw RangeError('radix');\n if (this.isZero())\n return '0';\n if (this.isNegative()) { // Unsigned Longs are never negative\n if (this.eq(MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = fromNumber(radix),\n div = this.div(radixLong),\n rem1 = div.mul(radixLong).sub(this);\n return div.toString(radix) + rem1.toInt().toString(radix);\n } else\n return '-' + this.neg().toString(radix);\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\n rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower),\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\n digits = intval.toString(radix);\n rem = remDiv;\n if (rem.isZero())\n return digits + result;\n else {\n while (digits.length < 6)\n digits = '0' + digits;\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Gets the high 32 bits as a signed integer.\n * @this {!Long}\n * @returns {number} Signed high bits\n */\nLongPrototype.getHighBits = function getHighBits() {\n return this.high;\n};\n\n/**\n * Gets the high 32 bits as an unsigned integer.\n * @this {!Long}\n * @returns {number} Unsigned high bits\n */\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\n return this.high >>> 0;\n};\n\n/**\n * Gets the low 32 bits as a signed integer.\n * @this {!Long}\n * @returns {number} Signed low bits\n */\nLongPrototype.getLowBits = function getLowBits() {\n return this.low;\n};\n\n/**\n * Gets the low 32 bits as an unsigned integer.\n * @this {!Long}\n * @returns {number} Unsigned low bits\n */\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\n return this.low >>> 0;\n};\n\n/**\n * Gets the number of bits needed to represent the absolute value of this Long.\n * @this {!Long}\n * @returns {number}\n */\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\n if (this.isNegative()) // Unsigned Longs are never negative\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\n var val = this.high != 0 ? this.high : this.low;\n for (var bit = 31; bit > 0; bit--)\n if ((val & (1 << bit)) != 0)\n break;\n return this.high != 0 ? bit + 33 : bit + 1;\n};\n\n/**\n * Tests if this Long's value equals zero.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isZero = function isZero() {\n return this.high === 0 && this.low === 0;\n};\n\n/**\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\n * @returns {boolean}\n */\nLongPrototype.eqz = LongPrototype.isZero;\n\n/**\n * Tests if this Long's value is negative.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isNegative = function isNegative() {\n return !this.unsigned && this.high < 0;\n};\n\n/**\n * Tests if this Long's value is positive.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isPositive = function isPositive() {\n return this.unsigned || this.high >= 0;\n};\n\n/**\n * Tests if this Long's value is odd.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isOdd = function isOdd() {\n return (this.low & 1) === 1;\n};\n\n/**\n * Tests if this Long's value is even.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isEven = function isEven() {\n return (this.low & 1) === 0;\n};\n\n/**\n * Tests if this Long's value equals the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.equals = function equals(other) {\n if (!isLong(other))\n other = fromValue(other);\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\n return false;\n return this.high === other.high && this.low === other.low;\n};\n\n/**\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.eq = LongPrototype.equals;\n\n/**\n * Tests if this Long's value differs from the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.notEquals = function notEquals(other) {\n return !this.eq(/* validates */ other);\n};\n\n/**\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.neq = LongPrototype.notEquals;\n\n/**\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.ne = LongPrototype.notEquals;\n\n/**\n * Tests if this Long's value is less than the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lessThan = function lessThan(other) {\n return this.comp(/* validates */ other) < 0;\n};\n\n/**\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lt = LongPrototype.lessThan;\n\n/**\n * Tests if this Long's value is less than or equal the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\n return this.comp(/* validates */ other) <= 0;\n};\n\n/**\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\n\n/**\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.le = LongPrototype.lessThanOrEqual;\n\n/**\n * Tests if this Long's value is greater than the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.greaterThan = function greaterThan(other) {\n return this.comp(/* validates */ other) > 0;\n};\n\n/**\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.gt = LongPrototype.greaterThan;\n\n/**\n * Tests if this Long's value is greater than or equal the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\n return this.comp(/* validates */ other) >= 0;\n};\n\n/**\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\n\n/**\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\n\n/**\n * Compares this Long's value with the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\n * if the given one is greater\n */\nLongPrototype.compare = function compare(other) {\n if (!isLong(other))\n other = fromValue(other);\n if (this.eq(other))\n return 0;\n var thisNeg = this.isNegative(),\n otherNeg = other.isNegative();\n if (thisNeg && !otherNeg)\n return -1;\n if (!thisNeg && otherNeg)\n return 1;\n // At this point the sign bits are the same\n if (!this.unsigned)\n return this.sub(other).isNegative() ? -1 : 1;\n // Both are positive if at least one is unsigned\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\n};\n\n/**\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\n * if the given one is greater\n */\nLongPrototype.comp = LongPrototype.compare;\n\n/**\n * Negates this Long's value.\n * @this {!Long}\n * @returns {!Long} Negated Long\n */\nLongPrototype.negate = function negate() {\n if (!this.unsigned && this.eq(MIN_VALUE))\n return MIN_VALUE;\n return this.not().add(ONE);\n};\n\n/**\n * Negates this Long's value. This is an alias of {@link Long#negate}.\n * @function\n * @returns {!Long} Negated Long\n */\nLongPrototype.neg = LongPrototype.negate;\n\n/**\n * Returns the sum of this and the specified Long.\n * @this {!Long}\n * @param {!Long|number|string} addend Addend\n * @returns {!Long} Sum\n */\nLongPrototype.add = function add(addend) {\n if (!isLong(addend))\n addend = fromValue(addend);\n\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high >>> 16;\n var a32 = this.high & 0xFFFF;\n var a16 = this.low >>> 16;\n var a00 = this.low & 0xFFFF;\n\n var b48 = addend.high >>> 16;\n var b32 = addend.high & 0xFFFF;\n var b16 = addend.low >>> 16;\n var b00 = addend.low & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\n};\n\n/**\n * Returns the difference of this and the specified Long.\n * @this {!Long}\n * @param {!Long|number|string} subtrahend Subtrahend\n * @returns {!Long} Difference\n */\nLongPrototype.subtract = function subtract(subtrahend) {\n if (!isLong(subtrahend))\n subtrahend = fromValue(subtrahend);\n return this.add(subtrahend.neg());\n};\n\n/**\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\n * @function\n * @param {!Long|number|string} subtrahend Subtrahend\n * @returns {!Long} Difference\n */\nLongPrototype.sub = LongPrototype.subtract;\n\n/**\n * Returns the product of this and the specified Long.\n * @this {!Long}\n * @param {!Long|number|string} multiplier Multiplier\n * @returns {!Long} Product\n */\nLongPrototype.multiply = function multiply(multiplier) {\n if (this.isZero())\n return ZERO;\n if (!isLong(multiplier))\n multiplier = fromValue(multiplier);\n\n // use wasm support if present\n if (wasm) {\n var low = wasm[\"mul\"](this.low,\n this.high,\n multiplier.low,\n multiplier.high);\n return fromBits(low, wasm[\"get_high\"](), this.unsigned);\n }\n\n if (multiplier.isZero())\n return ZERO;\n if (this.eq(MIN_VALUE))\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\n if (multiplier.eq(MIN_VALUE))\n return this.isOdd() ? MIN_VALUE : ZERO;\n\n if (this.isNegative()) {\n if (multiplier.isNegative())\n return this.neg().mul(multiplier.neg());\n else\n return this.neg().mul(multiplier).neg();\n } else if (multiplier.isNegative())\n return this.mul(multiplier.neg()).neg();\n\n // If both longs are small, use float multiplication\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\n\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high >>> 16;\n var a32 = this.high & 0xFFFF;\n var a16 = this.low >>> 16;\n var a00 = this.low & 0xFFFF;\n\n var b48 = multiplier.high >>> 16;\n var b32 = multiplier.high & 0xFFFF;\n var b16 = multiplier.low >>> 16;\n var b00 = multiplier.low & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\n};\n\n/**\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\n * @function\n * @param {!Long|number|string} multiplier Multiplier\n * @returns {!Long} Product\n */\nLongPrototype.mul = LongPrototype.multiply;\n\n/**\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\n * unsigned if this Long is unsigned.\n * @this {!Long}\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Quotient\n */\nLongPrototype.divide = function divide(divisor) {\n if (!isLong(divisor))\n divisor = fromValue(divisor);\n if (divisor.isZero())\n throw Error('division by zero');\n\n // use wasm support if present\n if (wasm) {\n // guard against signed division overflow: the largest\n // negative number / -1 would be 1 larger than the largest\n // positive number, due to two's complement.\n if (!this.unsigned &&\n this.high === -0x80000000 &&\n divisor.low === -1 && divisor.high === -1) {\n // be consistent with non-wasm code path\n return this;\n }\n var low = (this.unsigned ? wasm[\"div_u\"] : wasm[\"div_s\"])(\n this.low,\n this.high,\n divisor.low,\n divisor.high\n );\n return fromBits(low, wasm[\"get_high\"](), this.unsigned);\n }\n\n if (this.isZero())\n return this.unsigned ? UZERO : ZERO;\n var approx, rem, res;\n if (!this.unsigned) {\n // This section is only relevant for signed longs and is derived from the\n // closure library as a whole.\n if (this.eq(MIN_VALUE)) {\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n else if (divisor.eq(MIN_VALUE))\n return ONE;\n else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shr(1);\n approx = halfThis.div(divisor).shl(1);\n if (approx.eq(ZERO)) {\n return divisor.isNegative() ? ONE : NEG_ONE;\n } else {\n rem = this.sub(divisor.mul(approx));\n res = approx.add(rem.div(divisor));\n return res;\n }\n }\n } else if (divisor.eq(MIN_VALUE))\n return this.unsigned ? UZERO : ZERO;\n if (this.isNegative()) {\n if (divisor.isNegative())\n return this.neg().div(divisor.neg());\n return this.neg().div(divisor).neg();\n } else if (divisor.isNegative())\n return this.div(divisor.neg()).neg();\n res = ZERO;\n } else {\n // The algorithm below has not been made for unsigned longs. It's therefore\n // required to take special care of the MSB prior to running it.\n if (!divisor.unsigned)\n divisor = divisor.toUnsigned();\n if (divisor.gt(this))\n return UZERO;\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\n return UONE;\n res = UZERO;\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n rem = this;\n while (rem.gte(divisor)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n approxRes = fromNumber(approx),\n approxRem = approxRes.mul(divisor);\n while (approxRem.isNegative() || approxRem.gt(rem)) {\n approx -= delta;\n approxRes = fromNumber(approx, this.unsigned);\n approxRem = approxRes.mul(divisor);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero())\n approxRes = ONE;\n\n res = res.add(approxRes);\n rem = rem.sub(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\n * @function\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Quotient\n */\nLongPrototype.div = LongPrototype.divide;\n\n/**\n * Returns this Long modulo the specified.\n * @this {!Long}\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Remainder\n */\nLongPrototype.modulo = function modulo(divisor) {\n if (!isLong(divisor))\n divisor = fromValue(divisor);\n\n // use wasm support if present\n if (wasm) {\n var low = (this.unsigned ? wasm[\"rem_u\"] : wasm[\"rem_s\"])(\n this.low,\n this.high,\n divisor.low,\n divisor.high\n );\n return fromBits(low, wasm[\"get_high\"](), this.unsigned);\n }\n\n return this.sub(this.div(divisor).mul(divisor));\n};\n\n/**\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\n * @function\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Remainder\n */\nLongPrototype.mod = LongPrototype.modulo;\n\n/**\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\n * @function\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Remainder\n */\nLongPrototype.rem = LongPrototype.modulo;\n\n/**\n * Returns the bitwise NOT of this Long.\n * @this {!Long}\n * @returns {!Long}\n */\nLongPrototype.not = function not() {\n return fromBits(~this.low, ~this.high, this.unsigned);\n};\n\n/**\n * Returns the bitwise AND of this Long and the specified.\n * @this {!Long}\n * @param {!Long|number|string} other Other Long\n * @returns {!Long}\n */\nLongPrototype.and = function and(other) {\n if (!isLong(other))\n other = fromValue(other);\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\n};\n\n/**\n * Returns the bitwise OR of this Long and the specified.\n * @this {!Long}\n * @param {!Long|number|string} other Other Long\n * @returns {!Long}\n */\nLongPrototype.or = function or(other) {\n if (!isLong(other))\n other = fromValue(other);\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\n};\n\n/**\n * Returns the bitwise XOR of this Long and the given one.\n * @this {!Long}\n * @param {!Long|number|string} other Other Long\n * @returns {!Long}\n */\nLongPrototype.xor = function xor(other) {\n if (!isLong(other))\n other = fromValue(other);\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\n if (isLong(numBits))\n numBits = numBits.toInt();\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\n else\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shl = LongPrototype.shiftLeft;\n\n/**\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shiftRight = function shiftRight(numBits) {\n if (isLong(numBits))\n numBits = numBits.toInt();\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\n else\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\n};\n\n/**\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shr = LongPrototype.shiftRight;\n\n/**\n * Returns this Long with bits logically shifted to the right by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\n if (isLong(numBits)) numBits = numBits.toInt();\n if ((numBits &= 63) === 0) return this;\n if (numBits < 32) return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >>> numBits, this.unsigned);\n if (numBits === 32) return fromBits(this.high, 0, this.unsigned);\n return fromBits(this.high >>> (numBits - 32), 0, this.unsigned);\n};\n\n/**\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\n\n/**\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\n\n/**\n * Returns this Long with bits rotated to the left by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotateLeft = function rotateLeft(numBits) {\n var b;\n if (isLong(numBits)) numBits = numBits.toInt();\n if ((numBits &= 63) === 0) return this;\n if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);\n if (numBits < 32) {\n b = (32 - numBits);\n return fromBits(((this.low << numBits) | (this.high >>> b)), ((this.high << numBits) | (this.low >>> b)), this.unsigned);\n }\n numBits -= 32;\n b = (32 - numBits);\n return fromBits(((this.high << numBits) | (this.low >>> b)), ((this.low << numBits) | (this.high >>> b)), this.unsigned);\n}\n/**\n * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotl = LongPrototype.rotateLeft;\n\n/**\n * Returns this Long with bits rotated to the right by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotateRight = function rotateRight(numBits) {\n var b;\n if (isLong(numBits)) numBits = numBits.toInt();\n if ((numBits &= 63) === 0) return this;\n if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);\n if (numBits < 32) {\n b = (32 - numBits);\n return fromBits(((this.high << b) | (this.low >>> numBits)), ((this.low << b) | (this.high >>> numBits)), this.unsigned);\n }\n numBits -= 32;\n b = (32 - numBits);\n return fromBits(((this.low << b) | (this.high >>> numBits)), ((this.high << b) | (this.low >>> numBits)), this.unsigned);\n}\n/**\n * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotr = LongPrototype.rotateRight;\n\n/**\n * Converts this Long to signed.\n * @this {!Long}\n * @returns {!Long} Signed long\n */\nLongPrototype.toSigned = function toSigned() {\n if (!this.unsigned)\n return this;\n return fromBits(this.low, this.high, false);\n};\n\n/**\n * Converts this Long to unsigned.\n * @this {!Long}\n * @returns {!Long} Unsigned long\n */\nLongPrototype.toUnsigned = function toUnsigned() {\n if (this.unsigned)\n return this;\n return fromBits(this.low, this.high, true);\n};\n\n/**\n * Converts this Long to its byte representation.\n * @param {boolean=} le Whether little or big endian, defaults to big endian\n * @this {!Long}\n * @returns {!Array.} Byte representation\n */\nLongPrototype.toBytes = function toBytes(le) {\n return le ? this.toBytesLE() : this.toBytesBE();\n};\n\n/**\n * Converts this Long to its little endian byte representation.\n * @this {!Long}\n * @returns {!Array.} Little endian byte representation\n */\nLongPrototype.toBytesLE = function toBytesLE() {\n var hi = this.high,\n lo = this.low;\n return [\n lo & 0xff,\n lo >>> 8 & 0xff,\n lo >>> 16 & 0xff,\n lo >>> 24 ,\n hi & 0xff,\n hi >>> 8 & 0xff,\n hi >>> 16 & 0xff,\n hi >>> 24\n ];\n};\n\n/**\n * Converts this Long to its big endian byte representation.\n * @this {!Long}\n * @returns {!Array.} Big endian byte representation\n */\nLongPrototype.toBytesBE = function toBytesBE() {\n var hi = this.high,\n lo = this.low;\n return [\n hi >>> 24 ,\n hi >>> 16 & 0xff,\n hi >>> 8 & 0xff,\n hi & 0xff,\n lo >>> 24 ,\n lo >>> 16 & 0xff,\n lo >>> 8 & 0xff,\n lo & 0xff\n ];\n};\n\n/**\n * Creates a Long from its byte representation.\n * @param {!Array.} bytes Byte representation\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @param {boolean=} le Whether little or big endian, defaults to big endian\n * @returns {Long} The corresponding Long value\n */\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\n};\n\n/**\n * Creates a Long from its little endian byte representation.\n * @param {!Array.} bytes Little endian byte representation\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {Long} The corresponding Long value\n */\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\n return new Long(\n bytes[0] |\n bytes[1] << 8 |\n bytes[2] << 16 |\n bytes[3] << 24,\n bytes[4] |\n bytes[5] << 8 |\n bytes[6] << 16 |\n bytes[7] << 24,\n unsigned\n );\n};\n\n/**\n * Creates a Long from its big endian byte representation.\n * @param {!Array.} bytes Big endian byte representation\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {Long} The corresponding Long value\n */\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\n return new Long(\n bytes[4] << 24 |\n bytes[5] << 16 |\n bytes[6] << 8 |\n bytes[7],\n bytes[0] << 24 |\n bytes[1] << 16 |\n bytes[2] << 8 |\n bytes[3],\n unsigned\n );\n};\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// long.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f96e8d1360c0487f2545","module.exports = Long;\n\n/**\n * wasm optimizations, to do native i64 multiplication and divide\n */\nvar wasm = null;\n\ntry {\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\n ])), {}).exports;\n} catch (e) {\n // no wasm support :(\n}\n\n/**\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\n * See the from* functions below for more convenient ways of constructing Longs.\n * @exports Long\n * @class A Long class for representing a 64 bit two's-complement integer value.\n * @param {number} low The low (signed) 32 bits of the long\n * @param {number} high The high (signed) 32 bits of the long\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @constructor\n */\nfunction Long(low, high, unsigned) {\n\n /**\n * The low 32 bits as a signed value.\n * @type {number}\n */\n this.low = low | 0;\n\n /**\n * The high 32 bits as a signed value.\n * @type {number}\n */\n this.high = high | 0;\n\n /**\n * Whether unsigned or not.\n * @type {boolean}\n */\n this.unsigned = !!unsigned;\n}\n\n// The internal representation of a long is the two given signed, 32-bit values.\n// We use 32-bit pieces because these are the size of integers on which\n// Javascript performs bit-operations. For operations like addition and\n// multiplication, we split each number into 16 bit pieces, which can easily be\n// multiplied within Javascript's floating-point representation without overflow\n// or change in sign.\n//\n// In the algorithms below, we frequently reduce the negative case to the\n// positive case by negating the input(s) and then post-processing the result.\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n// a positive number, it overflows back into a negative). Not handling this\n// case would often result in infinite recursion.\n//\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\n// methods on which they depend.\n\n/**\n * An indicator used to reliably determine if an object is a Long or not.\n * @type {boolean}\n * @const\n * @private\n */\nLong.prototype.__isLong__;\n\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\n\n/**\n * @function\n * @param {*} obj Object\n * @returns {boolean}\n * @inner\n */\nfunction isLong(obj) {\n return (obj && obj[\"__isLong__\"]) === true;\n}\n\n/**\n * Tests if the specified object is a Long.\n * @function\n * @param {*} obj Object\n * @returns {boolean}\n */\nLong.isLong = isLong;\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {!Object}\n * @inner\n */\nvar INT_CACHE = {};\n\n/**\n * A cache of the Long representations of small unsigned integer values.\n * @type {!Object}\n * @inner\n */\nvar UINT_CACHE = {};\n\n/**\n * @param {number} value\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromInt(value, unsigned) {\n var obj, cachedObj, cache;\n if (unsigned) {\n value >>>= 0;\n if (cache = (0 <= value && value < 256)) {\n cachedObj = UINT_CACHE[value];\n if (cachedObj)\n return cachedObj;\n }\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\n if (cache)\n UINT_CACHE[value] = obj;\n return obj;\n } else {\n value |= 0;\n if (cache = (-128 <= value && value < 128)) {\n cachedObj = INT_CACHE[value];\n if (cachedObj)\n return cachedObj;\n }\n obj = fromBits(value, value < 0 ? -1 : 0, false);\n if (cache)\n INT_CACHE[value] = obj;\n return obj;\n }\n}\n\n/**\n * Returns a Long representing the given 32 bit integer value.\n * @function\n * @param {number} value The 32 bit integer in question\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long} The corresponding Long value\n */\nLong.fromInt = fromInt;\n\n/**\n * @param {number} value\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromNumber(value, unsigned) {\n if (isNaN(value))\n return unsigned ? UZERO : ZERO;\n if (unsigned) {\n if (value < 0)\n return UZERO;\n if (value >= TWO_PWR_64_DBL)\n return MAX_UNSIGNED_VALUE;\n } else {\n if (value <= -TWO_PWR_63_DBL)\n return MIN_VALUE;\n if (value + 1 >= TWO_PWR_63_DBL)\n return MAX_VALUE;\n }\n if (value < 0)\n return fromNumber(-value, unsigned).neg();\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\n}\n\n/**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n * @function\n * @param {number} value The number in question\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long} The corresponding Long value\n */\nLong.fromNumber = fromNumber;\n\n/**\n * @param {number} lowBits\n * @param {number} highBits\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromBits(lowBits, highBits, unsigned) {\n return new Long(lowBits, highBits, unsigned);\n}\n\n/**\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\n * assumed to use 32 bits.\n * @function\n * @param {number} lowBits The low 32 bits\n * @param {number} highBits The high 32 bits\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long} The corresponding Long value\n */\nLong.fromBits = fromBits;\n\n/**\n * @function\n * @param {number} base\n * @param {number} exponent\n * @returns {number}\n * @inner\n */\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\n\n/**\n * @param {string} str\n * @param {(boolean|number)=} unsigned\n * @param {number=} radix\n * @returns {!Long}\n * @inner\n */\nfunction fromString(str, unsigned, radix) {\n if (str.length === 0)\n throw Error('empty string');\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\n return ZERO;\n if (typeof unsigned === 'number') {\n // For goog.math.long compatibility\n radix = unsigned,\n unsigned = false;\n } else {\n unsigned = !! unsigned;\n }\n radix = radix || 10;\n if (radix < 2 || 36 < radix)\n throw RangeError('radix');\n\n var p;\n if ((p = str.indexOf('-')) > 0)\n throw Error('interior hyphen');\n else if (p === 0) {\n return fromString(str.substring(1), unsigned, radix).neg();\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = fromNumber(pow_dbl(radix, 8));\n\n var result = ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i),\n value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = fromNumber(pow_dbl(radix, size));\n result = result.mul(power).add(fromNumber(value));\n } else {\n result = result.mul(radixToPower);\n result = result.add(fromNumber(value));\n }\n }\n result.unsigned = unsigned;\n return result;\n}\n\n/**\n * Returns a Long representation of the given string, written using the specified radix.\n * @function\n * @param {string} str The textual representation of the Long\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\n * @returns {!Long} The corresponding Long value\n */\nLong.fromString = fromString;\n\n/**\n * @function\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromValue(val, unsigned) {\n if (typeof val === 'number')\n return fromNumber(val, unsigned);\n if (typeof val === 'string')\n return fromString(val, unsigned);\n // Throws for non-objects, converts non-instanceof Long:\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\n}\n\n/**\n * Converts the specified value to a Long using the appropriate from* function for its type.\n * @function\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long}\n */\nLong.fromValue = fromValue;\n\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\n// no runtime penalty for these.\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_16_DBL = 1 << 16;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_24_DBL = 1 << 24;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\n\n/**\n * @type {!Long}\n * @const\n * @inner\n */\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\n\n/**\n * @type {!Long}\n * @inner\n */\nvar ZERO = fromInt(0);\n\n/**\n * Signed zero.\n * @type {!Long}\n */\nLong.ZERO = ZERO;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar UZERO = fromInt(0, true);\n\n/**\n * Unsigned zero.\n * @type {!Long}\n */\nLong.UZERO = UZERO;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar ONE = fromInt(1);\n\n/**\n * Signed one.\n * @type {!Long}\n */\nLong.ONE = ONE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar UONE = fromInt(1, true);\n\n/**\n * Unsigned one.\n * @type {!Long}\n */\nLong.UONE = UONE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar NEG_ONE = fromInt(-1);\n\n/**\n * Signed negative one.\n * @type {!Long}\n */\nLong.NEG_ONE = NEG_ONE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\n\n/**\n * Maximum signed value.\n * @type {!Long}\n */\nLong.MAX_VALUE = MAX_VALUE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\n\n/**\n * Maximum unsigned value.\n * @type {!Long}\n */\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\n\n/**\n * Minimum signed value.\n * @type {!Long}\n */\nLong.MIN_VALUE = MIN_VALUE;\n\n/**\n * @alias Long.prototype\n * @inner\n */\nvar LongPrototype = Long.prototype;\n\n/**\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\n * @this {!Long}\n * @returns {number}\n */\nLongPrototype.toInt = function toInt() {\n return this.unsigned ? this.low >>> 0 : this.low;\n};\n\n/**\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\n * @this {!Long}\n * @returns {number}\n */\nLongPrototype.toNumber = function toNumber() {\n if (this.unsigned)\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\n};\n\n/**\n * Converts the Long to a string written in the specified radix.\n * @this {!Long}\n * @param {number=} radix Radix (2-36), defaults to 10\n * @returns {string}\n * @override\n * @throws {RangeError} If `radix` is out of range\n */\nLongPrototype.toString = function toString(radix) {\n radix = radix || 10;\n if (radix < 2 || 36 < radix)\n throw RangeError('radix');\n if (this.isZero())\n return '0';\n if (this.isNegative()) { // Unsigned Longs are never negative\n if (this.eq(MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = fromNumber(radix),\n div = this.div(radixLong),\n rem1 = div.mul(radixLong).sub(this);\n return div.toString(radix) + rem1.toInt().toString(radix);\n } else\n return '-' + this.neg().toString(radix);\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\n rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower),\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\n digits = intval.toString(radix);\n rem = remDiv;\n if (rem.isZero())\n return digits + result;\n else {\n while (digits.length < 6)\n digits = '0' + digits;\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Gets the high 32 bits as a signed integer.\n * @this {!Long}\n * @returns {number} Signed high bits\n */\nLongPrototype.getHighBits = function getHighBits() {\n return this.high;\n};\n\n/**\n * Gets the high 32 bits as an unsigned integer.\n * @this {!Long}\n * @returns {number} Unsigned high bits\n */\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\n return this.high >>> 0;\n};\n\n/**\n * Gets the low 32 bits as a signed integer.\n * @this {!Long}\n * @returns {number} Signed low bits\n */\nLongPrototype.getLowBits = function getLowBits() {\n return this.low;\n};\n\n/**\n * Gets the low 32 bits as an unsigned integer.\n * @this {!Long}\n * @returns {number} Unsigned low bits\n */\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\n return this.low >>> 0;\n};\n\n/**\n * Gets the number of bits needed to represent the absolute value of this Long.\n * @this {!Long}\n * @returns {number}\n */\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\n if (this.isNegative()) // Unsigned Longs are never negative\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\n var val = this.high != 0 ? this.high : this.low;\n for (var bit = 31; bit > 0; bit--)\n if ((val & (1 << bit)) != 0)\n break;\n return this.high != 0 ? bit + 33 : bit + 1;\n};\n\n/**\n * Tests if this Long's value equals zero.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isZero = function isZero() {\n return this.high === 0 && this.low === 0;\n};\n\n/**\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\n * @returns {boolean}\n */\nLongPrototype.eqz = LongPrototype.isZero;\n\n/**\n * Tests if this Long's value is negative.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isNegative = function isNegative() {\n return !this.unsigned && this.high < 0;\n};\n\n/**\n * Tests if this Long's value is positive.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isPositive = function isPositive() {\n return this.unsigned || this.high >= 0;\n};\n\n/**\n * Tests if this Long's value is odd.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isOdd = function isOdd() {\n return (this.low & 1) === 1;\n};\n\n/**\n * Tests if this Long's value is even.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isEven = function isEven() {\n return (this.low & 1) === 0;\n};\n\n/**\n * Tests if this Long's value equals the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.equals = function equals(other) {\n if (!isLong(other))\n other = fromValue(other);\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\n return false;\n return this.high === other.high && this.low === other.low;\n};\n\n/**\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.eq = LongPrototype.equals;\n\n/**\n * Tests if this Long's value differs from the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.notEquals = function notEquals(other) {\n return !this.eq(/* validates */ other);\n};\n\n/**\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.neq = LongPrototype.notEquals;\n\n/**\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.ne = LongPrototype.notEquals;\n\n/**\n * Tests if this Long's value is less than the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lessThan = function lessThan(other) {\n return this.comp(/* validates */ other) < 0;\n};\n\n/**\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lt = LongPrototype.lessThan;\n\n/**\n * Tests if this Long's value is less than or equal the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\n return this.comp(/* validates */ other) <= 0;\n};\n\n/**\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\n\n/**\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.le = LongPrototype.lessThanOrEqual;\n\n/**\n * Tests if this Long's value is greater than the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.greaterThan = function greaterThan(other) {\n return this.comp(/* validates */ other) > 0;\n};\n\n/**\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.gt = LongPrototype.greaterThan;\n\n/**\n * Tests if this Long's value is greater than or equal the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\n return this.comp(/* validates */ other) >= 0;\n};\n\n/**\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\n\n/**\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\n\n/**\n * Compares this Long's value with the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\n * if the given one is greater\n */\nLongPrototype.compare = function compare(other) {\n if (!isLong(other))\n other = fromValue(other);\n if (this.eq(other))\n return 0;\n var thisNeg = this.isNegative(),\n otherNeg = other.isNegative();\n if (thisNeg && !otherNeg)\n return -1;\n if (!thisNeg && otherNeg)\n return 1;\n // At this point the sign bits are the same\n if (!this.unsigned)\n return this.sub(other).isNegative() ? -1 : 1;\n // Both are positive if at least one is unsigned\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\n};\n\n/**\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\n * if the given one is greater\n */\nLongPrototype.comp = LongPrototype.compare;\n\n/**\n * Negates this Long's value.\n * @this {!Long}\n * @returns {!Long} Negated Long\n */\nLongPrototype.negate = function negate() {\n if (!this.unsigned && this.eq(MIN_VALUE))\n return MIN_VALUE;\n return this.not().add(ONE);\n};\n\n/**\n * Negates this Long's value. This is an alias of {@link Long#negate}.\n * @function\n * @returns {!Long} Negated Long\n */\nLongPrototype.neg = LongPrototype.negate;\n\n/**\n * Returns the sum of this and the specified Long.\n * @this {!Long}\n * @param {!Long|number|string} addend Addend\n * @returns {!Long} Sum\n */\nLongPrototype.add = function add(addend) {\n if (!isLong(addend))\n addend = fromValue(addend);\n\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high >>> 16;\n var a32 = this.high & 0xFFFF;\n var a16 = this.low >>> 16;\n var a00 = this.low & 0xFFFF;\n\n var b48 = addend.high >>> 16;\n var b32 = addend.high & 0xFFFF;\n var b16 = addend.low >>> 16;\n var b00 = addend.low & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\n};\n\n/**\n * Returns the difference of this and the specified Long.\n * @this {!Long}\n * @param {!Long|number|string} subtrahend Subtrahend\n * @returns {!Long} Difference\n */\nLongPrototype.subtract = function subtract(subtrahend) {\n if (!isLong(subtrahend))\n subtrahend = fromValue(subtrahend);\n return this.add(subtrahend.neg());\n};\n\n/**\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\n * @function\n * @param {!Long|number|string} subtrahend Subtrahend\n * @returns {!Long} Difference\n */\nLongPrototype.sub = LongPrototype.subtract;\n\n/**\n * Returns the product of this and the specified Long.\n * @this {!Long}\n * @param {!Long|number|string} multiplier Multiplier\n * @returns {!Long} Product\n */\nLongPrototype.multiply = function multiply(multiplier) {\n if (this.isZero())\n return ZERO;\n if (!isLong(multiplier))\n multiplier = fromValue(multiplier);\n\n // use wasm support if present\n if (wasm) {\n var low = wasm[\"mul\"](this.low,\n this.high,\n multiplier.low,\n multiplier.high);\n return fromBits(low, wasm[\"get_high\"](), this.unsigned);\n }\n\n if (multiplier.isZero())\n return ZERO;\n if (this.eq(MIN_VALUE))\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\n if (multiplier.eq(MIN_VALUE))\n return this.isOdd() ? MIN_VALUE : ZERO;\n\n if (this.isNegative()) {\n if (multiplier.isNegative())\n return this.neg().mul(multiplier.neg());\n else\n return this.neg().mul(multiplier).neg();\n } else if (multiplier.isNegative())\n return this.mul(multiplier.neg()).neg();\n\n // If both longs are small, use float multiplication\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\n\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high >>> 16;\n var a32 = this.high & 0xFFFF;\n var a16 = this.low >>> 16;\n var a00 = this.low & 0xFFFF;\n\n var b48 = multiplier.high >>> 16;\n var b32 = multiplier.high & 0xFFFF;\n var b16 = multiplier.low >>> 16;\n var b00 = multiplier.low & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\n};\n\n/**\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\n * @function\n * @param {!Long|number|string} multiplier Multiplier\n * @returns {!Long} Product\n */\nLongPrototype.mul = LongPrototype.multiply;\n\n/**\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\n * unsigned if this Long is unsigned.\n * @this {!Long}\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Quotient\n */\nLongPrototype.divide = function divide(divisor) {\n if (!isLong(divisor))\n divisor = fromValue(divisor);\n if (divisor.isZero())\n throw Error('division by zero');\n\n // use wasm support if present\n if (wasm) {\n // guard against signed division overflow: the largest\n // negative number / -1 would be 1 larger than the largest\n // positive number, due to two's complement.\n if (!this.unsigned &&\n this.high === -0x80000000 &&\n divisor.low === -1 && divisor.high === -1) {\n // be consistent with non-wasm code path\n return this;\n }\n var low = (this.unsigned ? wasm[\"div_u\"] : wasm[\"div_s\"])(\n this.low,\n this.high,\n divisor.low,\n divisor.high\n );\n return fromBits(low, wasm[\"get_high\"](), this.unsigned);\n }\n\n if (this.isZero())\n return this.unsigned ? UZERO : ZERO;\n var approx, rem, res;\n if (!this.unsigned) {\n // This section is only relevant for signed longs and is derived from the\n // closure library as a whole.\n if (this.eq(MIN_VALUE)) {\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n else if (divisor.eq(MIN_VALUE))\n return ONE;\n else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shr(1);\n approx = halfThis.div(divisor).shl(1);\n if (approx.eq(ZERO)) {\n return divisor.isNegative() ? ONE : NEG_ONE;\n } else {\n rem = this.sub(divisor.mul(approx));\n res = approx.add(rem.div(divisor));\n return res;\n }\n }\n } else if (divisor.eq(MIN_VALUE))\n return this.unsigned ? UZERO : ZERO;\n if (this.isNegative()) {\n if (divisor.isNegative())\n return this.neg().div(divisor.neg());\n return this.neg().div(divisor).neg();\n } else if (divisor.isNegative())\n return this.div(divisor.neg()).neg();\n res = ZERO;\n } else {\n // The algorithm below has not been made for unsigned longs. It's therefore\n // required to take special care of the MSB prior to running it.\n if (!divisor.unsigned)\n divisor = divisor.toUnsigned();\n if (divisor.gt(this))\n return UZERO;\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\n return UONE;\n res = UZERO;\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n rem = this;\n while (rem.gte(divisor)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n approxRes = fromNumber(approx),\n approxRem = approxRes.mul(divisor);\n while (approxRem.isNegative() || approxRem.gt(rem)) {\n approx -= delta;\n approxRes = fromNumber(approx, this.unsigned);\n approxRem = approxRes.mul(divisor);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero())\n approxRes = ONE;\n\n res = res.add(approxRes);\n rem = rem.sub(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\n * @function\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Quotient\n */\nLongPrototype.div = LongPrototype.divide;\n\n/**\n * Returns this Long modulo the specified.\n * @this {!Long}\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Remainder\n */\nLongPrototype.modulo = function modulo(divisor) {\n if (!isLong(divisor))\n divisor = fromValue(divisor);\n\n // use wasm support if present\n if (wasm) {\n var low = (this.unsigned ? wasm[\"rem_u\"] : wasm[\"rem_s\"])(\n this.low,\n this.high,\n divisor.low,\n divisor.high\n );\n return fromBits(low, wasm[\"get_high\"](), this.unsigned);\n }\n\n return this.sub(this.div(divisor).mul(divisor));\n};\n\n/**\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\n * @function\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Remainder\n */\nLongPrototype.mod = LongPrototype.modulo;\n\n/**\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\n * @function\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Remainder\n */\nLongPrototype.rem = LongPrototype.modulo;\n\n/**\n * Returns the bitwise NOT of this Long.\n * @this {!Long}\n * @returns {!Long}\n */\nLongPrototype.not = function not() {\n return fromBits(~this.low, ~this.high, this.unsigned);\n};\n\n/**\n * Returns the bitwise AND of this Long and the specified.\n * @this {!Long}\n * @param {!Long|number|string} other Other Long\n * @returns {!Long}\n */\nLongPrototype.and = function and(other) {\n if (!isLong(other))\n other = fromValue(other);\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\n};\n\n/**\n * Returns the bitwise OR of this Long and the specified.\n * @this {!Long}\n * @param {!Long|number|string} other Other Long\n * @returns {!Long}\n */\nLongPrototype.or = function or(other) {\n if (!isLong(other))\n other = fromValue(other);\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\n};\n\n/**\n * Returns the bitwise XOR of this Long and the given one.\n * @this {!Long}\n * @param {!Long|number|string} other Other Long\n * @returns {!Long}\n */\nLongPrototype.xor = function xor(other) {\n if (!isLong(other))\n other = fromValue(other);\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\n if (isLong(numBits))\n numBits = numBits.toInt();\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\n else\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shl = LongPrototype.shiftLeft;\n\n/**\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shiftRight = function shiftRight(numBits) {\n if (isLong(numBits))\n numBits = numBits.toInt();\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\n else\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\n};\n\n/**\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shr = LongPrototype.shiftRight;\n\n/**\n * Returns this Long with bits logically shifted to the right by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\n if (isLong(numBits)) numBits = numBits.toInt();\n if ((numBits &= 63) === 0) return this;\n if (numBits < 32) return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >>> numBits, this.unsigned);\n if (numBits === 32) return fromBits(this.high, 0, this.unsigned);\n return fromBits(this.high >>> (numBits - 32), 0, this.unsigned);\n};\n\n/**\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\n\n/**\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\n\n/**\n * Returns this Long with bits rotated to the left by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotateLeft = function rotateLeft(numBits) {\n var b;\n if (isLong(numBits)) numBits = numBits.toInt();\n if ((numBits &= 63) === 0) return this;\n if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);\n if (numBits < 32) {\n b = (32 - numBits);\n return fromBits(((this.low << numBits) | (this.high >>> b)), ((this.high << numBits) | (this.low >>> b)), this.unsigned);\n }\n numBits -= 32;\n b = (32 - numBits);\n return fromBits(((this.high << numBits) | (this.low >>> b)), ((this.low << numBits) | (this.high >>> b)), this.unsigned);\n}\n/**\n * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotl = LongPrototype.rotateLeft;\n\n/**\n * Returns this Long with bits rotated to the right by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotateRight = function rotateRight(numBits) {\n var b;\n if (isLong(numBits)) numBits = numBits.toInt();\n if ((numBits &= 63) === 0) return this;\n if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);\n if (numBits < 32) {\n b = (32 - numBits);\n return fromBits(((this.high << b) | (this.low >>> numBits)), ((this.low << b) | (this.high >>> numBits)), this.unsigned);\n }\n numBits -= 32;\n b = (32 - numBits);\n return fromBits(((this.low << b) | (this.high >>> numBits)), ((this.high << b) | (this.low >>> numBits)), this.unsigned);\n}\n/**\n * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotr = LongPrototype.rotateRight;\n\n/**\n * Converts this Long to signed.\n * @this {!Long}\n * @returns {!Long} Signed long\n */\nLongPrototype.toSigned = function toSigned() {\n if (!this.unsigned)\n return this;\n return fromBits(this.low, this.high, false);\n};\n\n/**\n * Converts this Long to unsigned.\n * @this {!Long}\n * @returns {!Long} Unsigned long\n */\nLongPrototype.toUnsigned = function toUnsigned() {\n if (this.unsigned)\n return this;\n return fromBits(this.low, this.high, true);\n};\n\n/**\n * Converts this Long to its byte representation.\n * @param {boolean=} le Whether little or big endian, defaults to big endian\n * @this {!Long}\n * @returns {!Array.} Byte representation\n */\nLongPrototype.toBytes = function toBytes(le) {\n return le ? this.toBytesLE() : this.toBytesBE();\n};\n\n/**\n * Converts this Long to its little endian byte representation.\n * @this {!Long}\n * @returns {!Array.} Little endian byte representation\n */\nLongPrototype.toBytesLE = function toBytesLE() {\n var hi = this.high,\n lo = this.low;\n return [\n lo & 0xff,\n lo >>> 8 & 0xff,\n lo >>> 16 & 0xff,\n lo >>> 24 ,\n hi & 0xff,\n hi >>> 8 & 0xff,\n hi >>> 16 & 0xff,\n hi >>> 24\n ];\n};\n\n/**\n * Converts this Long to its big endian byte representation.\n * @this {!Long}\n * @returns {!Array.} Big endian byte representation\n */\nLongPrototype.toBytesBE = function toBytesBE() {\n var hi = this.high,\n lo = this.low;\n return [\n hi >>> 24 ,\n hi >>> 16 & 0xff,\n hi >>> 8 & 0xff,\n hi & 0xff,\n lo >>> 24 ,\n lo >>> 16 & 0xff,\n lo >>> 8 & 0xff,\n lo & 0xff\n ];\n};\n\n/**\n * Creates a Long from its byte representation.\n * @param {!Array.} bytes Byte representation\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @param {boolean=} le Whether little or big endian, defaults to big endian\n * @returns {Long} The corresponding Long value\n */\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\n};\n\n/**\n * Creates a Long from its little endian byte representation.\n * @param {!Array.} bytes Little endian byte representation\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {Long} The corresponding Long value\n */\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\n return new Long(\n bytes[0] |\n bytes[1] << 8 |\n bytes[2] << 16 |\n bytes[3] << 24,\n bytes[4] |\n bytes[5] << 8 |\n bytes[6] << 16 |\n bytes[7] << 24,\n unsigned\n );\n};\n\n/**\n * Creates a Long from its big endian byte representation.\n * @param {!Array.} bytes Big endian byte representation\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {Long} The corresponding Long value\n */\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\n return new Long(\n bytes[4] << 24 |\n bytes[5] << 16 |\n bytes[6] << 8 |\n bytes[7],\n bytes[0] << 24 |\n bytes[1] << 16 |\n bytes[2] << 8 |\n bytes[3],\n unsigned\n );\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/long.js\n// module id = 0\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..04dfea61df84bc8ce900de0cce8c0ed14159aec4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/index.d.ts @@ -0,0 +1,429 @@ +export = Long; +export as namespace Long; + +declare namespace Long { } + +declare class Long { + /** + * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs. + */ + constructor(low: number, high?: number, unsigned?: boolean); + + /** + * Maximum unsigned value. + */ + static MAX_UNSIGNED_VALUE: Long; + + /** + * Maximum signed value. + */ + static MAX_VALUE: Long; + + /** + * Minimum signed value. + */ + static MIN_VALUE: Long; + + /** + * Signed negative one. + */ + static NEG_ONE: Long; + + /** + * Signed one. + */ + static ONE: Long; + + /** + * Unsigned one. + */ + static UONE: Long; + + /** + * Unsigned zero. + */ + static UZERO: Long; + + /** + * Signed zero + */ + static ZERO: Long; + + /** + * The high 32 bits as a signed value. + */ + high: number; + + /** + * The low 32 bits as a signed value. + */ + low: number; + + /** + * Whether unsigned or not. + */ + unsigned: boolean; + + /** + * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. + */ + static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; + + /** + * Returns a Long representing the given 32 bit integer value. + */ + static fromInt(value: number, unsigned?: boolean): Long; + + /** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + */ + static fromNumber(value: number, unsigned?: boolean): Long; + + /** + * Returns a Long representation of the given string, written using the specified radix. + */ + static fromString(str: string, unsigned?: boolean | number, radix?: number): Long; + + /** + * Creates a Long from its byte representation. + */ + static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long; + + /** + * Creates a Long from its little endian byte representation. + */ + static fromBytesLE(bytes: number[], unsigned?: boolean): Long; + + /** + * Creates a Long from its big endian byte representation. + */ + static fromBytesBE(bytes: number[], unsigned?: boolean): Long; + + /** + * Tests if the specified object is a Long. + */ + static isLong(obj: any): obj is Long; + + /** + * Converts the specified value to a Long. + */ + static fromValue(val: Long | number | string | {low: number, high: number, unsigned: boolean}, unsigned?: boolean): Long; + + /** + * Returns the sum of this and the specified Long. + */ + add(addend: number | Long | string): Long; + + /** + * Returns the bitwise AND of this Long and the specified. + */ + and(other: Long | number | string): Long; + + /** + * Compares this Long's value with the specified's. + */ + compare(other: Long | number | string): number; + + /** + * Compares this Long's value with the specified's. + */ + comp(other: Long | number | string): number; + + /** + * Returns this Long divided by the specified. + */ + divide(divisor: Long | number | string): Long; + + /** + * Returns this Long divided by the specified. + */ + div(divisor: Long | number | string): Long; + + /** + * Tests if this Long's value equals the specified's. + */ + equals(other: Long | number | string): boolean; + + /** + * Tests if this Long's value equals the specified's. + */ + eq(other: Long | number | string): boolean; + + /** + * Gets the high 32 bits as a signed integer. + */ + getHighBits(): number; + + /** + * Gets the high 32 bits as an unsigned integer. + */ + getHighBitsUnsigned(): number; + + /** + * Gets the low 32 bits as a signed integer. + */ + getLowBits(): number; + + /** + * Gets the low 32 bits as an unsigned integer. + */ + getLowBitsUnsigned(): number; + + /** + * Gets the number of bits needed to represent the absolute value of this Long. + */ + getNumBitsAbs(): number; + + /** + * Tests if this Long's value is greater than the specified's. + */ + greaterThan(other: Long | number | string): boolean; + + /** + * Tests if this Long's value is greater than the specified's. + */ + gt(other: Long | number | string): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + greaterThanOrEqual(other: Long | number | string): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + gte(other: Long | number | string): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + ge(other: Long | number | string): boolean; + + /** + * Tests if this Long's value is even. + */ + isEven(): boolean; + + /** + * Tests if this Long's value is negative. + */ + isNegative(): boolean; + + /** + * Tests if this Long's value is odd. + */ + isOdd(): boolean; + + /** + * Tests if this Long's value is positive. + */ + isPositive(): boolean; + + /** + * Tests if this Long's value equals zero. + */ + isZero(): boolean; + + /** + * Tests if this Long's value equals zero. + */ + eqz(): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lessThan(other: Long | number | string): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lt(other: Long | number | string): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lessThanOrEqual(other: Long | number | string): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lte(other: Long | number | string): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + le(other: Long | number | string): boolean; + + /** + * Returns this Long modulo the specified. + */ + modulo(other: Long | number | string): Long; + + /** + * Returns this Long modulo the specified. + */ + mod(other: Long | number | string): Long; + + /** + * Returns this Long modulo the specified. + */ + rem(other: Long | number | string): Long; + + /** + * Returns the product of this and the specified Long. + */ + multiply(multiplier: Long | number | string): Long; + + /** + * Returns the product of this and the specified Long. + */ + mul(multiplier: Long | number | string): Long; + + /** + * Negates this Long's value. + */ + negate(): Long; + + /** + * Negates this Long's value. + */ + neg(): Long; + + /** + * Returns the bitwise NOT of this Long. + */ + not(): Long; + + /** + * Tests if this Long's value differs from the specified's. + */ + notEquals(other: Long | number | string): boolean; + + /** + * Tests if this Long's value differs from the specified's. + */ + neq(other: Long | number | string): boolean; + + /** + * Tests if this Long's value differs from the specified's. + */ + ne(other: Long | number | string): boolean; + + /** + * Returns the bitwise OR of this Long and the specified. + */ + or(other: Long | number | string): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shiftLeft(numBits: number | Long): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shl(numBits: number | Long): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shiftRight(numBits: number | Long): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shr(numBits: number | Long): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shiftRightUnsigned(numBits: number | Long): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shru(numBits: number | Long): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shr_u(numBits: number | Long): Long; + + /** + * Returns this Long with bits rotated to the left by the given amount. + */ + rotateLeft(numBits: number | Long): Long; + + /** + * Returns this Long with bits rotated to the left by the given amount. + */ + rotl(numBits: number | Long): Long; + + /** + * Returns this Long with bits rotated to the right by the given amount. + */ + rotateRight(numBits: number | Long): Long; + + /** + * Returns this Long with bits rotated to the right by the given amount. + */ + rotr(numBits: number | Long): Long; + + /** + * Returns the difference of this and the specified Long. + */ + subtract(subtrahend: number | Long | string): Long; + + /** + * Returns the difference of this and the specified Long. + */ + sub(subtrahend: number | Long |string): Long; + + /** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + */ + toInt(): number; + + /** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + */ + toNumber(): number; + + /** + * Converts this Long to its byte representation. + */ + + toBytes(le?: boolean): number[]; + + /** + * Converts this Long to its little endian byte representation. + */ + + toBytesLE(): number[]; + + /** + * Converts this Long to its big endian byte representation. + */ + + toBytesBE(): number[]; + + /** + * Converts this Long to signed. + */ + toSigned(): Long; + + /** + * Converts the Long to a string written in the specified radix. + */ + toString(radix?: number): string; + + /** + * Converts this Long to unsigned. + */ + toUnsigned(): Long; + + /** + * Returns the bitwise XOR of this Long and the given one. + */ + xor(other: Long | number | string): Long; +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e16857a10980d991cc0cf2604deffbabe1aff755 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/index.js @@ -0,0 +1 @@ +module.exports = require("./src/long"); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/package.json new file mode 100644 index 0000000000000000000000000000000000000000..648a5bb5e917b308c3599870e14f7823739480df --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/package.json @@ -0,0 +1,36 @@ +{ + "name": "@xtuc/long", + "version": "4.2.2", + "author": "Daniel Wirtz ", + "description": "A Long class for representing a 64-bit two's-complement integer value.", + "main": "src/long.js", + "repository": { + "type": "git", + "url": "https://github.com/dcodeIO/long.js.git" + }, + "bugs": { + "url": "https://github.com/dcodeIO/long.js/issues" + }, + "keywords": [ + "math" + ], + "dependencies": {}, + "devDependencies": { + "webpack": "^3.10.0" + }, + "license": "Apache-2.0", + "scripts": { + "build": "webpack", + "test": "node tests" + }, + "files": [ + "index.js", + "LICENSE", + "README.md", + "src/long.js", + "dist/long.js", + "dist/long.js.map", + "index.d.ts" + ], + "types": "index.d.ts" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/src/long.js b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/src/long.js new file mode 100644 index 0000000000000000000000000000000000000000..e1dfd57808670eec46fc0e33abced381878667d0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/@xtuc/long/src/long.js @@ -0,0 +1,1405 @@ +module.exports = Long; + +/** + * wasm optimizations, to do native i64 multiplication and divide + */ +var wasm = null; + +try { + wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ + 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11 + ])), {}).exports; +} catch (e) { + // no wasm support :( +} + +/** + * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. + * See the from* functions below for more convenient ways of constructing Longs. + * @exports Long + * @class A Long class for representing a 64 bit two's-complement integer value. + * @param {number} low The low (signed) 32 bits of the long + * @param {number} high The high (signed) 32 bits of the long + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @constructor + */ +function Long(low, high, unsigned) { + + /** + * The low 32 bits as a signed value. + * @type {number} + */ + this.low = low | 0; + + /** + * The high 32 bits as a signed value. + * @type {number} + */ + this.high = high | 0; + + /** + * Whether unsigned or not. + * @type {boolean} + */ + this.unsigned = !!unsigned; +} + +// The internal representation of a long is the two given signed, 32-bit values. +// We use 32-bit pieces because these are the size of integers on which +// Javascript performs bit-operations. For operations like addition and +// multiplication, we split each number into 16 bit pieces, which can easily be +// multiplied within Javascript's floating-point representation without overflow +// or change in sign. +// +// In the algorithms below, we frequently reduce the negative case to the +// positive case by negating the input(s) and then post-processing the result. +// Note that we must ALWAYS check specially whether those values are MIN_VALUE +// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as +// a positive number, it overflows back into a negative). Not handling this +// case would often result in infinite recursion. +// +// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from* +// methods on which they depend. + +/** + * An indicator used to reliably determine if an object is a Long or not. + * @type {boolean} + * @const + * @private + */ +Long.prototype.__isLong__; + +Object.defineProperty(Long.prototype, "__isLong__", { value: true }); + +/** + * @function + * @param {*} obj Object + * @returns {boolean} + * @inner + */ +function isLong(obj) { + return (obj && obj["__isLong__"]) === true; +} + +/** + * Tests if the specified object is a Long. + * @function + * @param {*} obj Object + * @returns {boolean} + */ +Long.isLong = isLong; + +/** + * A cache of the Long representations of small integer values. + * @type {!Object} + * @inner + */ +var INT_CACHE = {}; + +/** + * A cache of the Long representations of small unsigned integer values. + * @type {!Object} + * @inner + */ +var UINT_CACHE = {}; + +/** + * @param {number} value + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromInt(value, unsigned) { + var obj, cachedObj, cache; + if (unsigned) { + value >>>= 0; + if (cache = (0 <= value && value < 256)) { + cachedObj = UINT_CACHE[value]; + if (cachedObj) + return cachedObj; + } + obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true); + if (cache) + UINT_CACHE[value] = obj; + return obj; + } else { + value |= 0; + if (cache = (-128 <= value && value < 128)) { + cachedObj = INT_CACHE[value]; + if (cachedObj) + return cachedObj; + } + obj = fromBits(value, value < 0 ? -1 : 0, false); + if (cache) + INT_CACHE[value] = obj; + return obj; + } +} + +/** + * Returns a Long representing the given 32 bit integer value. + * @function + * @param {number} value The 32 bit integer in question + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ +Long.fromInt = fromInt; + +/** + * @param {number} value + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromNumber(value, unsigned) { + if (isNaN(value)) + return unsigned ? UZERO : ZERO; + if (unsigned) { + if (value < 0) + return UZERO; + if (value >= TWO_PWR_64_DBL) + return MAX_UNSIGNED_VALUE; + } else { + if (value <= -TWO_PWR_63_DBL) + return MIN_VALUE; + if (value + 1 >= TWO_PWR_63_DBL) + return MAX_VALUE; + } + if (value < 0) + return fromNumber(-value, unsigned).neg(); + return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned); +} + +/** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * @function + * @param {number} value The number in question + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ +Long.fromNumber = fromNumber; + +/** + * @param {number} lowBits + * @param {number} highBits + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromBits(lowBits, highBits, unsigned) { + return new Long(lowBits, highBits, unsigned); +} + +/** + * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is + * assumed to use 32 bits. + * @function + * @param {number} lowBits The low 32 bits + * @param {number} highBits The high 32 bits + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ +Long.fromBits = fromBits; + +/** + * @function + * @param {number} base + * @param {number} exponent + * @returns {number} + * @inner + */ +var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4) + +/** + * @param {string} str + * @param {(boolean|number)=} unsigned + * @param {number=} radix + * @returns {!Long} + * @inner + */ +function fromString(str, unsigned, radix) { + if (str.length === 0) + throw Error('empty string'); + if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") + return ZERO; + if (typeof unsigned === 'number') { + // For goog.math.long compatibility + radix = unsigned, + unsigned = false; + } else { + unsigned = !! unsigned; + } + radix = radix || 10; + if (radix < 2 || 36 < radix) + throw RangeError('radix'); + + var p; + if ((p = str.indexOf('-')) > 0) + throw Error('interior hyphen'); + else if (p === 0) { + return fromString(str.substring(1), unsigned, radix).neg(); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = fromNumber(pow_dbl(radix, 8)); + + var result = ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i), + value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = fromNumber(pow_dbl(radix, size)); + result = result.mul(power).add(fromNumber(value)); + } else { + result = result.mul(radixToPower); + result = result.add(fromNumber(value)); + } + } + result.unsigned = unsigned; + return result; +} + +/** + * Returns a Long representation of the given string, written using the specified radix. + * @function + * @param {string} str The textual representation of the Long + * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed + * @param {number=} radix The radix in which the text is written (2-36), defaults to 10 + * @returns {!Long} The corresponding Long value + */ +Long.fromString = fromString; + +/** + * @function + * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromValue(val, unsigned) { + if (typeof val === 'number') + return fromNumber(val, unsigned); + if (typeof val === 'string') + return fromString(val, unsigned); + // Throws for non-objects, converts non-instanceof Long: + return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned); +} + +/** + * Converts the specified value to a Long using the appropriate from* function for its type. + * @function + * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} + */ +Long.fromValue = fromValue; + +// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be +// no runtime penalty for these. + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_16_DBL = 1 << 16; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_24_DBL = 1 << 24; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2; + +/** + * @type {!Long} + * @const + * @inner + */ +var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL); + +/** + * @type {!Long} + * @inner + */ +var ZERO = fromInt(0); + +/** + * Signed zero. + * @type {!Long} + */ +Long.ZERO = ZERO; + +/** + * @type {!Long} + * @inner + */ +var UZERO = fromInt(0, true); + +/** + * Unsigned zero. + * @type {!Long} + */ +Long.UZERO = UZERO; + +/** + * @type {!Long} + * @inner + */ +var ONE = fromInt(1); + +/** + * Signed one. + * @type {!Long} + */ +Long.ONE = ONE; + +/** + * @type {!Long} + * @inner + */ +var UONE = fromInt(1, true); + +/** + * Unsigned one. + * @type {!Long} + */ +Long.UONE = UONE; + +/** + * @type {!Long} + * @inner + */ +var NEG_ONE = fromInt(-1); + +/** + * Signed negative one. + * @type {!Long} + */ +Long.NEG_ONE = NEG_ONE; + +/** + * @type {!Long} + * @inner + */ +var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false); + +/** + * Maximum signed value. + * @type {!Long} + */ +Long.MAX_VALUE = MAX_VALUE; + +/** + * @type {!Long} + * @inner + */ +var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true); + +/** + * Maximum unsigned value. + * @type {!Long} + */ +Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE; + +/** + * @type {!Long} + * @inner + */ +var MIN_VALUE = fromBits(0, 0x80000000|0, false); + +/** + * Minimum signed value. + * @type {!Long} + */ +Long.MIN_VALUE = MIN_VALUE; + +/** + * @alias Long.prototype + * @inner + */ +var LongPrototype = Long.prototype; + +/** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + * @this {!Long} + * @returns {number} + */ +LongPrototype.toInt = function toInt() { + return this.unsigned ? this.low >>> 0 : this.low; +}; + +/** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + * @this {!Long} + * @returns {number} + */ +LongPrototype.toNumber = function toNumber() { + if (this.unsigned) + return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0); + return this.high * TWO_PWR_32_DBL + (this.low >>> 0); +}; + +/** + * Converts the Long to a string written in the specified radix. + * @this {!Long} + * @param {number=} radix Radix (2-36), defaults to 10 + * @returns {string} + * @override + * @throws {RangeError} If `radix` is out of range + */ +LongPrototype.toString = function toString(radix) { + radix = radix || 10; + if (radix < 2 || 36 < radix) + throw RangeError('radix'); + if (this.isZero()) + return '0'; + if (this.isNegative()) { // Unsigned Longs are never negative + if (this.eq(MIN_VALUE)) { + // We need to change the Long value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixLong = fromNumber(radix), + div = this.div(radixLong), + rem1 = div.mul(radixLong).sub(this); + return div.toString(radix) + rem1.toInt().toString(radix); + } else + return '-' + this.neg().toString(radix); + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), + rem = this; + var result = ''; + while (true) { + var remDiv = rem.div(radixToPower), + intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, + digits = intval.toString(radix); + rem = remDiv; + if (rem.isZero()) + return digits + result; + else { + while (digits.length < 6) + digits = '0' + digits; + result = '' + digits + result; + } + } +}; + +/** + * Gets the high 32 bits as a signed integer. + * @this {!Long} + * @returns {number} Signed high bits + */ +LongPrototype.getHighBits = function getHighBits() { + return this.high; +}; + +/** + * Gets the high 32 bits as an unsigned integer. + * @this {!Long} + * @returns {number} Unsigned high bits + */ +LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() { + return this.high >>> 0; +}; + +/** + * Gets the low 32 bits as a signed integer. + * @this {!Long} + * @returns {number} Signed low bits + */ +LongPrototype.getLowBits = function getLowBits() { + return this.low; +}; + +/** + * Gets the low 32 bits as an unsigned integer. + * @this {!Long} + * @returns {number} Unsigned low bits + */ +LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() { + return this.low >>> 0; +}; + +/** + * Gets the number of bits needed to represent the absolute value of this Long. + * @this {!Long} + * @returns {number} + */ +LongPrototype.getNumBitsAbs = function getNumBitsAbs() { + if (this.isNegative()) // Unsigned Longs are never negative + return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs(); + var val = this.high != 0 ? this.high : this.low; + for (var bit = 31; bit > 0; bit--) + if ((val & (1 << bit)) != 0) + break; + return this.high != 0 ? bit + 33 : bit + 1; +}; + +/** + * Tests if this Long's value equals zero. + * @this {!Long} + * @returns {boolean} + */ +LongPrototype.isZero = function isZero() { + return this.high === 0 && this.low === 0; +}; + +/** + * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}. + * @returns {boolean} + */ +LongPrototype.eqz = LongPrototype.isZero; + +/** + * Tests if this Long's value is negative. + * @this {!Long} + * @returns {boolean} + */ +LongPrototype.isNegative = function isNegative() { + return !this.unsigned && this.high < 0; +}; + +/** + * Tests if this Long's value is positive. + * @this {!Long} + * @returns {boolean} + */ +LongPrototype.isPositive = function isPositive() { + return this.unsigned || this.high >= 0; +}; + +/** + * Tests if this Long's value is odd. + * @this {!Long} + * @returns {boolean} + */ +LongPrototype.isOdd = function isOdd() { + return (this.low & 1) === 1; +}; + +/** + * Tests if this Long's value is even. + * @this {!Long} + * @returns {boolean} + */ +LongPrototype.isEven = function isEven() { + return (this.low & 1) === 0; +}; + +/** + * Tests if this Long's value equals the specified's. + * @this {!Long} + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.equals = function equals(other) { + if (!isLong(other)) + other = fromValue(other); + if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1) + return false; + return this.high === other.high && this.low === other.low; +}; + +/** + * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.eq = LongPrototype.equals; + +/** + * Tests if this Long's value differs from the specified's. + * @this {!Long} + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.notEquals = function notEquals(other) { + return !this.eq(/* validates */ other); +}; + +/** + * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.neq = LongPrototype.notEquals; + +/** + * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.ne = LongPrototype.notEquals; + +/** + * Tests if this Long's value is less than the specified's. + * @this {!Long} + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lessThan = function lessThan(other) { + return this.comp(/* validates */ other) < 0; +}; + +/** + * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lt = LongPrototype.lessThan; + +/** + * Tests if this Long's value is less than or equal the specified's. + * @this {!Long} + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) { + return this.comp(/* validates */ other) <= 0; +}; + +/** + * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lte = LongPrototype.lessThanOrEqual; + +/** + * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.le = LongPrototype.lessThanOrEqual; + +/** + * Tests if this Long's value is greater than the specified's. + * @this {!Long} + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.greaterThan = function greaterThan(other) { + return this.comp(/* validates */ other) > 0; +}; + +/** + * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.gt = LongPrototype.greaterThan; + +/** + * Tests if this Long's value is greater than or equal the specified's. + * @this {!Long} + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) { + return this.comp(/* validates */ other) >= 0; +}; + +/** + * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.gte = LongPrototype.greaterThanOrEqual; + +/** + * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.ge = LongPrototype.greaterThanOrEqual; + +/** + * Compares this Long's value with the specified's. + * @this {!Long} + * @param {!Long|number|string} other Other value + * @returns {number} 0 if they are the same, 1 if the this is greater and -1 + * if the given one is greater + */ +LongPrototype.compare = function compare(other) { + if (!isLong(other)) + other = fromValue(other); + if (this.eq(other)) + return 0; + var thisNeg = this.isNegative(), + otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) + return -1; + if (!thisNeg && otherNeg) + return 1; + // At this point the sign bits are the same + if (!this.unsigned) + return this.sub(other).isNegative() ? -1 : 1; + // Both are positive if at least one is unsigned + return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1; +}; + +/** + * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}. + * @function + * @param {!Long|number|string} other Other value + * @returns {number} 0 if they are the same, 1 if the this is greater and -1 + * if the given one is greater + */ +LongPrototype.comp = LongPrototype.compare; + +/** + * Negates this Long's value. + * @this {!Long} + * @returns {!Long} Negated Long + */ +LongPrototype.negate = function negate() { + if (!this.unsigned && this.eq(MIN_VALUE)) + return MIN_VALUE; + return this.not().add(ONE); +}; + +/** + * Negates this Long's value. This is an alias of {@link Long#negate}. + * @function + * @returns {!Long} Negated Long + */ +LongPrototype.neg = LongPrototype.negate; + +/** + * Returns the sum of this and the specified Long. + * @this {!Long} + * @param {!Long|number|string} addend Addend + * @returns {!Long} Sum + */ +LongPrototype.add = function add(addend) { + if (!isLong(addend)) + addend = fromValue(addend); + + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high >>> 16; + var a32 = this.high & 0xFFFF; + var a16 = this.low >>> 16; + var a00 = this.low & 0xFFFF; + + var b48 = addend.high >>> 16; + var b32 = addend.high & 0xFFFF; + var b16 = addend.low >>> 16; + var b00 = addend.low & 0xFFFF; + + var c48 = 0, c32 = 0, c16 = 0, c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xFFFF; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c48 += a48 + b48; + c48 &= 0xFFFF; + return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); +}; + +/** + * Returns the difference of this and the specified Long. + * @this {!Long} + * @param {!Long|number|string} subtrahend Subtrahend + * @returns {!Long} Difference + */ +LongPrototype.subtract = function subtract(subtrahend) { + if (!isLong(subtrahend)) + subtrahend = fromValue(subtrahend); + return this.add(subtrahend.neg()); +}; + +/** + * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}. + * @function + * @param {!Long|number|string} subtrahend Subtrahend + * @returns {!Long} Difference + */ +LongPrototype.sub = LongPrototype.subtract; + +/** + * Returns the product of this and the specified Long. + * @this {!Long} + * @param {!Long|number|string} multiplier Multiplier + * @returns {!Long} Product + */ +LongPrototype.multiply = function multiply(multiplier) { + if (this.isZero()) + return ZERO; + if (!isLong(multiplier)) + multiplier = fromValue(multiplier); + + // use wasm support if present + if (wasm) { + var low = wasm["mul"](this.low, + this.high, + multiplier.low, + multiplier.high); + return fromBits(low, wasm["get_high"](), this.unsigned); + } + + if (multiplier.isZero()) + return ZERO; + if (this.eq(MIN_VALUE)) + return multiplier.isOdd() ? MIN_VALUE : ZERO; + if (multiplier.eq(MIN_VALUE)) + return this.isOdd() ? MIN_VALUE : ZERO; + + if (this.isNegative()) { + if (multiplier.isNegative()) + return this.neg().mul(multiplier.neg()); + else + return this.neg().mul(multiplier).neg(); + } else if (multiplier.isNegative()) + return this.mul(multiplier.neg()).neg(); + + // If both longs are small, use float multiplication + if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24)) + return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned); + + // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high >>> 16; + var a32 = this.high & 0xFFFF; + var a16 = this.low >>> 16; + var a00 = this.low & 0xFFFF; + + var b48 = multiplier.high >>> 16; + var b32 = multiplier.high & 0xFFFF; + var b16 = multiplier.low >>> 16; + var b00 = multiplier.low & 0xFFFF; + + var c48 = 0, c32 = 0, c16 = 0, c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xFFFF; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xFFFF; + return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); +}; + +/** + * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}. + * @function + * @param {!Long|number|string} multiplier Multiplier + * @returns {!Long} Product + */ +LongPrototype.mul = LongPrototype.multiply; + +/** + * Returns this Long divided by the specified. The result is signed if this Long is signed or + * unsigned if this Long is unsigned. + * @this {!Long} + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Quotient + */ +LongPrototype.divide = function divide(divisor) { + if (!isLong(divisor)) + divisor = fromValue(divisor); + if (divisor.isZero()) + throw Error('division by zero'); + + // use wasm support if present + if (wasm) { + // guard against signed division overflow: the largest + // negative number / -1 would be 1 larger than the largest + // positive number, due to two's complement. + if (!this.unsigned && + this.high === -0x80000000 && + divisor.low === -1 && divisor.high === -1) { + // be consistent with non-wasm code path + return this; + } + var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])( + this.low, + this.high, + divisor.low, + divisor.high + ); + return fromBits(low, wasm["get_high"](), this.unsigned); + } + + if (this.isZero()) + return this.unsigned ? UZERO : ZERO; + var approx, rem, res; + if (!this.unsigned) { + // This section is only relevant for signed longs and is derived from the + // closure library as a whole. + if (this.eq(MIN_VALUE)) { + if (divisor.eq(ONE) || divisor.eq(NEG_ONE)) + return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + else if (divisor.eq(MIN_VALUE)) + return ONE; + else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shr(1); + approx = halfThis.div(divisor).shl(1); + if (approx.eq(ZERO)) { + return divisor.isNegative() ? ONE : NEG_ONE; + } else { + rem = this.sub(divisor.mul(approx)); + res = approx.add(rem.div(divisor)); + return res; + } + } + } else if (divisor.eq(MIN_VALUE)) + return this.unsigned ? UZERO : ZERO; + if (this.isNegative()) { + if (divisor.isNegative()) + return this.neg().div(divisor.neg()); + return this.neg().div(divisor).neg(); + } else if (divisor.isNegative()) + return this.div(divisor.neg()).neg(); + res = ZERO; + } else { + // The algorithm below has not been made for unsigned longs. It's therefore + // required to take special care of the MSB prior to running it. + if (!divisor.unsigned) + divisor = divisor.toUnsigned(); + if (divisor.gt(this)) + return UZERO; + if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true + return UONE; + res = UZERO; + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + rem = this; + while (rem.gte(divisor)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2), + delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48), + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + approxRes = fromNumber(approx), + approxRem = approxRes.mul(divisor); + while (approxRem.isNegative() || approxRem.gt(rem)) { + approx -= delta; + approxRes = fromNumber(approx, this.unsigned); + approxRem = approxRes.mul(divisor); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) + approxRes = ONE; + + res = res.add(approxRes); + rem = rem.sub(approxRem); + } + return res; +}; + +/** + * Returns this Long divided by the specified. This is an alias of {@link Long#divide}. + * @function + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Quotient + */ +LongPrototype.div = LongPrototype.divide; + +/** + * Returns this Long modulo the specified. + * @this {!Long} + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Remainder + */ +LongPrototype.modulo = function modulo(divisor) { + if (!isLong(divisor)) + divisor = fromValue(divisor); + + // use wasm support if present + if (wasm) { + var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])( + this.low, + this.high, + divisor.low, + divisor.high + ); + return fromBits(low, wasm["get_high"](), this.unsigned); + } + + return this.sub(this.div(divisor).mul(divisor)); +}; + +/** + * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. + * @function + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Remainder + */ +LongPrototype.mod = LongPrototype.modulo; + +/** + * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. + * @function + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Remainder + */ +LongPrototype.rem = LongPrototype.modulo; + +/** + * Returns the bitwise NOT of this Long. + * @this {!Long} + * @returns {!Long} + */ +LongPrototype.not = function not() { + return fromBits(~this.low, ~this.high, this.unsigned); +}; + +/** + * Returns the bitwise AND of this Long and the specified. + * @this {!Long} + * @param {!Long|number|string} other Other Long + * @returns {!Long} + */ +LongPrototype.and = function and(other) { + if (!isLong(other)) + other = fromValue(other); + return fromBits(this.low & other.low, this.high & other.high, this.unsigned); +}; + +/** + * Returns the bitwise OR of this Long and the specified. + * @this {!Long} + * @param {!Long|number|string} other Other Long + * @returns {!Long} + */ +LongPrototype.or = function or(other) { + if (!isLong(other)) + other = fromValue(other); + return fromBits(this.low | other.low, this.high | other.high, this.unsigned); +}; + +/** + * Returns the bitwise XOR of this Long and the given one. + * @this {!Long} + * @param {!Long|number|string} other Other Long + * @returns {!Long} + */ +LongPrototype.xor = function xor(other) { + if (!isLong(other)) + other = fromValue(other); + return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned); +}; + +/** + * Returns this Long with bits shifted to the left by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shiftLeft = function shiftLeft(numBits) { + if (isLong(numBits)) + numBits = numBits.toInt(); + if ((numBits &= 63) === 0) + return this; + else if (numBits < 32) + return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned); + else + return fromBits(0, this.low << (numBits - 32), this.unsigned); +}; + +/** + * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shl = LongPrototype.shiftLeft; + +/** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shiftRight = function shiftRight(numBits) { + if (isLong(numBits)) + numBits = numBits.toInt(); + if ((numBits &= 63) === 0) + return this; + else if (numBits < 32) + return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned); + else + return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned); +}; + +/** + * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shr = LongPrototype.shiftRight; + +/** + * Returns this Long with bits logically shifted to the right by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) { + if (isLong(numBits)) numBits = numBits.toInt(); + if ((numBits &= 63) === 0) return this; + if (numBits < 32) return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >>> numBits, this.unsigned); + if (numBits === 32) return fromBits(this.high, 0, this.unsigned); + return fromBits(this.high >>> (numBits - 32), 0, this.unsigned); +}; + +/** + * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shru = LongPrototype.shiftRightUnsigned; + +/** + * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shr_u = LongPrototype.shiftRightUnsigned; + +/** + * Returns this Long with bits rotated to the left by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Rotated Long + */ +LongPrototype.rotateLeft = function rotateLeft(numBits) { + var b; + if (isLong(numBits)) numBits = numBits.toInt(); + if ((numBits &= 63) === 0) return this; + if (numBits === 32) return fromBits(this.high, this.low, this.unsigned); + if (numBits < 32) { + b = (32 - numBits); + return fromBits(((this.low << numBits) | (this.high >>> b)), ((this.high << numBits) | (this.low >>> b)), this.unsigned); + } + numBits -= 32; + b = (32 - numBits); + return fromBits(((this.high << numBits) | (this.low >>> b)), ((this.low << numBits) | (this.high >>> b)), this.unsigned); +} +/** + * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Rotated Long + */ +LongPrototype.rotl = LongPrototype.rotateLeft; + +/** + * Returns this Long with bits rotated to the right by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Rotated Long + */ +LongPrototype.rotateRight = function rotateRight(numBits) { + var b; + if (isLong(numBits)) numBits = numBits.toInt(); + if ((numBits &= 63) === 0) return this; + if (numBits === 32) return fromBits(this.high, this.low, this.unsigned); + if (numBits < 32) { + b = (32 - numBits); + return fromBits(((this.high << b) | (this.low >>> numBits)), ((this.low << b) | (this.high >>> numBits)), this.unsigned); + } + numBits -= 32; + b = (32 - numBits); + return fromBits(((this.low << b) | (this.high >>> numBits)), ((this.high << b) | (this.low >>> numBits)), this.unsigned); +} +/** + * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Rotated Long + */ +LongPrototype.rotr = LongPrototype.rotateRight; + +/** + * Converts this Long to signed. + * @this {!Long} + * @returns {!Long} Signed long + */ +LongPrototype.toSigned = function toSigned() { + if (!this.unsigned) + return this; + return fromBits(this.low, this.high, false); +}; + +/** + * Converts this Long to unsigned. + * @this {!Long} + * @returns {!Long} Unsigned long + */ +LongPrototype.toUnsigned = function toUnsigned() { + if (this.unsigned) + return this; + return fromBits(this.low, this.high, true); +}; + +/** + * Converts this Long to its byte representation. + * @param {boolean=} le Whether little or big endian, defaults to big endian + * @this {!Long} + * @returns {!Array.} Byte representation + */ +LongPrototype.toBytes = function toBytes(le) { + return le ? this.toBytesLE() : this.toBytesBE(); +}; + +/** + * Converts this Long to its little endian byte representation. + * @this {!Long} + * @returns {!Array.} Little endian byte representation + */ +LongPrototype.toBytesLE = function toBytesLE() { + var hi = this.high, + lo = this.low; + return [ + lo & 0xff, + lo >>> 8 & 0xff, + lo >>> 16 & 0xff, + lo >>> 24 , + hi & 0xff, + hi >>> 8 & 0xff, + hi >>> 16 & 0xff, + hi >>> 24 + ]; +}; + +/** + * Converts this Long to its big endian byte representation. + * @this {!Long} + * @returns {!Array.} Big endian byte representation + */ +LongPrototype.toBytesBE = function toBytesBE() { + var hi = this.high, + lo = this.low; + return [ + hi >>> 24 , + hi >>> 16 & 0xff, + hi >>> 8 & 0xff, + hi & 0xff, + lo >>> 24 , + lo >>> 16 & 0xff, + lo >>> 8 & 0xff, + lo & 0xff + ]; +}; + +/** + * Creates a Long from its byte representation. + * @param {!Array.} bytes Byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @param {boolean=} le Whether little or big endian, defaults to big endian + * @returns {Long} The corresponding Long value + */ +Long.fromBytes = function fromBytes(bytes, unsigned, le) { + return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned); +}; + +/** + * Creates a Long from its little endian byte representation. + * @param {!Array.} bytes Little endian byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {Long} The corresponding Long value + */ +Long.fromBytesLE = function fromBytesLE(bytes, unsigned) { + return new Long( + bytes[0] | + bytes[1] << 8 | + bytes[2] << 16 | + bytes[3] << 24, + bytes[4] | + bytes[5] << 8 | + bytes[6] << 16 | + bytes[7] << 24, + unsigned + ); +}; + +/** + * Creates a Long from its big endian byte representation. + * @param {!Array.} bytes Big endian byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {Long} The corresponding Long value + */ +Long.fromBytesBE = function fromBytesBE(bytes, unsigned) { + return new Long( + bytes[4] << 24 | + bytes[5] << 16 | + bytes[6] << 8 | + bytes[7], + bytes[0] << 24 | + bytes[1] << 16 | + bytes[2] << 8 | + bytes[3], + unsigned + ); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/formats.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/formats.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8a3e1404b5cf8f17cae8a4322099a69d9bed0d43 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/formats.d.ts @@ -0,0 +1,9 @@ +import type { Format } from "ajv"; +export declare type FormatMode = "fast" | "full"; +export declare type FormatName = "date" | "time" | "date-time" | "duration" | "uri" | "uri-reference" | "uri-template" | "url" | "email" | "hostname" | "ipv4" | "ipv6" | "regex" | "uuid" | "json-pointer" | "json-pointer-uri-fragment" | "relative-json-pointer" | "byte" | "int32" | "int64" | "float" | "double" | "password" | "binary"; +export declare type DefinedFormats = { + [key in FormatName]: Format; +}; +export declare const fullFormats: DefinedFormats; +export declare const fastFormats: DefinedFormats; +export declare const formatNames: FormatName[]; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/formats.js b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/formats.js new file mode 100644 index 0000000000000000000000000000000000000000..e345121b9573a8eaff76c66d2e167e64f0b1c78d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/formats.js @@ -0,0 +1,173 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatNames = exports.fastFormats = exports.fullFormats = void 0; +function fmtDef(validate, compare) { + return { validate, compare }; +} +exports.fullFormats = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: fmtDef(date, compareDate), + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: fmtDef(time, compareTime), + "date-time": fmtDef(date_time, compareDateTime), + // duration: https://tools.ietf.org/html/rfc3339#appendix-A + duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/, + uri, + "uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, + // uri-template: https://tools.ietf.org/html/rfc6570 + "uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, + // For the source: https://gist.github.com/dperini/729294 + // For test cases: https://mathiasbynens.be/demo/url-regex + url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, + email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i, + regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/, + "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/, + // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types + // byte: https://github.com/miguelmota/is-base64 + byte, + // signed 32 bit integer + int32: { type: "number", validate: validateInt32 }, + // signed 64 bit integer + int64: { type: "number", validate: validateInt64 }, + // C-type float + float: { type: "number", validate: validateNumber }, + // C-type double + double: { type: "number", validate: validateNumber }, + // hint to the UI to hide input strings + password: true, + // unchecked string payload + binary: true, +}; +exports.fastFormats = { + ...exports.fullFormats, + date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate), + time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareTime), + "date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime), + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, + "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation') + email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, +}; +exports.formatNames = Object.keys(exports.fullFormats); +function isLeapYear(year) { + // https://tools.ietf.org/html/rfc3339#appendix-C + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +function date(str) { + // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 + const matches = DATE.exec(str); + if (!matches) + return false; + const year = +matches[1]; + const month = +matches[2]; + const day = +matches[3]; + return (month >= 1 && + month <= 12 && + day >= 1 && + day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month])); +} +function compareDate(d1, d2) { + if (!(d1 && d2)) + return undefined; + if (d1 > d2) + return 1; + if (d1 < d2) + return -1; + return 0; +} +const TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i; +function time(str, withTimeZone) { + const matches = TIME.exec(str); + if (!matches) + return false; + const hour = +matches[1]; + const minute = +matches[2]; + const second = +matches[3]; + const timeZone = matches[5]; + return (((hour <= 23 && minute <= 59 && second <= 59) || + (hour === 23 && minute === 59 && second === 60)) && + (!withTimeZone || timeZone !== "")); +} +function compareTime(t1, t2) { + if (!(t1 && t2)) + return undefined; + const a1 = TIME.exec(t1); + const a2 = TIME.exec(t2); + if (!(a1 && a2)) + return undefined; + t1 = a1[1] + a1[2] + a1[3] + (a1[4] || ""); + t2 = a2[1] + a2[2] + a2[3] + (a2[4] || ""); + if (t1 > t2) + return 1; + if (t1 < t2) + return -1; + return 0; +} +const DATE_TIME_SEPARATOR = /t|\s/i; +function date_time(str) { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dateTime = str.split(DATE_TIME_SEPARATOR); + return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1], true); +} +function compareDateTime(dt1, dt2) { + if (!(dt1 && dt2)) + return undefined; + const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR); + const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR); + const res = compareDate(d1, d2); + if (res === undefined) + return undefined; + return res || compareTime(t1, t2); +} +const NOT_URI_FRAGMENT = /\/|:/; +const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; +function uri(str) { + // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." + return NOT_URI_FRAGMENT.test(str) && URI.test(str); +} +const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm; +function byte(str) { + BYTE.lastIndex = 0; + return BYTE.test(str); +} +const MIN_INT32 = -(2 ** 31); +const MAX_INT32 = 2 ** 31 - 1; +function validateInt32(value) { + return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32; +} +function validateInt64(value) { + // JSON and javascript max Int is 2**53, so any int that passes isInteger is valid for Int64 + return Number.isInteger(value); +} +function validateNumber() { + return true; +} +const Z_ANCHOR = /[^\\]\\Z/; +function regex(str) { + if (Z_ANCHOR.test(str)) + return false; + try { + new RegExp(str); + return true; + } + catch (e) { + return false; + } +} +//# sourceMappingURL=formats.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/formats.js.map b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/formats.js.map new file mode 100644 index 0000000000000000000000000000000000000000..86e93a1bc23c3794a15ce4a12bc4a992f017cde9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/formats.js.map @@ -0,0 +1 @@ +{"version":3,"file":"formats.js","sourceRoot":"","sources":["../src/formats.ts"],"names":[],"mappings":";;;AAmCA,SAAS,MAAM,CACb,QAA0C,EAC1C,OAA8B;IAE9B,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAA;AAC5B,CAAC;AAEY,QAAA,WAAW,GAAmB;IACzC,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAC/B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC;IAC/C,2DAA2D;IAC3D,QAAQ,EAAE,wEAAwE;IAClF,GAAG;IACH,eAAe,EACb,woCAAwoC;IAC1oC,oDAAoD;IACpD,cAAc,EACZ,mLAAmL;IACrL,yDAAyD;IACzD,0DAA0D;IAC1D,GAAG,EAAE,odAAod;IACzd,KAAK,EACH,0IAA0I;IAC5I,QAAQ,EACN,uGAAuG;IACzG,mHAAmH;IACnH,IAAI,EAAE,2EAA2E;IACjF,IAAI,EAAE,k/BAAk/B;IACx/B,KAAK;IACL,2CAA2C;IAC3C,IAAI,EAAE,8DAA8D;IACpE,oDAAoD;IACpD,+DAA+D;IAC/D,cAAc,EAAE,2BAA2B;IAC3C,2BAA2B,EAAE,8DAA8D;IAC3F,wFAAwF;IACxF,uBAAuB,EAAE,kDAAkD;IAC3E,+GAA+G;IAC/G,gDAAgD;IAChD,IAAI;IACJ,wBAAwB;IACxB,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAC;IAChD,wBAAwB;IACxB,K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AC,KAAa;IAClC,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,SAAS,CAAA;AAC5E,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,4FAA4F;IAC5F,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,cAAc;IACrB,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,QAAQ,GAAG,UAAU,CAAA;AAC3B,SAAS,KAAK,CAAC,GAAW;IACxB,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA;IACpC,IAAI;QACF,IAAI,MAAM,CAAC,GAAG,CAAC,CAAA;QACf,OAAO,IAAI,CAAA;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAA;KACb;AACH,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..479d40522a2fd875a3fcd77a09921f1cabcacd67 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/index.d.ts @@ -0,0 +1,15 @@ +import { FormatMode, FormatName } from "./formats"; +import type { Plugin, Format } from "ajv"; +export { FormatMode, FormatName } from "./formats"; +export { LimitFormatError } from "./limit"; +export interface FormatOptions { + mode?: FormatMode; + formats?: FormatName[]; + keywords?: boolean; +} +export declare type FormatsPluginOptions = FormatName[] | FormatOptions; +export interface FormatsPlugin extends Plugin { + get: (format: FormatName, mode?: FormatMode) => Format; +} +declare const formatsPlugin: FormatsPlugin; +export default formatsPlugin; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5db64fec301c82bdaef7b95d6d7886654cf29c12 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/index.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const formats_1 = require("./formats"); +const limit_1 = require("./limit"); +const codegen_1 = require("ajv/dist/compile/codegen"); +const fullName = new codegen_1.Name("fullFormats"); +const fastName = new codegen_1.Name("fastFormats"); +const formatsPlugin = (ajv, opts = { keywords: true }) => { + if (Array.isArray(opts)) { + addFormats(ajv, opts, formats_1.fullFormats, fullName); + return ajv; + } + const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName]; + const list = opts.formats || formats_1.formatNames; + addFormats(ajv, list, formats, exportName); + if (opts.keywords) + limit_1.default(ajv); + return ajv; +}; +formatsPlugin.get = (name, mode = "full") => { + const formats = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats; + const f = formats[name]; + if (!f) + throw new Error(`Unknown format "${name}"`); + return f; +}; +function addFormats(ajv, list, fs, exportName) { + var _a; + var _b; + (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : (_b.formats = codegen_1._ `require("ajv-formats/dist/formats").${exportName}`); + for (const f of list) + ajv.addFormat(f, fs[f]); +} +module.exports = exports = formatsPlugin; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = formatsPlugin; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/index.js.map b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9a61c691b9dd69a5f590786f9e024739d4f17424 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,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AAE,IAAkB,EAAE,EAAkB,EAAE,UAAgB;;;IACpF,YAAA,GAAG,CAAC,IAAI,CAAC,IAAI,EAAC,OAAO,uCAAP,OAAO,GAAK,WAAC,CAAA,uCAAuC,UAAU,EAAE,EAAA;IAC9E,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/C,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,aAAa,CAAA;AACxC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/limit.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/limit.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7367da4262923778d000b7dfc6183fbb917c081 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/limit.d.ts @@ -0,0 +1,10 @@ +import type { Plugin, CodeKeywordDefinition, ErrorObject } from "ajv"; +declare type Kwd = "formatMaximum" | "formatMinimum" | "formatExclusiveMaximum" | "formatExclusiveMinimum"; +declare type Comparison = "<=" | ">=" | "<" | ">"; +export declare type LimitFormatError = ErrorObject; +export declare const formatLimitDefinition: CodeKeywordDefinition; +declare const formatLimitPlugin: Plugin; +export default formatLimitPlugin; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/limit.js b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/limit.js new file mode 100644 index 0000000000000000000000000000000000000000..7f6c7fdc8ccbb65e92410eea8fe1b482e44b753e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/limit.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatLimitDefinition = void 0; +const ajv_1 = require("ajv"); +const codegen_1 = require("ajv/dist/compile/codegen"); +const ops = codegen_1.operators; +const KWDs = { + formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, + formatMinimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, + formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, + formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }, +}; +const error = { + message: ({ keyword, schemaCode }) => codegen_1.str `should be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => codegen_1._ `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`, +}; +exports.formatLimitDefinition = { + keyword: Object.keys(KWDs), + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const { gen, data, schemaCode, keyword, it } = cxt; + const { opts, self } = it; + if (!opts.validateFormats) + return; + const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format"); + if (fCxt.$data) + validate$DataFormat(); + else + validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }); + const fmt = gen.const("fmt", codegen_1._ `${fmts}[${fCxt.schemaCode}]`); + cxt.fail$data(codegen_1.or(codegen_1._ `typeof ${fmt} != "object"`, codegen_1._ `${fmt} instanceof RegExp`, codegen_1._ `typeof ${fmt}.compare != "function"`, compareCode(fmt))); + } + function validateFormat() { + const format = fCxt.schema; + const fmtDef = self.formats[format]; + if (!fmtDef || fmtDef === true) + return; + if (typeof fmtDef != "object" || + fmtDef instanceof RegExp || + typeof fmtDef.compare != "function") { + throw new Error(`"${keyword}": format "${format}" does not define "compare" function`); + } + const fmt = gen.scopeValue("formats", { + key: format, + ref: fmtDef, + code: opts.code.formats ? codegen_1._ `${opts.code.formats}${codegen_1.getProperty(format)}` : undefined, + }); + cxt.fail$data(compareCode(fmt)); + } + function compareCode(fmt) { + return codegen_1._ `${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`; + } + }, + dependencies: ["format"], +}; +const formatLimitPlugin = (ajv) => { + ajv.addKeyword(exports.formatLimitDefinition); + return ajv; +}; +exports.default = formatLimitPlugin; +//# sourceMappingURL=limit.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/limit.js.map b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/limit.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ff9c19e051750a3091d91a656f1130dc7d5b32d6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/dist/limit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limit.js","sourceRoot":"","sources":["../src/limit.ts"],"names":[],"mappings":";;;AAWA,6BAA8B;AAC9B,sDAA2E;AAM3E,MAAM,GAAG,GAAG,mBAAS,CAAA;AAErB,MAAM,IAAI,GAA4D;IACpE,aAAa,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACvD,aAAa,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACvD,sBAAsB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;IAC/D,sBAAsB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;CAChE,CAAA;AAID,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,aAAG,CAAA,aAAa,IAAI,CAAC,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AED,kBAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/.runkit_example.js b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/.runkit_example.js new file mode 100644 index 0000000000000000000000000000000000000000..0d578d5d51e51a3e03b8a69f0eea05c3a3d8913a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/.runkit_example.js @@ -0,0 +1,23 @@ +const Ajv = require("ajv") +const ajv = new Ajv({allErrors: true}) + +const schema = { + type: "object", + properties: { + foo: {type: "string"}, + bar: {type: "number", maximum: 3}, + }, + required: ["foo", "bar"], + additionalProperties: false, +} + +const validate = ajv.compile(schema) + +test({foo: "abc", bar: 2}) +test({foo: 2, bar: 4}) + +function test(data) { + const valid = validate(data) + if (valid) console.log("Valid!") + else console.log("Invalid: " + ajv.errorsText(validate.errors)) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..139162ad2c389a18d3d66e159a2821b2e40087fc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015-2021 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d8ee276cefbea36c9816c7b8dc35b556eed262d3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/README.md @@ -0,0 +1,207 @@ +Ajv logo + +  + +# Ajv JSON schema validator + +The fastest JSON validator for Node.js and browser. + +Supports JSON Schema draft-04/06/07/2019-09/2020-12 ([draft-04 support](https://ajv.js.org/json-schema.html#draft-04) requires ajv-draft-04 package) and JSON Type Definition [RFC8927](https://datatracker.ietf.org/doc/rfc8927/). + +[![build](https://github.com/ajv-validator/ajv/actions/workflows/build.yml/badge.svg)](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild) +[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) +[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master) +[![SimpleX](https://img.shields.io/badge/chat-on%20SimpleX-70F0F9)](https://simplex.chat/contact#/?v=1-2&smp=smp%3A%2F%2Fu2dS9sG8nMNURyZwqASV4yROM28Er0luVTx5X1CsMrU%3D%40smp4.simplex.im%2F8KvvURM6J38Gdq9dCuPswMOkMny0xCOJ%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAr8rPVRuMOXv6kwF2yUAap-eoVg-9ssOFCi1fIrxTUw0%253D%26srv%3Do5vmywmrnaxalvz6wi3zicyftgio6psuvyniis6gco6bp6ekl4cqj4id.onion&data=%7B%22type%22%3A%22group%22%2C%22groupLinkId%22%3A%224pwLRgWHU9tlroMWHz0uOg%3D%3D%22%7D) +[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) +[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin) + +## Ajv sponsors + +[Mozilla](https://www.mozilla.org)[](https://opencollective.com/ajv) + +[Microsoft](https://opensource.microsoft.com)[](https://opencollective.com/ajv)[](https://opencollective.com/ajv) + +[Retool](https://retool.com/?utm_source=sponsor&utm_campaign=ajv)[Tidelift](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=enterprise)[SimpleX](https://github.com/simplex-chat/simplex-chat)[](https://opencollective.com/ajv) + +## Contributing + +More than 100 people contributed to Ajv, and we would love to have you join the development. We welcome implementing new features that will benefit many users and ideas to improve our documentation. + +Please review [Contributing guidelines](./CONTRIBUTING.md) and [Code components](https://ajv.js.org/components.html). + +## Documentation + +All documentation is available on the [Ajv website](https://ajv.js.org). + +Some useful site links: + +- [Getting started](https://ajv.js.org/guide/getting-started.html) +- [JSON Schema vs JSON Type Definition](https://ajv.js.org/guide/schema-language.html) +- [API reference](https://ajv.js.org/api.html) +- [Strict mode](https://ajv.js.org/strict-mode.html) +- [Standalone validation code](https://ajv.js.org/standalone.html) +- [Security considerations](https://ajv.js.org/security.html) +- [Command line interface](https://ajv.js.org/packages/ajv-cli.html) +- [Frequently Asked Questions](https://ajv.js.org/faq.html) + +## Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin) + +Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant! + +Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released. + +Please sponsor Ajv via: + +- [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it) +- [Ajv Open Collective](https://opencollective.com/ajv) + +Thank you. + +#### Open Collective sponsors + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Performance + +Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization. + +Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks: + +- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place +- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster +- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) +- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) + +Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark): + +[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=62,4,1&chs=600x416&chxl=-1:|ajv|@exodus/schemasafe|is-my-json-valid|djv|@cfworker/json-schema|jsonschema/=t:100,69.2,51.5,13.1,5.1,1.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance) + +## Features + +- Ajv implements JSON Schema [draft-06/07/2019-09/2020-12](http://json-schema.org/) standards (draft-04 is supported in v6): + - all validation keywords (see [JSON Schema validation keywords](https://ajv.js.org/json-schema.html)) + - [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) extensions: + - NEW: keyword [discriminator](https://ajv.js.org/json-schema.html#discriminator). + - keyword [nullable](https://ajv.js.org/json-schema.html#nullable). + - full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available) + - support of recursive references between schemas + - correct string lengths for strings with unicode pairs + - JSON Schema [formats](https://ajv.js.org/guide/formats.html) (with [ajv-formats](https://github.com/ajv-validator/ajv-formats) plugin). + - [validates schemas against meta-schema](https://ajv.js.org/api.html#api-validateschema) +- NEW: supports [JSON Type Definition](https://datatracker.ietf.org/doc/rfc8927/): + - all keywords (see [JSON Type Definition schema forms](https://ajv.js.org/json-type-definition.html)) + - meta-schema for JTD schemas + - "union" keyword and user-defined keywords (can be used inside "metadata" member of the schema) +- supports [browsers](https://ajv.js.org/guide/environments.html#browsers) and Node.js 10.x - current +- [asynchronous loading](https://ajv.js.org/guide/managing-schemas.html#asynchronous-schema-loading) of referenced schemas during compilation +- "All errors" validation mode with [option allErrors](https://ajv.js.org/options.html#allerrors) +- [error messages with parameters](https://ajv.js.org/api.html#validation-errors) describing error reasons to allow error message generation +- i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package +- [removing-additional-properties](https://ajv.js.org/guide/modifying-data.html#removing-additional-properties) +- [assigning defaults](https://ajv.js.org/guide/modifying-data.html#assigning-defaults) to missing properties and items +- [coercing data](https://ajv.js.org/guide/modifying-data.html#coercing-data-types) to the types specified in `type` keywords +- [user-defined keywords](https://ajv.js.org/guide/user-keywords.html) +- additional extension keywords with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package +- [\$data reference](https://ajv.js.org/guide/combining-schemas.html#data-reference) to use values from the validated data as values for the schema keywords +- [asynchronous validation](https://ajv.js.org/guide/async-validation.html) of user-defined formats and keywords + +## Install + +To install version 8: + +``` +npm install ajv +``` + +## Getting started + +Try it in the Node.js REPL: https://runkit.com/npm/ajv + +In JavaScript: + +```javascript +// or ESM/TypeScript import +import Ajv from "ajv" +// Node.js require: +const Ajv = require("ajv") + +const ajv = new Ajv() // options can be passed, e.g. {allErrors: true} + +const schema = { + type: "object", + properties: { + foo: {type: "integer"}, + bar: {type: "string"}, + }, + required: ["foo"], + additionalProperties: false, +} + +const data = { + foo: 1, + bar: "abc", +} + +const validate = ajv.compile(schema) +const valid = validate(data) +if (!valid) console.log(validate.errors) +``` + +Learn how to use Ajv and see more examples in the [Guide: getting started](https://ajv.js.org/guide/getting-started.html) + +## Changes history + +See [https://github.com/ajv-validator/ajv/releases](https://github.com/ajv-validator/ajv/releases) + +**Please note**: [Changes in version 8.0.0](https://github.com/ajv-validator/ajv/releases/tag/v8.0.0) + +[Version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0) + +[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). + +## Code of conduct + +Please review and follow the [Code of conduct](./CODE_OF_CONDUCT.md). + +Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team. + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues. + +## Open-source software support + +Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. + +## License + +[MIT](./LICENSE) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/package.json new file mode 100644 index 0000000000000000000000000000000000000000..17df7b147360abe613db76d26e15331360d9433b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/node_modules/ajv/package.json @@ -0,0 +1,126 @@ +{ + "name": "ajv", + "version": "8.17.1", + "description": "Another JSON Schema Validator", + "main": "dist/ajv.js", + "types": "dist/ajv.d.ts", + "files": [ + "lib/", + "dist/", + ".runkit_example.js" + ], + "scripts": { + "eslint": "eslint \"lib/**/*.ts\" \"spec/**/*.*s\" --ignore-pattern spec/JSON-Schema-Test-Suite", + "prettier:write": "prettier --write \"./**/*.{json,yaml,js,ts}\"", + "prettier:check": "prettier --list-different \"./**/*.{json,yaml,js,ts}\"", + "test-spec": "cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register \"spec/**/*.spec.{ts,js}\" -R dot", + "test-codegen": "nyc cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register 'spec/codegen.spec.ts' -R spec", + "test-debug": "npm run test-spec -- --inspect-brk", + "test-cov": "nyc npm run test-spec", + "rollup": "rm -rf bundle && rollup -c", + "bundle": "rm -rf bundle && node ./scripts/bundle.js ajv ajv7 ajv7 && node ./scripts/bundle.js 2019 ajv2019 ajv2019 && node ./scripts/bundle.js 2020 ajv2020 ajv2020 && node ./scripts/bundle.js jtd ajvJTD ajvJTD", + "build": "rm -rf dist && tsc && cp -r lib/refs dist && rm dist/refs/json-schema-2019-09/index.ts && rm dist/refs/json-schema-2020-12/index.ts && rm dist/refs/jtd-schema.ts", + "json-tests": "rm -rf spec/_json/*.js && node scripts/jsontests", + "test-karma": "karma start", + "test-browser": "rm -rf .browser && npm run bundle && scripts/prepare-tests && karma start", + "test-all": "npm run test-cov && if-node-version 12 npm run test-browser", + "test": "npm run json-tests && npm run prettier:check && npm run eslint && npm link && npm link --legacy-peer-deps ajv && npm run test-cov", + "test-ci": "AJV_FULL_TEST=true npm test", + "prepublish": "npm run build", + "benchmark": "npm i && npm run build && npm link && cd ./benchmark && npm link --legacy-peer-deps ajv && npm i && node ./jtd", + "docs:dev": "./scripts/prepare-site && vuepress dev docs", + "docs:build": "./scripts/prepare-site && vuepress build docs" + }, + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "repository": "ajv-validator/ajv", + "keywords": [ + "JSON", + "schema", + "validator", + "validation", + "jsonschema", + "json-schema", + "json-schema-validator", + "json-schema-validation" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": "https://github.com/ajv-validator/ajv/issues", + "homepage": "https://ajv.js.org", + "runkitExampleFilename": ".runkit_example.js", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "devDependencies": { + "@ajv-validator/config": "^0.5.0", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-typescript": "^11.1.6", + "@types/chai": "^4.3.11", + "@types/mocha": "^10.0.6", + "@types/node": "^20.11.30", + "@types/require-from-string": "^1.2.3", + "@typescript-eslint/eslint-plugin": "^7.3.1", + "@typescript-eslint/parser": "^7.3.1", + "ajv-formats": "^3.0.1", + "browserify": "^17.0.0", + "chai": "^4.4.1", + "cross-env": "^7.0.3", + "dayjs": "^1.11.10", + "dayjs-plugin-utc": "^0.1.2", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "glob": "^10.3.10", + "husky": "^9.0.11", + "if-node-version": "^1.1.1", + "jimp": "^0.22.10", + "js-beautify": "^1.15.1", + "json-schema-test": "^2.0.0", + "karma": "^6.4.2", + "karma-chrome-launcher": "^3.2.0", + "karma-mocha": "^2.0.1", + "lint-staged": "^15.2.2", + "mocha": "^10.3.0", + "module-from-string": "^3.3.0", + "node-fetch": "^3.3.2", + "nyc": "^15.1.0", + "prettier": "3.0.3", + "re2": "^1.20.9", + "rollup": "^2.79.1", + "rollup-plugin-terser": "^7.0.2", + "ts-node": "^10.9.2", + "tsify": "^5.0.4", + "typescript": "5.3.3", + "uri-js": "^4.4.1" + }, + "collective": { + "type": "opencollective", + "url": "https://opencollective.com/ajv" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + }, + "prettier": "@ajv-validator/config/prettierrc.json", + "husky": { + "hooks": { + "pre-commit": "lint-staged && npm test" + } + }, + "lint-staged": { + "*.{json,yaml,js,ts}": "prettier --write" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/src/formats.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/src/formats.ts new file mode 100644 index 0000000000000000000000000000000000000000..9e28226a03ee8b8d4427580a6bef9c210e88724d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/src/formats.ts @@ -0,0 +1,232 @@ +import type {Format, FormatDefinition} from "ajv" +import type {FormatValidator, FormatCompare} from "ajv/dist/types" + +export type FormatMode = "fast" | "full" + +export type FormatName = + | "date" + | "time" + | "date-time" + | "duration" + | "uri" + | "uri-reference" + | "uri-template" + | "url" + | "email" + | "hostname" + | "ipv4" + | "ipv6" + | "regex" + | "uuid" + | "json-pointer" + | "json-pointer-uri-fragment" + | "relative-json-pointer" + | "byte" + | "int32" + | "int64" + | "float" + | "double" + | "password" + | "binary" + +export type DefinedFormats = { + [key in FormatName]: Format +} + +function fmtDef( + validate: RegExp | FormatValidator, + compare: FormatCompare +): FormatDefinition { + return {validate, compare} +} + +export const fullFormats: DefinedFormats = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: fmtDef(date, compareDate), + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: fmtDef(time, compareTime), + "date-time": fmtDef(date_time, compareDateTime), + // duration: https://tools.ietf.org/html/rfc3339#appendix-A + duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/, + uri, + "uri-reference": + /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, + // uri-template: https://tools.ietf.org/html/rfc6570 + "uri-template": + /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, + // For the source: https://gist.github.com/dperini/729294 + // For test cases: https://mathiasbynens.be/demo/url-regex + url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, + email: + /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: + /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i, + regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/, + "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/, + // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types + // byte: https://github.com/miguelmota/is-base64 + byte, + // signed 32 bit integer + int32: {type: "number", validate: validateInt32}, + // signed 64 bit integer + int64: {type: "number", validate: validateInt64}, + // C-type float + float: {type: "number", validate: validateNumber}, + // C-type double + double: {type: "number", validate: validateNumber}, + // hint to the UI to hide input strings + password: true, + // unchecked string payload + binary: true, +} + +export const fastFormats: DefinedFormats = { + ...fullFormats, + date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate), + time: fmtDef( + /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, + compareTime + ), + "date-time": fmtDef( + /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, + compareDateTime + ), + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, + "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation') + email: + /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, +} + +export const formatNames = Object.keys(fullFormats) as FormatName[] + +function isLeapYear(year: number): boolean { + // https://tools.ietf.org/html/rfc3339#appendix-C + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) +} + +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/ +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + +function date(str: string): boolean { + // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 + const matches: string[] | null = DATE.exec(str) + if (!matches) return false + const year: number = +matches[1] + const month: number = +matches[2] + const day: number = +matches[3] + return ( + month >= 1 && + month <= 12 && + day >= 1 && + day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]) + ) +} + +function compareDate(d1: string, d2: string): number | undefined { + if (!(d1 && d2)) return undefined + if (d1 > d2) return 1 + if (d1 < d2) return -1 + return 0 +} + +const TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i + +function time(str: string, withTimeZone?: boolean): boolean { + const matches: string[] | null = TIME.exec(str) + if (!matches) return false + + const hour: number = +matches[1] + const minute: number = +matches[2] + const second: number = +matches[3] + const timeZone: string = matches[5] + return ( + ((hour <= 23 && minute <= 59 && second <= 59) || + (hour === 23 && minute === 59 && second === 60)) && + (!withTimeZone || timeZone !== "") + ) +} + +function compareTime(t1: string, t2: string): number | undefined { + if (!(t1 && t2)) return undefined + const a1 = TIME.exec(t1) + const a2 = TIME.exec(t2) + if (!(a1 && a2)) return undefined + t1 = a1[1] + a1[2] + a1[3] + (a1[4] || "") + t2 = a2[1] + a2[2] + a2[3] + (a2[4] || "") + if (t1 > t2) return 1 + if (t1 < t2) return -1 + return 0 +} + +const DATE_TIME_SEPARATOR = /t|\s/i +function date_time(str: string): boolean { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dateTime: string[] = str.split(DATE_TIME_SEPARATOR) + return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1], true) +} + +function compareDateTime(dt1: string, dt2: string): number | undefined { + if (!(dt1 && dt2)) return undefined + const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR) + const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR) + const res = compareDate(d1, d2) + if (res === undefined) return undefined + return res || compareTime(t1, t2) +} + +const NOT_URI_FRAGMENT = /\/|:/ +const URI = + /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+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/i + +function uri(str: string): boolean { + // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." + return NOT_URI_FRAGMENT.test(str) && URI.test(str) +} + +const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm + +function byte(str: string): boolean { + BYTE.lastIndex = 0 + return BYTE.test(str) +} + +const MIN_INT32 = -(2 ** 31) +const MAX_INT32 = 2 ** 31 - 1 + +function validateInt32(value: number): boolean { + return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32 +} + +function validateInt64(value: number): boolean { + // JSON and javascript max Int is 2**53, so any int that passes isInteger is valid for Int64 + return Number.isInteger(value) +} + +function validateNumber(): boolean { + return true +} + +const Z_ANCHOR = /[^\\]\\Z/ +function regex(str: string): boolean { + if (Z_ANCHOR.test(str)) return false + try { + new RegExp(str) + return true + } catch (e) { + return false + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/src/index.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..8fd944a09021a795e86c3285c838f65ca0a957d9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/src/index.ts @@ -0,0 +1,62 @@ +import { + DefinedFormats, + FormatMode, + FormatName, + formatNames, + fastFormats, + fullFormats, +} from "./formats" +import formatLimit from "./limit" +import type Ajv from "ajv" +import type {Plugin, Format} from "ajv" +import {_, Name} from "ajv/dist/compile/codegen" + +export {FormatMode, FormatName} from "./formats" +export {LimitFormatError} from "./limit" +export interface FormatOptions { + mode?: FormatMode + formats?: FormatName[] + keywords?: boolean +} + +export type FormatsPluginOptions = FormatName[] | FormatOptions + +export interface FormatsPlugin extends Plugin { + get: (format: FormatName, mode?: FormatMode) => Format +} + +const fullName = new Name("fullFormats") +const fastName = new Name("fastFormats") + +const formatsPlugin: FormatsPlugin = ( + ajv: Ajv, + opts: FormatsPluginOptions = {keywords: true} +): Ajv => { + if (Array.isArray(opts)) { + addFormats(ajv, opts, fullFormats, fullName) + return ajv + } + const [formats, exportName] = + opts.mode === "fast" ? [fastFormats, fastName] : [fullFormats, fullName] + const list = opts.formats || formatNames + addFormats(ajv, list, formats, exportName) + if (opts.keywords) formatLimit(ajv) + return ajv +} + +formatsPlugin.get = (name: FormatName, mode: FormatMode = "full"): Format => { + const formats = mode === "fast" ? fastFormats : fullFormats + const f = formats[name] + if (!f) throw new Error(`Unknown format "${name}"`) + return f +} + +function addFormats(ajv: Ajv, list: FormatName[], fs: DefinedFormats, exportName: Name): void { + ajv.opts.code.formats ??= _`require("ajv-formats/dist/formats").${exportName}` + for (const f of list) ajv.addFormat(f, fs[f]) +} + +module.exports = exports = formatsPlugin +Object.defineProperty(exports, "__esModule", {value: true}) + +export default formatsPlugin diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/src/limit.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/src/limit.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf6a57cb9d728658e8461b9e02b5d59fcaff74b1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/ajv-formats/src/limit.ts @@ -0,0 +1,99 @@ +import type Ajv from "ajv" +import type { + Plugin, + CodeKeywordDefinition, + KeywordErrorDefinition, + Code, + Name, + ErrorObject, +} from "ajv" +import type {AddedFormat} from "ajv/dist/types" +import type {Rule} from "ajv/dist/compile/rules" +import {KeywordCxt} from "ajv" +import {_, str, or, getProperty, operators} from "ajv/dist/compile/codegen" + +type Kwd = "formatMaximum" | "formatMinimum" | "formatExclusiveMaximum" | "formatExclusiveMinimum" + +type Comparison = "<=" | ">=" | "<" | ">" + +const ops = operators + +const KWDs: {[K in Kwd]: {okStr: Comparison; ok: Code; fail: Code}} = { + formatMaximum: {okStr: "<=", ok: ops.LTE, fail: ops.GT}, + formatMinimum: {okStr: ">=", ok: ops.GTE, fail: ops.LT}, + formatExclusiveMaximum: {okStr: "<", ok: ops.LT, fail: ops.GTE}, + formatExclusiveMinimum: {okStr: ">", ok: ops.GT, fail: ops.LTE}, +} + +export type LimitFormatError = ErrorObject + +const error: KeywordErrorDefinition = { + message: ({keyword, schemaCode}) => str`should be ${KWDs[keyword as Kwd].okStr} ${schemaCode}`, + params: ({keyword, schemaCode}) => + _`{comparison: ${KWDs[keyword as Kwd].okStr}, limit: ${schemaCode}}`, +} + +export const formatLimitDefinition: CodeKeywordDefinition = { + keyword: Object.keys(KWDs), + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const {gen, data, schemaCode, keyword, it} = cxt + const {opts, self} = it + if (!opts.validateFormats) return + + const fCxt = new KeywordCxt(it, (self.RULES.all.format as Rule).definition, "format") + if (fCxt.$data) validate$DataFormat() + else validateFormat() + + function validate$DataFormat(): void { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }) + const fmt = gen.const("fmt", _`${fmts}[${fCxt.schemaCode}]`) + cxt.fail$data( + or( + _`typeof ${fmt} != "object"`, + _`${fmt} instanceof RegExp`, + _`typeof ${fmt}.compare != "function"`, + compareCode(fmt) + ) + ) + } + + function validateFormat(): void { + const format = fCxt.schema as string + const fmtDef: AddedFormat | undefined = self.formats[format] + if (!fmtDef || fmtDef === true) return + if ( + typeof fmtDef != "object" || + fmtDef instanceof RegExp || + typeof fmtDef.compare != "function" + ) { + throw new Error(`"${keyword}": format "${format}" does not define "compare" function`) + } + const fmt = gen.scopeValue("formats", { + key: format, + ref: fmtDef, + code: opts.code.formats ? _`${opts.code.formats}${getProperty(format)}` : undefined, + }) + + cxt.fail$data(compareCode(fmt)) + } + + function compareCode(fmt: Name): Code { + return _`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword as Kwd].fail} 0` + } + }, + dependencies: ["format"], +} + +const formatLimitPlugin: Plugin = (ajv: Ajv): Ajv => { + ajv.addKeyword(formatLimitDefinition) + return ajv +} + +export default formatLimitPlugin diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/.bin/resolve b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/.bin/resolve new file mode 100644 index 0000000000000000000000000000000000000000..b7064585ef01f96f92f752c6c304399d1a67dad7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/.bin/resolve @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38bfe8e320fb462083ff58d54aee6fc4cc2db9baef9ce9f88830652d55863e8b +size 1535 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/CHANGELOG.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..820d21e3322b9d2778786ea743dd5e818991d595 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..658c933d28255e8c716899789e8c0f846e5dc125 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0ee7634ddd0a4a6337fe7677e99ba78cd626fa07 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/README.md @@ -0,0 +1,437 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/node.js new file mode 100644 index 0000000000000000000000000000000000000000..7fc36fe6dbecbfd41530c5a490cc738ec2968653 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/package.json new file mode 100644 index 0000000000000000000000000000000000000000..191c8154787cb9f8662967d4c4f8f9f3467a2bbf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/package.json @@ -0,0 +1,51 @@ +{ + "name": "debug", + "version": "3.2.7", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "node.js", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "author": "TJ Holowaychuk ", + "contributors": [ + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + }, + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "unpkg": "./dist/debug.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/browser.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/browser.js new file mode 100644 index 0000000000000000000000000000000000000000..c924b0ac4d4882e4a72a116436ed17a487c2fc05 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/browser.js @@ -0,0 +1,180 @@ +"use strict"; + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +/** + * Colors. + */ + +exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ +// eslint-disable-next-line complexity + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); +} +/** + * Colorize log arguments if enabled. + * + * @api public + */ + + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); +} +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + +function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); +} +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } +} +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + +function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); +var formatters = module.exports.formatters; +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/common.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/common.js new file mode 100644 index 0000000000000000000000000000000000000000..e0de3fb530f1c2ea33c4c65bcfd39b98a53600d7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/common.js @@ -0,0 +1,249 @@ +"use strict"; + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + // Disabled? + if (!debug.enabled) { + return; + } + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @api public + */ + + + function disable() { + createDebug.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; +} + +module.exports = setup; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..021731593ac517b224bddda8c450bac52889843a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/index.js @@ -0,0 +1,12 @@ +"use strict"; + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/node.js new file mode 100644 index 0000000000000000000000000000000000000000..1e6a5f16aecdd38a2bfb607f3d82e299f7624f9a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/debug/src/node.js @@ -0,0 +1,177 @@ +"use strict"; + +/** + * Module dependencies. + */ +var tty = require('tty'); + +var util = require('util'); +/** + * This is the Node.js implementation of `debug()`. + */ + + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + var supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221]; + } +} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be. + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // Camel-case + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) { + return k.toUpperCase(); + }); // Coerce string value into JS value + + var val = process.env[key]; + + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); +} +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + + +function formatArgs(args) { + var name = this.namespace, + useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c); + var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m"); + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m"); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + + return new Date().toISOString() + ' '; +} +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + + +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + +function load() { + return process.env.DEBUG; +} +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + + +function init(debug) { + debug.inspectOpts = {}; + var keys = Object.keys(exports.inspectOpts); + + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); +var formatters = module.exports.formatters; +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(function (str) { return str.trim(); }) + .join(' '); +}; +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/.editorconfig b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..d63f0bb6cdfb9bff414b1493862deef1c385a5ec --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/.editorconfig @@ -0,0 +1,37 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 200 + +[*.js] +block_comment_start = /* +block_comment = * +block_comment_end = */ + +[*.yml] +indent_size = 1 + +[package.json] +indent_style = tab + +[lib/core.json] +indent_style = tab + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[{*.json,Makefile}] +max_line_length = off + +[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*] +indent_style = off +indent_size = off +max_line_length = off +insert_final_newline = off diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/.eslintrc b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/.eslintrc new file mode 100644 index 0000000000000000000000000000000000000000..ad05dd8c2ec56fb83470bb3b27b31c1fe8ba0aba --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/.eslintrc @@ -0,0 +1,65 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "indent": [2, 4], + "strict": 0, + "complexity": 0, + "consistent-return": 0, + "curly": 0, + "dot-notation": [2, { "allowKeywords": true }], + "func-name-matching": 0, + "func-style": 0, + "global-require": 1, + "id-length": [2, { "min": 1, "max": 40 }], + "max-lines": [2, 350], + "max-lines-per-function": 0, + "max-nested-callbacks": 0, + "max-params": 0, + "max-statements-per-line": [2, { "max": 2 }], + "max-statements": 0, + "no-magic-numbers": 0, + "no-shadow": 0, + "no-use-before-define": 0, + "sort-keys": 0, + }, + "overrides": [ + { + "files": "bin/**", + "rules": { + "no-process-exit": "off", + }, + }, + { + "files": "example/**", + "rules": { + "no-console": 0, + }, + }, + { + "files": "test/resolver/nested_symlinks/mylib/*.js", + "rules": { + "no-throw-literal": 0, + }, + }, + { + "files": "test/**", + "parserOptions": { + "ecmaVersion": 5, + "allowReserved": false, + }, + "rules": { + "dot-notation": [2, { "allowPattern": "throws" }], + "max-lines": 0, + "max-lines-per-function": 0, + "no-unused-vars": [2, { "vars": "all", "args": "none" }], + }, + }, + ], + + "ignorePatterns": [ + "./test/resolver/malformed_package_json/package.json", + ], +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/.github/FUNDING.yml b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..d9c05955459660bd6b6a972499502b8d09958220 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/resolve +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ff4fce28af33a4504d6960856a0bd603860a62e0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/SECURITY.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/SECURITY.md new file mode 100644 index 0000000000000000000000000000000000000000..82e4285adc6285693cd6c06af02d606e09dd8fcd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/async.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/async.js new file mode 100644 index 0000000000000000000000000000000000000000..f38c5813ebd04ab8bf6988cc0186b9f95433f7e2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/async.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/async'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/bin/resolve b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/bin/resolve new file mode 100644 index 0000000000000000000000000000000000000000..21d1a87eec1fe1557a535fc0cdfd877908cb5c71 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/bin/resolve @@ -0,0 +1,50 @@ +#!/usr/bin/env node + +'use strict'; + +var path = require('path'); +var fs = require('fs'); + +if ( + String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve ' + && ( + !process.argv + || process.argv.length < 2 + || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino) + || (process.env.npm_lifecycle_event !== 'npx' && process.env._ && fs.realpathSync(path.resolve(process.env._)) !== __filename) + ) +) { + console.error('Error: `resolve` must be run directly as an executable'); + process.exit(1); +} + +var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag'); + +var preserveSymlinks = false; +for (var i = 2; i < process.argv.length; i += 1) { + if (process.argv[i].slice(0, 2) === '--') { + if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') { + preserveSymlinks = true; + } else if (process.argv[i].length > 2) { + console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, '')); + process.exit(2); + } + process.argv.splice(i, 1); + i -= 1; + if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax + } +} + +if (process.argv.length < 3) { + console.error('Error: `resolve` expects a specifier'); + process.exit(2); +} + +var resolve = require('../'); + +var result = resolve.sync(process.argv[2], { + basedir: process.cwd(), + preserveSymlinks: preserveSymlinks +}); + +console.log(result); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/example/async.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/example/async.js new file mode 100644 index 0000000000000000000000000000000000000000..20e65dc281dbaa3947a1c5d1b1a0bc94167c2073 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/example/async.js @@ -0,0 +1,5 @@ +var resolve = require('../'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/example/sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/example/sync.js new file mode 100644 index 0000000000000000000000000000000000000000..54b2cc1004223d114e38bbd46fe9a0f5b73ca7e2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/example/sync.js @@ -0,0 +1,3 @@ +var resolve = require('../'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/index.js new file mode 100644 index 0000000000000000000000000000000000000000..125d8146423596fa289ec4edf8e3c78ef92eb7c7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/index.js @@ -0,0 +1,6 @@ +var async = require('./lib/async'); +async.core = require('./lib/core'); +async.isCore = require('./lib/is-core'); +async.sync = require('./lib/sync'); + +module.exports = async; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/async.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/async.js new file mode 100644 index 0000000000000000000000000000000000000000..60d2555fc3bd01a9461393cc52d3c746b137312f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/async.js @@ -0,0 +1,329 @@ +var fs = require('fs'); +var getHomedir = require('./homedir'); +var path = require('path'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); +var isCore = require('is-core-module'); + +var realpathFS = process.platform !== 'win32' && fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultIsDir = function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultRealpath = function realpath(x, cb) { + realpathFS(x, function (realpathErr, realPath) { + if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); + else cb(null, realpathErr ? x : realPath); + }); +}; + +var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { + if (opts && opts.preserveSymlinks === false) { + realpath(x, cb); + } else { + cb(null, x); + } +}; + +var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolve(x, options, callback) { + var cb = callback; + var opts = options; + if (typeof options === 'function') { + cb = opts; + opts = {}; + } + if (typeof x !== 'string') { + var err = new TypeError('Path must be a string.'); + return process.nextTick(function () { + cb(err); + }); + } + + opts = normalizeOptions(x, opts); + + var isFile = opts.isFile || defaultIsFile; + var isDirectory = opts.isDirectory || defaultIsDir; + var readFile = opts.readFile || fs.readFile; + var realpath = opts.realpath || defaultRealpath; + var readPackage = opts.readPackage || defaultReadPackage; + if (opts.readFile && opts.readPackage) { + var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.'); + return process.nextTick(function () { + cb(conflictErr); + }); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = path.resolve(basedir); + + maybeRealpath( + realpath, + absoluteStart, + opts, + function (err, realStart) { + if (err) cb(err); + else init(realStart); + } + ); + + var res; + function init(basedir) { + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + res = path.resolve(basedir, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + if ((/\/$/).test(x) && res === basedir) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else if (includeCoreModules && isCore(x)) { + return cb(null, x); + } else loadNodeModules(x, basedir, function (err, n, pkg) { + if (err) cb(err); + else if (n) { + return maybeRealpath(realpath, n, opts, function (err, realN) { + if (err) { + cb(err); + } else { + cb(null, realN, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function onfile(err, m, pkg) { + if (err) cb(err); + else if (m) cb(null, m, pkg); + else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err); + else if (d) { + maybeRealpath(realpath, d, opts, function (err, realD) { + if (err) { + cb(err); + } else { + cb(null, realD, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function loadAsFile(x, thePackage, callback) { + var loadAsFilePackage = thePackage; + var cb = callback; + if (typeof loadAsFilePackage === 'function') { + cb = loadAsFilePackage; + loadAsFilePackage = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, loadAsFilePackage); + + function load(exts, x, loadPackage) { + if (exts.length === 0) return cb(null, undefined, loadPackage); + var file = x + exts[0]; + + var pkg = loadPackage; + if (pkg) onpkg(null, pkg); + else loadpkg(path.dirname(file), onpkg); + + function onpkg(err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err); + if (dir && pkg && opts.pathFilter) { + var rfile = path.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load( + [''].concat(extensions.slice()), + path.resolve(dir, r), + pkg + ); + } + isFile(file, onex); + } + function onex(err, ex) { + if (err) return cb(err); + if (ex) return cb(null, file, pkg); + load(exts.slice(1), x, pkg); + } + } + } + + function loadpkg(dir, cb) { + if (dir === '' || dir === '/') return cb(null); + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return cb(null); + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); + + maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadpkg(path.dirname(dir), cb); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path.dirname(dir), cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + cb(null, pkg, dir); + }); + }); + }); + } + + function loadAsDirectory(x, loadAsDirectoryPackage, callback) { + var cb = callback; + var fpkg = loadAsDirectoryPackage; + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return cb(unwrapErr); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) return cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, 'index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + }); + } + + function processDirs(cb, dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + + isDirectory(path.dirname(dir), isdir); + + function isdir(err, isdir) { + if (err) return cb(err); + if (!isdir) return processDirs(cb, dirs.slice(1)); + loadAsFile(dir, opts.package, onfile); + } + + function onfile(err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(dir, opts.package, ondir); + } + + function ondir(err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + processDirs(cb, dirs.slice(1)); + } + } + function loadNodeModules(x, start, cb) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + processDirs( + cb, + packageIterator ? packageIterator(x, start, thunk, opts) : thunk() + ); + } +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/caller.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/caller.js new file mode 100644 index 0000000000000000000000000000000000000000..b14a2804ae828a4c39c9f949611236cd6ef7a45d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/caller.js @@ -0,0 +1,8 @@ +module.exports = function () { + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var origPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = function (_, stack) { return stack; }; + var stack = (new Error()).stack; + Error.prepareStackTrace = origPrepareStackTrace; + return stack[2].getFileName(); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/core.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/core.js new file mode 100644 index 0000000000000000000000000000000000000000..57b048f1386ff93b941e8d375d878041535f1964 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/core.js @@ -0,0 +1,12 @@ +'use strict'; + +var isCoreModule = require('is-core-module'); +var data = require('./core.json'); + +var core = {}; +for (var mod in data) { // eslint-disable-line no-restricted-syntax + if (Object.prototype.hasOwnProperty.call(data, mod)) { + core[mod] = isCoreModule(mod); + } +} +module.exports = core; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/core.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/core.json new file mode 100644 index 0000000000000000000000000000000000000000..928d34595fda776e22a7d35045f764314b5a8e0e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/core.json @@ -0,0 +1,162 @@ +{ + "assert": true, + "node:assert": [">= 14.18 && < 15", ">= 16"], + "assert/strict": ">= 15", + "node:assert/strict": ">= 16", + "async_hooks": ">= 8", + "node:async_hooks": [">= 14.18 && < 15", ">= 16"], + "buffer_ieee754": ">= 0.5 && < 0.9.7", + "buffer": true, + "node:buffer": [">= 14.18 && < 15", ">= 16"], + "child_process": true, + "node:child_process": [">= 14.18 && < 15", ">= 16"], + "cluster": ">= 0.5", + "node:cluster": [">= 14.18 && < 15", ">= 16"], + "console": true, + "node:console": [">= 14.18 && < 15", ">= 16"], + "constants": true, + "node:constants": [">= 14.18 && < 15", ">= 16"], + "crypto": true, + "node:crypto": [">= 14.18 && < 15", ">= 16"], + "_debug_agent": ">= 1 && < 8", + "_debugger": "< 8", + "dgram": true, + "node:dgram": [">= 14.18 && < 15", ">= 16"], + "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], + "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"], + "dns": true, + "node:dns": [">= 14.18 && < 15", ">= 16"], + "dns/promises": ">= 15", + "node:dns/promises": ">= 16", + "domain": ">= 0.7.12", + "node:domain": [">= 14.18 && < 15", ">= 16"], + "events": true, + "node:events": [">= 14.18 && < 15", ">= 16"], + "freelist": "< 6", + "fs": true, + "node:fs": [">= 14.18 && < 15", ">= 16"], + "fs/promises": [">= 10 && < 10.1", ">= 14"], + "node:fs/promises": [">= 14.18 && < 15", ">= 16"], + "_http_agent": ">= 0.11.1", + "node:_http_agent": [">= 14.18 && < 15", ">= 16"], + "_http_client": ">= 0.11.1", + "node:_http_client": [">= 14.18 && < 15", ">= 16"], + "_http_common": ">= 0.11.1", + "node:_http_common": [">= 14.18 && < 15", ">= 16"], + "_http_incoming": ">= 0.11.1", + "node:_http_incoming": [">= 14.18 && < 15", ">= 16"], + "_http_outgoing": ">= 0.11.1", + "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"], + "_http_server": ">= 0.11.1", + "node:_http_server": [">= 14.18 && < 15", ">= 16"], + "http": true, + "node:http": [">= 14.18 && < 15", ">= 16"], + "http2": ">= 8.8", + "node:http2": [">= 14.18 && < 15", ">= 16"], + "https": true, + "node:https": [">= 14.18 && < 15", ">= 16"], + "inspector": ">= 8", + "node:inspector": [">= 14.18 && < 15", ">= 16"], + "inspector/promises": [">= 19"], + "node:inspector/promises": [">= 19"], + "_linklist": "< 8", + "module": true, + "node:module": [">= 14.18 && < 15", ">= 16"], + "net": true, + "node:net": [">= 14.18 && < 15", ">= 16"], + "node-inspect/lib/_inspect": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", + "os": true, + "node:os": [">= 14.18 && < 15", ">= 16"], + "path": true, + "node:path": [">= 14.18 && < 15", ">= 16"], + "path/posix": ">= 15.3", + "node:path/posix": ">= 16", + "path/win32": ">= 15.3", + "node:path/win32": ">= 16", + "perf_hooks": ">= 8.5", + "node:perf_hooks": [">= 14.18 && < 15", ">= 16"], + "process": ">= 1", + "node:process": [">= 14.18 && < 15", ">= 16"], + "punycode": ">= 0.5", + "node:punycode": [">= 14.18 && < 15", ">= 16"], + "querystring": true, + "node:querystring": [">= 14.18 && < 15", ">= 16"], + "readline": true, + "node:readline": [">= 14.18 && < 15", ">= 16"], + "readline/promises": ">= 17", + "node:readline/promises": ">= 17", + "repl": true, + "node:repl": [">= 14.18 && < 15", ">= 16"], + "node:sea": [">= 20.12 && < 21", ">= 21.7"], + "smalloc": ">= 0.11.5 && < 3", + "node:sqlite": ">= 23.4", + "_stream_duplex": ">= 0.9.4", + "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"], + "_stream_transform": ">= 0.9.4", + "node:_stream_transform": [">= 14.18 && < 15", ">= 16"], + "_stream_wrap": ">= 1.4.1", + "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"], + "_stream_passthrough": ">= 0.9.4", + "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"], + "_stream_readable": ">= 0.9.4", + "node:_stream_readable": [">= 14.18 && < 15", ">= 16"], + "_stream_writable": ">= 0.9.4", + "node:_stream_writable": [">= 14.18 && < 15", ">= 16"], + "stream": true, + "node:stream": [">= 14.18 && < 15", ">= 16"], + "stream/consumers": ">= 16.7", + "node:stream/consumers": ">= 16.7", + "stream/promises": ">= 15", + "node:stream/promises": ">= 16", + "stream/web": ">= 16.5", + "node:stream/web": ">= 16.5", + "string_decoder": true, + "node:string_decoder": [">= 14.18 && < 15", ">= 16"], + "sys": [">= 0.4 && < 0.7", ">= 0.8"], + "node:sys": [">= 14.18 && < 15", ">= 16"], + "test/reporters": ">= 19.9 && < 20.2", + "node:test/reporters": [">= 18.17 && < 19", ">= 19.9", ">= 20"], + "test/mock_loader": ">= 22.3 && < 22.7", + "node:test/mock_loader": ">= 22.3 && < 22.7", + "node:test": [">= 16.17 && < 17", ">= 18"], + "timers": true, + "node:timers": [">= 14.18 && < 15", ">= 16"], + "timers/promises": ">= 15", + "node:timers/promises": ">= 16", + "_tls_common": ">= 0.11.13", + "node:_tls_common": [">= 14.18 && < 15", ">= 16"], + "_tls_legacy": ">= 0.11.3 && < 10", + "_tls_wrap": ">= 0.11.3", + "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"], + "tls": true, + "node:tls": [">= 14.18 && < 15", ">= 16"], + "trace_events": ">= 10", + "node:trace_events": [">= 14.18 && < 15", ">= 16"], + "tty": true, + "node:tty": [">= 14.18 && < 15", ">= 16"], + "url": true, + "node:url": [">= 14.18 && < 15", ">= 16"], + "util": true, + "node:util": [">= 14.18 && < 15", ">= 16"], + "util/types": ">= 15.3", + "node:util/types": ">= 16", + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8": ">= 1", + "node:v8": [">= 14.18 && < 15", ">= 16"], + "vm": true, + "node:vm": [">= 14.18 && < 15", ">= 16"], + "wasi": [">= 13.4 && < 13.5", ">= 18.17 && < 19", ">= 20"], + "node:wasi": [">= 18.17 && < 19", ">= 20"], + "worker_threads": ">= 11.7", + "node:worker_threads": [">= 14.18 && < 15", ">= 16"], + "zlib": ">= 0.5", + "node:zlib": [">= 14.18 && < 15", ">= 16"] +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/homedir.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/homedir.js new file mode 100644 index 0000000000000000000000000000000000000000..5ffdf73bb336aea8649f285547a6f08f779a7be1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/homedir.js @@ -0,0 +1,24 @@ +'use strict'; + +var os = require('os'); + +// adapted from https://github.com/sindresorhus/os-homedir/blob/11e089f4754db38bb535e5a8416320c4446e8cfd/index.js + +module.exports = os.homedir || function homedir() { + var home = process.env.HOME; + var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME; + + if (process.platform === 'win32') { + return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null; + } + + if (process.platform === 'darwin') { + return home || (user ? '/Users/' + user : null); + } + + if (process.platform === 'linux') { + return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); // eslint-disable-line no-extra-parens + } + + return home || null; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/is-core.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/is-core.js new file mode 100644 index 0000000000000000000000000000000000000000..537f5c782ffe55c97e43920e8405856a9e828ada --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/is-core.js @@ -0,0 +1,5 @@ +var isCoreModule = require('is-core-module'); + +module.exports = function isCore(x) { + return isCoreModule(x); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/node-modules-paths.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/node-modules-paths.js new file mode 100644 index 0000000000000000000000000000000000000000..1cff0107b5862c3cf080030ac3eeb8244e7328b5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/node-modules-paths.js @@ -0,0 +1,42 @@ +var path = require('path'); +var parse = path.parse || require('path-parse'); // eslint-disable-line global-require + +var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { + var prefix = '/'; + if ((/^([A-Za-z]:)/).test(absoluteStart)) { + prefix = ''; + } else if ((/^\\\\/).test(absoluteStart)) { + prefix = '\\\\'; + } + + var paths = [absoluteStart]; + var parsed = parse(absoluteStart); + while (parsed.dir !== paths[paths.length - 1]) { + paths.push(parsed.dir); + parsed = parse(parsed.dir); + } + + return paths.reduce(function (dirs, aPath) { + return dirs.concat(modules.map(function (moduleDir) { + return path.resolve(prefix, aPath, moduleDir); + })); + }, []); +}; + +module.exports = function nodeModulesPaths(start, opts, request) { + var modules = opts && opts.moduleDirectory + ? [].concat(opts.moduleDirectory) + : ['node_modules']; + + if (opts && typeof opts.paths === 'function') { + return opts.paths( + request, + start, + function () { return getNodeModulesDirs(start, modules); }, + opts + ); + } + + var dirs = getNodeModulesDirs(start, modules); + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/normalize-options.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/normalize-options.js new file mode 100644 index 0000000000000000000000000000000000000000..4b56904eaea72ba024f96728fff40e1be4af7df0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/normalize-options.js @@ -0,0 +1,10 @@ +module.exports = function (x, opts) { + /** + * This file is purposefully a passthrough. It's expected that third-party + * environments will override it at runtime in order to inject special logic + * into `resolve` (by manipulating the options). One such example is the PnP + * code path in Yarn. + */ + + return opts || {}; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/sync.js new file mode 100644 index 0000000000000000000000000000000000000000..0b6cd58d44b1c2be6e662f481ba3bc75f2a9780d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/lib/sync.js @@ -0,0 +1,208 @@ +var isCore = require('is-core-module'); +var fs = require('fs'); +var path = require('path'); +var getHomedir = require('./homedir'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); + +var realpathFS = process.platform !== 'win32' && fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file) { + try { + var stat = fs.statSync(file, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && (stat.isFile() || stat.isFIFO()); +}; + +var defaultIsDir = function isDirectory(dir) { + try { + var stat = fs.statSync(dir, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && stat.isDirectory(); +}; + +var defaultRealpathSync = function realpathSync(x) { + try { + return realpathFS(x); + } catch (realpathErr) { + if (realpathErr.code !== 'ENOENT') { + throw realpathErr; + } + } + return x; +}; + +var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { + if (opts && opts.preserveSymlinks === false) { + return realpathSync(x); + } + return x; +}; + +var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolveSync(x, options) { + if (typeof x !== 'string') { + throw new TypeError('Path must be a string.'); + } + var opts = normalizeOptions(x, options); + + var isFile = opts.isFile || defaultIsFile; + var readFileSync = opts.readFileSync || fs.readFileSync; + var isDirectory = opts.isDirectory || defaultIsDir; + var realpathSync = opts.realpathSync || defaultRealpathSync; + var readPackageSync = opts.readPackageSync || defaultReadPackageSync; + if (opts.readFileSync && opts.readPackageSync) { + throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.'); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); + + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + var res = path.resolve(absoluteStart, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return maybeRealpathSync(realpathSync, m, opts); + } else if (includeCoreModules && isCore(x)) { + return x; + } else { + var n = loadNodeModulesSync(x, absoluteStart); + if (n) return maybeRealpathSync(realpathSync, n, opts); + } + + var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + + function loadAsFileSync(x) { + var pkg = loadpkg(path.dirname(x)); + + if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { + var rfile = path.relative(pkg.dir, x); + var r = opts.pathFilter(pkg.pkg, x, rfile); + if (r) { + x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign + } + } + + if (isFile(x)) { + return x; + } + + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + if (isFile(file)) { + return file; + } + } + } + + function loadpkg(dir) { + if (dir === '' || dir === '/') return; + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return; + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; + + var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); + + if (!isFile(pkgfile)) { + return loadpkg(path.dirname(dir)); + } + + var pkg = readPackageSync(readFileSync, pkgfile); + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment + } + + return { pkg: pkg, dir: dir }; + } + + function loadAsDirectorySync(x) { + var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); + if (isFile(pkgfile)) { + try { + var pkg = readPackageSync(readFileSync, pkgfile); + } catch (e) {} + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + throw mainError; + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + try { + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); + if (n) return n; + } catch (e) {} + } + } + + return loadAsFileSync(path.join(x, '/index')); + } + + function loadNodeModulesSync(x, start) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); + + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + if (isDirectory(path.dirname(dir))) { + var m = loadAsFileSync(dir); + if (m) return m; + var n = loadAsDirectorySync(dir); + if (n) return n; + } + } + } +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/package.json new file mode 100644 index 0000000000000000000000000000000000000000..062bb742eaf3d6cdb248f002bd6cc0a82d604ce9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/package.json @@ -0,0 +1,75 @@ +{ + "name": "resolve", + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", + "version": "1.22.10", + "repository": { + "type": "git", + "url": "git://github.com/browserify/resolve.git" + }, + "bin": { + "resolve": "./bin/resolve" + }, + "main": "index.js", + "keywords": [ + "resolve", + "require", + "node", + "module" + ], + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated && cp node_modules/is-core-module/core.json ./lib/ ||:", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**'", + "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", + "tests-only": "tape test/*.js", + "pretest": "npm run lint", + "test": "npm run --silent tests-only", + "posttest": "npm run test:multirepo && npx npm@'>= 10.2' audit --production", + "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.1", + "array.prototype.map": "^1.0.7", + "copy-dir": "^1.3.0", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "mkdirp": "^0.5.5", + "mv": "^2.1.1", + "npmignore": "^0.3.1", + "object-keys": "^1.1.1", + "rimraf": "^2.7.1", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.1", + "tap": "0.4.13", + "tape": "^5.9.0", + "tmp": "^0.0.31" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "appveyor.yml", + "test/resolver/malformed_package_json", + "test/list-exports" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/readme.markdown b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/readme.markdown new file mode 100644 index 0000000000000000000000000000000000000000..ad34d60dd57771d805f0e6cf9f1104a63b98940d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/readme.markdown @@ -0,0 +1,301 @@ +# resolve [![Version Badge][2]][1] + +implements the [node `require.resolve()` algorithm](https://nodejs.org/api/modules.html#modules_all_together) such that you can `require.resolve()` on behalf of a file asynchronously and synchronously + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +# example + +asynchronously resolve: + +```js +var resolve = require('resolve/async'); // or, require('resolve') +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); +``` + +``` +$ node example/async.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +synchronously resolve: + +```js +var resolve = require('resolve/sync'); // or, `require('resolve').sync +var res = resolve('tap', { basedir: __dirname }); +console.log(res); +``` + +``` +$ node example/sync.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +# methods + +```js +var resolve = require('resolve'); +var async = require('resolve/async'); +var sync = require('resolve/sync'); +``` + +For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: + +- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module +- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory +- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) + +## resolve(id, opts={}, cb) + +Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.package - `package.json` data applicable to the module being loaded + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFile - how to read files asynchronously + +* opts.isFile - function to asynchronously test whether a file exists + +* opts.isDirectory - function to asynchronously test whether a file exists and is a directory + +* opts.realpath - function to asynchronously resolve a potential symlink to its real path + +* `opts.readPackage(readFile, pkgfile, cb)` - function to asynchronously read and parse a package.json file + * readFile - the passed `opts.readFile` or `fs.readFile` if not specified + * pkgfile - path to package.json + * cb - callback + +* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * pkgfile - path to package.json + * dir - directory that contains package.json + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFile: fs.readFile, + isFile: function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + isDirectory: function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + realpath: function realpath(file, cb) { + var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + realpath(file, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? file : realPath); + }); + }, + readPackage: function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +## resolve.sync(id, opts) + +Synchronously resolve the module path string `id`, returning the result and +throwing an error when `id` can't be resolved. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFileSync - how to read files synchronously + +* opts.isFile - function to synchronously test whether a file exists + +* opts.isDirectory - function to synchronously test whether a file exists and is a directory + +* opts.realpathSync - function to synchronously resolve a potential symlink to its real path + +* `opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file + * readFileSync - the passed `opts.readFileSync` or `fs.readFileSync` if not specified + * pkgfile - path to package.json + +* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * dir - directory that contains package.json (Note: the second argument will change to "pkgfile" in v2) + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFileSync: fs.readFileSync, + isFile: function isFile(file) { + try { + var stat = fs.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isFile() || stat.isFIFO(); + }, + isDirectory: function isDirectory(dir) { + try { + var stat = fs.statSync(dir); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isDirectory(); + }, + realpathSync: function realpathSync(file) { + try { + var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + return realpath(file); + } catch (realPathErr) { + if (realPathErr.code !== 'ENOENT') { + throw realPathErr; + } + } + return file; + }, + readPackageSync: function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +# install + +With [npm](https://npmjs.org) do: + +```sh +npm install resolve +``` + +# license + +MIT + +[1]: https://npmjs.org/package/resolve +[2]: https://versionbadg.es/browserify/resolve.svg +[5]: https://david-dm.org/browserify/resolve.svg +[6]: https://david-dm.org/browserify/resolve +[7]: https://david-dm.org/browserify/resolve/dev-status.svg +[8]: https://david-dm.org/browserify/resolve#info=devDependencies +[11]: https://nodei.co/npm/resolve.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/resolve.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/resolve.svg +[downloads-url]: https://npm-stat.com/charts.html?package=resolve +[codecov-image]: https://codecov.io/gh/browserify/resolve/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/browserify/resolve/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/resolve +[actions-url]: https://github.com/browserify/resolve/actions diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/sync.js new file mode 100644 index 0000000000000000000000000000000000000000..cd0ee040177e92c676b1a063406c743289719bd0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/sync.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/sync'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/core.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/core.js new file mode 100644 index 0000000000000000000000000000000000000000..a477adc5ce2a4464362d617a21604b367a8d9718 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/core.js @@ -0,0 +1,88 @@ +var test = require('tape'); +var keys = require('object-keys'); +var semver = require('semver'); + +var resolve = require('../'); + +var brokenNode = semver.satisfies(process.version, '11.11 - 11.13'); + +test('core modules', function (t) { + t.test('isCore()', function (st) { + st.ok(resolve.isCore('fs')); + st.ok(resolve.isCore('net')); + st.ok(resolve.isCore('http')); + + st.ok(!resolve.isCore('seq')); + st.ok(!resolve.isCore('../')); + + st.ok(!resolve.isCore('toString')); + + st.end(); + }); + + t.test('core list', function (st) { + var cores = keys(resolve.core); + st.plan(cores.length); + + for (var i = 0; i < cores.length; ++i) { + var mod = cores[i]; + // note: this must be require, not require.resolve, due to https://github.com/nodejs/node/issues/43274 + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + t.comment(mod + ': ' + resolve.core[mod]); + if (resolve.core[mod]) { + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); + } else if (brokenNode) { + st.ok(true, 'this version of node is broken: attempting to require things that fail to resolve breaks "home_paths" tests'); + } else { + st.throws(requireFunc, mod + ' not supported; requiring throws'); + } + } + + st.end(); + }); + + t.test('core via repl module', { skip: !resolve.core.repl }, function (st) { + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + st.end(); + }); + + t.test('core via builtinModules list', { skip: !resolve.core.module }, function (st) { + var libs = require('module').builtinModules; + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + var blacklist = [ + '_debug_agent', + 'v8/tools/tickprocessor-driver', + 'v8/tools/SourceMap', + 'v8/tools/tickprocessor', + 'v8/tools/profile' + ]; + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + if (blacklist.indexOf(mod) === -1) { + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + } + st.end(); + }); + + t.end(); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/dotdot.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/dotdot.js new file mode 100644 index 0000000000000000000000000000000000000000..30806659be2ef27d410722636d6f79c8f8e999b0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/dotdot.js @@ -0,0 +1,29 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('dotdot', function (t) { + t.plan(4); + var dir = path.join(__dirname, '/dotdot/abc'); + + resolve('..', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'dotdot/index.js')); + }); + + resolve('.', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('dotdot sync', function (t) { + t.plan(2); + var dir = path.join(__dirname, '/dotdot/abc'); + + var a = resolve.sync('..', { basedir: dir }); + t.equal(a, path.join(__dirname, 'dotdot/index.js')); + + var b = resolve.sync('.', { basedir: dir }); + t.equal(b, path.join(dir, 'index.js')); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/dotdot/abc/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/dotdot/abc/index.js new file mode 100644 index 0000000000000000000000000000000000000000..67f2534ebf90dcc4c2c1c13ce3ab52c41f4d2ed9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/dotdot/abc/index.js @@ -0,0 +1,2 @@ +var x = require('..'); +console.log(x); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/dotdot/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/dotdot/index.js new file mode 100644 index 0000000000000000000000000000000000000000..643f9fcc6a6a7cf025dcc86559e83d00b993ed96 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/dotdot/index.js @@ -0,0 +1 @@ +module.exports = 'whatever'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/faulty_basedir.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/faulty_basedir.js new file mode 100644 index 0000000000000000000000000000000000000000..5f2141a67267bceaf743ab292ca8e7bebb2b6bbc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/faulty_basedir.js @@ -0,0 +1,29 @@ +var test = require('tape'); +var path = require('path'); +var resolve = require('../'); + +test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) { + t.plan(1); + + var resolverDir = 'C:\\a\\b\\c\\d'; + + resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(!!err, true); + }); +}); + +test('non-existent basedir should not throw when preserveSymlinks is false', function (t) { + t.plan(2); + + var opts = { + basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'), + preserveSymlinks: false + }; + + var module = './dotdot/abc'; + + resolve(module, opts, function (err, res) { + t.equal(err.code, 'MODULE_NOT_FOUND'); + t.equal(res, undefined); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js new file mode 100644 index 0000000000000000000000000000000000000000..8f8cccdb2f59f3ea03a27151da52f73ed9f068de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js @@ -0,0 +1,34 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + resolve('./baz', { + basedir: dir, + packageFilter: function (pkg, pkgfile) { + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = [pkg, pkgfile]; + return pkg; + } + }, function (err, res, pkg) { + if (err) t.fail(err); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(pkg, packageData, 'first packageFilter argument is "pkg"'); + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + var packageFile = packageFilterArgs[1]; + t.equal( + packageFile, + path.join(dir, 'baz/package.json'), + 'second packageFilter argument is "pkgfile"' + ); + + t.end(); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter_sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter_sync.js new file mode 100644 index 0000000000000000000000000000000000000000..8a43b9818973dfba95a2389f27e966ff4f315343 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter_sync.js @@ -0,0 +1,33 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + var res = resolve.sync('./baz', { + basedir: dir, + // NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility + packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef + return pkg; + } + }); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + if (!'is 1.x') { // eslint-disable-line no-constant-condition + var packageFile = packageFilterArgs[1]; + t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct'); + } + + var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition + // eslint-disable-next-line no-constant-condition + t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"'); + + t.end(); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/home_paths.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/home_paths.js new file mode 100644 index 0000000000000000000000000000000000000000..3b8c9b32c87bd73fb2a3ec42494d13faae1594e4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/home_paths.js @@ -0,0 +1,127 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../async'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazPkg = { name: 'baz', main: 'quux.js' }; + var dotMainPkg = { main: 'index' }; + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + var dotSlashMainPkg = { main: 'index' }; + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('dot_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_main`'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + s2t.deepEqual(pkg, dotMainPkg); + }); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(3); + + resolve('dot_slash_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_slash_main`'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + s2t.deepEqual(pkg, dotSlashMainPkg); + }); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('baz', function (err, res, pkg) { + s2t.error(err, 'no error resolving `baz`'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + s2t.deepEqual(pkg, bazPkg); + }); + }); + }); + }); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/home_paths_sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/home_paths_sync.js new file mode 100644 index 0000000000000000000000000000000000000000..5d2c56fd35d0a3ad072c3549f12695c93654aaed --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/home_paths_sync.js @@ -0,0 +1,114 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../sync'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_main'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_slash_main'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('baz'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + }); + }); + }); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/mock.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/mock.js new file mode 100644 index 0000000000000000000000000000000000000000..611627549889541b31e4eb8d8f9277871a452076 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/mock.js @@ -0,0 +1,315 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock from package', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, file)); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[file]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('mock package from package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('symlinked', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + cb(null, resolved); + return; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + cb(null, path.join(dir, 'symlinked', base)); + } else { + cb(null, path.join(resolved, 'symlinked')); + } + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); +}); + +test('readPackage', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + t.test('with readFile', function (st) { + st.plan(3); + + resolve('bar', opts('/foo'), function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + st.equal(pkg && pkg.main, './baz.js'); + }); + }); + + var readPackage = function (readFile, file, cb) { + var barPackage = path.join('bar', 'package.json'); + if (file.slice(-barPackage.length) === barPackage) { + cb(null, { main: './something-else.js' }); + } else { + cb(null, JSON.parse(files[path.resolve(file)])); + } + }; + + t.test('with readPackage', function (st) { + st.plan(3); + + var options = opts('/foo'); + delete options.readFile; + options.readPackage = readPackage; + resolve('bar', options, function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/something-else.js')); + st.equal(pkg && pkg.main, './something-else.js'); + }); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackage = readPackage; + resolve('bar', options, function (err) { + st.throws(function () { throw err; }, TypeError, 'errors when both readFile and readPackage are provided'); + }); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/mock_sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/mock_sync.js new file mode 100644 index 0000000000000000000000000000000000000000..c5a7e2a98030d90cc256c9f4174eafdce395280d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/mock_sync.js @@ -0,0 +1,214 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.throws(function () { + resolve.sync('baz', opts('/foo/bar')); + }); + + t.throws(function () { + resolve.sync('../baz', opts('/foo/bar')); + }); +}); + +test('mock package', function (t) { + t.plan(1); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); +}); + +test('symlinked', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + return resolved; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + return path.join(dir, 'symlinked', base); + } + return path.join(resolved, 'symlinked'); + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); +}); + +test('readPackageSync', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir, useReadPackage) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: useReadPackage ? null : function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + t.test('with readFile', function (st) { + st.plan(1); + + st.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); + }); + + var readPackageSync = function (readFileSync, file) { + if (file.indexOf(path.join('bar', 'package.json')) >= 0) { + return { main: './something-else.js' }; + } + return JSON.parse(files[path.resolve(file)]); + }; + + t.test('with readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + delete options.readFileSync; + options.readPackageSync = readPackageSync; + + st.equal( + resolve.sync('bar', options), + path.resolve('/foo/node_modules/bar/something-else.js') + ); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackageSync = readPackageSync; + st.throws( + function () { resolve.sync('bar', options); }, + TypeError, + 'errors when both readFile and readPackage are provided' + ); + }); +}); + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir.js new file mode 100644 index 0000000000000000000000000000000000000000..b50e5bb1751d69694deaae36d5f0bc6691498008 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir.js @@ -0,0 +1,56 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('moduleDirectory strings', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'module_dir'); + var xopts = { + basedir: dir, + moduleDirectory: 'xmodules' + }; + resolve('aaa', xopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var yopts = { + basedir: dir, + moduleDirectory: 'ymodules' + }; + resolve('aaa', yopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); +}); + +test('moduleDirectory array', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'module_dir'); + var aopts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('aaa', aopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var bopts = { + basedir: dir, + moduleDirectory: ['zmodules', 'ymodules', 'xmodules'] + }; + resolve('aaa', bopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); + + var copts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('bbb', copts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/zmodules/bbb/main.js')); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/xmodules/aaa/index.js new file mode 100644 index 0000000000000000000000000000000000000000..dd7cf7b2d022daae3c3f7628fcfb2f8bf186efac --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/xmodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x * 100; }; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/ymodules/aaa/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ef2d4d4bf76e61fdfe16ef406c9752c6435138f3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/ymodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x + 100; }; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/zmodules/bbb/main.js new file mode 100644 index 0000000000000000000000000000000000000000..e8ba629936a7ad11134ac826edfad2379759c7cb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/zmodules/bbb/main.js @@ -0,0 +1 @@ +module.exports = function (n) { return n * 111; }; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/zmodules/bbb/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c13b8cf6acfd3344bc2c7969a31d930d933fdf22 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/module_dir/zmodules/bbb/package.json @@ -0,0 +1,3 @@ +{ + "main": "main.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node-modules-paths.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node-modules-paths.js new file mode 100644 index 0000000000000000000000000000000000000000..675441db2ced7b7facac9b7344fe8ea98c16e45b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node-modules-paths.js @@ -0,0 +1,143 @@ +var test = require('tape'); +var path = require('path'); +var parse = path.parse || require('path-parse'); +var keys = require('object-keys'); + +var nodeModulesPaths = require('../lib/node-modules-paths'); + +var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) { + var moduleDirs = [].concat(moduleDirectories || 'node_modules'); + if (paths) { + for (var k = 0; k < paths.length; ++k) { + moduleDirs.push(path.basename(paths[k])); + } + } + + var foundModuleDirs = {}; + var uniqueDirs = {}; + var parsedDirs = {}; + for (var i = 0; i < dirs.length; ++i) { + var parsed = parse(dirs[i]); + if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; } + foundModuleDirs[parsed.base] += 1; + parsedDirs[parsed.dir] = true; + uniqueDirs[dirs[i]] = true; + } + t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has'); + var foundModuleDirNames = keys(foundModuleDirs); + t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found'); + t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique'); + + var counts = {}; + for (var j = 0; j < foundModuleDirNames.length; ++j) { + counts[foundModuleDirs[j]] = true; + } + t.equal(keys(counts).length, 1, 'all found module directories had the same count'); +}; + +test('node-modules-paths', function (t) { + t.test('no options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('empty options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, {}); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('with paths=array option', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var dirs = nodeModulesPaths(start, { paths: paths }); + + verifyDirs(t, start, dirs, null, paths); + + t.end(); + }); + + t.test('with paths=function option', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request)); + }; + + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg'); + + verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]); + + t.end(); + }); + + t.test('with paths=function skipping node modules resolution', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return []; + }; + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }); + t.deepEqual(dirs, [], 'no node_modules was computed'); + t.end(); + }); + + t.test('with moduleDirectory option', function (t) { + var start = path.join(__dirname, 'resolver'); + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory); + + t.end(); + }); + + t.test('with 1 moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory, paths); + + t.end(); + }); + + t.test('with 1+ moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectories = ['not node modules', 'other modules']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + verifyDirs(t, start, dirs, moduleDirectories, paths); + + t.end(); + }); + + t.test('combine paths correctly on Windows', function (t) { + var start = 'C:\\Users\\username\\myProject\\src'; + var paths = []; + var moduleDirectories = ['node_modules', start]; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); + + t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) { + var start = '/Users/username/git/myProject/src'; + var paths = []; + var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path.js new file mode 100644 index 0000000000000000000000000000000000000000..e463d6c8c313b3554d5d4e07643fea29cfa86c51 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path.js @@ -0,0 +1,70 @@ +var fs = require('fs'); +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('$NODE_PATH', function (t) { + t.plan(8); + + var isDir = function (dir, cb) { + if (dir === '/node_path' || dir === 'node_path/x') { + return cb(null, true); + } + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }; + + resolve('aaa', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves'); + }); + + resolve('bbb', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves'); + }); + + resolve('ccc', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves'); + }); + + // ensure that relative paths still resolve against the regular `node_modules` correctly + resolve('tap', { + paths: [ + 'node_path' + ], + basedir: path.join(__dirname, 'node_path/x'), + isDirectory: isDir + }, function (err, res) { + var root = require('tap/package.json').main; // eslint-disable-line global-require + t.error(err); + t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves'); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/x/aaa/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/x/aaa/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ad70d0bb03f6f433224a681f9055fe9d0a388dfc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/x/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'A'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/x/ccc/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/x/ccc/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a64132e4c7e52cfea76744d826e99932e994c7c1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/x/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'C'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/y/bbb/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/y/bbb/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4d0f32e24368185d6f3c16445f88b902329025d6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/y/bbb/index.js @@ -0,0 +1 @@ +module.exports = 'B'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/y/ccc/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/y/ccc/index.js new file mode 100644 index 0000000000000000000000000000000000000000..793315e846687e1dd2bae012fc30676b2a421753 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/node_path/y/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'CY'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/nonstring.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/nonstring.js new file mode 100644 index 0000000000000000000000000000000000000000..ef63c40f9393dc63219d5e3debb7ed6db175c455 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/nonstring.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var resolve = require('../'); + +test('nonstring', function (t) { + t.plan(1); + resolve(555, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/pathfilter.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/pathfilter.js new file mode 100644 index 0000000000000000000000000000000000000000..16519aeae51c4fb65b8ccdd69f303a2315358ef3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/pathfilter.js @@ -0,0 +1,75 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +var resolverDir = path.join(__dirname, '/pathfilter/deep_ref'); + +var pathFilterFactory = function (t) { + return function (pkg, x, remainder) { + t.equal(pkg.version, '1.2.3'); + t.equal(x, path.join(resolverDir, 'node_modules/deep/ref')); + t.equal(remainder, 'ref'); + return 'alt'; + }; +}; + +test('#62: deep module references and the pathFilter', function (t) { + t.test('deep/ref.js', function (st) { + st.plan(3); + + resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) { + if (err) st.fail(err); + + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + var res = resolve.sync('deep/ref', { basedir: resolverDir }); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + t.test('deep/deeper/ref', function (st) { + st.plan(4); + + resolve( + 'deep/deeper/ref', + { basedir: resolverDir }, + function (err, res, pkg) { + if (err) t.fail(err); + st.notEqual(pkg, undefined); + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + } + ); + + var res = resolve.sync( + 'deep/deeper/ref', + { basedir: resolverDir } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + }); + + t.test('deep/ref alt', function (st) { + st.plan(8); + + var pathFilter = pathFilterFactory(st); + + var res = resolve.sync( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + + resolve( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter }, + function (err, res, pkg) { + if (err) st.fail(err); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + st.end(); + } + ); + }); + + t.end(); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/pathfilter/deep_ref/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/pathfilter/deep_ref/main.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence.js new file mode 100644 index 0000000000000000000000000000000000000000..2febb598fbc06832ce5b076735cb9f79fb257c7c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence.js @@ -0,0 +1,23 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('precedence', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'precedence/aaa'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg.name, 'resolve'); + }); +}); + +test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string + t.plan(1); + var dir = path.join(__dirname, 'precedence/bbb'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/aaa.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/aaa.js new file mode 100644 index 0000000000000000000000000000000000000000..b83a3e7ad98d17536ebc574326276c0fe341b99a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/aaa.js @@ -0,0 +1 @@ +module.exports = 'wtf'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/aaa/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/aaa/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e0f8f6abf72f7fe517abf6c57fae219b831b1cc9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'okok'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/aaa/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/aaa/main.js new file mode 100644 index 0000000000000000000000000000000000000000..93542a965e0ea4fa1a548dcb4491e1defd73afe0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/aaa/main.js @@ -0,0 +1 @@ +console.log(require('./')); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/bbb.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/bbb.js new file mode 100644 index 0000000000000000000000000000000000000000..2298f47fdd16dcc8375b62d1a15109a5833da926 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/bbb.js @@ -0,0 +1 @@ +module.exports = '>_<'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/bbb/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/bbb/main.js new file mode 100644 index 0000000000000000000000000000000000000000..716b81d4bd463f66980f3cb44588b283bfb23edc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/precedence/bbb/main.js @@ -0,0 +1 @@ +console.log(require('./')); // should throw diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver.js new file mode 100644 index 0000000000000000000000000000000000000000..df8211af3af3d2059ce2a665e936390fcc4529a4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver.js @@ -0,0 +1,597 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var resolve = require('../'); +var async = require('../async'); + +test('`./async` entry point', function (t) { + t.equal(resolve, async, '`./async` entry point is the same as `main`'); + t.end(); +}); + +test('async foo', function (t) { + t.plan(12); + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo.js', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.main, 'resolver'); + }); + + resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg.main, 'resolver'); + }); + + resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + }); + + resolve('foo', { basedir: dir }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'"); + }); +}); + +test('bar', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'resolver'); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg.main, 'bar'); + }); +}); + +test('baz', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + + resolve('./baz', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); + + resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); +}); + +test('biz', function (t) { + t.plan(24); + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + resolve('./grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'biz'); + }); + + resolve('./garply', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, 'grux'); + }); + + resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'tiv'); + }); + + resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); +}); + +test('quux', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/quux'); + + resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo/index.js')); + t.equal(pkg.main, 'quux'); + }); +}); + +test('normalize', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + resolve('../grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg, undefined); + }); +}); + +test('cup', function (t) { + t.plan(5); + var dir = path.join(__dirname, 'resolver'); + + resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup.coffee', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'"); + }); +}); + +test('mug', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'resolver'); + + resolve('./mug', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'mug.js')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, '/mug.coffee')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + t.equal(res, path.join(dir, '/mug.js')); + }); +}); + +test('other path', function (t) { + t.plan(6); + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/root.js')); + }); + + resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js')); + }); + + resolve('root', { basedir: dir }, function (err, res) { + t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) { + t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('path iterator', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'baz/quux.js')); + t.equal(pkg && pkg.name, 'baz'); + }); +}); + +test('incorrect main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('missing index', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + resolve('./missing_index', { basedir: resolverDir }, function (err, res, pkg) { + t.ok(err instanceof Error); + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('missing main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./missing_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('null main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./null_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('main: false', function (t) { + t.plan(2); + + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + resolve('./false_main', { basedir: basedir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal( + res, + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + t.deepEqual(pkg, { + name: 'false_main', + main: false + }); + }); +}); + +test('without basedir', function (t) { + t.plan(1); + + var dir = path.join(__dirname, 'resolver/without_basedir'); + var tester = require(path.join(dir, 'main.js')); // eslint-disable-line global-require + + tester(t, function (err, res, pkg) { + if (err) { + t.fail(err); + } else { + t.equal(res, path.join(dir, 'node_modules/mymodule.js')); + } + }); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo.js')); + }); + + resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); + + resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('async: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.plan(1); + resolve('./' + testFile, function (err, res, pkg) { + if (err) t.fail(err); + st.equal(res, __filename, 'sanity check'); + }); + }); + + t.test('with a fake directory', function (st) { + st.plan(4); + + resolve('./' + testFile + '/blah', function (err, res, pkg) { + st.ok(err, 'there is an error'); + st.notOk(res, 'no result'); + + st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + err && err.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + st.end(); + }); + }); + + t.end(); +}); + +test('async dot main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('async dot slash main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_slash_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('not a directory', function (t) { + t.plan(6); + var path = './foo'; + resolve(path, { basedir: __filename }, function (err, res, pkg) { + t.ok(err, 'a non-directory errors'); + t.equal(arguments.length, 1); + t.equal(res, undefined); + t.equal(pkg, undefined); + + t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\''); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('browser field in package.json', function (t) { + t.plan(3); + + var dir = path.join(__dirname, 'resolver'); + resolve( + './browser_field', + { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }, + function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.equal(pkg && pkg.main, 'b'); + t.equal(pkg && pkg.browser, undefined); + } + ); +}); + +test('absolute paths', function (t) { + t.plan(4); + + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + resolve(__filename, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file resolves' + ); + }); + resolve(extensionless, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file resolves' + ); + }); + resolve(__filename, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file with a basedir resolves' + ); + }); + resolve(extensionless, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + }); +}); + +var malformedDir = path.join(__dirname, 'resolver/malformed_package_json'); +test('malformed package.json', { skip: !fs.existsSync(malformedDir) }, function (t) { + /* eslint operator-linebreak: ["error", "before"], function-paren-newline: "off" */ + t.plan( + (3 * 3) // 3 sets of 3 assertions in the final callback + + 2 // 1 readPackage call with malformed package.json + ); + + var basedir = malformedDir; + var expected = path.join(basedir, 'index.js'); + + resolve('./index.js', { basedir: basedir }, function (err, res, pkg) { + t.error(err, 'no error'); + t.equal(res, expected, 'malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'malformed package.json gives an undefined `pkg` argument'); + }); + + resolve( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + }, + function (err, res, pkg) { + t.error(err, 'with packageFilter: no error'); + t.equal(res, expected, 'with packageFilter: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with packageFilter: malformed package.json gives an undefined `pkg` argument'); + } + ); + + resolve( + './index.js', + { + basedir: basedir, + readPackage: function (readFile, pkgfile, cb) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + readFile(pkgfile, function (err, result) { + try { + cb(null, JSON.parse(result)); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackage: malformed package.json parses as a syntax error'); + cb(null); + } + }); + } + }, + function (err, res, pkg) { + t.error(err, 'with readPackage: no error'); + t.equal(res, expected, 'with readPackage: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with readPackage: malformed package.json gives an undefined `pkg` argument'); + } + ); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/baz/doom.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/baz/doom.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/baz/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/baz/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2f77720b8672a0e2ed8b49636775335884cb3ec0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/baz/package.json @@ -0,0 +1,4 @@ +{ + "name": "baz", + "main": "quux.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/baz/quux.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/baz/quux.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/baz/quux.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/browser_field/a.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/browser_field/a.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/browser_field/b.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/browser_field/b.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/browser_field/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/browser_field/package.json new file mode 100644 index 0000000000000000000000000000000000000000..bf406f0830f8aab6aaec9e3f60f1623fbe6854e6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/browser_field/package.json @@ -0,0 +1,5 @@ +{ + "name": "browser_field", + "main": "a", + "browser": "b" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/cup.coffee b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/cup.coffee new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/cup.coffee @@ -0,0 +1 @@ + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_main/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_main/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d7f4fc8079f60aaee820b293537b21d488a1bc31 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "." +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_slash_main/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_slash_main/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_slash_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_slash_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_slash_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f51287b9d1e739a8827578a541e89f7e91450615 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/dot_slash_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "./" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/false_main/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/false_main/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/false_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/false_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a7416c0c7aa4a1df56419f92dcc7519836db8978 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/false_main/package.json @@ -0,0 +1,4 @@ +{ + "name": "false_main", + "main": false +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/foo.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/foo.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/foo.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/incorrect_main/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/incorrect_main/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bc1fb0a6f4ede17ec05e767ca8ccacbc3015ff70 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/incorrect_main/index.js @@ -0,0 +1,2 @@ +// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/incorrect_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/incorrect_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b7188041763f8a94977f173a26c41fdbf5f2effb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/incorrect_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "wrong.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/invalid_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/invalid_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0590748642ae2eadb17726ec3d1b501c94652277 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/invalid_main/package.json @@ -0,0 +1,7 @@ +{ + "name": "invalid_main", + "main": [ + "why is this a thing", + "srsly omg wtf" + ] +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/mug.coffee b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/mug.coffee new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/mug.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/mug.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/lerna.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/lerna.json new file mode 100644 index 0000000000000000000000000000000000000000..d6707ca0cd64d48d212b90abe2e72f24b092572f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/lerna.json @@ -0,0 +1,6 @@ +{ + "packages": [ + "packages/*" + ], + "version": "0.0.0" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4391d392ea2761caea4d8286cc8ccc56cfa3e4a5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/package.json @@ -0,0 +1,20 @@ +{ + "name": "ljharb-monorepo-symlink-test", + "private": true, + "version": "0.0.0", + "description": "", + "main": "index.js", + "scripts": { + "postinstall": "lerna bootstrap", + "test": "node packages/package-a" + }, + "author": "", + "license": "MIT", + "dependencies": { + "jquery": "^3.3.1", + "resolve": "../../../" + }, + "devDependencies": { + "lerna": "^3.4.3" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8875a32df0ffc4eda94bb6c6dd9855ac604820c4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var assert = require('assert'); +var path = require('path'); +var resolve = require('resolve'); + +var basedir = __dirname + '/node_modules/@my-scope/package-b'; + +var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js'); + +/* + * preserveSymlinks === false + * will search NPM package from + * - packages/package-b/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected); +assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected); + +/* + * preserveSymlinks === true + * will search NPM package from + * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules + * - packages/package-a/node_modules/@my-scope/packages/node_modules + * - packages/package-a/node_modules/@my-scope/node_modules + * - packages/package-a/node_modules/node_modules + * - packages/package-a/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected); +assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected); + +console.log(' * all monorepo paths successfully resolved through symlinks'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json new file mode 100644 index 0000000000000000000000000000000000000000..204de51e05878b3451223ba654c5e4a790ef1e51 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-a", + "version": "0.0.0", + "private": true, + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-b": "^0.0.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f57c3b5f5e454d3948e1a4bc5aec10fdcd79d8b5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-b", + "private": true, + "version": "0.0.0", + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-a": "^0.0.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js new file mode 100644 index 0000000000000000000000000000000000000000..9b4846a82a77be169097f041f791070732229cb7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js @@ -0,0 +1,26 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b; +var c; + +var test = function test() { + console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); + console.log(b, ': preserveSymlinks true'); + console.log(c, ': preserveSymlinks false'); + + if (a !== b && a !== c) { + throw 'async: no match'; + } + console.log('async: success! a matched either b or c\n'); +}; + +require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) { + if (err) { throw err; } + b = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); +require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) { + if (err) { throw err; } + c = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json new file mode 100644 index 0000000000000000000000000000000000000000..acfe9e9517720ab5532c247052fadb214c5ffef3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json @@ -0,0 +1,15 @@ +{ + "name": "mylib", + "version": "0.0.0", + "description": "", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "buffer": "*" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js new file mode 100644 index 0000000000000000000000000000000000000000..3283efc2ec81f8d2a62be9a1fd28a192403ce549 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js @@ -0,0 +1,12 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD'); +var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD'); + +console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); +console.log(b, ': preserveSymlinks true'); +console.log(c, ': preserveSymlinks false'); + +if (a !== b && a !== c) { + throw 'sync: no match'; +} +console.log('sync: success! a matched either b or c\n'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/other_path/lib/other-lib.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/other_path/root.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/other_path/root.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/quux/foo/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/quux/foo/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/quux/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/same_names/foo.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/same_names/foo.js new file mode 100644 index 0000000000000000000000000000000000000000..888cae37af95c51299d735439cf896dc4d5aaafc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/same_names/foo.js @@ -0,0 +1 @@ +module.exports = 42; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/same_names/foo/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/same_names/foo/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/same_names/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/package/bar.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/package/bar.js new file mode 100644 index 0000000000000000000000000000000000000000..cb1c2c01e753b31f6e550e991a82022f7acf8638 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/package/bar.js @@ -0,0 +1 @@ +module.exports = 'bar'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/package/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/package/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8e1b585914a7b46cd21d5d8709ac08bc1fe84962 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/symlinked/package/package.json @@ -0,0 +1,3 @@ +{ + "main": "bar.js" +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/without_basedir/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/without_basedir/main.js new file mode 100644 index 0000000000000000000000000000000000000000..5b31975be69da5efea03fac676afa5f2199831be --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver/without_basedir/main.js @@ -0,0 +1,5 @@ +var resolve = require('../../../'); + +module.exports = function (t, cb) { + resolve('mymodule', null, cb); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver_sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver_sync.js new file mode 100644 index 0000000000000000000000000000000000000000..a6df8ced4682af11914d60c7a6a96b8a33ab438b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/resolver_sync.js @@ -0,0 +1,730 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); + +var resolve = require('../'); +var sync = require('../sync'); + +var requireResolveSupportsPaths = require.resolve.length > 1 + && !(/^v12\.[012]\./).test(process.version); // broken in v12.0-12.2, see https://github.com/nodejs/node/issues/27794 + +var requireResolveDefaultPathsBroken = (/^v8\.9\.|^v9\.[01]\.0|^v9\.2\./).test(process.version); +// broken in node v8.9.x, v9.0, v9.1, v9.2.x. see https://github.com/nodejs/node/pull/17113 + +test('`./sync` entry point', function (t) { + t.equal(resolve.sync, sync, '`./sync` entry point is the same as `.sync` on `main`'); + t.end(); +}); + +test('foo', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./foo', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: dir }), + require.resolve('./foo', { paths: [dir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + require.resolve('./foo.js', { paths: [dir] }), + './foo.js: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }), + path.join(dir, 'foo.js') + ); + + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }); + + // Test that filename is reported as the "from" value when passed. + t.throws( + function () { + resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') }); + }, + { + name: 'Error', + message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'" + } + ); + + t.end(); +}); + +test('bar', function (t) { + var dir = path.join(__dirname, 'resolver'); + + var basedir = path.join(dir, 'bar'); + + t.equal( + resolve.sync('foo', { basedir: basedir }), + path.join(dir, 'bar/node_modules/foo/index.js'), + 'foo in bar' + ); + if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) { + t.equal( + resolve.sync('foo', { basedir: basedir }), + require.resolve('foo', { paths: [basedir] }), + 'foo in bar: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('baz', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./baz', { basedir: dir }), + path.join(dir, 'baz/quux.js'), + './baz' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./baz', { basedir: dir }), + require.resolve('./baz', { paths: [dir] }), + './baz: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('biz', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + t.equal( + resolve.sync('./grux', { basedir: dir }), + path.join(dir, 'grux/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./grux', { basedir: dir }), + require.resolve('./grux', { paths: [dir] }), + './grux: resolve.sync === require.resolve' + ); + } + + var tivDir = path.join(dir, 'grux'); + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + path.join(dir, 'tiv/index.js') + ); + if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) { + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + require.resolve('tiv', { paths: [tivDir] }), + 'tiv: resolve.sync === require.resolve' + ); + } + + var gruxDir = path.join(dir, 'tiv'); + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + path.join(dir, 'grux/index.js') + ); + if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) { + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + require.resolve('grux', { paths: [gruxDir] }), + 'grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('normalize', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + t.equal( + resolve.sync('../grux', { basedir: dir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('../grux', { basedir: dir }), + require.resolve('../grux', { paths: [dir] }), + '../grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('cup', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'cup.coffee'), + './cup -> ./cup.coffee' + ); + + t.equal( + resolve.sync('./cup.coffee', { basedir: dir }), + path.join(dir, 'cup.coffee'), + './cup.coffee' + ); + + t.throws(function () { + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js'] + }); + }); + + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./cup.coffee', { basedir: dir, extensions: ['.js', '.coffee'] }), + require.resolve('./cup.coffee', { paths: [dir] }), + './cup.coffee: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('mug', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./mug', { basedir: dir }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./mug', { basedir: dir }), + require.resolve('./mug', { paths: [dir] }), + './mug: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.coffee', '.js'] + }), + path.join(dir, 'mug.coffee'), + './mug -> ./mug.coffee' + ); + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + + t.end(); +}); + +test('other path', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + t.equal( + resolve.sync('root', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/root.js') + ); + + t.equal( + resolve.sync('lib/other-lib', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/lib/other-lib.js') + ); + + t.throws(function () { + resolve.sync('root', { basedir: dir }); + }); + + t.throws(function () { + resolve.sync('zzz', { + basedir: dir, + paths: [otherDir] + }); + }); + + t.end(); +}); + +test('path iterator', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + t.equal( + resolve.sync('baz', { packageIterator: exactIterator }), + path.join(resolverDir, 'baz/quux.js') + ); + + t.end(); +}); + +test('incorrect main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + require.resolve('./incorrect_main', { paths: [resolverDir] }), + './incorrect_main: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('missing index', function (t) { + t.plan(requireResolveSupportsPaths ? 2 : 1); + + var resolverDir = path.join(__dirname, 'resolver'); + try { + resolve.sync('./missing_index', { basedir: resolverDir }); + t.fail('did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + require.resolve('./missing_index', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } +}); + +test('missing main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('null main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('main: false', function (t) { + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + require.resolve('./false_main', { paths: [basedir] }), + '`"main": false`: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +var stubStatSync = function stubStatSync(fn) { + var statSync = fs.statSync; + try { + fs.statSync = function () { + throw new EvalError('Unknown Error'); + }; + return fn(); + } finally { + fs.statSync = statSync; + } +}; + +test('#79 - re-throw non ENOENT errors from stat', function (t) { + var dir = path.join(__dirname, 'resolver'); + + stubStatSync(function () { + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }, /Unknown Error/); + }); + + t.end(); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names'); + + t.equal( + resolve.sync('./foo', { basedir: basedir }), + path.join(dir, 'same_names/foo.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: basedir }), + require.resolve('./foo', { paths: [basedir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + require.resolve('./foo/', { paths: [basedir] }), + './foo/: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names/foo'); + + t.equal( + resolve.sync('./', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + './' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./', { basedir: basedir }), + require.resolve('./', { paths: [basedir] }), + './: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('.', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + '.' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('.', { basedir: basedir }), + require.resolve('.', { paths: [basedir] }), + '.: resolve.sync === require.resolve', + { todo: true } + ); + } + + t.end(); +}); + +test('sync: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.equal( + resolve.sync('./' + testFile), + __filename, + 'sanity check' + ); + st.equal( + resolve.sync('./' + testFile), + require.resolve('./' + testFile), + 'sanity check: resolve.sync === require.resolve' + ); + + st.end(); + }); + + t.test('with a fake directory', function (st) { + function run() { return resolve.sync('./' + testFile + '/blah'); } + + st.throws(run, 'throws an error'); + + try { + run(); + } catch (e) { + st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + e.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + } + + st.end(); + }); + + t.end(); +}); + +test('sync dot main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_main'), + path.join(__dirname, 'resolver/dot_main/index.js'), + './resolver/dot_main' + ); + t.equal( + resolve.sync('./resolver/dot_main'), + require.resolve('./resolver/dot_main'), + './resolver/dot_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('sync dot slash main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_slash_main'), + path.join(__dirname, 'resolver/dot_slash_main/index.js') + ); + t.equal( + resolve.sync('./resolver/dot_slash_main'), + require.resolve('./resolver/dot_slash_main'), + './resolver/dot_slash_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('not a directory', function (t) { + var path = './foo'; + try { + resolve.sync(path, { basedir: __filename }); + t.fail(); + } catch (err) { + t.ok(err, 'a non-directory errors'); + t.equal(err && err.message, 'Cannot find module \'' + path + "' from '" + __filename + "'"); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('browser field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + var res = resolve.sync('./browser_field', { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.end(); +}); + +test('absolute paths', function (t) { + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + t.equal( + resolve.sync(__filename), + __filename, + 'absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(extensionless), + __filename, + 'extensionless absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + __filename, + 'absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + require.resolve(__filename, { paths: [process.cwd()] }), + 'absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + require.resolve(extensionless, { paths: [process.cwd()] }), + 'extensionless absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +var malformedDir = path.join(__dirname, 'resolver/malformed_package_json'); +test('malformed package.json', { skip: !fs.existsSync(malformedDir) }, function (t) { + t.plan(5 + (requireResolveSupportsPaths ? 1 : 0)); + + var basedir = malformedDir; + var expected = path.join(basedir, 'index.js'); + + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + expected, + 'malformed package.json is silently ignored' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + require.resolve('./index.js', { paths: [basedir] }), + 'malformed package.json: resolve.sync === require.resolve' + ); + } + + var res1 = resolve.sync( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + } + ); + + t.equal( + res1, + expected, + 'with packageFilter: malformed package.json is silently ignored' + ); + + var res2 = resolve.sync( + './index.js', + { + basedir: basedir, + readPackageSync: function (readFileSync, pkgfile) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + var result = String(readFileSync(pkgfile)); + try { + return JSON.parse(result); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackageSync: malformed package.json parses as a syntax error'); + } + } + } + ); + + t.equal( + res2, + expected, + 'with readPackageSync: malformed package.json is silently ignored' + ); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/shadowed_core.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/shadowed_core.js new file mode 100644 index 0000000000000000000000000000000000000000..3a5f4fcff728f305c2d3d17a416fea4cbfe31f6b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/shadowed_core.js @@ -0,0 +1,54 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('shadowed core modules still return core module', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, 'util'); + }); +}); + +test('shadowed core modules still return core module [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, 'util'); +}); + +test('shadowed core modules return shadow when appending `/`', function (t) { + t.plan(2); + + resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow when appending `/` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false`', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/shadowed_core/node_modules/util/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/shadowed_core/node_modules/util/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/subdirs.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/subdirs.js new file mode 100644 index 0000000000000000000000000000000000000000..b7b8450a9ef231940eca37b8fe951310147a9470 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/subdirs.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('subdirs', function (t) { + t.plan(2); + + var dir = path.join(__dirname, '/subdirs'); + resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/symlinks.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/symlinks.js new file mode 100644 index 0000000000000000000000000000000000000000..35f881afb8c7e043567cf85953d9046c011cec3d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-node/node_modules/resolve/test/symlinks.js @@ -0,0 +1,176 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var map = require('array.prototype.map'); +var resolve = require('../'); + +var symlinkDir = path.join(__dirname, 'resolver', 'symlinked', 'symlink'); +var packageDir = path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'package'); +var modADir = path.join(__dirname, 'symlinks', 'source', 'node_modules', 'mod-a'); +var symlinkModADir = path.join(__dirname, 'symlinks', 'dest', 'node_modules', 'mod-a'); +try { + fs.unlinkSync(symlinkDir); +} catch (err) {} +try { + fs.unlinkSync(packageDir); +} catch (err) {} +try { + fs.unlinkSync(modADir); +} catch (err) {} +try { + fs.unlinkSync(symlinkModADir); +} catch (err) {} + +try { + fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction'); +} +try { + fs.symlinkSync('../../package', packageDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'package') + '\\', packageDir, 'junction'); +} +try { + fs.symlinkSync('../../source/node_modules/mod-a', symlinkModADir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'source', 'node_modules', 'mod-a') + '\\', symlinkModADir, 'junction'); +} + +test('symlink', function (t) { + t.plan(2); + + resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) { + t.error(err); + t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + }); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.plan(4); + + resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) { + t.ok(err, 'there is an error'); + t.notOk(res, 'no result'); + + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + t.equal( + err && err.message, + 'Cannot find module \'foo\' from \'' + symlinkDir + '\'', + 'can not find nonexistent module' + ); + }); +}); + +test('sync symlink', function (t) { + var start = new Date(); + t.doesNotThrow(function () { + t.equal( + resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), + path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js') + ); + }); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.throws(function () { + resolve.sync('foo', { basedir: symlinkDir }); + }, /Cannot find module 'foo'/); + t.end(); +}); + +test('sync symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + var fn = resolve.sync('package', { basedir: basedir, preserveSymlinks: false }); + + t.equal(fn, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + t.end(); +}); + +test('async symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + t.plan(2); + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + resolve('package', { basedir: basedir, preserveSymlinks: false }, function (err, result) { + t.notOk(err, 'no error'); + t.equal(result, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + }); +}); + +test('packageFilter', function (t) { + function relative(x) { + return path.relative(__dirname, x); + } + + function testPackageFilter(preserveSymlinks) { + return function (st) { + st.plan('is 1.x' ? 3 : 5); // eslint-disable-line no-constant-condition + + var destMain = 'symlinks/dest/node_modules/mod-a/index.js'; + var destPkg = 'symlinks/dest/node_modules/mod-a/package.json'; + var sourceMain = 'symlinks/source/node_modules/mod-a/index.js'; + var sourcePkg = 'symlinks/source/node_modules/mod-a/package.json'; + var destDir = path.join(__dirname, 'symlinks', 'dest'); + + /* eslint multiline-comment-style: 0 */ + /* v2.x will restore these tests + var packageFilterPath = []; + var actualPath = resolve.sync('mod-a', { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile, dir) { + packageFilterPath.push(pkgfile); + } + }); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'sync: actual path is correct' + ); + st.deepEqual( + map(packageFilterPath, relative), + map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize), + 'sync: packageFilter pkgfile arg is correct' + ); + */ + + var asyncPackageFilterPath = []; + resolve( + 'mod-a', + { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile) { + asyncPackageFilterPath.push(pkgfile); + } + }, + function (err, actualPath) { + st.error(err, 'no error'); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'async: actual path is correct' + ); + st.deepEqual( + map(asyncPackageFilterPath, relative), + map( + preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg], + path.normalize + ), + 'async: packageFilter pkgfile arg is correct' + ); + } + ); + }; + } + + t.test('preserveSymlinks: false', testPackageFilter(false)); + + t.test('preserveSymlinks: true', testPackageFilter(true)); + + t.end(); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/.bin/semver b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/.bin/semver new file mode 100644 index 0000000000000000000000000000000000000000..cd4636ac6704de73732e7da50f86ca0cb50dcd1d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/.bin/semver @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03f83d135afd4855683ff95d708f671593af782471daf4794ba9079178aa1b03 +size 4418 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/CHANGELOG.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..820d21e3322b9d2778786ea743dd5e818991d595 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..658c933d28255e8c716899789e8c0f846e5dc125 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0ee7634ddd0a4a6337fe7677e99ba78cd626fa07 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/README.md @@ -0,0 +1,437 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/node.js new file mode 100644 index 0000000000000000000000000000000000000000..7fc36fe6dbecbfd41530c5a490cc738ec2968653 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/package.json new file mode 100644 index 0000000000000000000000000000000000000000..191c8154787cb9f8662967d4c4f8f9f3467a2bbf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/package.json @@ -0,0 +1,51 @@ +{ + "name": "debug", + "version": "3.2.7", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "node.js", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "author": "TJ Holowaychuk ", + "contributors": [ + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + }, + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "unpkg": "./dist/debug.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/browser.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/browser.js new file mode 100644 index 0000000000000000000000000000000000000000..c924b0ac4d4882e4a72a116436ed17a487c2fc05 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/browser.js @@ -0,0 +1,180 @@ +"use strict"; + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +/** + * Colors. + */ + +exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ +// eslint-disable-next-line complexity + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); +} +/** + * Colorize log arguments if enabled. + * + * @api public + */ + + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); +} +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + +function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); +} +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } +} +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + +function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); +var formatters = module.exports.formatters; +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/common.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/common.js new file mode 100644 index 0000000000000000000000000000000000000000..e0de3fb530f1c2ea33c4c65bcfd39b98a53600d7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/common.js @@ -0,0 +1,249 @@ +"use strict"; + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + // Disabled? + if (!debug.enabled) { + return; + } + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @api public + */ + + + function disable() { + createDebug.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; +} + +module.exports = setup; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..021731593ac517b224bddda8c450bac52889843a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/index.js @@ -0,0 +1,12 @@ +"use strict"; + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/node.js new file mode 100644 index 0000000000000000000000000000000000000000..1e6a5f16aecdd38a2bfb607f3d82e299f7624f9a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/debug/src/node.js @@ -0,0 +1,177 @@ +"use strict"; + +/** + * Module dependencies. + */ +var tty = require('tty'); + +var util = require('util'); +/** + * This is the Node.js implementation of `debug()`. + */ + + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + var supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221]; + } +} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be. + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // Camel-case + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) { + return k.toUpperCase(); + }); // Coerce string value into JS value + + var val = process.env[key]; + + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); +} +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + + +function formatArgs(args) { + var name = this.namespace, + useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c); + var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m"); + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m"); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + + return new Date().toISOString() + ' '; +} +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + + +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + +function load() { + return process.env.DEBUG; +} +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + + +function init(debug) { + debug.inspectOpts = {}; + var keys = Object.keys(exports.inspectOpts); + + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); +var formatters = module.exports.formatters; +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(function (str) { return str.trim(); }) + .join(' '); +}; +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d3f7931041a9fadbc4ad975d16eee49f7e368f06 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/README.md @@ -0,0 +1,28 @@ +# enhanced-resolve + +Offers a async require.resolve function. It's highly configurable. + +[documentation](https://github.com/webpack/docs/wiki) + + +## Features + +* plugin system +* provide a custom filesystem +* sync and async node.js filesystems included + + +## Tests + +``` javascript +npm test +``` + +[![Build Status](https://secure.travis-ci.org/webpack/enhanced-resolve.png?branch=master)](http://travis-ci.org/webpack/enhanced-resolve) + + +## License + +Copyright (c) 2012-2013 Tobias Koppers + +MIT (http://www.opensource.org/licenses/mit-license.php) \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js new file mode 100644 index 0000000000000000000000000000000000000000..132f96531bde90d446f6a95991fe592257cf747f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js @@ -0,0 +1,152 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +function Storage(duration) { + this.duration = duration; + this.running = {}; + this.data = {}; + this.levels = []; + if(duration > 0) { + this.levels.push([], [], [], [], [], [], [], [], []); + for(var i = 8000; i < duration; i+=500) + this.levels.push([]); + } + this.count = 0; + this.interval = null; + this.needTickCheck = false; + this.nextTick = null; + this.passive = true; +} + +Storage.prototype.ensureTick = function() { + if(!this.interval && this.duration > 0 && !this.nextTick) + this.interval = setInterval(this.tick.bind(this), Math.floor(this.duration / this.levels.length)); +}; + +Storage.prototype.finished = function(name) { + var args = Array.prototype.slice.call(arguments, 1); + var callbacks = this.running[name]; + delete this.running[name]; + if(this.duration > 0) { + this.count++; + this.data[name] = args; + this.levels[0].push(name); + this.ensureTick(); + } + for(var i = 0; i < callbacks.length; i++) { + callbacks[i].apply(null, args); + } +}; + +Storage.prototype.provide = function(name, provider, callback) { + var running = this.running[name]; + if(running) { + running.push(callback); + return; + } + if(this.duration > 0) { + this.checkTicks(); + var data = this.data[name]; + if(data) { + return callback.apply(null, data); + } + } + this.running[name] = running = [callback]; + provider(name, this.finished.bind(this, name)); +}; + +Storage.prototype.tick = function() { + var decay = this.levels.pop(); + for(var i = decay.length - 1; i >= 0; i--) { + delete this.data[decay[i]]; + } + this.count -= decay.length; + decay.length = 0; + this.levels.unshift(decay); + if(this.count == 0) { + clearInterval(this.interval); + this.interval = null; + this.nextTick = null; + return true; + } else if(this.nextTick) { + this.nextTick += Math.floor(this.duration / this.levels.length); + var time = new Date().getTime(); + if(this.nextTick > time) { + this.nextTick = null; + this.interval = setInterval(this.tick.bind(this), Math.floor(this.duration / this.levels.length)); + return true; + } + } else if(this.passive) { + clearInterval(this.interval); + this.interval = null; + this.nextTick = new Date().getTime() + Math.floor(this.duration / this.levels.length); + } else { + this.passive = true; + } +}; + +Storage.prototype.checkTicks = function() { + this.passive = false; + if(this.nextTick) { + while(!this.tick()); + } +}; + +Storage.prototype.purge = function(what) { + if(!what) { + this.count = 0; + clearInterval(this.interval); + this.nextTick = null; + this.data = {}; + this.levels.forEach(function(level) { + level.length = 0; + }); + } else if(typeof what === "string") { + Object.keys(this.data).forEach(function(key) { + if(key.indexOf(what) === 0) + delete this.data[key]; + }, this); + } else { + for(var i = what.length - 1; i >= 0; i--) { + this.purge(what[i]); + } + } +}; + + +function CachedInputFileSystem(fileSystem, duration) { + this.fileSystem = fileSystem; + this._statStorage = new Storage(duration); + this._readdirStorage = new Storage(duration); + this._readFileStorage = new Storage(duration); + this._readlinkStorage = new Storage(duration); +} +module.exports = CachedInputFileSystem; + +CachedInputFileSystem.prototype.isSync = function() { + return this.fileSystem.isSync(); +}; + +CachedInputFileSystem.prototype.stat = function(path, callback) { + this._statStorage.provide(path, this.fileSystem.stat.bind(this.fileSystem), callback); +}; + +CachedInputFileSystem.prototype.readdir = function(path, callback) { + this._readdirStorage.provide(path, this.fileSystem.readdir.bind(this.fileSystem), callback); +}; + +CachedInputFileSystem.prototype.readFile = function(path, callback) { + this._readFileStorage.provide(path, this.fileSystem.readFile.bind(this.fileSystem), callback); +}; + +CachedInputFileSystem.prototype.readlink = function(path, callback) { + this._readlinkStorage.provide(path, this.fileSystem.readlink.bind(this.fileSystem), callback); +}; + +CachedInputFileSystem.prototype.purge = function(what) { + this._statStorage.purge(what); + this._readdirStorage.purge(what); + this._readFileStorage.purge(what); + this._readlinkStorage.purge(what); +}; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryDefaultFilePlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryDefaultFilePlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..f4514ff32246704ab87a000030d7b577ea374686 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryDefaultFilePlugin.js @@ -0,0 +1,42 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var createInnerCallback = require("./createInnerCallback"); + +function DirectoryDefaultFilePlugin(files) { + this.files = files; +} +module.exports = DirectoryDefaultFilePlugin; + +DirectoryDefaultFilePlugin.prototype.apply = function(resolver) { + var files = this.files; + resolver.plugin("directory", function(request, callback) { + var fs = this.fileSystem; + var topLevelCallback = callback; + var directory = this.join(request.path, request.request); + fs.stat(directory, function(err, stat) { + if(err || !stat) { + if(callback.log) callback.log(directory + " doesn't exist (directory default file)"); + return callback(); + } + if(!stat.isDirectory()) { + if(callback.log) callback.log(directory + " is not a directory (directory default file)"); + return callback(); + } + this.forEachBail(files, function(file, callback) { + this.doResolve("file", { + path: directory, + query: request.query, + request: file + }, createInnerCallback(function(err, result) { + if(!err && result) return callback(result); + return callback(); + }, topLevelCallback, "directory default file " + file)); + }.bind(this), function(result) { + if(!result) return callback(); + return callback(null, result); + }); + }.bind(this)); + }); +}; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryDescriptionFileFieldAliasPlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryDescriptionFileFieldAliasPlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..e9a44f2ced10e125ac9de99fa172475af2cf8d10 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryDescriptionFileFieldAliasPlugin.js @@ -0,0 +1,126 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var createInnerCallback = require("./createInnerCallback"); + +function DirectoryDescriptionFileFieldAliasPlugin(filename, field) { + this.filename = filename; + this.field = field; +} +module.exports = DirectoryDescriptionFileFieldAliasPlugin; + +function findDescriptionFileField(resolver, directory, filename, field, callback) { + (function findDescriptionFile() { + var descriptionFilePath = resolver.join(directory, filename); + resolver.fileSystem.readFile(descriptionFilePath, function(err, content) { + if(err) { + directory = cdUp(directory); + if(!directory) { + return callback(); + } else { + return findDescriptionFile(); + } + } + try { + content = JSON.parse(content); + } catch(e) { + if(callback.log) + callback.log(descriptionFilePath + " (directory description file): " + e); + else + e.message = descriptionFilePath + " (directory description file): " + e; + return callback(e); + } + var fieldData; + if(Array.isArray(field)) { + var current = content; + for(var j = 0; j < field.length; j++) { + if(current === null || typeof current !== "object") { + current = null; + break; + } + current = current[field[j]]; + } + if(typeof current === "object") { + fieldData = current; + } + } else { + if(typeof content[field] === "object") { + fieldData = content[field]; + } + } + if(!fieldData) return callback(); + callback(null, fieldData, directory); + }); + }()); +} + +function cdUp(directory) { + if(directory === "/") return null; + var i = directory.lastIndexOf("/"), + j = directory.lastIndexOf("\\"); + var p = i < 0 ? j : j < 0 ? i : i < j ? j : i; + if(p < 0) return null; + return directory.substr(0, p || 1); +} + +DirectoryDescriptionFileFieldAliasPlugin.prototype.apply = function(resolver) { + var filename = this.filename; + var field = this.field; + resolver.plugin("module", function(request, callback) { + var directory = request.path; + var moduleName = request.request; + findDescriptionFileField(this, directory, filename, field, function(err, fieldData, directory) { + if(err) return callback(err); + if(!fieldData) return callback(); + var data = fieldData[moduleName]; + if(data === moduleName) return callback(); + if(data === false) return callback(null, { + path: false, + resolved: true + }); + if(!data) return callback(); + var newRequest = this.parse(data); + var obj = { + path: directory, + request: newRequest.path, + query: newRequest.query, + directory: newRequest.directory + }; + var newCallback = createInnerCallback(callback, callback, "aliased from directory description file " + this.join(directory, filename) + " with mapping " + JSON.stringify(moduleName)); + if(newRequest.module) return this.doResolve("module", obj, newCallback); + if(newRequest.directory) return this.doResolve("directory", obj, newCallback); + return this.doResolve(["file", "directory"], obj, newCallback); + }.bind(this)); + }); + resolver.plugin("result", function(request, callback) { + var directory = cdUp(request.path); + var requestPath = request.path; + findDescriptionFileField(this, directory, filename, field, function(err, fieldData, directory) { + if(err) return callback(err); + if(!fieldData) return callback(); + var relative = requestPath.substr(directory.length+1).replace(/\\/g, "/"); + if(typeof fieldData[relative] !== "undefined") + var data = fieldData[relative]; + else if(typeof fieldData["./" + relative] !== "undefined") + var data = fieldData["./" + relative]; + if(data === relative || data === "./" + relative) return callback(); + if(data === false) return callback(null, { + path: false, + resolved: true + }); + if(!data) return callback(); + var newRequest = this.parse(data); + var obj = { + path: directory, + request: newRequest.path, + query: newRequest.query, + directory: newRequest.directory + }; + var newCallback = createInnerCallback(callback, callback, "aliased from directory description file " + this.join(directory, filename) + " with mapping " + JSON.stringify(relative)); + if(newRequest.module) return this.doResolve("module", obj, newCallback); + if(newRequest.directory) return this.doResolve("directory", obj, newCallback); + return this.doResolve(["file", "directory"], obj, newCallback); + }.bind(this)); + }); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryDescriptionFilePlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryDescriptionFilePlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..2cbc8c686e629885e06005a00068f454914b48c6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryDescriptionFilePlugin.js @@ -0,0 +1,74 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var createInnerCallback = require("./createInnerCallback"); + +function DirectoryDescriptionFilePlugin(filename, fields) { + this.filename = filename; + this.fields = fields; +} +module.exports = DirectoryDescriptionFilePlugin; + +DirectoryDescriptionFilePlugin.prototype.apply = function(resolver) { + var filename = this.filename; + var fields = this.fields; + resolver.plugin("directory", function(request, callback) { + var fs = this.fileSystem; + var directory = this.join(request.path, request.request); + var descriptionFilePath = this.join(directory, filename); + fs.readFile(descriptionFilePath, function(err, content) { + if(err) { + if(callback.log) + callback.log(descriptionFilePath + " doesn't exist (directory description file)"); + return callback(); + } + content = content.toString("utf-8"); + try { + content = JSON.parse(content); + } catch(e) { + if(callback.log) + callback.log(descriptionFilePath + " (directory description file): " + e); + else + e.message = descriptionFilePath + " (directory description file): " + e; + return callback(e); + } + var mainModules = []; + for(var i = 0; i < fields.length; i++) { + if(Array.isArray(fields[i])) { + var current = content; + for(var j = 0; j < fields[i].length; j++) { + if(current === null || typeof current !== "object") { + current = null; + break; + } + var field = fields[i][j]; + current = current[field]; + } + if(typeof current === "string") { + mainModules.push(current); + continue; + } + } else { + var field = fields[i]; + if(typeof content[field] === "string") { + mainModules.push(content[field]); + continue; + } + } + } + (function next() { + if(mainModules.length == 0) return callback(); + var mainModule = mainModules.shift(); + return this.doResolve(["file", "directory"], { + path: directory, + query: request.query, + request: mainModule + }, createInnerCallback(function(err, result) { + if(!err && result) return callback(null, result); + return next.call(this); + }.bind(this), callback, "use " + mainModule + " from " + filename)); + }.call(this)) + }.bind(this)); + }); +}; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryResultPlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryResultPlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..7ad57306efddc427b2da796843f1329e1f22d2ee --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/DirectoryResultPlugin.js @@ -0,0 +1,31 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +function DirectoryResultPlugin(files) { + this.files = files; +} +module.exports = DirectoryResultPlugin; + +DirectoryResultPlugin.prototype.apply = function(resolver) { + var files = this.files; + resolver.plugin("directory", function(request, callback) { + var fs = this.fileSystem; + var directory = this.join(request.path, request.request); + fs.stat(directory, function(err, stat) { + if(!err && stat && stat.isDirectory()) { + return this.doResolve("result", { + path: directory, + query: request.query, + directory: true, + resolved: true + }, callback); + } + if(callback.log) { + if(err) callback.log(directory + " doesn't exist"); + else callback.log(directory + " is not a directory"); + } + return callback(); + }.bind(this)); + }); +}; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/FileAppendPlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/FileAppendPlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..1be582a4eaa11c0143953a36017f32396926adab --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/FileAppendPlugin.js @@ -0,0 +1,40 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +function FileAppendPlugin(appendings) { + this.appendings = appendings; +} +module.exports = FileAppendPlugin; + +FileAppendPlugin.prototype.apply = function(resolver) { + var appendings = this.appendings; + resolver.plugin("file", function(request, callback) { + var fs = this.fileSystem; + var addr = this.join(request.path, request.request); + var addrs = appendings.map(function(a) { return addr + a }); + var log = callback.log; + var missing = callback.missing; + this.forEachBail(addrs, function(addr, callback) { + fs.stat(addr, function(err, stat) { + if(!err && stat && stat.isFile()) + return callback(addr); + if(missing && err) + missing.push(addr); + if(log) { + if(err) log(addr + " doesn't exist"); + else log(addr + " is not a file"); + } + return callback(); + }); + }, function(validAddr) { + if(!validAddr) return callback(); + return this.doResolve("result", { + path: validAddr, + query: request.query, + file: true, + resolved: true + }, callback); + }.bind(this)); + }); +}; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleAliasPlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleAliasPlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..eaa692675ca0d3ca46c6c6b98db6200dddd275e7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleAliasPlugin.js @@ -0,0 +1,44 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var createInnerCallback = require("./createInnerCallback"); + +function ModuleAliasPlugin(aliasMap) { + this.aliasMap = aliasMap; +} +module.exports = ModuleAliasPlugin; + +ModuleAliasPlugin.prototype.apply = function(resolver) { + var aliasMap = this.aliasMap; + resolver.plugin("module", function(request, callback) { + var fs = this.fileSystem; + var keys = Object.keys(aliasMap); + var i = 0; + (function next() { + for(;i < keys.length; i++) { + var aliasName = keys[i]; + var onlyModule = /\$$/.test(aliasName); + if(onlyModule) aliasName = aliasName.substr(0, aliasName.length-1); + if((!onlyModule && request.request.indexOf(aliasName + "/") === 0) || request.request === aliasName) { + var aliasValue = aliasMap[keys[i]]; + if(request.request.indexOf(aliasValue + "/") !== 0 && request.request != aliasValue) { + var newRequestStr = aliasValue + request.request.substr(aliasName.length); + var newRequest = this.parse(newRequestStr); + var obj = { + path: request.path, + request: newRequest.path, + query: newRequest.query, + directory: newRequest.directory + }; + var newCallback = createInnerCallback(callback, callback, "aliased with mapping " + JSON.stringify(aliasName) + ": " + JSON.stringify(aliasValue) + " to " + newRequestStr); + if(newRequest.module) return this.doResolve("module", obj, newCallback); + if(newRequest.directory) return this.doResolve("directory", obj, newCallback); + return this.doResolve(["file", "directory"], obj, newCallback); + } + } + } + return callback(); + }.call(this)); + }); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleAsDirectoryPlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleAsDirectoryPlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..e058fcf9c3972fdb1d23b256aaab64191d22b59f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleAsDirectoryPlugin.js @@ -0,0 +1,43 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +function ModuleAsDirectoryPlugin(moduleType) { + this.moduleType = moduleType; +} +module.exports = ModuleAsDirectoryPlugin; + +ModuleAsDirectoryPlugin.prototype.apply = function(resolver) { + resolver.plugin("module-" + this.moduleType, function(request, callback) { + var fs = this.fileSystem; + var i = request.request.indexOf("/"), + j = request.request.indexOf("\\"); + var p = i < 0 ? j : j < 0 ? i : i < j ? i : j; + var moduleName, remainingRequest; + if(p < 0) { + moduleName = request.request; + remainingRequest = ""; + } else { + moduleName = request.request.substr(0, p); + remainingRequest = request.request.substr(p+1); + } + var modulePath = this.join(request.path, moduleName); + fs.stat(modulePath, function(err, stat) { + if(err || !stat) { + if(callback.missing) + callback.missing.push(modulePath); + if(callback.log) callback.log(modulePath + " doesn't exist (module as directory)"); + return callback(); + } + if(stat.isDirectory()) { + return this.doResolve(request.directory ? "directory" : ["file", "directory"], { + path: modulePath, + request: remainingRequest, + query: request.query + }, callback, true); + } + if(callback.log) callback.log(modulePath + " is not a directory (module as directory)"); + return callback(); + }.bind(this)); + }); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleAsFilePlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleAsFilePlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..7d6fadba35c7b312c7725b96e24396410e498a76 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleAsFilePlugin.js @@ -0,0 +1,18 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +function ModuleAsFilePlugin(moduleType) { + this.moduleType = moduleType; +} +module.exports = ModuleAsFilePlugin; + +ModuleAsFilePlugin.prototype.apply = function(resolver) { + resolver.plugin("module-" + this.moduleType, function(request, callback) { + var fs = this.fileSystem; + var i = request.request.indexOf("/"), + j = request.request.indexOf("\\"); + if(i >= 0 || j >= 0 || request.directory) return callback(); + return this.doResolve("file", request, callback, true); + }); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleTemplatesPlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleTemplatesPlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..2962ee276abed02c9b9be8ed3b35a0c41646c98a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModuleTemplatesPlugin.js @@ -0,0 +1,45 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var createInnerCallback = require("./createInnerCallback"); + +function ModuleTemplatesPlugin(moduleType, templates, targetModuleType) { + this.moduleType = moduleType; + this.targetModuleType = targetModuleType; + this.templates = templates; +} +module.exports = ModuleTemplatesPlugin; + +ModuleTemplatesPlugin.prototype.apply = function(resolver) { + var templates = this.templates; + var targetModuleType = this.targetModuleType; + resolver.plugin("module-" + this.moduleType, function(request, callback) { + var fs = this.fileSystem; + var topLevelCallback = callback; + var i = request.request.indexOf("/"), + j = request.request.indexOf("\\"); + var p = i < 0 ? j : j < 0 ? i : i < j ? i : j; + var moduleName, remainingRequest; + if(p < 0) { + moduleName = request.request; + remainingRequest = ""; + } else { + moduleName = request.request.substr(0, p); + remainingRequest = request.request.substr(p); + } + this.forEachBail(templates, function(template, callback) { + var moduleFinalName = template.replace(/\*/g, moduleName); + this.applyPluginsParallelBailResult("module-" + targetModuleType, { + path: request.path, + request: moduleFinalName + remainingRequest, + query: request.query, + directory: request.directory + }, createInnerCallback(function(err, result) { + if(err) return callback(err); + if(!result) return callback(); + return callback(null, result); + }, topLevelCallback, "module variation " + moduleFinalName)); + }.bind(this), callback); + }); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModulesInDirectoriesPlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModulesInDirectoriesPlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..3b801c017bc57c8303750ececc09a91a4e2c5329 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModulesInDirectoriesPlugin.js @@ -0,0 +1,58 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var createInnerCallback = require("./createInnerCallback"); +var popPathSeqment = require("./popPathSeqment"); + +function ModulesInDirectoriesPlugin(moduleType, directories) { + this.moduleType = moduleType; + this.directories = directories; +} +module.exports = ModulesInDirectoriesPlugin; + +ModulesInDirectoriesPlugin.prototype.apply = function(resolver) { + var moduleType = this.moduleType; + var directories = this.directories; + resolver.plugin("module", function(request, callback) { + var fs = this.fileSystem; + var paths = [request.path]; + var addr = [request.path]; + var pathSeqment = popPathSeqment(addr); + var topLevelCallback = callback; + while(pathSeqment) { + paths.push(addr[0]); + pathSeqment = popPathSeqment(addr); + } + var addrs = paths.map(function(p) { + return directories.map(function(d) { + return this.join(p, d); + }, this); + }, this).reduce(function(array, p) { + array.push.apply(array, p); + return array; + }, []); + this.forEachBail(addrs, function(addr, callback) { + fs.stat(addr, function(err, stat) { + if(!err && stat && stat.isDirectory()) { + this.applyPluginsParallelBailResult("module-" + moduleType, { + path: addr, + request: request.request, + query: request.query, + directory: request.directory + }, createInnerCallback(function(err, result) { + if(err) return callback(err); + if(!result) return callback(); + return callback(null, result); + }, topLevelCallback, "looking for modules in " + addr)); + return; + } + return callback(); + }.bind(this)); + }.bind(this), function(err, result) { + if(err) return callback(err); + if(!result) return callback(); + return callback(null, result); + }); + }); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModulesInRootPlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModulesInRootPlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..2b2ab6aebed334951c9193cbcb5a22248db48696 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ModulesInRootPlugin.js @@ -0,0 +1,28 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var createInnerCallback = require("./createInnerCallback"); + +function ModulesInRootPlugin(moduleType, path) { + this.moduleType = moduleType; + this.path = path; +} +module.exports = ModulesInRootPlugin; + +ModulesInRootPlugin.prototype.apply = function(resolver) { + var moduleType = this.moduleType; + var path = this.path; + resolver.plugin("module", function(request, callback) { + this.applyPluginsParallelBailResult("module-" + moduleType, { + path: path, + request: request.request, + query: request.query, + directory: request.directory + }, createInnerCallback(function innerCallback(err, result) { + if(err) return callback(err); + if(!result) return callback(); + return callback(null, result); + }, callback, "looking for modules in " + path)); + }); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/NodeJsInputFileSystem.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/NodeJsInputFileSystem.js new file mode 100644 index 0000000000000000000000000000000000000000..588095d8e1c3a4a4a6251874ea4ed7c09edc163d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/NodeJsInputFileSystem.js @@ -0,0 +1,23 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var fs = require("graceful-fs"); + +function NodeJsInputFileSystem() {} +module.exports = NodeJsInputFileSystem; + +NodeJsInputFileSystem.prototype.isSync = function() { + return false; +}; + +NodeJsInputFileSystem.prototype.stat = fs.stat.bind(fs); +NodeJsInputFileSystem.prototype.readdir = function readdir(path, callback) { + fs.readdir(path, function (err, files) { + callback(err, files && files.map(function (file) { + return file.normalize ? file.normalize("NFC") : file; + })); + }); +}; +NodeJsInputFileSystem.prototype.readFile = fs.readFile.bind(fs); +NodeJsInputFileSystem.prototype.readlink = fs.readlink.bind(fs); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/Resolver.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/Resolver.js new file mode 100644 index 0000000000000000000000000000000000000000..62e57d92a7bd989d3fcd4168d145ef0349fc8ec7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/Resolver.js @@ -0,0 +1,200 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var Tapable = require("tapable"); +var createInnerCallback = require("./createInnerCallback"); + +function Resolver(fileSystem) { + Tapable.call(this); + this.fileSystem = fileSystem; +} +module.exports = Resolver; + +Resolver.prototype = Object.create(Tapable.prototype); + +Resolver.prototype.resolveSync = function resolveSync(context, request) { + var err, result, sync = false; + this.resolve(context, request, function(e, r) { + err = e; + result = r; + sync = true; + }); + if(!sync) throw new Error("Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!"); + if(err) throw err; + return result; +}; + +Resolver.prototype.resolve = function resolve(context, request, callback) { + if(typeof request === "string") request = this.parse(request); + this.applyPlugins("resolve", context, request); + var obj = { + path: context, + request: request.path, + query: request.query, + directory: request.directory + }; + function onResolved(err, result) { + if(err) return callback(err); + return callback(null, result.path === false ? false : result.path + (result.query || "")); + } + onResolved.log = callback.log; + onResolved.missing = callback.missing; + if(request.module) return this.doResolve("module", obj, onResolved); + if(request.directory) return this.doResolve("directory", obj, onResolved); + return this.doResolve(["file", "directory"], obj, onResolved); +}; + +Resolver.prototype.doResolve = function doResolve(types, request, callback, noError) { + if(!Array.isArray(types)) types = [types]; + var stackLine = types.join(" or ") + ": (" + request.path + ") " + + (request.request || "") + (request.query || "") + + (request.directory ? " directory" : "") + + (request.module ? " module" : ""); + var newStack = [stackLine]; + if(callback.stack) { + newStack = callback.stack.concat(newStack); + if(callback.stack.indexOf(stackLine) >= 0) { + // Prevent recursion + var recursionError = new Error("Recursion in resolving\nStack:\n " + newStack.join("\n ")); + recursionError.recursion = true; + if(callback.log) callback.log("abort resolving because of recursion"); + return callback(recursionError); + } + } + this.applyPlugins("resolve-step", types, request); + var localMissing = []; + var missing = callback.missing ? { + push: function(item) { + callback.missing.push(item); + localMissing.push(item); + } + } : localMissing; + var log = []; + function writeLog(msg) { + log.push(msg); + } + function logAsString() { + return log.join("\n"); + } + var currentRequestString = request.request ? request.request + " in " + request.path : request.path; + if(types.length == 1 && !noError) { + // If only one type, we can pass the error. + return this.applyPluginsParallelBailResult(types[0], request, createInnerCallback(function innerCallback(err, result) { + if(callback.log) { + for(var i = 0; i < log.length; i++) + callback.log(log[i]); + } + if(err) return callback(err); + if(result) return callback(null, result); + if(types[0] === "result") return callback(null, request); + var error = new Error("Cannot resolve " + types[0] + " '" + request.request + "' in " + request.path); + error.details = logAsString(); + error.missing = localMissing; + return callback(error); + }, { + log: writeLog, + missing: missing, + stack: newStack + }, "resolve " + types[0] + " " + currentRequestString)); + } + // For multiple type we list the errors in the details although some of them are not important + this.forEachBail(types, function(type, callback) { + this.applyPluginsParallelBailResult(type, request, createInnerCallback(function(err, result) { + if(!err && result) return callback(result); + if (err) { + (err.message || "").split("\n").forEach(function(line) { + log.push(" " + line); + }); + } + callback(); + }, { + log: writeLog, + missing: missing, + stack: newStack + }, "resolve " + type)); + }.bind(this), function(result) { + if(callback.log) { + callback.log("resolve '" + types.join("' or '") + "' " + currentRequestString); + for(var i = 0; i < log.length; i++) + callback.log(" " + log[i]); + } + if(noError && !result) return callback(); + if(result) return callback(null, result); + var error = new Error("Cannot resolve '" + types.join("' or '") + "' " + currentRequestString); + error.details = logAsString(); + error.missing = localMissing; + return callback(error); + }); +}; + +Resolver.prototype.parse = function parse(identifier) { + if(identifier === "") return null; + var part = { + path: null, + query: null, + module: false, + directory: false, + file: false + }; + var idxQuery = identifier.indexOf("?"); + if(idxQuery == 0) { + part.query = identifier; + } else if(idxQuery > 0) { + part.path = identifier.slice(0, idxQuery); + part.query = identifier.slice(idxQuery); + } else { + part.path = identifier; + } + if(part.path) { + part.module = this.isModule(part.path); + if(part.directory = this.isDirectory(part.path)) { + part.path = part.path.substr(0, part.path.length - 1); + } + } + return part; +}; + +var notModuleRegExp = /^\.$|^\.[\\\/]|^\.\.$|^\.\.[\/\\]|^\/|^[A-Z]:[\\\/]/i; +Resolver.prototype.isModule = function isModule(path) { + return !notModuleRegExp.test(path); +}; + +var directoryRegExp = /[\/\\]$/i; +Resolver.prototype.isDirectory = function isDirectory(path) { + return directoryRegExp.test(path); +}; + +Resolver.prototype.join = require("memory-fs/lib/join"); + +Resolver.prototype.normalize = require("memory-fs/lib/normalize"); + +Resolver.prototype.forEachBail = function(array, iterator, callback) { + if(array.length == 0) return callback(); + var currentPos = array.length; + var currentError, currentResult; + var done = []; + for(var i = 0; i < array.length; i++) { + var itCb = (function(i) { + return function() { + if(i >= currentPos) return; // ignore + var args = Array.prototype.slice.call(arguments); + done.push(i); + if(args.length > 0) { + currentPos = i + 1; + done = done.filter(function(item) { + return item <= i; + }); + currentResult = args; + } + if(done.length == currentPos) { + callback.apply(null, currentResult); + currentPos = 0; + } + }; + }(i)); + iterator(array[i], itCb); + if(currentPos == 0) break; + } +}; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ResultSymlinkPlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ResultSymlinkPlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..9d4fac2a2c34dc6a82abab7ac6d62a45dcac0ffb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/ResultSymlinkPlugin.js @@ -0,0 +1,49 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var popPathSeqment = require("./popPathSeqment"); + +function ResultSymlinkPlugin(appendings) { +} +module.exports = ResultSymlinkPlugin; + +ResultSymlinkPlugin.prototype.apply = function(resolver) { + resolver.plugin("result", function pluginMethod(request, callback) { + var fs = this.fileSystem; + var paths = [request.path]; + var pathSeqments = []; + var addr = [request.path]; + var pathSeqment = popPathSeqment(addr); + while(pathSeqment) { + pathSeqments.push(pathSeqment); + paths.push(addr[0]); + pathSeqment = popPathSeqment(addr); + } + pathSeqments.push(paths[paths.length-1]); + var log = callback.log; + var missing = callback.missing; + var containsSymlink = false; + this.forEachBail(paths.map(function(_, i) { return i; }), function(idx, callback) { + fs.readlink(paths[idx], function(err, result) { + if(!err && result) { + pathSeqments[idx] = result; + containsSymlink = true; + // Shortcut when absolute symlink found + if(/^(\/|[a-zA-z]:($|\\))/.test(result)) + return callback(null, idx); + } + callback(); + }); + }, function(err, idx) { + if(!containsSymlink) return callback(); + var resultSeqments = typeof idx === "number" ? pathSeqments.slice(0, idx+1) : pathSeqments.slice(); + var result = resultSeqments.reverse().reduce(function(a, b) { + return this.join(a, b); + }.bind(this)); + log("resolved symlink to " + result); + request.path = result; + pluginMethod.call(this, request, callback); + }.bind(this)); + }); +}; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/SyncNodeJsInputFileSystem.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/SyncNodeJsInputFileSystem.js new file mode 100644 index 0000000000000000000000000000000000000000..9fc036a7a5224bbd2a8c814121b5905270a93f1a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/SyncNodeJsInputFileSystem.js @@ -0,0 +1,34 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var fs = require("graceful-fs"); + +function SyncNodeJsInputFileSystem() {} +module.exports = SyncNodeJsInputFileSystem; + +SyncNodeJsInputFileSystem.prototype.isSync = function() { + return true; +}; + +function asAsync(fn, context) { + return function() { + var args = Array.prototype.slice.call(arguments); + var callback = args.pop(); + try { + callback(null, fn.apply(context, args)); + } catch(e) { + callback(e); + } + }; +} + +SyncNodeJsInputFileSystem.prototype.stat = asAsync(fs.statSync, fs); +SyncNodeJsInputFileSystem.prototype.readdir = asAsync(function readdirSync(path) { + var files = fs.readdirSync(path); + return files && files.map(function (file) { + return file.normalize ? file.normalize("NFC") : file; + }); +}, fs); +SyncNodeJsInputFileSystem.prototype.readFile = asAsync(fs.readFileSync, fs); +SyncNodeJsInputFileSystem.prototype.readlink = asAsync(fs.readlinkSync, fs); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js new file mode 100644 index 0000000000000000000000000000000000000000..8806b1ca3de05c849e4be9d46ef7268bf5c3c0d1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js @@ -0,0 +1,32 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +function UnsafeCachePlugin(regExps, cache) { + this.regExps = regExps || [/./]; + if(this.regExps === true) this.regExps = [/./]; + else if(!Array.isArray(this.regExps)) this.regExps = [this.regExps]; + this.cache = cache || {}; +} +module.exports = UnsafeCachePlugin; + +UnsafeCachePlugin.prototype.apply = function(resolver) { + var oldResolve = resolver.resolve; + var regExps = this.regExps; + var cache = this.cache; + resolver.resolve = function resolve(context, request, callback) { + var id = context + "->" + request; + if(cache[id]) { + // From cache + return callback(null, cache[id]); + } + oldResolve.call(resolver, context, request, function(err, result) { + if(err) return callback(err); + var doCache = regExps.some(function(regExp) { + return regExp.test(result.path); + }); + if(!doCache) return callback(null, result); + callback(null, cache[id] = result); + }); + }; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js new file mode 100644 index 0000000000000000000000000000000000000000..66fc772a92b960e103c3b151b24f6a0904b79be7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js @@ -0,0 +1,30 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +module.exports = function createInnerCallback(callback, options, message) { + var log = options.log; + if(!log) { + if(options.stack !== callback.stack) { + function callbackWrapper() { + return callback.apply(this, arguments); + } + callbackWrapper.stack = options.stack; + callbackWrapper.missing = options.missing; + } + return callback; + } + function loggingCallbackWrapper() { + log(message); + for(var i = 0; i < theLog.length; i++) + log(" " + theLog[i]); + return callback.apply(this, arguments); + } + var theLog = []; + loggingCallbackWrapper.log = function writeLog(msg) { + theLog.push(msg); + }; + loggingCallbackWrapper.stack = options.stack; + loggingCallbackWrapper.missing = options.missing; + return loggingCallbackWrapper; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/node.js new file mode 100644 index 0000000000000000000000000000000000000000..22c65905c4fe6e41e8d8ab074a81f8b1e77acb43 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/node.js @@ -0,0 +1,103 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var Resolver = require("./Resolver"); +var NodeJsInputFileSystem = require("./NodeJsInputFileSystem"); +var SyncNodeJsInputFileSystem = require("./SyncNodeJsInputFileSystem"); +var CachedInputFileSystem = require("./CachedInputFileSystem"); +var ModulesInDirectoriesPlugin = require("./ModulesInDirectoriesPlugin"); +var ModuleTemplatesPlugin = require("./ModuleTemplatesPlugin"); +var ModuleAsFilePlugin = require("./ModuleAsFilePlugin"); +var ModuleAsDirectoryPlugin = require("./ModuleAsDirectoryPlugin"); +var DirectoryDefaultFilePlugin = require("./DirectoryDefaultFilePlugin"); +var DirectoryDescriptionFilePlugin = require("./DirectoryDescriptionFilePlugin"); +var FileAppendPlugin = require("./FileAppendPlugin"); +var ResultSymlinkPlugin = require("./ResultSymlinkPlugin"); +var DirectoryResultPlugin = require("./DirectoryResultPlugin"); + +var commonPlugins = [ + new ModulesInDirectoriesPlugin("node", ["node_modules"]), + new ModuleAsFilePlugin("node"), + new ModuleAsDirectoryPlugin("node"), + new DirectoryDescriptionFilePlugin("package.json", ["main"]), + new DirectoryDefaultFilePlugin(["index"]), + new FileAppendPlugin(["", ".js", ".node"]), + new ResultSymlinkPlugin() +]; + +var commonContextPlugins = [ + new ModulesInDirectoriesPlugin("node", ["node_modules"]), + new ModuleAsFilePlugin("node"), + new ModuleAsDirectoryPlugin("node"), + new DirectoryResultPlugin(), + new ResultSymlinkPlugin() +]; + +var commonLoaderPlugins = [ + new ModulesInDirectoriesPlugin("loader-module", ["node_loaders", "node_modules"]), + new ModuleTemplatesPlugin("loader-module", ["*-loader", "*"], "node"), + new ModuleAsFilePlugin("node"), + new ModuleAsDirectoryPlugin("node"), + new DirectoryDescriptionFilePlugin("package.json", ["loader", "main"]), + new DirectoryDefaultFilePlugin(["index"]), + new FileAppendPlugin([".loader.js", "", ".js"]), + new ResultSymlinkPlugin() +]; + +var asyncFileSystem = new CachedInputFileSystem(new NodeJsInputFileSystem(), 4000); +var syncFileSystem = new CachedInputFileSystem(new SyncNodeJsInputFileSystem(), 4000); + + +var asyncResolver = new Resolver(asyncFileSystem); +asyncResolver.apply.apply(asyncResolver, commonPlugins); +module.exports = function resolve(context, request, callback) { + asyncResolver.resolve(context, request, callback); +}; + +var syncResolver = new Resolver(syncFileSystem); +syncResolver.apply.apply(syncResolver, commonPlugins); +module.exports.sync = function resolveSync(context, request) { + return syncResolver.resolveSync(context, request); +}; + + +var asyncContextResolver = new Resolver(asyncFileSystem); +asyncContextResolver.apply.apply(asyncContextResolver, commonContextPlugins); +module.exports.context = function resolveContext(context, request, callback) { + asyncContextResolver.resolve(context, request, callback); +}; + +var syncContextResolver = new Resolver(syncFileSystem); +syncContextResolver.apply.apply(syncContextResolver, commonContextPlugins); +module.exports.context.sync = function resolveSync(context, request) { + return syncContextResolver.resolveSync(context, request); +}; + + +var asyncLoaderResolver = new Resolver(asyncFileSystem); +asyncLoaderResolver.apply.apply(asyncLoaderResolver, commonLoaderPlugins); +module.exports.loader = function resolveContext(context, request, callback) { + asyncLoaderResolver.resolve(context, request, callback); +}; + +var syncLoaderResolver = new Resolver(syncFileSystem); +syncLoaderResolver.apply.apply(syncLoaderResolver, commonLoaderPlugins); +module.exports.loader.sync = function resolveSync(context, request) { + return syncLoaderResolver.resolveSync(context, request); +}; + +// Export Resolver, FileSystems and Plugins +module.exports.Resolver = Resolver; +module.exports.NodeJsInputFileSystem = NodeJsInputFileSystem; +module.exports.SyncNodeJsInputFileSystem = SyncNodeJsInputFileSystem; +module.exports.CachedInputFileSystem = CachedInputFileSystem; +module.exports.ModulesInDirectoriesPlugin = ModulesInDirectoriesPlugin; +module.exports.ModuleAsDirectoryPlugin = ModuleAsDirectoryPlugin; +module.exports.DirectoryDefaultFilePlugin = DirectoryDefaultFilePlugin; +module.exports.DirectoryDescriptionFilePlugin = DirectoryDescriptionFilePlugin; +module.exports.FileAppendPlugin = FileAppendPlugin; +module.exports.DirectoryResultPlugin = DirectoryResultPlugin; +module.exports.ResultSymlinkPlugin = ResultSymlinkPlugin; +module.exports.ModuleAsFilePlugin = ModuleAsFilePlugin; +module.exports.ModuleTemplatesPlugin = ModuleTemplatesPlugin; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/popPathSeqment.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/popPathSeqment.js new file mode 100644 index 0000000000000000000000000000000000000000..7eea05c2dd48541d26f6b721a4ac4c318b57b6bc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/lib/popPathSeqment.js @@ -0,0 +1,13 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +module.exports = function popPathSeqment(pathInArray) { + var i = pathInArray[0].lastIndexOf("/"), + j = pathInArray[0].lastIndexOf("\\"); + var p = i < 0 ? j : j < 0 ? i : i < j ? j : i; + if(p < 0) return null; + var s = pathInArray[0].substr(p+1); + pathInArray[0] = pathInArray[0].substr(0, p || 1); + return s; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f603231c42f91bb4938a6169bdd1ed1582aa5843 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/enhanced-resolve/package.json @@ -0,0 +1,38 @@ +{ + "name": "enhanced-resolve", + "version": "0.9.1", + "author": "Tobias Koppers @sokra", + "description": "Offers a async require.resolve function. It's highly configurable.", + "files": [ + "lib" + ], + "dependencies": { + "tapable": "^0.1.8", + "memory-fs": "^0.2.0", + "graceful-fs": "^4.1.2" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + } + ], + "devDependencies": { + "istanbul": "^0.3.5", + "mocha": "^2.1.0", + "should": "^4.6.0" + }, + "engines": { + "node": ">=0.6" + }, + "main": "lib/node.js", + "homepage": "http://github.com/webpack/enhanced-resolve", + "scripts": { + "test": "mocha --reporter spec", + "cover": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec" + }, + "repository": { + "type": "git", + "url": "git://github.com/webpack/enhanced-resolve.git" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..19129e315fe593965a2fdd50ec0d1253bcbd2ece --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f8dfa5a0df5fc454d87c54fb702ad3c245a6b524 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/README.md @@ -0,0 +1,412 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install --save semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero digit in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/bin/semver b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/bin/semver new file mode 100644 index 0000000000000000000000000000000000000000..801e77f1303c153987fb9cec7fae3c06ddf0206a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/bin/semver @@ -0,0 +1,160 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/package.json new file mode 100644 index 0000000000000000000000000000000000000000..db035e97d98209b4f09aeaf7ebbfb184691780c8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/package.json @@ -0,0 +1,38 @@ +{ + "name": "semver", + "version": "5.7.2", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap test/ --100 --timeout=30", + "lint": "echo linting disabled", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap test/ --100 --timeout=30", + "posttest": "npm run lint" + }, + "devDependencies": { + "@npmcli/template-oss": "4.17.0", + "tap": "^12.7.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "./bin/semver" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "content": "./scripts/template-oss", + "version": "4.17.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/range.bnf b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/range.bnf new file mode 100644 index 0000000000000000000000000000000000000000..d4c6ae0d76c9ac0c10c93062e5ff9cec277b07cd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/semver.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/semver.js new file mode 100644 index 0000000000000000000000000000000000000000..dcb68334150b207485cff109830c88f236331a33 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/semver/semver.js @@ -0,0 +1,1525 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +// The actual regexps go on exports.re +var re = exports.re = [] +var safeRe = exports.safeRe = [] +var src = exports.src = [] +var R = 0 + +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++ +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' +var NUMERICIDENTIFIERLOOSE = R++ +src[NUMERICIDENTIFIERLOOSE] = '\\d+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++ +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++ +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')' + +var MAINVERSIONLOOSE = R++ +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++ +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +var PRERELEASEIDENTIFIERLOOSE = R++ +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++ +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' + +var PRERELEASELOOSE = R++ +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++ +src[BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++ +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++ +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?' + +src[FULL] = '^' + FULLPLAIN + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?' + +var LOOSE = R++ +src[LOOSE] = '^' + LOOSEPLAIN + '$' + +var GTLT = R++ +src[GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++ +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +var XRANGEIDENTIFIER = R++ +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' + +var XRANGEPLAIN = R++ +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGEPLAINLOOSE = R++ +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGE = R++ +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' +var XRANGELOOSE = R++ +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +var COERCE = R++ +src[COERCE] = '(?:^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++ +src[LONETILDE] = '(?:~>?)' + +var TILDETRIM = R++ +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') +safeRe[TILDETRIM] = new RegExp(makeSafeRe(src[TILDETRIM]), 'g') +var tildeTrimReplace = '$1~' + +var TILDE = R++ +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' +var TILDELOOSE = R++ +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++ +src[LONECARET] = '(?:\\^)' + +var CARETTRIM = R++ +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') +safeRe[CARETTRIM] = new RegExp(makeSafeRe(src[CARETTRIM]), 'g') +var caretTrimReplace = '$1^' + +var CARET = R++ +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' +var CARETLOOSE = R++ +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++ +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' +var COMPARATOR = R++ +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++ +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') +safeRe[COMPARATORTRIM] = new RegExp(makeSafeRe(src[COMPARATORTRIM]), 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++ +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$' + +var HYPHENRANGELOOSE = R++ +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +var STAR = R++ +src[STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? safeRe[LOOSE] : safeRe[FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? safeRe[LOOSE] : safeRe[FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compare(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.rcompare(a, b, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY) { + return true + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + this.raw) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(safeRe[TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(safeRe[CARETTRIM], caretTrimReplace) + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return thisComparators.every(function (thisComparator) { + return range.set.some(function (rangeComparators) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + }) + }) +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? safeRe[XRANGELOOSE] : safeRe[XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(safeRe[STAR], '') +} + +// This function is passed to string.replace(safeRe[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version) { + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + var match = version.match(safeRe[COERCE]) + + if (match == null) { + return null + } + + return parse(match[1] + + '.' + (match[2] || '0') + + '.' + (match[3] || '0')) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/.gitattributes b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..4ee658a7a763b5d19ac9646e5c4c39f8c2afa1c5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/.npmignore b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..6be20218404cbd1f75d46849d6a5c167fba78def --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/.npmignore @@ -0,0 +1,11 @@ +/node_modules + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/.travis.yml b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..90afc1edff06fa799e65bcde2d3c149933175089 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.8 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/README.md new file mode 100644 index 0000000000000000000000000000000000000000..41fb15c84721079d427e4b2e10fdb3fd30def403 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/README.md @@ -0,0 +1,155 @@ +# Tapable + +``` javascript +var Tapable = require("tapable"); +``` + +`Tapable` is a class for plugin binding and applying. + +Just extend it. + +``` javascript +function MyClass() { + Tapable.call(this); +} + +MyClass.prototype = Object.create(Tapable.prototype); + +MyClass.prototype.method = function() {}; +``` + +Or mix it in. + +``` javascript +function MyClass2() { + EventEmitter.call(this); + Tapable.call(this); +} + +MyClass2.prototype = Object.create(EventEmitter.prototype); +Tapable.mixin(MyClass2.prototype); + +MyClass2.prototype.method = function() {}; +``` + +## Public functions + +### apply + +``` javascript +void apply(plugins: Plugin...) +``` + +Attaches all plugins passed as arguments to the instance, by calling `apply` on them. + +### plugin + +``` javascript +void plugin(names: string|string[], handler: Function) +``` + +`names` are the names (or a single name) of the plugin interfaces the class provides. + +`handler` is a callback function. The signature depends on the class. `this` is the instance of the class. + +### restartApplyPlugins + +``` javascript +void restartApplyPlugins() +``` + +Should only be called from a handler function. + +It restarts the process of applying handers. + +## Protected functions + +### applyPlugins + +``` javascript +void applyPlugins(name: string, args: any...) +``` + +Synchronous applies all registered handers for `name`. The handler functions are called with all args. + +### applyPluginsWaterfall + +``` javascript +any applyPluginsWaterfall(name: string, init: any, args: any...) +``` + +Synchronous applies all registered handers for `name`. The handler functions are called with the return value of the previous handler and all args. For the first handler `init` is used and the return value of the last handler is return by `applyPluginsWaterfall` + +### applyPluginsAsync + +``` javascript +void applyPluginsAsync( + name: string, + args: any..., + callback: (err?: Error) -> void +) +``` + +Asynchronously applies all registered handers for `name`. The handler functions are called with all args and a callback function with the signature `(err?: Error) -> void`. The hander functions are called in order of registration. + +`callback` is called after all handlers are called. + +### applyPluginsBailResult + +``` javascript +any applyPluginsBailResult(name: string, args: any...) +``` + +Synchronous applies all registered handers for `name`. The handler function are called with all args. If a handler function returns something `!== undefined`, the value is returned and no more handers are applied. + +### applyPluginsAsyncWaterfall + +``` javascript +applyPluginsAsyncWaterfall( + name: string, + init: any, + callback: (err: Error, result: any) -> void +) +``` + +Asynchronously applies all registered handers for `name`. The hander functions are called with the current value and a callback function with the signature `(err: Error, nextValue: any) -> void`. When called `nextValue` is the current value for the next handler. The current value for the first handler is `init`. After all handlers are applied, `callback` is called with the last value. If any handler passes a value for `err`, the `callback` is called with this error and no more handlers are called. + +### applyPluginsAsyncSeries + +``` javascript +applyPluginsAsyncSeries( + name: string, + args: any..., + callback: (err: Error, result: any) -> void +) +``` + +Asynchronously applies all registered handers for `name`. The hander functions are called with all `args` and a callback function with the signature `(err: Error) -> void`. The handers are called in series, one at a time. After all handlers are applied, `callback` is called. If any handler passes a value for `err`, the `callback` is called with this error and no more handlers are called. + +### applyPluginsParallel + +``` javascript +applyPluginsParallel( + name: string, + args: any..., + callback: (err?: Error) -> void +) +``` + +Applies all registered handlers for `name` parallel. The handler functions are called with all args and a callback function with the signature `(err?: Error) -> void`. The `callback` function is called when all handlers called the callback without `err`. If any handler calls the callback with `err`, `callback` is invoked with this error and the other handlers are ignored. + +`restartApplyPlugins` cannot be used. + +### applyPluginsParallelBailResult + +``` javascript +applyPluginsParallelBailResult( + name: string, + args: any..., + callback: (err: Error, result: any) -> void +) +``` + +Applies all registered handlers for `name` parallel. The handler functions are called with all args and a callback function with the signature `(err?: Error) -> void`. Handler functions must call the callback. They can either pass an error, or pass undefined, or pass an value. The first result (either error or value) with is not undefined is passed to the `callback`. The order is defined by registeration not by speed of the handler function. This function compentate this. + +`restartApplyPlugins` cannot be used. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/lib/Tapable.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/lib/Tapable.js new file mode 100644 index 0000000000000000000000000000000000000000..591ecc1999b04663e69a05706e328be63997f5e0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/lib/Tapable.js @@ -0,0 +1,166 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +function Tapable() { + this._plugins = {}; +} +module.exports = Tapable; + +function copyProperties(from, to) { + for(var key in from) + to[key] = from[key]; + return to; +} + +Tapable.mixin = function mixinTapable(pt) { + copyProperties(Tapable.prototype, pt); +} + +Tapable.prototype.applyPlugins = function applyPlugins(name) { + if(!this._plugins[name]) return; + var args = Array.prototype.slice.call(arguments, 1); + var plugins = this._plugins[name]; + var old = this._currentPluginApply; + for(this._currentPluginApply = 0; this._currentPluginApply < plugins.length; this._currentPluginApply++) + plugins[this._currentPluginApply].apply(this, args); + this._currentPluginApply = old; +}; + +Tapable.prototype.applyPluginsWaterfall = function applyPlugins(name, init) { + if(!this._plugins[name]) return init; + var args = Array.prototype.slice.call(arguments, 2); + var plugins = this._plugins[name]; + var current = init; + var old = this._currentPluginApply; + for(this._currentPluginApply = 0; this._currentPluginApply < plugins.length; this._currentPluginApply++) + current = plugins[this._currentPluginApply].apply(this, [current].concat(args)); + this._currentPluginApply = old; + return current; +}; + +Tapable.prototype.applyPluginsBailResult = function applyPluginsBailResult(name) { + if(!this._plugins[name]) return; + var args = Array.prototype.slice.call(arguments, 1); + var plugins = this._plugins[name]; + var old = this._currentPluginApply + for(this._currentPluginApply = 0; this._currentPluginApply < plugins.length; this._currentPluginApply++) { + var result = plugins[this._currentPluginApply].apply(this, args); + if(typeof result !== "undefined") { + this._currentPluginApply = old; + return result; + } + } + this._currentPluginApply = old; +}; + +Tapable.prototype.applyPluginsAsyncSeries = Tapable.prototype.applyPluginsAsync = function applyPluginsAsync(name) { + var args = Array.prototype.slice.call(arguments, 1); + var callback = args.pop(); + if(!this._plugins[name] || this._plugins[name].length == 0) return callback(); + var plugins = this._plugins[name]; + var i = 0; + args.push(copyProperties(callback, function next(err) { + if(err) return callback(err); + i++; + if(i >= plugins.length) { + return callback(); + } + plugins[i].apply(this, args); + }.bind(this))); + plugins[0].apply(this, args); +}; + +Tapable.prototype.applyPluginsAsyncWaterfall = function applyPluginsAsyncWaterfall(name, init, callback) { + if(!this._plugins[name] || this._plugins[name].length == 0) return callback(null, init); + var plugins = this._plugins[name]; + var i = 0; + var next = copyProperties(callback, function(err, value) { + if(err) return callback(err); + i++; + if(i >= plugins.length) { + return callback(null, value); + } + plugins[i].call(this, value, next); + }.bind(this)); + plugins[0].call(this, init, next); +}; + +Tapable.prototype.applyPluginsParallel = function applyPluginsParallel(name) { + var args = Array.prototype.slice.call(arguments, 1); + var callback = args.pop(); + if(!this._plugins[name] || this._plugins[name].length == 0) return callback(); + var plugins = this._plugins[name]; + var remaining = plugins.length; + args.push(copyProperties(callback, function(err) { + if(remaining < 0) return; // ignore + if(err) { + remaining = -1; + return callback(err); + } + remaining--; + if(remaining == 0) { + return callback(); + } + })); + for(var i = 0; i < plugins.length; i++) { + plugins[i].apply(this, args); + if(remaining < 0) return; + } +}; + +Tapable.prototype.applyPluginsParallelBailResult = function applyPluginsParallelBailResult(name) { + var args = Array.prototype.slice.call(arguments, 1); + var callback = args[args.length-1]; + if(!this._plugins[name] || this._plugins[name].length == 0) return callback(); + var plugins = this._plugins[name]; + var currentPos = plugins.length; + var currentError, currentResult; + var done = []; + for(var i = 0; i < plugins.length; i++) { + args[args.length-1] = (function(i) { + return copyProperties(callback, function(err, result) { + if(i >= currentPos) return; // ignore + done.push(i); + if(err || result) { + currentPos = i + 1; + done = done.filter(function(item) { + return item <= i; + }); + currentError = err; + currentResult = result; + } + if(done.length == currentPos) { + callback(currentError, currentResult); + currentPos = 0; + } + }); + }(i)); + plugins[i].apply(this, args); + } +}; + + +Tapable.prototype.restartApplyPlugins = function restartApplyPlugins() { + if(typeof this._currentPluginApply !== "number") + throw new Error("Tapable.prototype.restartApplyPlugins can only be used inside of any sync plugins application"); + this._currentPluginApply = -1; +}; + + +Tapable.prototype.plugin = function plugin(name, fn) { + if(Array.isArray(name)) { + name.forEach(function(name) { + this.plugin(name, fn); + }, this); + return; + } + if(!this._plugins[name]) this._plugins[name] = [fn]; + else this._plugins[name].push(fn); +}; + +Tapable.prototype.apply = function apply() { + for(var i = 0; i < arguments.length; i++) { + arguments[i].apply(this); + } +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6fa867e02b6c77f0477577d7c180cc29c9438074 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/package.json @@ -0,0 +1,23 @@ +{ + "name": "tapable", + "version": "0.1.10", + "author": "Tobias Koppers @sokra", + "description": "Just a little module for plugins.", + "license": "MIT", + "repository": { + "type": "git", + "url": "http://github.com/webpack/tapable.git" + }, + "devDependencies": { + "mocha": "^2.2.4", + "should": "^5.2.0" + }, + "engines": { + "node": ">=0.6" + }, + "homepage": "https://github.com/webpack/tapable", + "main": "lib/Tapable.js", + "scripts": { + "test": "mocha --reporter spec" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/test/applyPluginsParallelBailResultTest.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/test/applyPluginsParallelBailResultTest.js new file mode 100644 index 0000000000000000000000000000000000000000..5643d0f26465b8f35ae8f2986bd46e0815417cbf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-import-resolver-webpack/node_modules/tapable/test/applyPluginsParallelBailResultTest.js @@ -0,0 +1,140 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +var Tapable = require("../lib/Tapable"); +var should = require("should"); + +function makeTestPlugin(arr, index) { + var last; + var f = function() { + f.shouldNotBeCalled(); + var args = Array.prototype.slice.call(arguments); + args.unshift(index); + last = args; + arr.push(args); + }; + f.issue = function() { + f.shouldBeCalled(); + last.pop().apply(null, arguments); + last = null; + }; + f.shouldNotBeCalled = function() { + if(last) throw new Error("Plugin " + index + " was called, but shouldn't be."); + }; + f.shouldBeCalled = function() { + if(!last) throw new Error("Plugin " + index + " was not called, but should be."); + }; + f.shouldBeCalledAsyncWith = function() { + f.shouldBeCalled(); + var args = Array.prototype.slice.call(arguments); + for(var i = 0; i < args.length && i < last.length - 2; i++) { + if(args[i] === null || args[i] === undefined) { + should.not.exist(last[i+1]); + } else { + should.exist(last[i+1]); + last[i+1].should.be.eql(args[i]); + } + } + args.length.should.be.eql(last.length - 2); + }; + return f; +} + +describe("applyPluginsParallelBailResult", function() { + it("should call all handlers", function() { + var tapable = new Tapable(); + var log = []; + var p1 = makeTestPlugin(log, 1); + var p2 = makeTestPlugin(log, 2); + var p3 = makeTestPlugin(log, 3); + var p4 = makeTestPlugin(log, 4); + var result = makeTestPlugin(log, 0); + tapable.plugin("test", p1); + tapable.plugin("test", p2); + tapable.plugin("xxxx", p3); + tapable.plugin("test", p4); + tapable.applyPluginsParallelBailResult("test", 1, 2, result); + p1.shouldBeCalledAsyncWith(1, 2); + p2.shouldBeCalledAsyncWith(1, 2); + p3.shouldNotBeCalled(); + p4.shouldBeCalledAsyncWith(1, 2); + p1.issue(); + p2.issue(null, "ok"); + p4.issue(null, "fail"); + log.should.be.eql([ + [1, 1, 2], + [2, 1, 2], + [4, 1, 2], + [0, null, "ok"] + ]); + }); + it("should save valid results", function() { + var tapable = new Tapable(); + var log = []; + var p1 = makeTestPlugin(log, 1); + var p2 = makeTestPlugin(log, 2); + var p3 = makeTestPlugin(log, 3); + tapable.plugin("test", p1); + tapable.plugin("test", p2); + tapable.plugin("test", p3); + var result = makeTestPlugin(log, 0); + tapable.applyPluginsParallelBailResult("test", "a", result); + p3.issue(null, "fail"); + p2.issue(null, "ok"); + p1.issue(); + log.should.be.eql([ + [1, "a"], + [2, "a"], + [3, "a"], + [0, null, "ok"], + ]); + }); + it("should take the first result", function() { + var tapable = new Tapable(); + var log = []; + var p1 = makeTestPlugin(log, 1); + var p2 = makeTestPlugin(log, 2); + var p3 = makeTestPlugin(log, 3); + tapable.plugin("test", p1); + tapable.plugin("test", p2); + tapable.plugin("test", p3); + var result = makeTestPlugin(log, 0); + tapable.applyPluginsParallelBailResult("test", "a", result); + log.length.should.be.eql(3); + p1.issue(null, "ok"); + log.length.should.be.eql(4); + p2.issue(new Error("fail")); + p3.issue(); + log.should.be.eql([ + [1, "a"], + [2, "a"], + [3, "a"], + [0, null, "ok"], + ]); + }); + it("should return errors", function() { + var tapable = new Tapable(); + var log = []; + var p1 = makeTestPlugin(log, 1); + var p2 = makeTestPlugin(log, 2); + var p3 = makeTestPlugin(log, 3); + tapable.plugin("test", p1); + tapable.plugin("test", p2); + tapable.plugin("test", p3); + var result = makeTestPlugin(log, 0); + tapable.applyPluginsParallelBailResult("test", "a", result); + log.length.should.be.eql(3); + p1.issue("ok"); + log.length.should.be.eql(4); + p2.issue(); + p3.issue(null, "fail"); + log.should.be.eql([ + [1, "a"], + [2, "a"], + [3, "a"], + [0, "ok", undefined], + ]); + }); + +}); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/electron.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/electron.js new file mode 100644 index 0000000000000000000000000000000000000000..f98ff0614bdb4cf603a39f537651c532f4344a3c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/electron.js @@ -0,0 +1,8 @@ +/** + * Default settings for Electron applications. + */ +module.exports = { + settings: { + 'import/core-modules': ['electron'], + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/errors.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..127c29a0cca94138b39843b8c34e688a1053f232 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/errors.js @@ -0,0 +1,14 @@ +/** + * unopinionated config. just the things that are necessarily runtime errors + * waiting to happen. + * @type {Object} + */ +module.exports = { + plugins: ['import'], + rules: { 'import/no-unresolved': 2, + 'import/named': 2, + 'import/namespace': 2, + 'import/default': 2, + 'import/export': 2, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/errors.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..98c19f824d012826f58d3e7ef2d65007148019d9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/errors.js @@ -0,0 +1,14 @@ +/** + * unopinionated config. just the things that are necessarily runtime errors + * waiting to happen. + * @type {Object} + */ +module.exports = { + rules: { + 'import/no-unresolved': 2, + 'import/named': 2, + 'import/namespace': 2, + 'import/default': 2, + 'import/export': 2, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/react.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/react.js new file mode 100644 index 0000000000000000000000000000000000000000..08674714227bfbf5e954aa79d6d966b5dbe517c4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/react.js @@ -0,0 +1,19 @@ +/** + * Adds `.jsx` as an extension, and enables JSX parsing. + * + * Even if _you_ aren't using JSX (or .jsx) directly, if your dependencies + * define jsnext:main and have JSX internally, you may run into problems + * if you don't enable these settings at the top level. + */ +module.exports = { + settings: { + 'import/extensions': ['.js', '.jsx', '.mjs', '.cjs'], + }, + languageOptions: { + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/recommended.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/recommended.js new file mode 100644 index 0000000000000000000000000000000000000000..11bc1f52a4b06733a958c13162fac6421d9da99a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/recommended.js @@ -0,0 +1,26 @@ +/** + * The basics. + * @type {Object} + */ +module.exports = { + rules: { + // analysis/correctness + 'import/no-unresolved': 'error', + 'import/named': 'error', + 'import/namespace': 'error', + 'import/default': 'error', + 'import/export': 'error', + + // red flags (thus, warnings) + 'import/no-named-as-default': 'warn', + 'import/no-named-as-default-member': 'warn', + 'import/no-duplicates': 'warn', + }, + + // need all these for parsing dependencies (even if _your_ code doesn't need + // all of them) + languageOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/warnings.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/warnings.js new file mode 100644 index 0000000000000000000000000000000000000000..e788ff9cdea456069facec67fc57b5c2156f3798 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/flat/warnings.js @@ -0,0 +1,11 @@ +/** + * more opinionated config. + * @type {Object} + */ +module.exports = { + rules: { + 'import/no-named-as-default': 1, + 'import/no-named-as-default-member': 1, + 'import/no-duplicates': 1, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/react-native.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/react-native.js new file mode 100644 index 0000000000000000000000000000000000000000..a1aa0ee5659ccdb5ca8eaba714d411e4f0fbbb6f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/react-native.js @@ -0,0 +1,13 @@ +/** + * - adds platform extensions to Node resolver + */ +module.exports = { + settings: { + 'import/resolver': { + node: { + // Note: will not complain if only _one_ of these files exists. + extensions: ['.js', '.web.js', '.ios.js', '.android.js'], + }, + }, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/react.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/react.js new file mode 100644 index 0000000000000000000000000000000000000000..1ae8e1a51a44c240445c6af77330c72b5fdf2c87 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/react.js @@ -0,0 +1,16 @@ +/** + * Adds `.jsx` as an extension, and enables JSX parsing. + * + * Even if _you_ aren't using JSX (or .jsx) directly, if your dependencies + * define jsnext:main and have JSX internally, you may run into problems + * if you don't enable these settings at the top level. + */ +module.exports = { + settings: { + 'import/extensions': ['.js', '.jsx'], + }, + + parserOptions: { + ecmaFeatures: { jsx: true }, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/recommended.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/recommended.js new file mode 100644 index 0000000000000000000000000000000000000000..8e7ca9fd05d3e43eddd5d571353f6a8f90b4f080 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/recommended.js @@ -0,0 +1,28 @@ +/** + * The basics. + * @type {Object} + */ +module.exports = { + plugins: ['import'], + + rules: { + // analysis/correctness + 'import/no-unresolved': 'error', + 'import/named': 'error', + 'import/namespace': 'error', + 'import/default': 'error', + 'import/export': 'error', + + // red flags (thus, warnings) + 'import/no-named-as-default': 'warn', + 'import/no-named-as-default-member': 'warn', + 'import/no-duplicates': 'warn', + }, + + // need all these for parsing dependencies (even if _your_ code doesn't need + // all of them) + parserOptions: { + sourceType: 'module', + ecmaVersion: 2018, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/stage-0.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/stage-0.js new file mode 100644 index 0000000000000000000000000000000000000000..42419123f0f349f8a68a0379470aad8de3e5fbeb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/stage-0.js @@ -0,0 +1,12 @@ +/** + * Rules in progress. + * + * Do not expect these to adhere to semver across releases. + * @type {Object} + */ +module.exports = { + plugins: ['import'], + rules: { + 'import/no-deprecated': 1, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/typescript.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/typescript.js new file mode 100644 index 0000000000000000000000000000000000000000..d5eb57a4658d0514059c19641aa42c4be0a6b5e6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/typescript.js @@ -0,0 +1,34 @@ +/** + * This config: + * 1) adds `.jsx`, `.ts`, `.cts`, `.mts`, and `.tsx` as an extension + * 2) enables JSX/TSX parsing + */ + +// Omit `.d.ts` because 1) TypeScript compilation already confirms that +// types are resolved, and 2) it would mask an unresolved +// `.ts`/`.tsx`/`.js`/`.jsx` implementation. +const typeScriptExtensions = ['.ts', '.cts', '.mts', '.tsx']; + +const allExtensions = [...typeScriptExtensions, '.js', '.jsx', '.mjs', '.cjs']; + +module.exports = { + settings: { + 'import/extensions': allExtensions, + 'import/external-module-folders': ['node_modules', 'node_modules/@types'], + 'import/parsers': { + '@typescript-eslint/parser': typeScriptExtensions, + }, + 'import/resolver': { + node: { + extensions: allExtensions, + }, + }, + }, + + rules: { + // analysis/correctness + + // TypeScript compilation already ensures that named imports exist in the referenced module + 'import/named': 'off', + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/warnings.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/warnings.js new file mode 100644 index 0000000000000000000000000000000000000000..5d74143b28df249258d9621fbf533a085b29cf24 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/config/warnings.js @@ -0,0 +1,12 @@ +/** + * more opinionated config. + * @type {Object} + */ +module.exports = { + plugins: ['import'], + rules: { + 'import/no-named-as-default': 1, + 'import/no-named-as-default-member': 1, + 'import/no-duplicates': 1, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/consistent-type-specifier-style.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/consistent-type-specifier-style.md new file mode 100644 index 0000000000000000000000000000000000000000..41d98e4e1f4b3f61e179b58347ab2d8373bf2d17 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/consistent-type-specifier-style.md @@ -0,0 +1,91 @@ +# import/consistent-type-specifier-style + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +In both Flow and TypeScript you can mark an import as a type-only import by adding a "kind" marker to the import. Both languages support two positions for marker. + +**At the top-level** which marks all names in the import as type-only and applies to named, default, and namespace (for TypeScript) specifiers: + +```ts +import type Foo from 'Foo'; +import type {Bar} from 'Bar'; +// ts only +import type * as Bam from 'Bam'; +// flow only +import typeof Baz from 'Baz'; +``` + +**Inline** with to the named import, which marks just the specific name in the import as type-only. An inline specifier is only valid for named specifiers, and not for default or namespace specifiers: + +```ts +import {type Foo} from 'Foo'; +// flow only +import {typeof Bar} from 'Bar'; +``` + +## Rule Details + +This rule either enforces or bans the use of inline type-only markers for named imports. + +This rule includes a fixer that will automatically convert your specifiers to the correct form - however the fixer will not respect your preferences around de-duplicating imports. If this is important to you, consider using the [`import/no-duplicates`] rule. + +[`import/no-duplicates`]: ./no-duplicates.md + +## Options + +The rule accepts a single string option which may be one of: + + - `'prefer-inline'` - enforces that named type-only specifiers are only ever written with an inline marker; and never as part of a top-level, type-only import. + - `'prefer-top-level'` - enforces that named type-only specifiers only ever written as part of a top-level, type-only import; and never with an inline marker. + +By default the rule will use the `prefer-inline` option. + +## Examples + +### `prefer-top-level` + +❌ Invalid with `["error", "prefer-top-level"]` + +```ts +import {type Foo} from 'Foo'; +import Foo, {type Bar} from 'Foo'; +// flow only +import {typeof Foo} from 'Foo'; +``` + +✅ Valid with `["error", "prefer-top-level"]` + +```ts +import type {Foo} from 'Foo'; +import type Foo, {Bar} from 'Foo'; +// flow only +import typeof {Foo} from 'Foo'; +``` + +### `prefer-inline` + +❌ Invalid with `["error", "prefer-inline"]` + +```ts +import type {Foo} from 'Foo'; +import type Foo, {Bar} from 'Foo'; +// flow only +import typeof {Foo} from 'Foo'; +``` + +✅ Valid with `["error", "prefer-inline"]` + +```ts +import {type Foo} from 'Foo'; +import Foo, {type Bar} from 'Foo'; +// flow only +import {typeof Foo} from 'Foo'; +``` + +## When Not To Use It + +If you aren't using Flow or TypeScript 4.5+, then this rule does not apply and need not be used. + +If you don't care about, and don't want to standardize how named specifiers are imported then you should not use this rule. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/default.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/default.md new file mode 100644 index 0000000000000000000000000000000000000000..9f8c919bf38d4420b68dca7a1a1b82b5eac36e34 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/default.md @@ -0,0 +1,72 @@ +# import/default + +💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`. + + + +If a default import is requested, this rule will report if there is no default +export in the imported module. + +For [ES7], reports if a default is named and exported but is not found in the +referenced module. + +Note: for packages, the plugin will find exported names +from [`jsnext:main`], if present in `package.json`. +Redux's npm module includes this key, and thereby is lintable, for example. + +A module path that is [ignored] or not [unambiguously an ES module] will not be reported when imported. + +[ignored]: ../README.md#importignore +[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar + +## Rule Details + +Given: + +```js +// ./foo.js +export default function () { return 42 } + +// ./bar.js +export function bar() { return null } + +// ./baz.js +module.exports = function () { /* ... */ } + +// node_modules/some-module/index.js +exports.sharedFunction = function shared() { /* ... */ } +``` + +The following is considered valid: + +```js +import foo from './foo' + +// assuming 'node_modules' are ignored (true by default) +import someModule from 'some-module' +``` + +...and the following cases are reported: + +```js +import bar from './bar' // no default export found in ./bar +import baz from './baz' // no default export found in ./baz +``` + +## When Not To Use It + +If you are using CommonJS and/or modifying the exported namespace of any module at +runtime, you will likely see false positives with this rule. + +This rule currently does not interpret `module.exports = ...` as a `default` export, +either, so such a situation will be reported in the importing module. + +## Further Reading + + - Lee Byron's [ES7] export proposal + - [`import/ignore`] setting + - [`jsnext:main`] (Rollup) + +[ES7]: https://github.com/leebyron/ecmascript-more-export-from +[`import/ignore`]: ../../README.md#importignore +[`jsnext:main`]: https://github.com/rollup/rollup/wiki/jsnext:main diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/dynamic-import-chunkname.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/dynamic-import-chunkname.md new file mode 100644 index 0000000000000000000000000000000000000000..d9ee8d15e2d9a82082f223df2c561a56742a9e58 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/dynamic-import-chunkname.md @@ -0,0 +1,134 @@ +# import/dynamic-import-chunkname + +💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions). + + + +This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format. + +This rule enforces naming of webpack chunks in dynamic imports. When you don't explicitly name chunks, webpack will autogenerate chunk names that are not consistent across builds, which prevents long-term browser caching. + +## Rule Details + +This rule runs against `import()` by default, but can be configured to also run against an alternative dynamic-import function, e.g. 'dynamicImport.' +You can also configure the regex format you'd like to accept for the webpackChunkName - for example, if we don't want the number 6 to show up in our chunk names: + + ```javascript +{ + "import/dynamic-import-chunkname": [2, { + importFunctions: ["dynamicImport"], + webpackChunknameFormat: "[a-zA-Z0-57-9-/_]+", + allowEmpty: false + }] +} +``` + +### invalid + +The following patterns are invalid: + +```javascript +// no leading comment +import('someModule'); + +// incorrectly formatted comment +import( + /*webpackChunkName:"someModule"*/ + 'someModule', +); +import( + /* webpackChunkName : "someModule" */ + 'someModule', +); + +// chunkname contains a 6 (forbidden by rule config) +import( + /* webpackChunkName: "someModule6" */ + 'someModule', +); + +// invalid syntax for webpack comment +import( + /* totally not webpackChunkName: "someModule" */ + 'someModule', +); + +// single-line comment, not a block-style comment +import( + // webpackChunkName: "someModule" + 'someModule', +); + +// chunk names are disallowed when eager mode is set +import( + /* webpackMode: "eager" */ + /* webpackChunkName: "someModule" */ + 'someModule', +) +``` + +### valid + +The following patterns are valid: + +```javascript + import( + /* webpackChunkName: "someModule" */ + 'someModule', + ); + import( + /* webpackChunkName: "someOtherModule12345789" */ + 'someModule', + ); + import( + /* webpackChunkName: "someModule" */ + /* webpackPrefetch: true */ + 'someModule', + ); + import( + /* webpackChunkName: "someModule", webpackPrefetch: true */ + 'someModule', + ); + + // using single quotes instead of double quotes + import( + /* webpackChunkName: 'someModule' */ + 'someModule', + ); +``` + +### `allowEmpty: true` + +If you want to allow dynamic imports without a webpackChunkName, you can set `allowEmpty: true` in the rule config. This will allow dynamic imports without a leading comment, or with a leading comment that does not contain a webpackChunkName. + +Given `{ "allowEmpty": true }`: + + +### valid + +The following patterns are valid: + +```javascript +import('someModule'); + +import( + /* webpackChunkName: "someModule" */ + 'someModule', +); +``` + +### invalid + +The following patterns are invalid: + +```javascript +// incorrectly formatted comment +import( + /*webpackChunkName:"someModule"*/ + 'someModule', +); +``` + +## When Not To Use It + +If you don't care that webpack will autogenerate chunk names and may blow up browser caches and bundle size reports. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/enforce-node-protocol-usage.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/enforce-node-protocol-usage.md new file mode 100644 index 0000000000000000000000000000000000000000..8d023b4e9ca9a516bc95a726fce6530f2ffda558 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/enforce-node-protocol-usage.md @@ -0,0 +1,81 @@ +# import/enforce-node-protocol-usage + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +Enforce either using, or omitting, the `node:` protocol when importing Node.js builtin modules. + +## Rule Details + +This rule enforces that builtins node imports are using, or omitting, the `node:` protocol. + +Determining whether a specifier is a core module depends on the node version being used to run `eslint`. +This version can be specified in the configuration with the [`import/node-version` setting](../../README.md#importnode-version). + +Reasons to prefer using the protocol include: + + - the code is more explicitly and clearly referencing a Node.js built-in module + +Reasons to prefer omitting the protocol include: + + - some tools don't support the `node:` protocol + - the code is more portable, because import maps and automatic polyfilling can be used + +## Options + +The rule requires a single string option which may be one of: + + - `'always'` - enforces that builtins node imports are using the `node:` protocol. + - `'never'` - enforces that builtins node imports are not using the `node:` protocol. + +## Examples + +### `'always'` + +❌ Invalid + +```js +import fs from 'fs'; +export { promises } from 'fs'; +// require +const fs = require('fs/promises'); +``` + +✅ Valid + +```js +import fs from 'node:fs'; +export { promises } from 'node:fs'; +import * as test from 'node:test'; +// require +const fs = require('node:fs/promises'); +``` + +### `'never'` + +❌ Invalid + +```js +import fs from 'node:fs'; +export { promises } from 'node:fs'; +// require +const fs = require('node:fs/promises'); +``` + +✅ Valid + +```js +import fs from 'fs'; +export { promises } from 'fs'; + +// require +const fs = require('fs/promises'); + +// This rule will not enforce not using `node:` protocol when the module is only available under the `node:` protocol. +import * as test from 'node:test'; +``` + +## When Not To Use It + +If you don't want to consistently enforce using, or omitting, the `node:` protocol when importing Node.js builtin modules. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/export.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/export.md new file mode 100644 index 0000000000000000000000000000000000000000..54a8a39cf33250d3450f4743b9302dc756977e71 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/export.md @@ -0,0 +1,37 @@ +# import/export + +💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`. + + + +Reports funny business with exports, like repeated exports of names or defaults. + +## Rule Details + +```js +export default class MyClass { /*...*/ } // Multiple default exports. + +function makeClass() { return new MyClass(...arguments) } + +export default makeClass // Multiple default exports. +``` + +or + +```js +export const foo = function () { /*...*/ } // Multiple exports of name 'foo'. + +function bar() { /*...*/ } +export { bar as foo } // Multiple exports of name 'foo'. +``` + +In the case of named/default re-export, all `n` re-exports will be reported, +as at least `n-1` of them are clearly mistakes, but it is not clear which one +(if any) is intended. Could be the result of copy/paste, code duplication with +intent to rename, etc. + +## Further Reading + + - Lee Byron's [ES7] export proposal + +[ES7]: https://github.com/leebyron/ecmascript-more-export-from diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/exports-last.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/exports-last.md new file mode 100644 index 0000000000000000000000000000000000000000..56e947e94bde0e7f2cc76d477669c803393119a7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/exports-last.md @@ -0,0 +1,51 @@ +# import/exports-last + + + +This rule enforces that all exports are declared at the bottom of the file. This rule will report any export declarations that comes before any non-export statements. + +## This will be reported + +```JS + +const bool = true + +export default bool + +const str = 'foo' + +``` + +```JS + +export const bool = true + +const str = 'foo' + +``` + +## This will not be reported + +```JS +const arr = ['bar'] + +export const bool = true + +export default bool + +export function func() { + console.log('Hello World 🌍') +} + +export const str = 'foo' +``` + +## When Not To Use It + +If you don't mind exports being sprinkled throughout a file, you may not want to enable this rule. + +### ES6 exports only + +The exports-last rule is currently only working on ES6 exports. You may not want to enable this rule if you're using CommonJS exports. + +If you need CommonJS support feel free to open an issue or create a PR. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/extensions.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/extensions.md new file mode 100644 index 0000000000000000000000000000000000000000..bd9f3f35844205ecacce91f8a01a69c18369152c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/extensions.md @@ -0,0 +1,239 @@ +# import/extensions + + + +Some file resolve algorithms allow you to omit the file extension within the import source path. For example the `node` resolver (which does not yet support ESM/`import`) can resolve `./foo/bar` to the absolute path `/User/someone/foo/bar.js` because the `.js` extension is resolved automatically by default in CJS. Depending on the resolver you can configure more extensions to get resolved automatically. + +In order to provide a consistent use of file extensions across your code base, this rule can enforce or disallow the use of certain file extensions. + +## Rule Details + +This rule either takes one string option, one object option, or a string and an object option. If it is the string `"never"` (the default value), then the rule forbids the use for any extension. If it is the string `"always"`, then the rule enforces the use of extensions for all import statements. If it is the string `"ignorePackages"`, then the rule enforces the use of extensions for all import statements except package imports. + +```jsonc +"import/extensions": [, "never" | "always" | "ignorePackages"] +``` + +By providing an object you can configure each extension separately. + +```jsonc +"import/extensions": [, { + : "never" | "always" | "ignorePackages" +}] +``` + + For example `{ "js": "always", "json": "never" }` would always enforce the use of the `.js` extension but never allow the use of the `.json` extension. + +By providing both a string and an object, the string will set the default setting for all extensions, and the object can be used to set granular overrides for specific extensions. + +```jsonc +"import/extensions": [ + , + "never" | "always" | "ignorePackages", + { + : "never" | "always" | "ignorePackages" + } +] +``` + +For example, `["error", "never", { "svg": "always" }]` would require that all extensions are omitted, except for "svg". + +`ignorePackages` can be set as a separate boolean option like this: + +```jsonc +"import/extensions": [ + , + "never" | "always" | "ignorePackages", + { + ignorePackages: true | false, + pattern: { + : "never" | "always" | "ignorePackages" + } + } +] +``` + +In that case, if you still want to specify extensions, you can do so inside the **pattern** property. +Default value of `ignorePackages` is `false`. + +By default, `import type` and `export type` style imports/exports are ignored. If you want to check them as well, you can set the `checkTypeImports` option to `true`. + +Unfortunately, in more advanced linting setups, such as when employing custom specifier aliases (e.g. you're using `eslint-import-resolver-alias`, `paths` in `tsconfig.json`, etc), this rule can be too coarse-grained when determining which imports to ignore and on which to enforce the config. +This is especially troublesome if you have import specifiers that [look like externals or builtins](./order.md#how-imports-are-grouped). + +Set `pathGroupOverrides` to force this rule to always ignore certain imports and never ignore others. +`pathGroupOverrides` accepts an array of one or more [`PathGroupOverride`](#pathgroupoverride) objects. + +For example: + +```jsonc +"import/extensions": [ + , + "never" | "always" | "ignorePackages", + { + ignorePackages: true | false, + pattern: { + : "never" | "always" | "ignorePackages" + }, + pathGroupOverrides: [ + { + pattern: "package-name-to-ignore", + action: "ignore", + }, + { + pattern: "bespoke+alias:{*,*/**}", + action: "enforce", + } + ] + } +] +``` + +> \[!NOTE] +> +> `pathGroupOverrides` is inspired by [`pathGroups` in `'import/order'`](./order.md#pathgroups) and shares a similar interface. +> If you're using `pathGroups` already, you may find `pathGroupOverrides` very useful. + +### `PathGroupOverride` + +| property | required | type | description | +| :--------------: | :------: | :---------------------: | --------------------------------------------------------------- | +| `pattern` | ☑️ | `string` | [Minimatch pattern][16] for specifier matching | +| `patternOptions` | | `object` | [Minimatch options][17]; default: `{nocomment: true}` | +| `action` | ☑️ | `"enforce" \| "ignore"` | What action to take on imports whose specifiers match `pattern` | + +### Exception + +When disallowing the use of certain extensions this rule makes an exception and allows the use of extension when the file would not be resolvable without extension. + +For example, given the following folder structure: + +```pt +├── foo +│   ├── bar.js +│   ├── bar.json +``` + +and this import statement: + +```js +import bar from './foo/bar.json'; +``` + +then the extension can’t be omitted because it would then resolve to `./foo/bar.js`. + +### Examples + +The following patterns are considered problems when configuration set to "never": + +```js +import foo from './foo.js'; + +import bar from './bar.json'; + +import Component from './Component.jsx'; + +import express from 'express/index.js'; +``` + +The following patterns are not considered problems when configuration set to "never": + +```js +import foo from './foo'; + +import bar from './bar'; + +import Component from './Component'; + +import express from 'express/index'; + +import * as path from 'path'; +``` + +The following patterns are considered problems when the configuration is set to "never" and the option "checkTypeImports" is set to `true`: + +```js +import type { Foo } from './foo.ts'; + +export type { Foo } from './foo.ts'; +``` + +The following patterns are considered problems when configuration set to "always": + +```js +import foo from './foo'; + +import bar from './bar'; + +import Component from './Component'; + +import foo from '@/foo'; +``` + +The following patterns are not considered problems when configuration set to "always": + +```js +import foo from './foo.js'; + +import bar from './bar.json'; + +import Component from './Component.jsx'; + +import * as path from 'path'; + +import foo from '@/foo.js'; +``` + +The following patterns are considered problems when configuration set to "ignorePackages": + +```js +import foo from './foo'; + +import bar from './bar'; + +import Component from './Component'; + +``` + +The following patterns are not considered problems when configuration set to "ignorePackages": + +```js +import foo from './foo.js'; + +import bar from './bar.json'; + +import Component from './Component.jsx'; + +import express from 'express'; + +import foo from '@/foo' +``` + +The following patterns are not considered problems when configuration set to `['error', 'always', {ignorePackages: true} ]`: + +```js +import Component from './Component.jsx'; + +import baz from 'foo/baz.js'; + +import express from 'express'; + +import foo from '@/foo'; +``` + +The following patterns are considered problems when the configuration is set to "always" and the option "checkTypeImports" is set to `true`: + +```js +import type { Foo } from './foo'; + +export type { Foo } from './foo'; +``` + +## When Not To Use It + +If you are not concerned about a consistent usage of file extension. + +In the future, when this rule supports native node ESM resolution, and the plugin is configured to use native rather than transpiled ESM (a config option that is not yet available) - setting this to `always` will have no effect. + +[16]: https://www.npmjs.com/package/minimatch#features +[17]: https://www.npmjs.com/package/minimatch#options diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/first.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/first.md new file mode 100644 index 0000000000000000000000000000000000000000..c765a29739408b545a4319c79651647e1e7b61c4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/first.md @@ -0,0 +1,75 @@ +# import/first + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +This rule reports any imports that come after non-import +statements. + +## Rule Details + +```js +import foo from './foo' + +// some module-level initializer +initWith(foo) + +import bar from './bar' // <- reported +``` + +Providing `absolute-first` as an option will report any absolute imports (i.e. +packages) that come after any relative imports: + +```js +import foo from 'foo' +import bar from './bar' + +import * as _ from 'lodash' // <- reported +``` + +If you really want import type ordering, check out [`import/order`]. + +Notably, `import`s are hoisted, which means the imported modules will be evaluated +before any of the statements interspersed between them. Keeping all `import`s together +at the top of the file may prevent surprises resulting from this part of the spec. + +### On directives + +Directives are allowed as long as they occur strictly before any `import` declarations, +as follows: + +```js +'use super-mega-strict' + +import { suchFoo } from 'lame-fake-module-name' // no report here +``` + +A directive in this case is assumed to be a single statement that contains only +a literal string-valued expression. + +`'use strict'` would be a good example, except that [modules are always in strict +mode](https://262.ecma-international.org/6.0/#sec-strict-mode-code) so it would be surprising to see a `'use strict'` sharing a file with `import`s and +`export`s. + +Given that, see [#255] for the reasoning. + +### With Fixer + +This rule contains a fixer to reorder in-body import to top, the following criteria applied: + +1. Never re-order relative to each other, even if `absolute-first` is set. +2. If an import creates an identifier, and that identifier is referenced at module level *before* the import itself, that won't be re-ordered. + +## When Not To Use It + +If you don't mind imports being sprinkled throughout, you may not want to +enable this rule. + +## Further Reading + + - [`import/order`]: a major step up from `absolute-first` + - Issue [#255] + +[`import/order`]: ./order.md +[#255]: https://github.com/import-js/eslint-plugin-import/issues/255 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/group-exports.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/group-exports.md new file mode 100644 index 0000000000000000000000000000000000000000..9fb212de6a24bdf833d4a1ec15247fcd6d76d24f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/group-exports.md @@ -0,0 +1,118 @@ +# import/group-exports + + + +Reports when named exports are not grouped together in a single `export` declaration or when multiple assignments to CommonJS `module.exports` or `exports` object are present in a single file. + +**Rationale:** An `export` declaration or `module.exports` assignment can appear anywhere in the code. By requiring a single export declaration all your exports will remain at one place, making it easier to see what exports a module provides. + +## Rule Details + +This rule warns whenever a single file contains multiple named export declarations or multiple assignments to `module.exports` (or `exports`). + +### Valid + +```js +// A single named export declaration -> ok +export const valid = true +``` + +```js +const first = true +const second = true + +// A single named export declaration -> ok +export { + first, + second, +} +``` + +```js +// Aggregating exports -> ok +export { default as module1 } from 'module-1' +export { default as module2 } from 'module-2' +``` + +```js +// A single exports assignment -> ok +module.exports = { + first: true, + second: true +} +``` + +```js +const first = true +const second = true + +// A single exports assignment -> ok +module.exports = { + first, + second, +} +``` + +```js +function test() {} +test.property = true +test.another = true + +// A single exports assignment -> ok +module.exports = test +``` + +```ts +const first = true; +type firstType = boolean + +// A single named export declaration (type exports handled separately) -> ok +export {first} +export type {firstType} +``` + +### Invalid + +```js +// Multiple named export statements -> not ok! +export const first = true +export const second = true +``` + +```js +// Aggregating exports from the same module -> not ok! +export { module1 } from 'module-1' +export { module2 } from 'module-1' +``` + +```js +// Multiple exports assignments -> not ok! +exports.first = true +exports.second = true +``` + +```js +// Multiple exports assignments -> not ok! +module.exports = {} +module.exports.first = true +``` + +```js +// Multiple exports assignments -> not ok! +module.exports = () => {} +module.exports.first = true +module.exports.second = true +``` + +```ts +type firstType = boolean +type secondType = any + +// Multiple named type export statements -> not ok! +export type {firstType} +export type {secondType} +``` + +## When Not To Use It + +If you do not mind having your exports spread across the file, you can safely turn this rule off. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/imports-first.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/imports-first.md new file mode 100644 index 0000000000000000000000000000000000000000..278e4c472508174038a32a9dade911fe051a792e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/imports-first.md @@ -0,0 +1,9 @@ +# import/imports-first + +❌ This rule is deprecated. + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +This rule was **deprecated** in eslint-plugin-import v2.0.0. Please use the corresponding rule [`first`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/first.md). diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/max-dependencies.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/max-dependencies.md new file mode 100644 index 0000000000000000000000000000000000000000..1ecbca64d3241bc699c34449c5a52929ab34c973 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/max-dependencies.md @@ -0,0 +1,70 @@ +# import/max-dependencies + + + +Forbid modules to have too many dependencies (`import` or `require` statements). + +This is a useful rule because a module with too many dependencies is a code smell, and usually indicates the module is doing too much and/or should be broken up into smaller modules. + +Importing multiple named exports from a single module will only count once (e.g. `import {x, y, z} from './foo'` will only count as a single dependency). + +## Options + +This rule has the following options, with these defaults: + +```js +"import/max-dependencies": ["error", { + "max": 10, + "ignoreTypeImports": false, +}] +``` + +### `max` + +This option sets the maximum number of dependencies allowed. Anything over will trigger the rule. **Default is 10** if the rule is enabled and no `max` is specified. + +Given a max value of `{"max": 2}`: + +### Fail + +```js +import a from './a'; // 1 +const b = require('./b'); // 2 +import c from './c'; // 3 - exceeds max! +``` + +### Pass + +```js +import a from './a'; // 1 +const anotherA = require('./a'); // still 1 +import {x, y, z} from './foo'; // 2 +``` + +### `ignoreTypeImports` + +Ignores `type` imports. Type imports are a feature released in TypeScript 3.8, you can [read more here](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export). Defaults to `false`. + +Given `{"max": 2, "ignoreTypeImports": true}`: + + +### Fail + +```ts +import a from './a'; +import b from './b'; +import c from './c'; +``` + + +### Pass + +```ts +import a from './a'; +import b from './b'; +import type c from './c'; // Doesn't count against max +``` + +## When Not To Use It + +If you don't care how many dependencies a module has. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/named.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/named.md new file mode 100644 index 0000000000000000000000000000000000000000..44f8dc65849da42c3d08d0199c23c6b4e18cf617 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/named.md @@ -0,0 +1,102 @@ +# import/named + +💼🚫 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`. This rule is _disabled_ in the ⌨️ `typescript` config. + + + +Verifies that all named imports are part of the set of named exports in the referenced module. + +For `export`, verifies that all named exports exist in the referenced module. + +Note: for packages, the plugin will find exported names +from [`jsnext:main`] (deprecated) or `module`, if present in `package.json`. +Redux's npm module includes this key, and thereby is lintable, for example. + +A module path that is [ignored] or not [unambiguously an ES module] will not be reported when imported. Note that type imports and exports, as used by [Flow], are always ignored. + +[ignored]: ../../README.md#importignore +[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar +[Flow]: https://flow.org/ + +## Rule Details + +Given: + +```js +// ./foo.js +export const foo = "I'm so foo" +``` + +The following is considered valid: + +```js +// ./bar.js +import { foo } from './foo' + +// ES7 proposal +export { foo as bar } from './foo' + +// node_modules without jsnext:main are not analyzed by default +// (import/ignore setting) +import { SomeNonsenseThatDoesntExist } from 'react' +``` + +...and the following are reported: + +```js +// ./baz.js +import { notFoo } from './foo' + +// ES7 proposal +export { notFoo as defNotBar } from './foo' + +// will follow 'jsnext:main', if available +import { dontCreateStore } from 'redux' +``` + +### Settings + +[`import/ignore`] can be provided as a setting to ignore certain modules (node_modules, +CoffeeScript, CSS if using Webpack, etc.). + +Given: + +```yaml +# .eslintrc (YAML) +--- +settings: + import/ignore: + - node_modules # included by default, but replaced if explicitly configured + - *.coffee$ # can't parse CoffeeScript (unless a custom polyglot parser was configured) +``` + +and + +```coffeescript +# ./whatever.coffee +exports.whatever = (foo) -> console.log foo +``` + +then the following is not reported: + +```js +// ./foo.js + +// can't be analyzed, and ignored, so not reported +import { notWhatever } from './whatever' +``` + +## When Not To Use It + +If you are using CommonJS and/or modifying the exported namespace of any module at +runtime, you will likely see false positives with this rule. + +## Further Reading + + - [`import/ignore`] setting + - [`jsnext:main`] deprecation + - [`pkg.module`] (Rollup) + +[`jsnext:main`]: https://github.com/jsforum/jsforum/issues/5 +[`pkg.module`]: https://github.com/rollup/rollup/wiki/pkg.module +[`import/ignore`]: ../../README.md#importignore diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/namespace.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/namespace.md new file mode 100644 index 0000000000000000000000000000000000000000..1a177f58199cfac30f4338b2ae938ed523efd10a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/namespace.md @@ -0,0 +1,106 @@ +# import/namespace + +💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`. + + + +Enforces names exist at the time they are dereferenced, when imported as a full namespace (i.e. `import * as foo from './foo'; foo.bar();` will report if `bar` is not exported by `./foo`.). + +Will report at the import declaration if there are _no_ exported names found. + +Also, will report for computed references (i.e. `foo["bar"]()`). + +Reports on assignment to a member of an imported namespace. + +Note: for packages, the plugin will find exported names +from [`jsnext:main`], if present in `package.json`. +Redux's npm module includes this key, and thereby is lintable, for example. + +A module path that is [ignored] or not [unambiguously an ES module] will not be reported when imported. + +[ignored]: ../README.md#importignore +[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar + +## Rule Details + +Currently, this rule does not check for possible +redefinition of the namespace in an intermediate scope. Adherence to the ESLint +`no-shadow` rule for namespaces will prevent this from being a problem. + +For [ES7], reports if an exported namespace would be empty (no names exported from the referenced module.) + +Given: + +```js +// @module ./named-exports +export const a = 1 +const b = 2 +export { b } + +const c = 3 +export { c as d } + +export class ExportedClass { } + +// ES7 +export * as deep from './deep' +``` + +and: + +```js +// @module ./deep +export const e = "MC2" +``` + +See what is valid and reported: + +```js +// @module ./foo +import * as names from './named-exports' + +function great() { + return names.a + names.b // so great https://youtu.be/ei7mb8UxEl8 +} + +function notGreat() { + doSomethingWith(names.c) // Reported: 'c' not found in imported namespace 'names'. + + const { a, b, c } = names // also reported, only for 'c' +} + +// also tunnels through re-exported namespaces! +function deepTrouble() { + doSomethingWith(names.deep.e) // fine + doSomethingWith(names.deep.f) // Reported: 'f' not found in deeply imported namespace 'names.deep'. +} + +``` + +### Options + +#### `allowComputed` + +Defaults to `false`. When false, will report the following: + +```js +/*eslint import/namespace: [2, { allowComputed: false }]*/ +import * as a from './a' + +function f(x) { + return a[x] // Unable to validate computed reference to imported namespace 'a'. +} +``` + +When set to `true`, the above computed namespace member reference is allowed, but +still can't be statically analyzed any further. + +## Further Reading + + - Lee Byron's [ES7] export proposal + - [`import/ignore`] setting + - [`jsnext:main`](Rollup) + +[ES7]: https://github.com/leebyron/ecmascript-more-export-from +[`import/ignore`]: ../../README.md#importignore +[`jsnext:main`]: https://github.com/rollup/rollup/wiki/jsnext:main diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/newline-after-import.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/newline-after-import.md new file mode 100644 index 0000000000000000000000000000000000000000..ef5aeed76705da841bd7d41f4c6ca1bee4388a0f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/newline-after-import.md @@ -0,0 +1,167 @@ +# import/newline-after-import + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +Enforces having one or more empty lines after the last top-level import statement or require call. + +## Rule Details + +This rule supports the following options: + + - `count` which sets the number of newlines that are enforced after the last top-level import statement or require call. This option defaults to `1`. + + - `exactCount` which enforce the exact numbers of newlines that is mentioned in `count`. This option defaults to `false`. + + - `considerComments` which enforces the rule on comments after the last import-statement as well when set to true. This option defaults to `false`. + +Valid: + +```js +import defaultExport from './foo'; + +const FOO = 'BAR'; +``` + +```js +import defaultExport from './foo'; +import { bar } from 'bar-lib'; + +const FOO = 'BAR'; +``` + +```js +const FOO = require('./foo'); +const BAR = require('./bar'); + +const BAZ = 1; +``` + +Invalid: + +```js +import * as foo from 'foo' +const FOO = 'BAR'; +``` + +```js +import * as foo from 'foo'; +const FOO = 'BAR'; + +import { bar } from 'bar-lib'; +``` + +```js +const FOO = require('./foo'); +const BAZ = 1; +const BAR = require('./bar'); +``` + +With `count` set to `2` this will be considered valid: + +```js +import defaultExport from './foo'; + + +const FOO = 'BAR'; +``` + +```js +import defaultExport from './foo'; + + + +const FOO = 'BAR'; +``` + +With `count` set to `2` these will be considered invalid: + +```js +import defaultExport from './foo'; +const FOO = 'BAR'; +``` + +```js +import defaultExport from './foo'; + +const FOO = 'BAR'; +``` + +With `count` set to `2` and `exactCount` set to `true` this will be considered valid: + +```js +import defaultExport from './foo'; + + +const FOO = 'BAR'; +``` + +With `count` set to `2` and `exactCount` set to `true` these will be considered invalid: + +```js +import defaultExport from './foo'; +const FOO = 'BAR'; +``` + +```js +import defaultExport from './foo'; + +const FOO = 'BAR'; +``` + +```js +import defaultExport from './foo'; + + + +const FOO = 'BAR'; +``` + +```js +import defaultExport from './foo'; + + + + +const FOO = 'BAR'; +``` + +With `considerComments` set to `false` this will be considered valid: + +```js +import defaultExport from './foo' +// some comment here. +const FOO = 'BAR' +``` + +With `considerComments` set to `true` this will be considered valid: + +```js +import defaultExport from './foo' + +// some comment here. +const FOO = 'BAR' +``` + +With `considerComments` set to `true` this will be considered invalid: + +```js +import defaultExport from './foo' +// some comment here. +const FOO = 'BAR' +``` + +## Example options usage + +```json +{ + "rules": { + "import/newline-after-import": ["error", { "count": 2 }] + } +} +``` + +## When Not To Use It + +If you like to visually group module imports with its usage, you don't want to use this rule. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-absolute-path.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-absolute-path.md new file mode 100644 index 0000000000000000000000000000000000000000..48fb9532bda8cbbd7429a35b344e7793ad80ec6f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-absolute-path.md @@ -0,0 +1,54 @@ +# import/no-absolute-path + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +Node.js allows the import of modules using an absolute path such as `/home/xyz/file.js`. That is a bad practice as it ties the code using it to your computer, and therefore makes it unusable in packages distributed on `npm` for instance. + +This rule forbids the import of modules using absolute paths. + +## Rule Details + +### Fail + +```js +import f from '/foo'; +import f from '/some/path'; + +var f = require('/foo'); +var f = require('/some/path'); +``` + +### Pass + +```js +import _ from 'lodash'; +import foo from 'foo'; +import foo from './foo'; + +var _ = require('lodash'); +var foo = require('foo'); +var foo = require('./foo'); +``` + +### Options + +By default, only ES6 imports and CommonJS `require` calls will have this rule enforced. + +You may provide an options object providing true/false for any of + + - `esmodule`: defaults to `true` + - `commonjs`: defaults to `true` + - `amd`: defaults to `false` + +If `{ amd: true }` is provided, dependency paths for AMD-style `define` and `require` +calls will be resolved: + +```js +/*eslint import/no-absolute-path: [2, { commonjs: false, amd: true }]*/ +define(['/foo'], function (foo) { /*...*/ }) // reported +require(['/foo'], function (foo) { /*...*/ }) // reported + +const foo = require('/foo') // ignored because of explicit `commonjs: false` +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-amd.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-amd.md new file mode 100644 index 0000000000000000000000000000000000000000..6e592ba75850b9c81364f5aaf4dbb76de7ebcf61 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-amd.md @@ -0,0 +1,37 @@ +# import/no-amd + + + +Reports `require([array], ...)` and `define([array], ...)` function calls at the +module scope. Will not report if !=2 arguments, or first argument is not a literal array. + +Intended for temporary use when migrating to pure ES6 modules. + +## Rule Details + +This will be reported: + +```js +define(["a", "b"], function (a, b) { /* ... */ }) + +require(["b", "c"], function (b, c) { /* ... */ }) +``` + +CommonJS `require` is still valid. + +## When Not To Use It + +If you don't mind mixing module systems (sometimes this is useful), you probably +don't want this rule. + +It is also fairly noisy if you have a larger codebase that is being transitioned +from AMD to ES6 modules. + +## Contributors + +Special thanks to @xjamundx for donating his no-define rule as a start to this. + +## Further Reading + + - [`no-commonjs`](./no-commonjs.md): report CommonJS `require` and `exports` + - Source: diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-anonymous-default-export.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-anonymous-default-export.md new file mode 100644 index 0000000000000000000000000000000000000000..70efb84501c355ab08475077fd28aba59dbfd7aa --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-anonymous-default-export.md @@ -0,0 +1,83 @@ +# import/no-anonymous-default-export + + + +Reports if a module's default export is unnamed. This includes several types of unnamed data types; literals, object expressions, arrays, anonymous functions, arrow functions, and anonymous class declarations. + +Ensuring that default exports are named helps improve the grepability of the codebase by encouraging the re-use of the same identifier for the module's default export at its declaration site and at its import sites. + +## Options + +By default, all types of anonymous default exports are forbidden, but any types can be selectively allowed by toggling them on in the options. + +The complete default configuration looks like this. + +```js +"import/no-anonymous-default-export": ["error", { + "allowArray": false, + "allowArrowFunction": false, + "allowAnonymousClass": false, + "allowAnonymousFunction": false, + "allowCallExpression": true, // The true value here is for backward compatibility + "allowNew": false, + "allowLiteral": false, + "allowObject": false +}] +``` + +## Rule Details + +### Fail + +```js +export default [] + +export default () => {} + +export default class {} + +export default function () {} + +/* eslint import/no-anonymous-default-export: [2, {"allowCallExpression": false}] */ +export default foo(bar) + +export default 123 + +export default {} + +export default new Foo() +``` + +### Pass + +```js +const foo = 123 +export default foo + +export default class MyClass() {} + +export default function foo() {} + +/* eslint import/no-anonymous-default-export: [2, {"allowArray": true}] */ +export default [] + +/* eslint import/no-anonymous-default-export: [2, {"allowArrowFunction": true}] */ +export default () => {} + +/* eslint import/no-anonymous-default-export: [2, {"allowAnonymousClass": true}] */ +export default class {} + +/* eslint import/no-anonymous-default-export: [2, {"allowAnonymousFunction": true}] */ +export default function () {} + +export default foo(bar) + +/* eslint import/no-anonymous-default-export: [2, {"allowLiteral": true}] */ +export default 123 + +/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */ +export default {} + +/* eslint import/no-anonymous-default-export: [2, {"allowNew": true}] */ +export default new Foo() +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-commonjs.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-commonjs.md new file mode 100644 index 0000000000000000000000000000000000000000..4dc9c8c5d90b45cc324d4cba9e92db932ee52bd4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-commonjs.md @@ -0,0 +1,96 @@ +# import/no-commonjs + + + +Reports `require([string])` function calls. Will not report if >1 argument, +or single argument is not a literal string. + +Reports `module.exports` or `exports.*`, also. + +Intended for temporary use when migrating to pure ES6 modules. + +## Rule Details + +This will be reported: + +```js +var mod = require('./mod') + , common = require('./common') + , fs = require('fs') + , whateverModule = require('./not-found') + +module.exports = { a: "b" } +exports.c = "d" +``` + +### Allow require + +If `allowRequire` option is set to `true`, `require` calls are valid: + +```js +/*eslint no-commonjs: [2, { allowRequire: true }]*/ +var mod = require('./mod'); +``` + +but `module.exports` is reported as usual. + +### Allow conditional require + +By default, conditional requires are allowed: + +```js +var a = b && require("c") + +if (typeof window !== "undefined") { + require('that-ugly-thing'); +} + +var fs = null; +try { + fs = require("fs") +} catch (error) {} +``` + +If the `allowConditionalRequire` option is set to `false`, they will be reported. + +If you don't rely on synchronous module loading, check out [dynamic import](https://github.com/airbnb/babel-plugin-dynamic-import-node). + +### Allow primitive modules + +If `allowPrimitiveModules` option is set to `true`, the following is valid: + +```js +/*eslint no-commonjs: [2, { allowPrimitiveModules: true }]*/ + +module.exports = "foo" +module.exports = function rule(context) { return { /* ... */ } } +``` + +but this is still reported: + +```js +/*eslint no-commonjs: [2, { allowPrimitiveModules: true }]*/ + +module.exports = { x: "y" } +exports.z = function boop() { /* ... */ } +``` + +This is useful for things like ESLint rule modules, which must export a function as +the module. + +## When Not To Use It + +If you don't mind mixing module systems (sometimes this is useful), you probably +don't want this rule. + +It is also fairly noisy if you have a larger codebase that is being transitioned +from CommonJS to ES6 modules. + +## Contributors + +Special thanks to @xjamundx for donating the module.exports and exports.* bits. + +## Further Reading + + - [`no-amd`](./no-amd.md): report on AMD `require`, `define` + - Source: diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-cycle.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-cycle.md new file mode 100644 index 0000000000000000000000000000000000000000..898b75330e34f6bf53c249e70d6cdb0fb01f3d96 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-cycle.md @@ -0,0 +1,119 @@ +# import/no-cycle + + + +Ensures that there is no resolvable path back to this module via its dependencies. + +This includes cycles of depth 1 (imported module imports me) to `"∞"` (or `Infinity`), if the +[`maxDepth`](#maxdepth) option is not set. + +```js +// dep-b.js +import './dep-a.js' + +export function b() { /* ... */ } +``` + +```js +// dep-a.js +import { b } from './dep-b.js' // reported: Dependency cycle detected. +``` + +This rule does _not_ detect imports that resolve directly to the linted module; +for that, see [`no-self-import`]. + +This rule ignores type-only imports in Flow and TypeScript syntax (`import type` and `import typeof`), which have no runtime effect. + +## Rule Details + +### Options + +By default, this rule only detects cycles for ES6 imports, but see the [`no-unresolved` options](./no-unresolved.md#options) as this rule also supports the same `commonjs` and `amd` flags. However, these flags only impact which import types are _linted_; the +import/export infrastructure only registers `import` statements in dependencies, so +cycles created by `require` within imported modules may not be detected. + +#### `maxDepth` + +There is a `maxDepth` option available to prevent full expansion of very deep dependency trees: + +```js +/*eslint import/no-cycle: [2, { maxDepth: 1 }]*/ + +// dep-c.js +import './dep-a.js' +``` + +```js +// dep-b.js +import './dep-c.js' + +export function b() { /* ... */ } +``` + +```js +// dep-a.js +import { b } from './dep-b.js' // not reported as the cycle is at depth 2 +``` + +This is not necessarily recommended, but available as a cost/benefit tradeoff mechanism +for reducing total project lint time, if needed. + +#### `ignoreExternal` + +An `ignoreExternal` option is available to prevent the cycle detection to expand to external modules: + +```js +/*eslint import/no-cycle: [2, { ignoreExternal: true }]*/ + +// dep-a.js +import 'module-b/dep-b.js' + +export function a() { /* ... */ } +``` + +```js +// node_modules/module-b/dep-b.js +import { a } from './dep-a.js' // not reported as this module is external +``` + +Its value is `false` by default, but can be set to `true` for reducing total project lint time, if needed. + +#### `allowUnsafeDynamicCyclicDependency` + +This option disable reporting of errors if a cycle is detected with at least one dynamic import. + +```js +// bar.js +import { foo } from './foo'; +export const bar = foo; + +// foo.js +export const foo = 'Foo'; +export function getBar() { return import('./bar'); } +``` + +> Cyclic dependency are **always** a dangerous anti-pattern as discussed extensively in [#2265](https://github.com/import-js/eslint-plugin-import/issues/2265). Please be extra careful about using this option. + +#### `disableScc` + +This option disables a pre-processing step that calculates [Strongly Connected Components](https://en.wikipedia.org/wiki/Strongly_connected_component), which are used for avoiding unnecessary work checking files in different SCCs for cycles. + +However, under some configurations, this pre-processing may be more expensive than the time it saves. + +When this option is `true`, we don't calculate any SCC graph, and check all files for cycles (leading to higher time-complexity). Default is `false`. + +## When Not To Use It + +This rule is comparatively computationally expensive. If you are pressed for lint +time, or don't think you have an issue with dependency cycles, you may not want +this rule enabled. + +## Further Reading + + - [Original inspiring issue](https://github.com/import-js/eslint-plugin-import/issues/941) + - Rule to detect that module imports itself: [`no-self-import`] + - [`import/external-module-folders`] setting + +[`no-self-import`]: ./no-self-import.md + +[`import/external-module-folders`]: ../../README.md#importexternal-module-folders diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-default-export.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-default-export.md new file mode 100644 index 0000000000000000000000000000000000000000..586d5e74511f5f5543a30ca77b017d1ba3cc8163 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-default-export.md @@ -0,0 +1,65 @@ +# import/no-default-export + + + +Prohibit default exports. Mostly an inverse of [`prefer-default-export`]. + +[`prefer-default-export`]: ./prefer-default-export.md + +## Rule Details + +The following patterns are considered warnings: + +```javascript +// bad1.js + +// There is a default export. +export const foo = 'foo'; +const bar = 'bar'; +export default 'bar'; +``` + +```javascript +// bad2.js + +// There is a default export. +const foo = 'foo'; +export { foo as default } +``` + +The following patterns are not warnings: + +```javascript +// good1.js + +// There is only a single module export and it's a named export. +export const foo = 'foo'; +``` + +```javascript +// good2.js + +// There is more than one named export in the module. +export const foo = 'foo'; +export const bar = 'bar'; +``` + +```javascript +// good3.js + +// There is more than one named export in the module +const foo = 'foo'; +const bar = 'bar'; +export { foo, bar } +``` + +```javascript +// export-star.js + +// Any batch export will disable this rule. The remote module is not inspected. +export * from './other-module' +``` + +## When Not To Use It + +If you don't care if default imports are used, or if you prefer default imports over named imports. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-deprecated.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-deprecated.md new file mode 100644 index 0000000000000000000000000000000000000000..a647d77ad54bafb118a93eec92afe572fd1d71c1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-deprecated.md @@ -0,0 +1,62 @@ +# import/no-deprecated + + + +Reports use of a deprecated name, as indicated by a JSDoc block with a `@deprecated` +tag or TomDoc `Deprecated:` comment. + +using a JSDoc `@deprecated` tag: + +```js +// @file: ./answer.js + +/** + * this is what you get when you trust a mouse talk show + * @deprecated need to restart the experiment + * @returns {Number} nonsense + */ +export function multiply(six, nine) { + return 42 +} +``` + +will report as such: + +```js +import { multiply } from './answer' // Deprecated: need to restart the experiment + +function whatever(y, z) { + return multiply(y, z) // Deprecated: need to restart the experiment +} +``` + +or using the TomDoc equivalent: + +```js +// Deprecated: This is what you get when you trust a mouse talk show, need to +// restart the experiment. +// +// Returns a Number nonsense +export function multiply(six, nine) { + return 42 +} +``` + +Only JSDoc is enabled by default. Other documentation styles can be enabled with +the `import/docstyle` setting. + +```yaml +# .eslintrc.yml +settings: + import/docstyle: ['jsdoc', 'tomdoc'] +``` + +## Worklist + + - [x] report explicit imports on the import node + - [x] support namespaces + - [x] should bubble up through deep namespaces (#157) + - [x] report explicit imports at reference time (at the identifier) similar to namespace + - [x] mark module deprecated if file JSDoc has a @deprecated tag? + - [ ] don't flag redeclaration of imported, deprecated names + - [ ] flag destructuring diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-duplicates.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-duplicates.md new file mode 100644 index 0000000000000000000000000000000000000000..29c16f15d166fae4f52413402c490c19d548d16b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-duplicates.md @@ -0,0 +1,109 @@ +# import/no-duplicates + +⚠️ This rule _warns_ in the following configs: ☑️ `recommended`, 🚸 `warnings`. + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +Reports if a resolved path is imported more than once. + +ESLint core has a similar rule ([`no-duplicate-imports`](https://eslint.org/docs/rules/no-duplicate-imports)), but this version +is different in two key ways: + +1. the paths in the source code don't have to exactly match, they just have to point to the same module on the filesystem. (i.e. `./foo` and `./foo.js`) +2. this version distinguishes Flow `type` imports from standard imports. ([#334](https://github.com/import-js/eslint-plugin-import/pull/334)) + +## Rule Details + +Valid: + +```js +import SomeDefaultClass, * as names from './mod' +// Flow `type` import from same module is fine +import type SomeType from './mod' +``` + +...whereas here, both `./mod` imports will be reported: + +```js +import SomeDefaultClass from './mod' + +// oops, some other import separated these lines +import foo from './some-other-mod' + +import * as names from './mod' + +// will catch this too, assuming it is the same target module +import { something } from './mod.js' +``` + +The motivation is that this is likely a result of two developers importing different +names from the same module at different times (and potentially largely different +locations in the file.) This rule brings both (or n-many) to attention. + +### Query Strings + +By default, this rule ignores query strings (i.e. paths followed by a question mark), and thus imports from `./mod?a` and `./mod?b` will be considered as duplicates. However you can use the option `considerQueryString` to handle them as different (primarily because browsers will resolve those imports differently). + +Config: + +```json +"import/no-duplicates": ["error", {"considerQueryString": true}] +``` + +And then the following code becomes valid: + +```js +import minifiedMod from './mod?minify' +import noCommentsMod from './mod?comments=0' +import originalMod from './mod' +``` + +It will still catch duplicates when using the same module and the exact same query string: + +```js +import SomeDefaultClass from './mod?minify' + +// This is invalid, assuming `./mod` and `./mod.js` are the same target: +import * from './mod.js?minify' +``` + +### Inline Type imports + +TypeScript 4.5 introduced a new [feature](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#type-on-import-names) that allows mixing of named value and type imports. In order to support fixing to an inline type import when duplicate imports are detected, `prefer-inline` can be set to true. + +Config: + +```json +"import/no-duplicates": ["error", {"prefer-inline": true}] +``` + + + +❌ Invalid `["error", {"prefer-inline": true}]` + +```js +import { AValue, type AType } from './mama-mia' +import type { BType } from './mama-mia' + +import { CValue } from './papa-mia' +import type { CType } from './papa-mia' +``` + +✅ Valid with `["error", {"prefer-inline": true}]` + +```js +import { AValue, type AType, type BType } from './mama-mia' + +import { CValue, type CType } from './papa-mia' +``` + + + +## When Not To Use It + +If the core ESLint version is good enough (i.e. you're _not_ using Flow and you _are_ using [`import/extensions`](./extensions.md)), keep it and don't use this. + +If you like to split up imports across lines or may need to import a default and a namespace, +you may not want to enable this rule. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-dynamic-require.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-dynamic-require.md new file mode 100644 index 0000000000000000000000000000000000000000..292055fcdc20b5f225f42cd883c2dc6ed5e71590 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-dynamic-require.md @@ -0,0 +1,25 @@ +# import/no-dynamic-require + + + +The `require` method from CommonJS is used to import modules from different files. Unlike the ES6 `import` syntax, it can be given expressions that will be resolved at runtime. While this is sometimes necessary and useful, in most cases it isn't. Using expressions (for instance, concatenating a path and variable) as the argument makes it harder for tools to do static code analysis, or to find where in the codebase a module is used. + +This rule forbids every call to `require()` that uses expressions for the module name argument. + +## Rule Details + +### Fail + +```js +require(name); +require('../' + name); +require(`../${name}`); +require(name()); +``` + +### Pass + +```js +require('../name'); +require(`../name`); +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-empty-named-blocks.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-empty-named-blocks.md new file mode 100644 index 0000000000000000000000000000000000000000..ad83c535f8e9c31c8fce927a5e3bcd8323289890 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-empty-named-blocks.md @@ -0,0 +1,49 @@ +# import/no-empty-named-blocks + +🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions). + + + +Reports the use of empty named import blocks. + +## Rule Details + +### Valid + +```js +import { mod } from 'mod' +import Default, { mod } from 'mod' +``` + +When using typescript + +```js +import type { mod } from 'mod' +``` + +When using flow + +```js +import typeof { mod } from 'mod' +``` + +### Invalid + +```js +import {} from 'mod' +import Default, {} from 'mod' +``` + +When using typescript + +```js +import type Default, {} from 'mod' +import type {} from 'mod' +``` + +When using flow + +```js +import typeof {} from 'mod' +import typeof Default, {} from 'mod' +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-extraneous-dependencies.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-extraneous-dependencies.md new file mode 100644 index 0000000000000000000000000000000000000000..848d5bb0da5c1c584c2de62426e6c83c089417f1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-extraneous-dependencies.md @@ -0,0 +1,139 @@ +# import/no-extraneous-dependencies + + + +Forbid the import of external modules that are not declared in the `package.json`'s `dependencies`, `devDependencies`, `optionalDependencies`, `peerDependencies`, or `bundledDependencies`. +The closest parent `package.json` will be used. If no `package.json` is found, the rule will not lint anything. This behavior can be changed with the rule option `packageDir`. Normally ignores imports of modules marked internal, but this can be changed with the rule option `includeInternal`. Type imports can be verified by specifying `includeTypes`. + +Modules have to be installed for this rule to work. + +## Options + +This rule supports the following options: + +`devDependencies`: If set to `false`, then the rule will show an error when `devDependencies` are imported. Defaults to `true`. +Type imports are ignored by default. + +`optionalDependencies`: If set to `false`, then the rule will show an error when `optionalDependencies` are imported. Defaults to `true`. + +`peerDependencies`: If set to `false`, then the rule will show an error when `peerDependencies` are imported. Defaults to `true`. + +`bundledDependencies`: If set to `false`, then the rule will show an error when `bundledDependencies` are imported. Defaults to `true`. + +You can set the options like this: + +```js +"import/no-extraneous-dependencies": ["error", {"devDependencies": false, "optionalDependencies": false, "peerDependencies": false}] +``` + +You can also use an array of globs instead of literal booleans: + +```js +"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js"]}] +``` + +When using an array of globs, the setting will be set to `true` (no errors reported) if the name of the file being linted (i.e. not the imported file/module) matches a single glob in the array, and `false` otherwise. + +There are 2 boolean options to opt into checking extra imports that are normally ignored: `includeInternal`, which enables the checking of internal modules, and `includeTypes`, which enables checking of type imports in TypeScript. + +```js +"import/no-extraneous-dependencies": ["error", {"includeInternal": true, "includeTypes": true}] +``` + +Also there is one more option called `packageDir`, this option is to specify the path to the folder containing package.json. + +If provided as a relative path string, will be computed relative to the current working directory at linter execution time. If this is not ideal (does not work with some editor integrations), consider using `__dirname` to provide a path relative to your configuration. + +```js +"import/no-extraneous-dependencies": ["error", {"packageDir": './some-dir/'}] +// or +"import/no-extraneous-dependencies": ["error", {"packageDir": path.join(__dirname, 'some-dir')}] +``` + +It may also be an array of multiple paths, to support monorepos or other novel project +folder layouts: + +```js +"import/no-extraneous-dependencies": ["error", {"packageDir": ['./some-dir/', './root-pkg']}] +``` + +## Rule Details + +Given the following `package.json`: + +```json +{ + "name": "my-project", + "...": "...", + "dependencies": { + "builtin-modules": "^1.1.1", + "lodash.cond": "^4.2.0", + "lodash.find": "^4.2.0", + "pkg-up": "^1.0.0" + }, + "devDependencies": { + "ava": "^0.13.0", + "eslint": "^2.4.0", + "eslint-plugin-ava": "^1.3.0", + "xo": "^0.13.0" + }, + "optionalDependencies": { + "lodash.isarray": "^4.0.0" + }, + "peerDependencies": { + "react": ">=15.0.0 <16.0.0" + }, + "bundledDependencies": [ + "@generated/foo", + ] +} +``` + +## Fail + +```js +var _ = require('lodash'); +import _ from 'lodash'; + +import react from 'react'; + +/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": false}] */ +import test from 'ava'; +var test = require('ava'); + +/* eslint import/no-extraneous-dependencies: ["error", {"optionalDependencies": false}] */ +import isArray from 'lodash.isarray'; +var isArray = require('lodash.isarray'); + +/* eslint import/no-extraneous-dependencies: ["error", {"bundledDependencies": false}] */ +import foo from '"@generated/foo"'; +var foo = require('"@generated/foo"'); + +/* eslint import/no-extraneous-dependencies: ["error", {"includeInternal": true}] */ +import foo from './foo'; +var foo = require('./foo'); + +/* eslint import/no-extraneous-dependencies: ["error", {"includeTypes": true}] */ +import type { MyType } from 'foo'; +``` + +## Pass + +```js +// Builtin and internal modules are fine +var path = require('path'); +var foo = require('./foo'); + +import test from 'ava'; +import find from 'lodash.find'; +import isArray from 'lodash.isarray'; +import foo from '"@generated/foo"'; +import type { MyType } from 'foo'; + +/* eslint import/no-extraneous-dependencies: ["error", {"peerDependencies": true}] */ +import react from 'react'; +``` + +## When Not To Use It + +If you do not have a `package.json` file in your project. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-import-module-exports.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-import-module-exports.md new file mode 100644 index 0000000000000000000000000000000000000000..1c572264959f2a3c87e3ec1c6434ff1b55719669 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-import-module-exports.md @@ -0,0 +1,81 @@ +# import/no-import-module-exports + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +Reports the use of import declarations with CommonJS exports in any module +except for the [main module](https://docs.npmjs.com/files/package.json#main). + +If you have multiple entry points or are using `js:next` this rule includes an +`exceptions` option which you can use to exclude those files from the rule. + +## Options + +### `exceptions` + + - An array of globs. The rule will be omitted from any file that matches a glob + in the options array. For example, the following setting will omit the rule + in the `some-file.js` file. + +```json +"import/no-import-module-exports": ["error", { + "exceptions": ["**/*/some-file.js"] +}] +``` + +## Rule Details + +### Fail + +```js +import { stuff } from 'starwars' +module.exports = thing + +import * as allThings from 'starwars' +exports.bar = thing + +import thing from 'other-thing' +exports.foo = bar + +import thing from 'starwars' +const baz = module.exports = thing +console.log(baz) +``` + +### Pass + +Given the following package.json: + +```json +{ + "main": "lib/index.js", +} +``` + +```js +import thing from 'other-thing' +export default thing + +const thing = require('thing') +module.exports = thing + +const thing = require('thing') +exports.foo = bar + +import thing from 'otherthing' +console.log(thing.module.exports) + +// in lib/index.js +import foo from 'path'; +module.exports = foo; + +// in some-file.js +// eslint import/no-import-module-exports: ["error", {"exceptions": ["**/*/some-file.js"]}] +import foo from 'path'; +module.exports = foo; +``` + +### Further Reading + + - [webpack issue #4039](https://github.com/webpack/webpack/issues/4039) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-internal-modules.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-internal-modules.md new file mode 100644 index 0000000000000000000000000000000000000000..433b55140d8493bb8f80f4c3befc7b1704af8ff9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-internal-modules.md @@ -0,0 +1,136 @@ +# import/no-internal-modules + + + +Use this rule to prevent importing the submodules of other modules. + +## Rule Details + +This rule has two mutally exclusive options that are arrays of [minimatch/glob patterns](https://github.com/isaacs/node-glob#glob-primer) patterns: + + - `allow` that include paths and import statements that can be imported with reaching. + - `forbid` that exclude paths and import statements that can be imported with reaching. + +### Examples + +Given the following folder structure: + +```pt +my-project +├── actions +│ └── getUser.js +│ └── updateUser.js +├── reducer +│ └── index.js +│ └── user.js +├── redux +│ └── index.js +│ └── configureStore.js +└── app +│ └── index.js +│ └── settings.js +└── entry.js +``` + +And the .eslintrc file: + +```json +{ + ... + "rules": { + "import/no-internal-modules": [ "error", { + "allow": [ "**/actions/*", "source-map-support/*" ], + } ] + } +} +``` + +The following patterns are considered problems: + +```js +/** + * in my-project/entry.js + */ + +import { settings } from './app/index'; // Reaching to "./app/index" is not allowed +import userReducer from './reducer/user'; // Reaching to "./reducer/user" is not allowed +import configureStore from './redux/configureStore'; // Reaching to "./redux/configureStore" is not allowed + +export { settings } from './app/index'; // Reaching to "./app/index" is not allowed +export * from './reducer/user'; // Reaching to "./reducer/user" is not allowed +``` + +The following patterns are NOT considered problems: + +```js +/** + * in my-project/entry.js + */ + +import 'source-map-support/register'; +import { settings } from '../app'; +import getUser from '../actions/getUser'; + +export * from 'source-map-support/register'; +export { settings } from '../app'; +``` + +Given the following folder structure: + +```pt +my-project +├── actions +│ └── getUser.js +│ └── updateUser.js +├── reducer +│ └── index.js +│ └── user.js +├── redux +│ └── index.js +│ └── configureStore.js +└── app +│ └── index.js +│ └── settings.js +└── entry.js +``` + +And the .eslintrc file: + +```json +{ + ... + "rules": { + "import/no-internal-modules": [ "error", { + "forbid": [ "**/actions/*", "source-map-support/*" ], + } ] + } +} +``` + +The following patterns are considered problems: + +```js +/** + * in my-project/entry.js + */ + +import 'source-map-support/register'; +import getUser from '../actions/getUser'; + +export * from 'source-map-support/register'; +export getUser from '../actions/getUser'; +``` + +The following patterns are NOT considered problems: + +```js +/** + * in my-project/entry.js + */ + +import 'source-map-support'; +import { getUser } from '../actions'; + +export * from 'source-map-support'; +export { getUser } from '../actions'; +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-mutable-exports.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-mutable-exports.md new file mode 100644 index 0000000000000000000000000000000000000000..ce51627858cc544ca1e629652f7d26c509ac186f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-mutable-exports.md @@ -0,0 +1,54 @@ +# import/no-mutable-exports + + + +Forbids the use of mutable exports with `var` or `let`. + +## Rule Details + +Valid: + +```js +export const count = 1 +export function getCount() {} +export class Counter {} +``` + +...whereas here exports will be reported: + +```js +export let count = 2 +export var count = 3 + +let count = 4 +export { count } // reported here +``` + +## Functions/Classes + +Note that exported function/class declaration identifiers may be reassigned, +but are not flagged by this rule at this time. They may be in the future, if a +reassignment is detected, i.e. + +```js +// possible future behavior! +export class Counter {} // reported here: exported class is reassigned on line [x]. +Counter = KitchenSink // not reported here unless you enable no-class-assign + +// this pre-declaration reassignment is valid on account of function hoisting +getCount = function getDuke() {} // not reported here without no-func-assign +export function getCount() {} // reported here: exported function is reassigned on line [x]. +``` + +To prevent general reassignment of these identifiers, exported or not, you may +want to enable the following core ESLint rules: + + - [no-func-assign] + - [no-class-assign] + +[no-func-assign]: https://eslint.org/docs/rules/no-func-assign +[no-class-assign]: https://eslint.org/docs/rules/no-class-assign + +## When Not To Use It + +If your environment correctly implements mutable export bindings. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-as-default-member.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-as-default-member.md new file mode 100644 index 0000000000000000000000000000000000000000..e8935fb7df4111b3ed08f9bf4fbc58b95a7f8dd4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-as-default-member.md @@ -0,0 +1,52 @@ +# import/no-named-as-default-member + +⚠️ This rule _warns_ in the following configs: ☑️ `recommended`, 🚸 `warnings`. + + + +Reports use of an exported name as a property on the default export. + +Rationale: Accessing a property that has a name that is shared by an exported +name from the same module is likely to be a mistake. + +Named import syntax looks very similar to destructuring assignment. It's easy to +make the (incorrect) assumption that named exports are also accessible as +properties of the default export. + +Furthermore, [in Babel 5 this is actually how things worked][blog]. This was +fixed in Babel 6. Before upgrading an existing codebase to Babel 6, it can be +useful to run this lint rule. + +[blog]: https://kentcdodds.com/blog/misunderstanding-es6-modules-upgrading-babel-tears-and-a-solution + +## Rule Details + +Given: + +```js +// foo.js +export default 'foo'; +export const bar = 'baz'; +``` + +...this would be valid: + +```js +import foo, {bar} from './foo.js'; +``` + +...and the following would be reported: + +```js +// Caution: `foo` also has a named export `bar`. +// Check if you meant to write `import {bar} from './foo.js'` instead. +import foo from './foo.js'; +const bar = foo.bar; +``` + +```js +// Caution: `foo` also has a named export `bar`. +// Check if you meant to write `import {bar} from './foo.js'` instead. +import foo from './foo.js'; +const {bar} = foo; +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-as-default.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-as-default.md new file mode 100644 index 0000000000000000000000000000000000000000..043d6994241b31fda7e37731703675b56c2ec1e6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-as-default.md @@ -0,0 +1,53 @@ +# import/no-named-as-default + +⚠️ This rule _warns_ in the following configs: ☑️ `recommended`, 🚸 `warnings`. + + + +Reports use of an exported name as the locally imported name of a default export. + +Rationale: using an exported name as the name of the default export is likely... + + - _misleading_: others familiar with `foo.js` probably expect the name to be `foo` + - _a mistake_: only needed to import `bar` and forgot the brackets (the case that is prompting this) + +## Rule Details + +Given: + +```js +// foo.js +export default 'foo'; +export const bar = 'baz'; +``` + +...this would be valid: + +```js +import foo from './foo.js'; +``` + +...and this would be reported: + +```js +// message: Using exported name 'bar' as identifier for default export. +import bar from './foo.js'; +``` + +For post-ES2015 `export` extensions, this also prevents exporting the default from a referenced module as a name within that module, for the same reasons: + +```js +// valid: +export foo from './foo.js'; + +// message: Using exported name 'bar' as identifier for default export. +export bar from './foo.js'; +``` + +## Further Reading + + - ECMAScript Proposal: [export ns from] + - ECMAScript Proposal: [export default from] + +[export ns from]: https://github.com/leebyron/ecmascript-export-ns-from +[export default from]: https://github.com/leebyron/ecmascript-export-default-from diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-default.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-default.md new file mode 100644 index 0000000000000000000000000000000000000000..05860cde1e0fde2f3bfefcab8ea42261e4518820 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-default.md @@ -0,0 +1,36 @@ +# import/no-named-default + + + +Reports use of a default export as a locally named import. + +Rationale: the syntax exists to import default exports expressively, let's use it. + +Note that type imports, as used by [Flow], are always ignored. + +[Flow]: https://flow.org/ + +## Rule Details + +Given: + +```js +// foo.js +export default 'foo'; +export const bar = 'baz'; +``` + +...these would be valid: + +```js +import foo from './foo.js'; +import foo, { bar } from './foo.js'; +``` + +...and these would be reported: + +```js +// message: Using exported name 'bar' as identifier for default export. +import { default as foo } from './foo.js'; +import { default as foo, bar } from './foo.js'; +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-export.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-export.md new file mode 100644 index 0000000000000000000000000000000000000000..13ea63ad739de4b68dc574e8c46934b6b69d67bc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-named-export.md @@ -0,0 +1,79 @@ +# import/no-named-export + + + +Prohibit named exports. Mostly an inverse of [`no-default-export`]. + +[`no-default-export`]: ./no-default-export.md + +## Rule Details + +The following patterns are considered warnings: + +```javascript +// bad1.js + +// There is only a single module export and it's a named export. +export const foo = 'foo'; +``` + +```javascript +// bad2.js + +// There is more than one named export in the module. +export const foo = 'foo'; +export const bar = 'bar'; +``` + +```javascript +// bad3.js + +// There is more than one named export in the module. +const foo = 'foo'; +const bar = 'bar'; +export { foo, bar } +``` + +```javascript +// bad4.js + +// There is more than one named export in the module. +export * from './other-module' +``` + +```javascript +// bad5.js + +// There is a default and a named export. +export const foo = 'foo'; +const bar = 'bar'; +export default 'bar'; +``` + +The following patterns are not warnings: + +```javascript +// good1.js + +// There is only a single module export and it's a default export. +export default 'bar'; +``` + +```javascript +// good2.js + +// There is only a single module export and it's a default export. +const foo = 'foo'; +export { foo as default } +``` + +```javascript +// good3.js + +// There is only a single module export and it's a default export. +export default from './other-module'; +``` + +## When Not To Use It + +If you don't care if named imports are used, or if you prefer named imports over default imports. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-namespace.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-namespace.md new file mode 100644 index 0000000000000000000000000000000000000000..c7346515a509ad5dbe1906893fca71b27b95d5a2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-namespace.md @@ -0,0 +1,44 @@ +# import/no-namespace + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +Enforce a convention of not using namespace (a.k.a. "wildcard" `*`) imports. + +The rule is auto-fixable when the namespace object is only used for direct member access, e.g. `namespace.a`. + +## Options + +This rule supports the following options: + + - `ignore`: array of glob strings for modules that should be ignored by the rule. + +## Rule Details + +Valid: + +```js +import defaultExport from './foo' +import { a, b } from './bar' +import defaultExport, { a, b } from './foobar' +``` + +```js +/* eslint import/no-namespace: ["error", {ignore: ['*.ext']}] */ +import * as bar from './ignored-module.ext'; +``` + +Invalid: + +```js +import * as foo from 'foo'; +``` + +```js +import defaultExport, * as foo from 'foo'; +``` + +## When Not To Use It + +If you want to use namespaces, you don't want to use this rule. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-nodejs-modules.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-nodejs-modules.md new file mode 100644 index 0000000000000000000000000000000000000000..5cbc907286820a446da662ffb6294b3f3788e560 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-nodejs-modules.md @@ -0,0 +1,42 @@ +# import/no-nodejs-modules + + + +Forbid the use of Node.js builtin modules. Can be useful for client-side web projects that do not have access to those modules. + +## Options + +This rule supports the following options: + + - `allow`: Array of names of allowed modules. Defaults to an empty array. + +## Rule Details + +### Fail + +```js +import fs from 'fs'; +import path from 'path'; + +var fs = require('fs'); +var path = require('path'); +``` + +### Pass + +```js +import _ from 'lodash'; +import foo from 'foo'; +import foo from './foo'; + +var _ = require('lodash'); +var foo = require('foo'); +var foo = require('./foo'); + +/* eslint import/no-nodejs-modules: ["error", {"allow": ["path"]}] */ +import path from 'path'; +``` + +## When Not To Use It + +If you have a project that is run mainly or partially using Node.js. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-relative-packages.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-relative-packages.md new file mode 100644 index 0000000000000000000000000000000000000000..ed724a9ebe17eb3b87903373208bc6041c0720e2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-relative-packages.md @@ -0,0 +1,69 @@ +# import/no-relative-packages + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +Use this rule to prevent importing packages through relative paths. + +It's useful in Yarn/Lerna workspaces, where it's possible to import a sibling package using `../package` relative path, while direct `package` is the correct one. + +## Examples + +Given the following folder structure: + +```pt +my-project +├── packages +│ ├── foo +│ │ ├── index.js +│ │ └── package.json +│ └── bar +│ ├── index.js +│ └── package.json +└── entry.js +``` + +And the .eslintrc file: + +```json +{ + ... + "rules": { + "import/no-relative-packages": "error" + } +} +``` + +The following patterns are considered problems: + +```js +/** + * in my-project/packages/foo.js + */ + +import bar from '../bar'; // Import sibling package using relative path +import entry from '../../entry.js'; // Import from parent package using relative path + +/** + * in my-project/entry.js + */ + +import bar from './packages/bar'; // Import child package using relative path +``` + +The following patterns are NOT considered problems: + +```js +/** + * in my-project/packages/foo.js + */ + +import bar from 'bar'; // Import sibling package using package name + +/** + * in my-project/entry.js + */ + +import bar from 'bar'; // Import sibling package using package name +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-relative-parent-imports.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-relative-parent-imports.md new file mode 100644 index 0000000000000000000000000000000000000000..c1f978487197e9c26cbb156bcea10dc11440fa98 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-relative-parent-imports.md @@ -0,0 +1,123 @@ +# import/no-relative-parent-imports + + + +Use this rule to prevent imports to folders in relative parent paths. + +This rule is useful for enforcing tree-like folder structures instead of complex graph-like folder structures. While this restriction might be a departure from Node's default resolution style, it can lead large, complex codebases to be easier to maintain. If you've ever had debates over "where to put files" this rule is for you. + +To fix violations of this rule there are three general strategies. Given this example: + +```pt +numbers +└── three.js +add.js +``` + +```js +// ./add.js +export default function (numbers) { + return numbers.reduce((sum, n) => sum + n, 0); +} + +// ./numbers/three.js +import add from '../add'; // violates import/no-relative-parent-imports + +export default function three() { + return add([1, 2]); +} +``` + +You can, + +1. Move the file to be in a sibling folder (or higher) of the dependency. + + `three.js` could be be in the same folder as `add.js`: + + ```pt + three.js + add.js + ``` + + or since `add` doesn't have any imports, it could be in it's own directory (namespace): + + ```pt + math + └── add.js + three.js + ``` + +2. Pass the dependency as an argument at runtime (dependency injection) + + ```js + // three.js + export default function three(add) { + return add([1, 2]); + } + + // somewhere else when you use `three.js`: + import add from './add'; + import three from './numbers/three'; + console.log(three(add)); + ``` + +3. Make the dependency a package so it's globally available to all files in your project: + + ```js + import add from 'add'; // from https://www.npmjs.com/package/add + export default function three() { + return add([1,2]); + } + ``` + +These are (respectively) static, dynamic & global solutions to graph-like dependency resolution. + +## Examples + +Given the following folder structure: + +```pt +my-project +├── lib +│ ├── a.js +│ └── b.js +└── main.js +``` + +And the .eslintrc file: + +```json +{ + ... + "rules": { + "import/no-relative-parent-imports": "error" + } +} +``` + +The following patterns are considered problems: + +```js +/** + * in my-project/lib/a.js + */ + +import bar from '../main'; // Import parent file using a relative path +``` + +The following patterns are NOT considered problems: + +```js +/** + * in my-project/main.js + */ + +import foo from 'foo'; // Import package using module path +import a from './lib/a'; // Import child file using relative path + +/** + * in my-project/lib/a.js + */ + +import b from './b'; // Import sibling file using relative path +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-restricted-paths.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-restricted-paths.md new file mode 100644 index 0000000000000000000000000000000000000000..5ba4b393e305ec8deaf945fbd5e665c734fe5a29 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-restricted-paths.md @@ -0,0 +1,220 @@ +# import/no-restricted-paths + + + +Some projects contain files which are not always meant to be executed in the same environment. +For example consider a web application that contains specific code for the server and some specific code for the browser/client. In this case you don’t want to import server-only files in your client code. + +In order to prevent such scenarios this rule allows you to define restricted zones where you can forbid files from being imported if they match a specific path. + +## Rule Details + +This rule has one option, which is an object containing all `zones` where restrictions will be applied, plus an optional `basePath` used to resolve relative paths within each zone. +The default for `basePath` is the current working directory. + +Each zone consists of a `target`, a `from`, and optional `except` and `message` attributes. + + - `target` - Identifies which files are part of the zone. It can be expressed as: + - A simple directory path, matching all files contained recursively within it + - A glob pattern + - An array of any of the two types above + - *Example: `target: './client'` - this zone consists of all files under the 'client' dir* + - `from` - Identifies folders from which the zone is not allowed to import. It can be expressed as: + - A simple directory path, matching all files contained recursively within it + - A glob pattern + - An array of only simple directories, or of only glob patterns (mixing both types within the array is not allowed) + - *Example: `from: './server'` - this zone is not allowed to import anything from the 'server' dir* + - `except` - Optional. Allows exceptions that would otherwise violate the related `from`. Note that it does not alter the behaviour of `target` in any way. + - If `from` is an array of glob patterns, `except` must be an array of glob patterns as well. + - If `from` is an array of simple directories, `except` is relative to `from` and cannot backtrack to a parent directory. + - *Example: `except: './server/config'` this zone is allowed to import server config, even if it can't import other server code* + - `message` - Optional. Displayed in case of rule violation. + +*Note: The `from` attribute is NOT matched literally against the import path string as it appears in the code. Instead, it's matched against the path to the imported file after it's been resolved against `basePath`.* + +### Examples + +Given this folder structure: + +```pt +. +├── client +│ ├── foo.js +│ └── baz.js +└── server + └── bar.js +``` + +And this configuration: + +```json +{ + "zones": [ + { + "target": "./client", + "from": "./server" + } + ] +} +``` + +:x: The following is considered incorrect: + +```js +// client/foo.js +import bar from '../server/bar'; +``` + +:white_check_mark: The following is considered correct: + +```js +// server/bar.js +import baz from '../client/baz'; +``` + +--------------- + +Given this folder structure: + +```pt +. +├── client +│ └── ... +└── server + ├── one + │ ├── a.js + │ └── b.js + └── two + └── a.js +``` + +And this configuration: + +```json +{ + "zones": [ + { + "target": "./server/one", + "from": "./server", + "except": ["./one"] + } + ] +} +``` + +:x: The following is considered incorrect: + +```js +// server/one/a.js +import a from '../two/a' +``` + +:white_check_mark: The following is considered correct: + +```js +// server/one/a.js +import b from './b' +``` + +--------------- + +Given this folder structure: + +```pt +. +└── client + ├── foo.js + └── sub-module + ├── bar.js + └── baz.js +``` + +And this configuration: + +```json +{ + "zones": [ + { + "target": "./client/!(sub-module)/**/*", + "from": "./client/sub-module/**/*", + } + ] +} +``` + +:x: The following is considered incorrect: + +```js +// client/foo.js +import a from './sub-module/baz' +``` + +:white_check_mark: The following is considered correct: + +```js +// client/sub-module/bar.js +import b from './baz' +``` + +--------------- + +Given this folder structure: + +```pt +. +├── one +│ ├── a.js +│ └── b.js +├── two +│ ├── a.js +│ └── b.js +└── three + ├── a.js + └── b.js +``` + +And this configuration: + +```json +{ + "zones": [ + { + "target": [ + "./two/*", + "./three/*" + ], + "from": [ + "./one", + "./three" + ] + } + ] +} +``` + +:white_check_mark: The following is considered correct: + +```js +// one/b.js +import a from '../three/a' +import a from './a' +``` + +```js +// two/b.js +import a from './a' +``` + +:x: The following is considered incorrect: + +```js +// two/a.js +import a from '../one/a' +import a from '../three/a' +``` + +```js +// three/b.js +import a from '../one/a' +import a from './a' +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-self-import.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-self-import.md new file mode 100644 index 0000000000000000000000000000000000000000..8d8491c508289272813c6d60cd7b273874be1a00 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-self-import.md @@ -0,0 +1,32 @@ +# import/no-self-import + + + +Forbid a module from importing itself. This can sometimes happen during refactoring. + +## Rule Details + +### Fail + +```js +// foo.js +import foo from './foo'; + +const foo = require('./foo'); +``` + +```js +// index.js +import index from '.'; + +const index = require('.'); +``` + +### Pass + +```js +// foo.js +import bar from './bar'; + +const bar = require('./bar'); +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-unassigned-import.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-unassigned-import.md new file mode 100644 index 0000000000000000000000000000000000000000..617395e2c38e67abcaf0bdc88605207c5ab231a2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-unassigned-import.md @@ -0,0 +1,60 @@ +# import/no-unassigned-import + + + +With both CommonJS' `require` and the ES6 modules' `import` syntax, it is possible to import a module but not to use its result. This can be done explicitly by not assigning the module to as variable. Doing so can mean either of the following things: + + - The module is imported but not used + - The module has side-effects (like [`should`](https://www.npmjs.com/package/should)). Having side-effects, makes it hard to know whether the module is actually used or can be removed. It can also make it harder to test or mock parts of your application. + +This rule aims to remove modules with side-effects by reporting when a module is imported but not assigned. + +## Options + +This rule supports the following option: + +`allow`: An Array of globs. The files that match any of these patterns would be ignored/allowed by the linter. This can be useful for some build environments (e.g. css-loader in webpack). + +Note that the globs start from the where the linter is executed (usually project root), but not from each file that includes the source. Learn more in both the pass and fail examples below. + +## Fail + +```js +import 'should' +require('should') + +// In /src/app.js +import '../styles/app.css' +// {"allow": ["styles/*.css"]} +``` + +## Pass + +```js +import _ from 'foo' +import _, {foo} from 'foo' +import _, {foo as bar} from 'foo' +import {foo as bar} from 'foo' +import * as _ from 'foo' + +const _ = require('foo') +const {foo} = require('foo') +const {foo: bar} = require('foo') +const [a, b] = require('foo') +const _ = require('foo') + +// Module is not assigned, but it is used +bar(require('foo')) +require('foo').bar +require('foo').bar() +require('foo')() + +// With allow option set +import './style.css' // {"allow": ["**/*.css"]} +import 'babel-register' // {"allow": ["babel-register"]} + +// In /src/app.js +import './styles/app.css' +import '../scripts/register.js' +// {"allow": ["src/styles/**", "**/scripts/*.js"]} +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-unresolved.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-unresolved.md new file mode 100644 index 0000000000000000000000000000000000000000..ca1da39c007f6b042a7b28b9d0627c3dbbc3ca8a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-unresolved.md @@ -0,0 +1,110 @@ +# import/no-unresolved + +💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`. + + + +Ensures an imported module can be resolved to a module on the local filesystem, +as defined by standard Node `require.resolve` behavior. + +See [settings](../../README.md#settings) for customization options for the resolution (i.e. +additional filetypes, `NODE_PATH`, etc.) + +This rule can also optionally report on unresolved modules in CommonJS `require('./foo')` calls and AMD `require(['./foo'], function (foo) {...})` and `define(['./foo'], function (foo) {...})`. + +To enable this, send `{ commonjs: true/false, amd: true/false }` as a rule option. +Both are disabled by default. + +If you are using Webpack, see the section on [resolvers](../../README.md#resolvers). + +## Rule Details + +### Options + +By default, only ES6 imports will be resolved: + +```js +/*eslint import/no-unresolved: 2*/ +import x from './foo' // reports if './foo' cannot be resolved on the filesystem +``` + +If `{commonjs: true}` is provided, single-argument `require` calls will be resolved: + +```js +/*eslint import/no-unresolved: [2, { commonjs: true }]*/ +const { default: x } = require('./foo') // reported if './foo' is not found + +require(0) // ignored +require(['x', 'y'], function (x, y) { /*...*/ }) // ignored +``` + +Similarly, if `{ amd: true }` is provided, dependency paths for `define` and `require` +calls will be resolved: + +```js +/*eslint import/no-unresolved: [2, { amd: true }]*/ +define(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found +require(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found + +const { default: x } = require('./foo') // ignored +``` + +Both may be provided, too: + +```js +/*eslint import/no-unresolved: [2, { commonjs: true, amd: true }]*/ +const { default: x } = require('./foo') // reported if './foo' is not found +define(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found +require(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found +``` + +#### `ignore` + +This rule has its own ignore list, separate from [`import/ignore`]. This is because you may want to know whether a module can be located, regardless of whether it can be parsed for exports: `node_modules`, CoffeeScript files, etc. are all good to resolve properly, but will not be parsed if configured as such via [`import/ignore`]. + +To suppress errors from files that may not be properly resolved by your [resolver settings](../../README.md#resolver-plugins), you may add an `ignore` key with an array of `RegExp` pattern strings: + +```js +/*eslint import/no-unresolved: [2, { ignore: ['\\.img$'] }]*/ + +import { x } from './mod' // may be reported, if not resolved to a module + +import coolImg from '../../img/coolImg.img' // will not be reported, even if not found +``` + +#### `caseSensitive` + +By default, this rule will report paths whose case do not match the underlying filesystem path, if the FS is not case-sensitive. To disable this behavior, set the `caseSensitive` option to `false`. + +```js +/*eslint import/no-unresolved: [2, { caseSensitive: true (default) | false }]*/ +const { default: x } = require('./foo') // reported if './foo' is actually './Foo' and caseSensitive: true +``` + +#### `caseSensitiveStrict` + +The `caseSensitive` option does not detect case for the current working directory. The `caseSensitiveStrict` option allows checking `cwd` in resolved path. By default, the option is disabled. + +```js +/*eslint import/no-unresolved: [2, { caseSensitiveStrict: true }]*/ + +// Absolute paths +import Foo from `/Users/fOo/bar/file.js` // reported, /Users/foo/bar/file.js +import Foo from `d:/fOo/bar/file.js` // reported, d:/foo/bar/file.js + +// Relative paths, cwd is Users/foo/ +import Foo from `./../fOo/bar/file.js` // reported +``` + +## When Not To Use It + +If you're using a module bundler other than Node or Webpack, you may end up with a lot of false positive reports of missing dependencies. + +## Further Reading + + - [Resolver plugins](../../README.md#resolvers) + - [Node resolver](https://npmjs.com/package/eslint-import-resolver-node) (default) + - [Webpack resolver](https://npmjs.com/package/eslint-import-resolver-webpack) + - [`import/ignore`] global setting + +[`import/ignore`]: ../../README.md#importignore diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-unused-modules.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-unused-modules.md new file mode 100644 index 0000000000000000000000000000000000000000..8d6398e5113217d344e60a1c5a24779801ecfc28 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-unused-modules.md @@ -0,0 +1,136 @@ +# import/no-unused-modules + + + +Reports: + + - modules without any exports + - individual exports not being statically `import`ed or `require`ed from other modules in the same project + - dynamic imports are supported if argument is a literal string + +## Rule Details + +### Usage + +In order for this plugin to work, at least one of the options `missingExports` or `unusedExports` must be enabled (see "Options" section below). In the future, these options will be enabled by default (see ) + +Example: + +```json +"rules": { + ...otherRules, + "import/no-unused-modules": [1, {"unusedExports": true}] +} +``` + +### Options + +This rule takes the following option: + + - **`missingExports`**: if `true`, files without any exports are reported (defaults to `false`) + - **`unusedExports`**: if `true`, exports without any static usage within other modules are reported (defaults to `false`) + - **`ignoreUnusedTypeExports`**: if `true`, TypeScript type exports without any static usage within other modules are reported (defaults to `false` and has no effect unless `unusedExports` is `true`) + - **`src`**: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided + - **`ignoreExports`**: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package) + +### Example for missing exports + +#### The following will be reported + +```js +const class MyClass { /*...*/ } + +function makeClass() { return new MyClass(...arguments) } +``` + +#### The following will not be reported + +```js +export default function () { /*...*/ } +``` + +```js +export const foo = function () { /*...*/ } +``` + +```js +export { foo, bar } +``` + +```js +export { foo as bar } +``` + +### Example for unused exports + +given file-f: + +```js +import { e } from 'file-a' +import { f } from 'file-b' +import * as fileC from 'file-c' +export { default, i0 } from 'file-d' // both will be reported + +export const j = 99 // will be reported +``` + +and file-d: + +```js +export const i0 = 9 // will not be reported +export const i1 = 9 // will be reported +export default () => {} // will not be reported +``` + +and file-c: + +```js +export const h = 8 // will not be reported +export default () => {} // will be reported, as export * only considers named exports and ignores default exports +``` + +and file-b: + +```js +import two, { b, c, doAnything } from 'file-a' + +export const f = 6 // will not be reported +``` + +and file-a: + +```js +const b = 2 +const c = 3 +const d = 4 + +export const a = 1 // will be reported + +export { b, c } // will not be reported + +export { d as e } // will not be reported + +export function doAnything() { + // some code +} // will not be reported + +export default 5 // will not be reported +``` + +### Unused exports with `ignoreUnusedTypeExports` set to `true` + +The following will not be reported: + +```ts +export type Foo = {}; // will not be reported +export interface Foo = {}; // will not be reported +export enum Foo {}; // will not be reported +``` + +#### Important Note + +Exports from files listed as a main file (`main`, `browser`, or `bin` fields in `package.json`) will be ignored by default. This only applies if the `package.json` is not set to `private: true` + +## When not to use + +If you don't mind having unused files or dead code within your codebase, you can disable this rule diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-useless-path-segments.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-useless-path-segments.md new file mode 100644 index 0000000000000000000000000000000000000000..22c4bf965b223215ed029ac64089e3048d56d472 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-useless-path-segments.md @@ -0,0 +1,85 @@ +# import/no-useless-path-segments + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +Use this rule to prevent unnecessary path segments in import and require statements. + +## Rule Details + +Given the following folder structure: + +```pt +my-project +├── app.js +├── footer.js +├── header.js +└── helpers.js +└── helpers + └── index.js +├── index.js +└── pages + ├── about.js + ├── contact.js + └── index.js +``` + +The following patterns are considered problems: + +```js +/** + * in my-project/app.js + */ + +import "./../my-project/pages/about.js"; // should be "./pages/about.js" +import "./../my-project/pages/about"; // should be "./pages/about" +import "../my-project/pages/about.js"; // should be "./pages/about.js" +import "../my-project/pages/about"; // should be "./pages/about" +import "./pages//about"; // should be "./pages/about" +import "./pages/"; // should be "./pages" +import "./pages/index"; // should be "./pages" (except if there is a ./pages.js file) +import "./pages/index.js"; // should be "./pages" (except if there is a ./pages.js file) +``` + +The following patterns are NOT considered problems: + +```js +/** + * in my-project/app.js + */ + +import "./header.js"; +import "./pages"; +import "./pages/about"; +import "."; +import ".."; +import fs from "fs"; +``` + +## Options + +### noUselessIndex + +If you want to detect unnecessary `/index` or `/index.js` (depending on the specified file extensions, see below) imports in your paths, you can enable the option `noUselessIndex`. By default it is set to `false`: + +```js +"import/no-useless-path-segments": ["error", { + noUselessIndex: true, +}] +``` + +Additionally to the patterns described above, the following imports are considered problems if `noUselessIndex` is enabled: + +```js +// in my-project/app.js +import "./helpers/index"; // should be "./helpers/" (not auto-fixable to `./helpers` because this would lead to an ambiguous import of `./helpers.js` and `./helpers/index.js`) +import "./pages/index"; // should be "./pages" (auto-fixable) +import "./pages/index.js"; // should be "./pages" (auto-fixable) +``` + +Note: `noUselessIndex` only avoids ambiguous imports for `.js` files if you haven't specified other resolved file extensions. See [Settings: import/extensions](https://github.com/import-js/eslint-plugin-import#importextensions) for details. + +### commonjs + +When set to `true`, this rule checks CommonJS imports. Default to `false`. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-webpack-loader-syntax.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-webpack-loader-syntax.md new file mode 100644 index 0000000000000000000000000000000000000000..291b1c058a57e282be5cd34c93a2f45888ccf84e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/no-webpack-loader-syntax.md @@ -0,0 +1,39 @@ +# import/no-webpack-loader-syntax + + + +Forbid Webpack loader syntax in imports. + +[Webpack](https://webpack.js.org) allows specifying the [loaders](https://webpack.js.org/concepts/loaders/) to use in the import source string using a special syntax like this: + +```js +var moduleWithOneLoader = require("my-loader!./my-awesome-module"); +``` + +This syntax is non-standard, so it couples the code to Webpack. The recommended way to specify Webpack loader configuration is in a [Webpack configuration file](https://webpack.js.org/concepts/loaders/#configuration). + +## Rule Details + +### Fail + +```js +import myModule from 'my-loader!my-module'; +import theme from 'style!css!./theme.css'; + +var myModule = require('my-loader!./my-module'); +var theme = require('style!css!./theme.css'); +``` + +### Pass + +```js +import myModule from 'my-module'; +import theme from './theme.css'; + +var myModule = require('my-module'); +var theme = require('./theme.css'); +``` + +## When Not To Use It + +If you have a project that doesn't use Webpack you can safely disable this rule. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/order.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/order.md new file mode 100644 index 0000000000000000000000000000000000000000..4a52b823e1cf6a6f46b9b61370d8491f46c7b629 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/order.md @@ -0,0 +1,1024 @@ +# import/order + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + + +Enforce a convention in the order of `require()` / `import` statements. + +With the [`groups`][18] option set to `["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"]` the order is as shown in the following example: + +```ts +// 1. node "builtin" modules +import fs from 'fs'; +import path from 'path'; +// 2. "external" modules +import _ from 'lodash'; +import chalk from 'chalk'; +// 3. "internal" modules +// (if you have configured your path or webpack to handle your internal paths differently) +import foo from 'src/foo'; +// 4. modules from a "parent" directory +import foo from '../foo'; +import qux from '../../foo/qux'; +// 5. "sibling" modules from the same or a sibling's directory +import bar from './bar'; +import baz from './bar/baz'; +// 6. "index" of the current directory +import main from './'; +// 7. "object"-imports (only available in TypeScript) +import log = console.log; +// 8. "type" imports (only available in Flow and TypeScript) +import type { Foo } from 'foo'; +``` + +See [here][3] for further details on how imports are grouped. + +## Fail + +```ts +import _ from 'lodash'; +import path from 'path'; // `path` import should occur before import of `lodash` + +// ----- + +var _ = require('lodash'); +var path = require('path'); // `path` import should occur before import of `lodash` + +// ----- + +var path = require('path'); +import foo from './foo'; // `import` statements must be before `require` statement +``` + +## Pass + +```ts +import path from 'path'; +import _ from 'lodash'; + +// ----- + +var path = require('path'); +var _ = require('lodash'); + +// ----- + +// Allowed as ̀`babel-register` is not assigned. +require('babel-register'); +var path = require('path'); + +// ----- + +// Allowed as `import` must be before `require` +import foo from './foo'; +var path = require('path'); +``` + +## Limitations of `--fix` + +Unbound imports are assumed to have side effects, and will never be moved/reordered. This can cause other imports to get "stuck" around them, and the fix to fail. + +```javascript +import b from 'b' +import 'format.css'; // This will prevent --fix from working. +import a from 'a' +``` + +As a workaround, move unbound imports to be entirely above or below bound ones. + +```javascript +import 'format1.css'; // OK +import b from 'b' +import a from 'a' +import 'format2.css'; // OK +``` + +## Options + +This rule supports the following options (none of which are required): + + - [`groups`][18] + - [`pathGroups`][8] + - [`pathGroupsExcludedImportTypes`][9] + - [`distinctGroup`][32] + - [`newlines-between`][20] + - [`alphabetize`][30] + - [`named`][33] + - [`warnOnUnassignedImports`][5] + - [`sortTypesGroup`][7] + - [`newlines-between-types`][27] + - [`consolidateIslands`][25] + +--- + +### `groups` + +Valid values: `("builtin" | "external" | "internal" | "unknown" | "parent" | "sibling" | "index" | "object" | "type")[]` \ +Default: `["builtin", "external", "parent", "sibling", "index"]` + +Determines which imports are subject to ordering, and how to order +them. The predefined groups are: `"builtin"`, `"external"`, `"internal"`, +`"unknown"`, `"parent"`, `"sibling"`, `"index"`, `"object"`, and `"type"`. + +The import order enforced by this rule is the same as the order of each group +in `groups`. Imports belonging to groups omitted from `groups` are lumped +together at the end. + +#### Example + +```jsonc +{ + "import/order": ["error", { + "groups": [ + // Imports of builtins are first + "builtin", + // Then sibling and parent imports. They can be mingled together + ["sibling", "parent"], + // Then index file imports + "index", + // Then any arcane TypeScript imports + "object", + // Then the omitted imports: internal, external, type, unknown + ], + }], +} +``` + +#### How Imports Are Grouped + +An import (a `ImportDeclaration`, `TSImportEqualsDeclaration`, or `require()` `CallExpression`) is grouped by its type (`"require"` vs `"import"`), its [specifier][4], and any corresponding identifiers. + +```ts +import { identifier1, identifier2 } from 'specifier1'; +import type { MyType } from 'specifier2'; +const identifier3 = require('specifier3'); +``` + +Roughly speaking, the grouping algorithm is as follows: + +1. If the import has no corresponding identifiers (e.g. `import './my/thing.js'`), is otherwise "unassigned," or is an unsupported use of `require()`, and [`warnOnUnassignedImports`][5] is disabled, it will be ignored entirely since the order of these imports may be important for their [side-effects][31] +2. If the import is part of an arcane TypeScript declaration (e.g. `import log = console.log`), it will be considered **object**. However, note that external module references (e.g. `import x = require('z')`) are treated as normal `require()`s and import-exports (e.g. `export import w = y;`) are ignored entirely +3. If the import is [type-only][6], `"type"` is in `groups`, and [`sortTypesGroup`][7] is disabled, it will be considered **type** (with additional implications if using [`pathGroups`][8] and `"type"` is in [`pathGroupsExcludedImportTypes`][9]) +4. If the import's specifier matches [`import/internal-regex`][28], it will be considered **internal** +5. If the import's specifier is an absolute path, it will be considered **unknown** +6. If the import's specifier has the name of a Node.js core module (using [is-core-module][10]), it will be considered **builtin** +7. If the import's specifier matches [`import/core-modules`][11], it will be considered **builtin** +8. If the import's specifier is a path relative to the parent directory of its containing file (e.g. starts with `../`), it will be considered **parent** +9. If the import's specifier is one of `['.', './', './index', './index.js']`, it will be considered **index** +10. If the import's specifier is a path relative to its containing file (e.g. starts with `./`), it will be considered **sibling** +11. If the import's specifier is a path pointing to a file outside the current package's root directory (determined using [package-up][12]), it will be considered **external** +12. If the import's specifier matches [`import/external-module-folders`][29] (defaults to matching anything pointing to files within the current package's `node_modules` directory), it will be considered **external** +13. If the import's specifier is a path pointing to a file within the current package's root directory (determined using [package-up][12]), it will be considered **internal** +14. If the import's specifier has a name that looks like a scoped package (e.g. `@scoped/package-name`), it will be considered **external** +15. If the import's specifier has a name that starts with a word character, it will be considered **external** +16. If this point is reached, the import will be ignored entirely + +At the end of the process, if they co-exist in the same file, all top-level `require()` statements that haven't been ignored are shifted (with respect to their order) below any ES6 `import` or similar declarations. Finally, any type-only declarations are potentially reorganized according to [`sortTypesGroup`][7]. + +### `pathGroups` + +Valid values: `PathGroup[]` \ +Default: `[]` + +Sometimes [the predefined groups][18] are not fine-grained enough, especially when using import aliases. +`pathGroups` defines one or more [`PathGroup`][13]s relative to a predefined group. +Imports are associated with a [`PathGroup`][13] based on path matching against the import specifier (using [minimatch][14]). + +> [!IMPORTANT] +> +> Note that, by default, imports grouped as `"builtin"`, `"external"`, or `"object"` will not be considered for further `pathGroups` matching unless they are removed from [`pathGroupsExcludedImportTypes`][9]. + +#### `PathGroup` + +| property | required | type | description | +| :--------------: | :------: | :--------------------: | ------------------------------------------------------------------------------------------------------------------------------- | +| `pattern` | ☑️ | `string` | [Minimatch pattern][16] for specifier matching | +| `patternOptions` | | `object` | [Minimatch options][17]; default: `{nocomment: true}` | +| `group` | ☑️ | [predefined group][18] | One of the [predefined groups][18] to which matching imports will be positioned relatively | +| `position` | | `"after" \| "before"` | Where, in relation to `group`, matching imports will be positioned; default: same position as `group` (neither before or after) | + +#### Example + +```jsonc +{ + "import/order": ["error", { + "pathGroups": [ + { + // Minimatch pattern used to match against specifiers + "pattern": "~/**", + // The predefined group this PathGroup is defined in relation to + "group": "external", + // How matching imports will be positioned relative to "group" + "position": "after" + } + ] + }] +} +``` + +### `pathGroupsExcludedImportTypes` + +Valid values: `("builtin" | "external" | "internal" | "unknown" | "parent" | "sibling" | "index" | "object" | "type")[]` \ +Default: `["builtin", "external", "object"]` + +By default, imports in certain [groups][18] are excluded from being matched against [`pathGroups`][8] to prevent overeager sorting. +Use `pathGroupsExcludedImportTypes` to modify which groups are excluded. + +> [!TIP] +> +> If using imports with custom specifier aliases (e.g. +> you're using `eslint-import-resolver-alias`, `paths` in `tsconfig.json`, etc) that [end up +> grouped][3] as `"builtin"` or `"external"` imports, +> remove them from `pathGroupsExcludedImportTypes` to ensure they are ordered +> correctly. + +#### Example + +```jsonc +{ + "import/order": ["error", { + "pathGroups": [ + { + "pattern": "@app/**", + "group": "external", + "position": "after" + } + ], + "pathGroupsExcludedImportTypes": ["builtin"] + }] +} +``` + +### `distinctGroup` + +Valid values: `boolean` \ +Default: `true` + +> [!CAUTION] +> +> Currently, `distinctGroup` defaults to `true`. However, in a later update, the +> default will change to `false`. + +This changes how [`PathGroup.position`][13] affects grouping, and is most useful when [`newlines-between`][20] is set to `always` and at least one [`PathGroup`][13] has a `position` property set. + +When [`newlines-between`][20] is set to `always` and an import matching a specific [`PathGroup.pattern`][13] is encountered, that import is added to a sort of "sub-group" associated with that [`PathGroup`][13]. Thanks to [`newlines-between`][20], imports in this "sub-group" will have a new line separating them from the rest of the imports in [`PathGroup.group`][13]. + +This behavior can be undesirable when using [`PathGroup.position`][13] to order imports _within_ [`PathGroup.group`][13] instead of creating a distinct "sub-group". Set `distinctGroup` to `false` to disable the creation of these "sub-groups". + +#### Example + +```jsonc +{ + "import/order": ["error", { + "distinctGroup": false, + "newlines-between": "always", + "pathGroups": [ + { + "pattern": "@app/**", + "group": "external", + "position": "after" + } + ] + }] +} +``` + +### `newlines-between` + +Valid values: `"ignore" | "always" | "always-and-inside-groups" | "never"` \ +Default: `"ignore"` + +Enforces or forbids new lines between import groups. + + - If set to `ignore`, no errors related to new lines between import groups will be reported + + - If set to `always`, at least one new line between each group will be enforced, and new lines inside a group will be forbidden + + > [!TIP] + > + > To prevent multiple lines between imports, the [`no-multiple-empty-lines` rule][21], or a tool like [Prettier][22], can be used. + + - If set to `always-and-inside-groups`, it will act like `always` except new lines are allowed inside import groups + + - If set to `never`, no new lines are allowed in the entire import section + +#### Example + +With the default [`groups`][18] setting, the following will fail the rule check: + +```ts +/* eslint import/order: ["error", {"newlines-between": "always"}] */ +import fs from 'fs'; +import path from 'path'; +import sibling from './foo'; +import index from './'; +``` + +```ts +/* eslint import/order: ["error", {"newlines-between": "always-and-inside-groups"}] */ +import fs from 'fs'; + +import path from 'path'; +import sibling from './foo'; +import index from './'; +``` + +```ts +/* eslint import/order: ["error", {"newlines-between": "never"}] */ +import fs from 'fs'; +import path from 'path'; + +import sibling from './foo'; + +import index from './'; +``` + +While this will pass: + +```ts +/* eslint import/order: ["error", {"newlines-between": "always"}] */ +import fs from 'fs'; +import path from 'path'; + +import sibling from './foo'; + +import index from './'; +``` + +```ts +/* eslint import/order: ["error", {"newlines-between": "always-and-inside-groups"}] */ +import fs from 'fs'; + +import path from 'path'; + +import sibling from './foo'; + +import index from './'; +``` + +```ts +/* eslint import/order: ["error", {"newlines-between": "never"}] */ +import fs from 'fs'; +import path from 'path'; +import sibling from './foo'; +import index from './'; +``` + +### `alphabetize` + +Valid values: `{ order?: "asc" | "desc" | "ignore", orderImportKind?: "asc" | "desc" | "ignore", caseInsensitive?: boolean }` \ +Default: `{ order: "ignore", orderImportKind: "ignore", caseInsensitive: false }` + +Determine the sort order of imports within each [predefined group][18] or [`PathGroup`][8] alphabetically based on specifier. + +> [!NOTE] +> +> Imports will be alphabetized based on their _specifiers_, not by their +> identifiers. For example, `const a = require('z');` will come _after_ `const z = require('a');` when `alphabetize` is set to `{ order: "asc" }`. + +Valid properties and their values include: + + - **`order`**: use `"asc"` to sort in ascending order, `"desc"` to sort in descending order, or "ignore" to prevent sorting + + - **`orderImportKind`**: use `"asc"` to sort various _import kinds_, e.g. [type-only and typeof imports][6], in ascending order, `"desc"` to sort them in descending order, or "ignore" to prevent sorting + + - **`caseInsensitive`**: use `true` to ignore case and `false` to consider case when sorting + +#### Example + +Given the following settings: + +```jsonc +{ + "import/order": ["error", { + "alphabetize": { + "order": "asc", + "caseInsensitive": true + } + }] +} +``` + +This will fail the rule check: + +```ts +import React, { PureComponent } from 'react'; +import aTypes from 'prop-types'; +import { compose, apply } from 'xcompose'; +import * as classnames from 'classnames'; +import blist from 'BList'; +``` + +While this will pass: + +```ts +import blist from 'BList'; +import * as classnames from 'classnames'; +import aTypes from 'prop-types'; +import React, { PureComponent } from 'react'; +import { compose, apply } from 'xcompose'; +``` + +### `named` + +Valid values: `boolean | { enabled: boolean, import?: boolean, export?: boolean, require?: boolean, cjsExports?: boolean, types?: "mixed" | "types-first" | "types-last" }` \ +Default: `false` + +Enforce ordering of names within imports and exports. + +If set to `true` or `{ enabled: true }`, _all_ named imports must be ordered according to [`alphabetize`][30]. +If set to `false` or `{ enabled: false }`, named imports can occur in any order. + +If set to `{ enabled: true, ... }`, and any of the properties `import`, `export`, `require`, or `cjsExports` are set to `false`, named ordering is disabled with respect to the following kind of expressions: + + - `import`: + + ```ts + import { Readline } from "readline"; + ``` + + - `export`: + + ```ts + export { Readline }; + // and + export { Readline } from "readline"; + ``` + + - `require`: + + ```ts + const { Readline } = require("readline"); + ``` + + - `cjsExports`: + + ```ts + module.exports.Readline = Readline; + // and + module.exports = { Readline }; + ``` + +Further, the `named.types` option allows you to specify the order of [import identifiers with inline type qualifiers][23] (or "type-only" identifiers/names), e.g. `import { type TypeIdentifier1, normalIdentifier2 } from 'specifier';`. + +`named.types` accepts the following values: + + - `types-first`: forces type-only identifiers to occur first + - `types-last`: forces type-only identifiers to occur last + - `mixed`: sorts all identifiers in alphabetical order + +#### Example + +Given the following settings: + +```jsonc +{ + "import/order": ["error", { + "named": true, + "alphabetize": { + "order": "asc" + } + }] +} +``` + +This will fail the rule check: + +```ts +import { compose, apply } from 'xcompose'; +``` + +While this will pass: + +```ts +import { apply, compose } from 'xcompose'; +``` + +### `warnOnUnassignedImports` + +Valid values: `boolean` \ +Default: `false` + +Warn when "unassigned" imports are out of order. +Unassigned imports are imports with no corresponding identifiers (e.g. `import './my/thing.js'` or `require('./side-effects.js')`). + +> [!NOTE] +> +> These warnings are not fixable with `--fix` since unassigned imports might be used for their [side-effects][31], +> and changing the order of such imports cannot be done safely. + +#### Example + +Given the following settings: + +```jsonc +{ + "import/order": ["error", { + "warnOnUnassignedImports": true + }] +} +``` + +This will fail the rule check: + +```ts +import fs from 'fs'; +import './styles.css'; +import path from 'path'; +``` + +While this will pass: + +```ts +import fs from 'fs'; +import path from 'path'; +import './styles.css'; +``` + +### `sortTypesGroup` + +Valid values: `boolean` \ +Default: `false` + +> [!NOTE] +> +> This setting is only meaningful when `"type"` is included in [`groups`][18]. + +Sort [type-only imports][6] separately from normal non-type imports. + +When enabled, the intragroup sort order of [type-only imports][6] will mirror the intergroup ordering of normal imports as defined by [`groups`][18], [`pathGroups`][8], etc. + +#### Example + +Given the following settings: + +```jsonc +{ + "import/order": ["error", { + "groups": ["type", "builtin", "parent", "sibling", "index"], + "alphabetize": { "order": "asc" } + }] +} +``` + +This will fail the rule check even though it's logically ordered as we expect (builtins come before parents, parents come before siblings, siblings come before indices), the only difference is we separated type-only imports from normal imports: + +```ts +import type A from "fs"; +import type B from "path"; +import type C from "../foo.js"; +import type D from "./bar.js"; +import type E from './'; + +import a from "fs"; +import b from "path"; +import c from "../foo.js"; +import d from "./bar.js"; +import e from "./"; +``` + +This happens because [type-only imports][6] are considered part of one global +[`"type"` group](#how-imports-are-grouped) by default. However, if we set +`sortTypesGroup` to `true`: + +```jsonc +{ + "import/order": ["error", { + "groups": ["type", "builtin", "parent", "sibling", "index"], + "alphabetize": { "order": "asc" }, + "sortTypesGroup": true + }] +} +``` + +The same example will pass. + +### `newlines-between-types` + +Valid values: `"ignore" | "always" | "always-and-inside-groups" | "never"` \ +Default: the value of [`newlines-between`][20] + +> [!NOTE] +> +> This setting is only meaningful when [`sortTypesGroup`][7] is enabled. + +`newlines-between-types` is functionally identical to [`newlines-between`][20] except it only enforces or forbids new lines between _[type-only][6] import groups_, which exist only when [`sortTypesGroup`][7] is enabled. + +In addition, when determining if a new line is enforceable or forbidden between the type-only imports and the normal imports, `newlines-between-types` takes precedence over [`newlines-between`][20]. + +#### Example + +Given the following settings: + +```jsonc +{ + "import/order": ["error", { + "groups": ["type", "builtin", "parent", "sibling", "index"], + "sortTypesGroup": true, + "newlines-between": "always" + }] +} +``` + +This will fail the rule check: + +```ts +import type A from "fs"; +import type B from "path"; +import type C from "../foo.js"; +import type D from "./bar.js"; +import type E from './'; + +import a from "fs"; +import b from "path"; + +import c from "../foo.js"; + +import d from "./bar.js"; + +import e from "./"; +``` + +However, if we set `newlines-between-types` to `"ignore"`: + +```jsonc +{ + "import/order": ["error", { + "groups": ["type", "builtin", "parent", "sibling", "index"], + "sortTypesGroup": true, + "newlines-between": "always", + "newlines-between-types": "ignore" + }] +} +``` + +The same example will pass. + +Note the new line after `import type E from './';` but before `import a from "fs";`. This new line separates the type-only imports from the normal imports. Its existence is governed by [`newlines-between-types`][27] and _not `newlines-between`_. + +> [!IMPORTANT] +> +> In certain situations, [`consolidateIslands: true`][25] will take precedence over `newlines-between-types: "never"`, if used, when it comes to the new line separating type-only imports from normal imports. + +The next example will pass even though there's a new line preceding the normal import and [`newlines-between`][20] is set to `"never"`: + +```jsonc +{ + "import/order": ["error", { + "groups": ["type", "builtin", "parent", "sibling", "index"], + "sortTypesGroup": true, + "newlines-between": "never", + "newlines-between-types": "always" + }] +} +``` + +```ts +import type A from "fs"; + +import type B from "path"; + +import type C from "../foo.js"; + +import type D from "./bar.js"; + +import type E from './'; + +import a from "fs"; +import b from "path"; +import c from "../foo.js"; +import d from "./bar.js"; +import e from "./"; +``` + +While the following fails due to the new line between the last type import and the first normal import: + +```jsonc +{ + "import/order": ["error", { + "groups": ["type", "builtin", "parent", "sibling", "index"], + "sortTypesGroup": true, + "newlines-between": "always", + "newlines-between-types": "never" + }] +} +``` + +```ts +import type A from "fs"; +import type B from "path"; +import type C from "../foo.js"; +import type D from "./bar.js"; +import type E from './'; + +import a from "fs"; + +import b from "path"; + +import c from "../foo.js"; + +import d from "./bar.js"; + +import e from "./"; +``` + +### `consolidateIslands` + +Valid values: `"inside-groups" | "never"` \ +Default: `"never"` + +> [!NOTE] +> +> This setting is only meaningful when [`newlines-between`][20] and/or [`newlines-between-types`][27] is set to `"always-and-inside-groups"`. + +When set to `"inside-groups"`, this ensures imports spanning multiple lines are separated from other imports with a new line while single-line imports are grouped together (and the space between them consolidated) if they belong to the same [group][18] or [`pathGroups`][8]. + +> [!IMPORTANT] +> +> When all of the following are true: +> +> - [`sortTypesGroup`][7] is set to `true` +> - `consolidateIslands` is set to `"inside-groups"` +> - [`newlines-between`][20] is set to `"always-and-inside-groups"` when [`newlines-between-types`][27] is set to `"never"` (or vice-versa) +> +> Then [`newlines-between`][20]/[`newlines-between-types`][27] will yield to +> `consolidateIslands` and allow new lines to separate multi-line imports +> regardless of the `"never"` setting. +> +> This configuration is useful, for instance, to keep single-line type-only +> imports stacked tightly together at the bottom of your import block to +> preserve space while still logically organizing normal imports for quick and +> pleasant reference. + +#### Example + +Given the following settings: + +```jsonc +{ + "import/order": ["error", { + "newlines-between": "always-and-inside-groups", + "consolidateIslands": "inside-groups" + }] +} +``` + +This will fail the rule check: + +```ts +var fs = require('fs'); +var path = require('path'); +var { util1, util2, util3 } = require('util'); +var async = require('async'); +var relParent1 = require('../foo'); +var { + relParent21, + relParent22, + relParent23, + relParent24, +} = require('../'); +var relParent3 = require('../bar'); +var { sibling1, + sibling2, sibling3 } = require('./foo'); +var sibling2 = require('./bar'); +var sibling3 = require('./foobar'); +``` + +While this will succeed (and is what `--fix` would yield): + +```ts +var fs = require('fs'); +var path = require('path'); +var { util1, util2, util3 } = require('util'); + +var async = require('async'); + +var relParent1 = require('../foo'); + +var { + relParent21, + relParent22, + relParent23, + relParent24, +} = require('../'); + +var relParent3 = require('../bar'); + +var { sibling1, + sibling2, sibling3 } = require('./foo'); + +var sibling2 = require('./bar'); +var sibling3 = require('./foobar'); +``` + +Note the intragroup "islands" of grouped single-line imports, as well as multi-line imports, are surrounded by new lines. At the same time, note the typical new lines separating different groups are still maintained thanks to [`newlines-between`][20]. + +The same holds true for the next example; when given the following settings: + +```jsonc +{ + "import/order": ["error", { + "alphabetize": { "order": "asc" }, + "groups": ["external", "internal", "index", "type"], + "pathGroups": [ + { + "pattern": "dirA/**", + "group": "internal", + "position": "after" + }, + { + "pattern": "dirB/**", + "group": "internal", + "position": "before" + }, + { + "pattern": "dirC/**", + "group": "internal" + } + ], + "newlines-between": "always-and-inside-groups", + "newlines-between-types": "never", + "pathGroupsExcludedImportTypes": [], + "sortTypesGroup": true, + "consolidateIslands": "inside-groups" + }] +} +``` + +> [!IMPORTANT] +> +> **Pay special attention to the value of [`pathGroupsExcludedImportTypes`][9]** in this example's settings. +> Without it, the successful example below would fail. +> This is because the imports with specifiers starting with "dirA/", "dirB/", and "dirC/" are all [considered part of the `"external"` group](#how-imports-are-grouped), and imports in that group are excluded from [`pathGroups`][8] matching by default. +> +> The fix is to remove `"external"` (and, in this example, the others) from [`pathGroupsExcludedImportTypes`][9]. + +This will fail the rule check: + +```ts +import c from 'Bar'; +import d from 'bar'; +import { + aa, + bb, + cc, + dd, + ee, + ff, + gg +} from 'baz'; +import { + hh, + ii, + jj, + kk, + ll, + mm, + nn +} from 'fizz'; +import a from 'foo'; +import b from 'dirA/bar'; +import index from './'; +import type { AA, + BB, CC } from 'abc'; +import type { Z } from 'fizz'; +import type { + A, + B +} from 'foo'; +import type { C2 } from 'dirB/Bar'; +import type { + D2, + X2, + Y2 +} from 'dirB/bar'; +import type { E2 } from 'dirB/baz'; +import type { C3 } from 'dirC/Bar'; +import type { + D3, + X3, + Y3 +} from 'dirC/bar'; +import type { E3 } from 'dirC/baz'; +import type { F3 } from 'dirC/caz'; +import type { C1 } from 'dirA/Bar'; +import type { + D1, + X1, + Y1 +} from 'dirA/bar'; +import type { E1 } from 'dirA/baz'; +import type { F } from './index.js'; +import type { G } from './aaa.js'; +import type { H } from './bbb'; +``` + +While this will succeed (and is what `--fix` would yield): + +```ts +import c from 'Bar'; +import d from 'bar'; + +import { + aa, + bb, + cc, + dd, + ee, + ff, + gg +} from 'baz'; + +import { + hh, + ii, + jj, + kk, + ll, + mm, + nn +} from 'fizz'; + +import a from 'foo'; + +import b from 'dirA/bar'; + +import index from './'; + +import type { AA, + BB, CC } from 'abc'; + +import type { Z } from 'fizz'; + +import type { + A, + B +} from 'foo'; + +import type { C2 } from 'dirB/Bar'; + +import type { + D2, + X2, + Y2 +} from 'dirB/bar'; + +import type { E2 } from 'dirB/baz'; +import type { C3 } from 'dirC/Bar'; + +import type { + D3, + X3, + Y3 +} from 'dirC/bar'; + +import type { E3 } from 'dirC/baz'; +import type { F3 } from 'dirC/caz'; +import type { C1 } from 'dirA/Bar'; + +import type { + D1, + X1, + Y1 +} from 'dirA/bar'; + +import type { E1 } from 'dirA/baz'; +import type { F } from './index.js'; +import type { G } from './aaa.js'; +import type { H } from './bbb'; +``` + +## Related + + - [`import/external-module-folders`][29] + - [`import/internal-regex`][28] + - [`import/core-modules`][11] + +[3]: #how-imports-are-grouped +[4]: https://nodejs.org/api/esm.html#terminology +[5]: #warnonunassignedimports +[6]: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export +[7]: #sorttypesgroup +[8]: #pathgroups +[9]: #pathgroupsexcludedimporttypes +[10]: https://www.npmjs.com/package/is-core-module +[11]: ../../README.md#importcore-modules +[12]: https://www.npmjs.com/package/package-up +[13]: #pathgroup +[14]: https://www.npmjs.com/package/minimatch +[16]: https://www.npmjs.com/package/minimatch#features +[17]: https://www.npmjs.com/package/minimatch#options +[18]: #groups +[20]: #newlines-between +[21]: https://eslint.org/docs/latest/rules/no-multiple-empty-lines +[22]: https://prettier.io +[23]: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names +[25]: #consolidateislands +[27]: #newlines-between-types +[28]: ../../README.md#importinternal-regex +[29]: ../../README.md#importexternal-module-folders +[30]: #alphabetize +[31]: https://webpack.js.org/guides/tree-shaking#mark-the-file-as-side-effect-free +[32]: #distinctgroup +[33]: #named diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/prefer-default-export.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/prefer-default-export.md new file mode 100644 index 0000000000000000000000000000000000000000..e2a7bacd7399da93962e2317dd89a774a0e8c380 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/prefer-default-export.md @@ -0,0 +1,185 @@ +# import/prefer-default-export + + + +In exporting files, this rule checks if there is default export or not. + +## Rule Details + +### rule schema + +```javascript +"import/prefer-default-export": [ + ( "off" | "warn" | "error" ), + { "target": "single" | "any" } // default is "single" +] +``` + +### Config Options + +There are two options available: `single` and `any`. By default, if you do not specify the option, rule will assume it is `single`. + +#### single + +**Definition**: When there is only a single export from a module, prefer using default export over named export. + +How to setup config file for this rule: + +```javascript +// you can manually specify it +"rules": { + "import/prefer-default-export": [ + ( "off" | "warn" | "error" ), + { "target": "single" } + ] +} + +// config setup below will also work +"rules": { + "import/prefer-default-export": "off" | "warn" | "error" +} +``` + +The following patterns are considered warnings: + +```javascript +// bad.js + +// There is only a single module export and it's a named export. +export const foo = 'foo'; + +``` + +The following patterns are not warnings: + +```javascript +// good1.js + +// There is a default export. +export const foo = 'foo'; +const bar = 'bar'; +export default bar; +``` + +```javascript +// good2.js + +// There is more than one named export in the module. +export const foo = 'foo'; +export const bar = 'bar'; +``` + +```javascript +// good3.js + +// There is more than one named export in the module +const foo = 'foo'; +const bar = 'bar'; +export { foo, bar } +``` + +```javascript +// good4.js + +// There is a default export. +const foo = 'foo'; +export { foo as default } +``` + +```javascript +// export-star.js + +// Any batch export will disable this rule. The remote module is not inspected. +export * from './other-module' +``` + +#### any + +**Definition**: any exporting file must contain a default export. + +How to setup config file for this rule: + +```javascript +// you have to manually specify it +"rules": { + "import/prefer-default-export": [ + ( "off" | "warn" | "error" ), + { "target": "any" } + ] +} +``` + +The following patterns are *not* considered warnings: + +```javascript +// good1.js + +//has default export +export default function bar() {}; +``` + +```javascript +// good2.js + +// has default export +let foo; +export { foo as default } +``` + +```javascript +// good3.js + +//contains multiple exports AND default export +export const a = 5; +export function bar(){}; +let foo; +export { foo as default } +``` + +```javascript +// good4.js + +// does not contain any exports => file is not checked by the rule +import * as foo from './foo'; +``` + +```javascript +// export-star.js + +// Any batch export will disable this rule. The remote module is not inspected. +export * from './other-module' +``` + +The following patterns are considered warnings: + +```javascript +// bad1.js + +//has 2 named exports, but no default export +export const foo = 'foo'; +export const bar = 'bar'; +``` + +```javascript +// bad2.js + +// does not have default export +let foo, bar; +export { foo, bar } +``` + +```javascript +// bad3.js + +// does not have default export +export { a, b } from "foo.js" +``` + +```javascript +// bad4.js + +// does not have default export +let item; +export const foo = item; +export { item }; +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/unambiguous.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/unambiguous.md new file mode 100644 index 0000000000000000000000000000000000000000..e9e5bf73da90949a8c073799418e358f5bc00b4c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/docs/rules/unambiguous.md @@ -0,0 +1,57 @@ +# import/unambiguous + + + +Warn if a `module` could be mistakenly parsed as a `script` by a consumer leveraging +[Unambiguous JavaScript Grammar] to determine correct parsing goal. + +Will respect the [`parserOptions.sourceType`] from ESLint config, i.e. files parsed +as `script` per that setting will not be reported. + +This plugin uses [Unambiguous JavaScript Grammar] internally to decide whether +dependencies should be parsed as modules and searched for exports matching the +`import`ed names, so it may be beneficial to keep this rule on even if your application +will run in an explicit `module`-only environment. + +## Rule Details + +For files parsed as `module` by ESLint, the following are valid: + +```js +import 'foo' +function x() { return 42 } +``` + +```js +export function x() { return 42 } +``` + +```js +(function x() { return 42 })() +export {} // simple way to mark side-effects-only file as 'module' without any imports/exports +``` + +...whereas the following file would be reported: + +```js +(function x() { return 42 })() +``` + +## When Not To Use It + +If your application environment will always know via [some other means](https://github.com/nodejs/node-eps/issues/13) +how to parse, regardless of syntax, you may not need this rule. + +Remember, though, that this plugin uses this strategy internally, so if you were +to `import` from a module with no `import`s or `export`s, this plugin would not +report it as it would not be clear whether it should be considered a `script` or +a `module`. + +## Further Reading + + - [Unambiguous JavaScript Grammar] + - [`parserOptions.sourceType`] + - [node-eps#13](https://github.com/nodejs/node-eps/issues/13) + +[`parserOptions.sourceType`]: https://eslint.org/docs/user-guide/configuring#specifying-parser-options +[Unambiguous JavaScript Grammar]: https://github.com/nodejs/node-eps/blob/HEAD/002-es-modules.md#32-determining-if-source-is-an-es-module diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/importType.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/importType.js new file mode 100644 index 0000000000000000000000000000000000000000..fd76a546385ac34031902af22d3a2015fa8a63fb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/importType.js @@ -0,0 +1,128 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();exports. + + + + + + +isScoped = isScoped;exports. + + + + + + + + + + + + + + + + + +isAbsolute = isAbsolute;exports. + + + + +isBuiltIn = isBuiltIn;exports. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +isExternalModule = isExternalModule;exports. + + + + + + +isExternalModuleMain = isExternalModuleMain;exports. + + + + + + + +isScopedMain = isScopedMain;exports['default'] = + + + +resolveImportType;var _path = require('path');var _isCoreModule = require('is-core-module');var _isCoreModule2 = _interopRequireDefault(_isCoreModule);var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve);var _packagePath = require('./packagePath');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}var scopedRegExp = /^@[^/]+\/?[^/]+/;function isScoped(name) {return name && scopedRegExp.test(name);}function baseModule(name) {if (isScoped(name)) {var _name$split = name.split('/'),_name$split2 = _slicedToArray(_name$split, 2),scope = _name$split2[0],_pkg = _name$split2[1];return String(scope) + '/' + String(_pkg);}var _name$split3 = name.split('/'),_name$split4 = _slicedToArray(_name$split3, 1),pkg = _name$split4[0];return pkg;}function isInternalRegexMatch(name, settings) {var internalScope = settings && settings['import/internal-regex'];return internalScope && new RegExp(internalScope).test(name);}function isAbsolute(name) {return typeof name === 'string' && (0, _path.isAbsolute)(name);} // path is defined only when a resolver resolves to a non-standard path +function isBuiltIn(name, settings, path) {if (path || !name) {return false;}var base = baseModule(name);var extras = settings && settings['import/core-modules'] || [];return (0, _isCoreModule2['default'])(base) || extras.indexOf(base) > -1;}var moduleRegExp = /^\w/;function isModule(name) {return name && moduleRegExp.test(name);}var moduleMainRegExp = /^[\w]((?!\/).)*$/;function isModuleMain(name) {return name && moduleMainRegExp.test(name);}function isRelativeToParent(name) {return (/^\.\.$|^\.\.[\\/]/.test(name));}var indexFiles = ['.', './', './index', './index.js'];function isIndex(name) {return indexFiles.indexOf(name) !== -1;}function isRelativeToSibling(name) {return (/^\.[\\/]/.test(name));}function isExternalPath(path, context) {if (!path) {return false;}var settings = context.settings;var packagePath = (0, _packagePath.getContextPackagePath)(context);if ((0, _path.relative)(packagePath, path).startsWith('..')) {return true;}var folders = settings && settings['import/external-module-folders'] || ['node_modules'];return folders.some(function (folder) {var folderPath = (0, _path.resolve)(packagePath, folder);var relativePath = (0, _path.relative)(folderPath, path);return !relativePath.startsWith('..');});}function isInternalPath(path, context) {if (!path) {return false;}var packagePath = (0, _packagePath.getContextPackagePath)(context);return !(0, _path.relative)(packagePath, path).startsWith('../');}function isExternalLookingName(name) {return isModule(name) || isScoped(name);}function typeTest(name, context, path) {var settings = context.settings;if (isInternalRegexMatch(name, settings)) {return 'internal';}if (isAbsolute(name, settings, path)) {return 'absolute';}if (isBuiltIn(name, settings, path)) {return 'builtin';}if (isRelativeToParent(name, settings, path)) {return 'parent';}if (isIndex(name, settings, path)) {return 'index';}if (isRelativeToSibling(name, settings, path)) {return 'sibling';}if (isExternalPath(path, context)) {return 'external';}if (isInternalPath(path, context)) {return 'internal';}if (isExternalLookingName(name)) {return 'external';}return 'unknown';}function isExternalModule(name, path, context) {if (arguments.length < 3) {throw new TypeError('isExternalModule: name, path, and context are all required');}return (isModule(name) || isScoped(name)) && typeTest(name, context, path) === 'external';}function isExternalModuleMain(name, path, context) {if (arguments.length < 3) {throw new TypeError('isExternalModule: name, path, and context are all required');}return isModuleMain(name) && typeTest(name, context, path) === 'external';}var scopedMainRegExp = /^@[^/]+\/?[^/]+$/;function isScopedMain(name) {return name && scopedMainRegExp.test(name);}function resolveImportType(name, context) {return typeTest(name, context, (0, _resolve2['default'])(name, context)); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL2ltcG9ydFR5cGUuanMiXSwibmFtZXMiOlsiaXNTY29wZWQiLCJpc0Fic29sdXRlIiwiaXNCdWlsdEluIiwiaXNFeHRlcm5hbE1vZHVsZSIsImlzRXh0ZXJuYWxNb2R1bGVNYWluIiwiaXNTY29wZWRNYWluIiwicmVzb2x2ZUltcG9ydFR5cGUiLCJzY29wZWRSZWdFeHAiLCJuYW1lIiwidGV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3cgbmV3IFR5cGVFcnJvcignaXNFeHRlcm5hbE1vZHVsZTogbmFtZSwgcGF0aCwgYW5kIGNvbnRleHQgYXJlIGFsbCByZXF1aXJlZCcpO1xuICB9XG4gIHJldHVybiAoaXNNb2R1bGUobmFtZSkgfHwgaXNTY29wZWQobmFtZSkpICYmIHR5cGVUZXN0KG5hbWUsIGNvbnRleHQsIHBhdGgpID09PSAnZXh0ZXJuYWwnO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gaXNFeHRlcm5hbE1vZHVsZU1haW4obmFtZSwgcGF0aCwgY29udGV4dCkge1xuICBpZiAoYXJndW1lbnRzLmxlbmd0aCA8IDMpIHtcbiAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdpc0V4dGVybmFsTW9kdWxlOiBuYW1lLCBwYXRoLCBhbmQgY29udGV4dCBhcmUgYWxsIHJlcXVpcmVkJyk7XG4gIH1cbiAgcmV0dXJuIGlzTW9kdWxlTWFpbihuYW1lKSAmJiB0eXBlVGVzdChuYW1lLCBjb250ZXh0LCBwYXRoKSA9PT0gJ2V4dGVybmFsJztcbn1cblxuY29uc3Qgc2NvcGVkTWFpblJlZ0V4cCA9IC9eQFteL10rXFwvP1teL10rJC87XG5leHBvcnQgZnVuY3Rpb24gaXNTY29wZWRNYWluKG5hbWUpIHtcbiAgcmV0dXJuIG5hbWUgJiYgc2NvcGVkTWFpblJlZ0V4cC50ZXN0KG5hbWUpO1xufVxuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiByZXNvbHZlSW1wb3J0VHlwZShuYW1lLCBjb250ZXh0KSB7XG4gIHJldHVybiB0eXBlVGVzdChuYW1lLCBjb250ZXh0LCByZXNvbHZlKG5hbWUsIGNvbnRleHQpKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/packagePath.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/packagePath.js new file mode 100644 index 0000000000000000000000000000000000000000..df8e6c269624c51e9b59109036138d478b6e424c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/packagePath.js @@ -0,0 +1,23 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports. + + + + +getFilePackagePath = getFilePackagePath;exports. + + + + +getContextPackagePath = getContextPackagePath;exports. + + + +getFilePackageName = getFilePackageName;var _path = require('path');var _contextCompat = require('eslint-module-utils/contextCompat');var _pkgUp = require('eslint-module-utils/pkgUp');var _pkgUp2 = _interopRequireDefault(_pkgUp);var _readPkgUp2 = require('eslint-module-utils/readPkgUp');var _readPkgUp3 = _interopRequireDefault(_readPkgUp2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function getFilePackagePath(filePath) {var fp = (0, _pkgUp2['default'])({ cwd: filePath });return (0, _path.dirname)(fp);}function getContextPackagePath(context) {return getFilePackagePath((0, _contextCompat.getPhysicalFilename)(context));}function getFilePackageName(filePath) {var _readPkgUp = + (0, _readPkgUp3['default'])({ cwd: filePath, normalize: false }),pkg = _readPkgUp.pkg,path = _readPkgUp.path; + if (pkg) { + // recursion in case of intermediate esm package.json without name found + return pkg.name || getFilePackageName((0, _path.dirname)((0, _path.dirname)(path))); + } + return null; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL3BhY2thZ2VQYXRoLmpzIl0sIm5hbWVzIjpbImdldEZpbGVQYWNrYWdlUGF0aCIsImdldENvbnRleHRQYWNrYWdlUGF0aCIsImdldEZpbGVQYWNrYWdlTmFtZSIsImZpbGVQYXRoIiwiZnAiLCJjd2QiLCJjb250ZXh0Iiwibm9ybWFsaXplIiwicGtnIiwicGF0aCIsIm5hbWUiXSwibWFwcGluZ3MiOiI7Ozs7O0FBS2dCQSxrQixHQUFBQSxrQjs7Ozs7QUFLQUMscUIsR0FBQUEscUI7Ozs7QU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aW9uIGdldEZpbGVQYWNrYWdlUGF0aChmaWxlUGF0aCkge1xuICBjb25zdCBmcCA9IHBrZ1VwKHsgY3dkOiBmaWxlUGF0aCB9KTtcbiAgcmV0dXJuIGRpcm5hbWUoZnApO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gZ2V0Q29udGV4dFBhY2thZ2VQYXRoKGNvbnRleHQpIHtcbiAgcmV0dXJuIGdldEZpbGVQYWNrYWdlUGF0aChnZXRQaHlzaWNhbEZpbGVuYW1lKGNvbnRleHQpKTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGdldEZpbGVQYWNrYWdlTmFtZShmaWxlUGF0aCkge1xuICBjb25zdCB7IHBrZywgcGF0aCB9ID0gcmVhZFBrZ1VwKHsgY3dkOiBmaWxlUGF0aCwgbm9ybWFsaXplOiBmYWxzZSB9KTtcbiAgaWYgKHBrZykge1xuICAgIC8vIHJlY3Vyc2lvbiBpbiBjYXNlIG9mIGludGVybWVkaWF0ZSBlc20gcGFja2FnZS5qc29uIHdpdGhvdXQgbmFtZSBmb3VuZFxuICAgIHJldHVybiBwa2cubmFtZSB8fCBnZXRGaWxlUGFja2FnZU5hbWUoZGlybmFtZShkaXJuYW1lKHBhdGgpKSk7XG4gIH1cbiAgcmV0dXJuIG51bGw7XG59XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/sourceType.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/sourceType.js new file mode 100644 index 0000000000000000000000000000000000000000..fa34d3424eb7789346b185a8f50481193ea05376 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/sourceType.js @@ -0,0 +1,13 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] = + + + +sourceType; /** + * @param {import('eslint').Rule.RuleContext} context + * @returns 'module' | 'script' | 'commonjs' | undefined + */function sourceType(context) {if ('sourceType' in context.parserOptions) {return context.parserOptions.sourceType;} + if ('languageOptions' in context && context.languageOptions) { + return context.languageOptions.sourceType; + } +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL3NvdXJjZVR5cGUuanMiXSwibmFtZXMiOlsic291cmNlVHlwZSIsImNvbnRleHQiLCJwYXJzZXJPcHRpb25zIiwibGFuZ3VhZ2VPcHRpb25zIl0sIm1hcHBpbmdzIjoiOzs7O0FBSXdCQSxVLEVBSnhCOzs7ZUFJZSxTQUFTQSxVQUFULENBQW9CQyxPQUFwQixFQUE2QixDQUMxQyxJQUFJLGdCQUFnQkEsUUFBUUMsYUFBNUIsRUFBMkMsQ0FDekMsT0FBT0QsUUFBUUMsYUFBUixDQUFzQkYsVUFBN0IsQ0FDRDtBQUNELE1BQUkscUJBQXFCQyxPQUFyQixJQUFnQ0EsUUFBUUUsZUFBNUMsRUFBNkQ7QUFDM0QsV0FBT0YsUUFBUUUsZUFBUixDQUF3QkgsVUFBL0I7QUFDRDtBQUNGIiwiZmlsZSI6InNvdXJjZVR5cGUuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBwYXJhbSB7aW1wb3J0KCdlc2xpbnQnKS5SdWxlLlJ1bGVDb250ZXh0fSBjb250ZXh0XG4gKiBAcmV0dXJucyAnbW9kdWxlJyB8ICdzY3JpcHQnIHwgJ2NvbW1vbmpzJyB8IHVuZGVmaW5lZFxuICovXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBzb3VyY2VUeXBlKGNvbnRleHQpIHtcbiAgaWYgKCdzb3VyY2VUeXBlJyBpbiBjb250ZXh0LnBhcnNlck9wdGlvbnMpIHtcbiAgICByZXR1cm4gY29udGV4dC5wYXJzZXJPcHRpb25zLnNvdXJjZVR5cGU7XG4gIH1cbiAgaWYgKCdsYW5ndWFnZU9wdGlvbnMnIGluIGNvbnRleHQgJiYgY29udGV4dC5sYW5ndWFnZU9wdGlvbnMpIHtcbiAgICByZXR1cm4gY29udGV4dC5sYW5ndWFnZU9wdGlvbnMuc291cmNlVHlwZTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/staticRequire.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/staticRequire.js new file mode 100644 index 0000000000000000000000000000000000000000..43bb282d84b4c1dbd6565a101af987a380c06e7e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/core/staticRequire.js @@ -0,0 +1,11 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] = +isStaticRequire; // todo: merge with module visitor +function isStaticRequire(node) {return node && + node.callee && + node.callee.type === 'Identifier' && + node.callee.name === 'require' && + node.arguments.length === 1 && + node.arguments[0].type === 'Literal' && + typeof node.arguments[0].value === 'string'; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL3N0YXRpY1JlcXVpcmUuanMiXSwibmFtZXMiOlsiaXNTdGF0aWNSZXF1aXJlIiwibm9kZSIsImNhbGxlZSIsInR5cGUiLCJuYW1lIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwidmFsdWUiXSwibWFwcGluZ3MiOiI7QUFDd0JBLGUsRUFEeEI7QUFDZSxTQUFTQSxlQUFULENBQXlCQyxJQUF6QixFQUErQixDQUM1QyxPQUFPQTtBQUNGQSxPQUFLQyxNQURIO0FBRUZELE9BQUtDLE1BQUwsQ0FBWUMsSUFBWixLQUFxQixZQUZuQjtBQUdGRixPQUFLQyxNQUFMLENBQVlFLElBQVosS0FBcUIsU0FIbkI7QUFJRkgsT0FBS0ksU0FBTCxDQUFlQyxNQUFmLEtBQTBCLENBSnhCO0FBS0ZMLE9BQUtJLFNBQUwsQ0FBZSxDQUFmLEVBQWtCRixJQUFsQixLQUEyQixTQUx6QjtBQU1GLFNBQU9GLEtBQUtJLFNBQUwsQ0FBZSxDQUFmLEVBQWtCRSxLQUF6QixLQUFtQyxRQU54QztBQU9EIiwiZmlsZSI6InN0YXRpY1JlcXVpcmUuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyB0b2RvOiBtZXJnZSB3aXRoIG1vZHVsZSB2aXNpdG9yXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBpc1N0YXRpY1JlcXVpcmUobm9kZSkge1xuICByZXR1cm4gbm9kZVxuICAgICYmIG5vZGUuY2FsbGVlXG4gICAgJiYgbm9kZS5jYWxsZWUudHlwZSA9PT0gJ0lkZW50aWZpZXInXG4gICAgJiYgbm9kZS5jYWxsZWUubmFtZSA9PT0gJ3JlcXVpcmUnXG4gICAgJiYgbm9kZS5hcmd1bWVudHMubGVuZ3RoID09PSAxXG4gICAgJiYgbm9kZS5hcmd1bWVudHNbMF0udHlwZSA9PT0gJ0xpdGVyYWwnXG4gICAgJiYgdHlwZW9mIG5vZGUuYXJndW1lbnRzWzBdLnZhbHVlID09PSAnc3RyaW5nJztcbn1cbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/docsUrl.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/docsUrl.js new file mode 100644 index 0000000000000000000000000000000000000000..f8d6f53f6392f6317094151beb2780c775bd824f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/docsUrl.js @@ -0,0 +1,8 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] = + + + +docsUrl;var _package = require('../package.json');var _package2 = _interopRequireDefault(_package);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}var repoUrl = 'https://github.com/import-js/eslint-plugin-import';function docsUrl(ruleName) {var commitish = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'v' + String(_package2['default'].version); + return repoUrl + '/blob/' + String(commitish) + '/docs/rules/' + String(ruleName) + '.md'; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kb2NzVXJsLmpzIl0sIm5hbWVzIjpbImRvY3NVcmwiLCJyZXBvVXJsIiwicnVsZU5hbWUiLCJjb21taXRpc2giLCJwa2ciLCJ2ZXJzaW9uIl0sIm1hcHBpbmdzIjoiOzs7O0FBSXdCQSxPLENBSnhCLDBDLGdKQUVBLElBQU1DLFVBQVUsbURBQWhCLENBRWUsU0FBU0QsT0FBVCxDQUFpQkUsUUFBakIsRUFBMEQsS0FBL0JDLFNBQStCLG9GQUFmQyxxQkFBSUMsT0FBVztBQUN2RSxTQUFVSixPQUFWLHFCQUEwQkUsU0FBMUIsNEJBQWtERCxRQUFsRDtBQUNEIiwiZmlsZSI6ImRvY3NVcmwuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgcGtnIGZyb20gJy4uL3BhY2thZ2UuanNvbic7XG5cbmNvbnN0IHJlcG9VcmwgPSAnaHR0cHM6Ly9naXRodWIuY29tL2ltcG9ydC1qcy9lc2xpbnQtcGx1Z2luLWltcG9ydCc7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGRvY3NVcmwocnVsZU5hbWUsIGNvbW1pdGlzaCA9IGB2JHtwa2cudmVyc2lvbn1gKSB7XG4gIHJldHVybiBgJHtyZXBvVXJsfS9ibG9iLyR7Y29tbWl0aXNofS9kb2NzL3J1bGVzLyR7cnVsZU5hbWV9Lm1kYDtcbn1cbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/builder.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/builder.js new file mode 100644 index 0000000000000000000000000000000000000000..d5366387f67336983de25fb2202084e26e1863c6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/builder.js @@ -0,0 +1,210 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();var _fs = require('fs');var _fs2 = _interopRequireDefault(_fs); + +var _doctrine = require('doctrine');var _doctrine2 = _interopRequireDefault(_doctrine); + +var _debug = require('debug');var _debug2 = _interopRequireDefault(_debug); + +var _parse2 = require('eslint-module-utils/parse');var _parse3 = _interopRequireDefault(_parse2); +var _visit = require('eslint-module-utils/visit');var _visit2 = _interopRequireDefault(_visit); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _ignore = require('eslint-module-utils/ignore');var _ignore2 = _interopRequireDefault(_ignore); + +var _hash = require('eslint-module-utils/hash'); +var _unambiguous = require('eslint-module-utils/unambiguous');var unambiguous = _interopRequireWildcard(_unambiguous); + +var _ = require('.');var _2 = _interopRequireDefault(_); +var _childContext = require('./childContext');var _childContext2 = _interopRequireDefault(_childContext); +var _typescript = require('./typescript'); +var _remotePath = require('./remotePath'); +var _visitor = require('./visitor');var _visitor2 = _interopRequireDefault(_visitor);function _interopRequireWildcard(obj) {if (obj && obj.__esModule) {return obj;} else {var newObj = {};if (obj != null) {for (var key in obj) {if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];}}newObj['default'] = obj;return newObj;}}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} + +var log = (0, _debug2['default'])('eslint-plugin-import:ExportMap'); + +var exportCache = new Map(); + +/** + * The creation of this closure is isolated from other scopes + * to avoid over-retention of unrelated variables, which has + * caused memory leaks. See #1266. + */ +function thunkFor(p, context) { + // eslint-disable-next-line no-use-before-define + return function () {return ExportMapBuilder['for']((0, _childContext2['default'])(p, context));}; +}var + +ExportMapBuilder = function () {function ExportMapBuilder() {_classCallCheck(this, ExportMapBuilder);}_createClass(ExportMapBuilder, null, [{ key: 'get', value: function () {function get( + source, context) { + var path = (0, _resolve2['default'])(source, context); + if (path == null) {return null;} + + return ExportMapBuilder['for']((0, _childContext2['default'])(path, context)); + }return get;}() }, { key: 'for', value: function () {function _for( + + context) {var + path = context.path; + + var cacheKey = context.cacheKey || (0, _hash.hashObject)(context).digest('hex'); + var exportMap = exportCache.get(cacheKey); + + // return cached ignore + if (exportMap === null) {return null;} + + var stats = _fs2['default'].statSync(path); + if (exportMap != null) { + // date equality check + if (exportMap.mtime - stats.mtime === 0) { + return exportMap; + } + // future: check content equality? + } + + // check valid extensions first + if (!(0, _ignore.hasValidExtension)(path, context)) { + exportCache.set(cacheKey, null); + return null; + } + + // check for and cache ignore + if ((0, _ignore2['default'])(path, context)) { + log('ignored path due to ignore settings:', path); + exportCache.set(cacheKey, null); + return null; + } + + var content = _fs2['default'].readFileSync(path, { encoding: 'utf8' }); + + // check for and cache unambiguous modules + if (!unambiguous.test(content)) { + log('ignored path due to unambiguous regex:', path); + exportCache.set(cacheKey, null); + return null; + } + + log('cache miss', cacheKey, 'for path', path); + exportMap = ExportMapBuilder.parse(path, content, context); + + // ambiguous modules return null + if (exportMap == null) { + log('ignored path due to ambiguous parse:', path); + exportCache.set(cacheKey, null); + return null; + } + + exportMap.mtime = stats.mtime; + + // If the visitor keys were not populated, then we shouldn't save anything to the cache, + // since the parse results may not be reliable. + if (exportMap.visitorKeys) { + exportCache.set(cacheKey, exportMap); + } + return exportMap; + }return _for;}() }, { key: 'parse', value: function () {function parse( + + path, content, context) { + var exportMap = new _2['default'](path); + var isEsModuleInteropTrue = (0, _typescript.isEsModuleInterop)(context); + + var ast = void 0; + var visitorKeys = void 0; + try { + var result = (0, _parse3['default'])(path, content, context); + ast = result.ast; + visitorKeys = result.visitorKeys; + } catch (err) { + exportMap.errors.push(err); + return exportMap; // can't continue + } + + exportMap.visitorKeys = visitorKeys; + + var hasDynamicImports = false; + + var remotePathResolver = new _remotePath.RemotePath(path, context); + + function processDynamicImport(source) { + hasDynamicImports = true; + if (source.type !== 'Literal') { + return null; + } + var p = remotePathResolver.resolve(source.value); + if (p == null) { + return null; + } + var importedSpecifiers = new Set(); + importedSpecifiers.add('ImportNamespaceSpecifier'); + var getter = thunkFor(p, context); + exportMap.imports.set(p, { + getter: getter, + declarations: new Set([{ + source: { + // capturing actual node reference holds full AST in memory! + value: source.value, + loc: source.loc }, + + importedSpecifiers: importedSpecifiers, + dynamic: true }]) }); + + + } + + (0, _visit2['default'])(ast, visitorKeys, { + ImportExpression: function () {function ImportExpression(node) { + processDynamicImport(node.source); + }return ImportExpression;}(), + CallExpression: function () {function CallExpression(node) { + if (node.callee.type === 'Import') { + processDynamicImport(node.arguments[0]); + } + }return CallExpression;}() }); + + + var unambiguouslyESM = unambiguous.isModule(ast); + if (!unambiguouslyESM && !hasDynamicImports) {return null;} + + // attempt to collect module doc + if (ast.comments) { + ast.comments.some(function (c) { + if (c.type !== 'Block') {return false;} + try { + var doc = _doctrine2['default'].parse(c.value, { unwrap: true }); + if (doc.tags.some(function (t) {return t.title === 'module';})) { + exportMap.doc = doc; + return true; + } + } catch (err) {/* ignore */} + return false; + }); + } + + var visitorBuilder = new _visitor2['default']( + path, + context, + exportMap, + ExportMapBuilder, + content, + ast, + isEsModuleInteropTrue, + thunkFor); + + ast.body.forEach(function (astNode) { + var visitor = visitorBuilder.build(astNode); + + if (visitor[astNode.type]) { + visitor[astNode.type].call(visitorBuilder); + } + }); + + if ( + isEsModuleInteropTrue // esModuleInterop is on in tsconfig + && exportMap.namespace.size > 0 // anything is exported + && !exportMap.namespace.has('default') // and default isn't added already + ) { + exportMap.namespace.set('default', {}); // add default export + } + + if (unambiguouslyESM) { + exportMap.parseGoal = 'Module'; + } + return exportMap; + }return parse;}() }]);return ExportMapBuilder;}();exports['default'] = ExportMapBuilder; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvYnVpbGRlci5qcyJdLCJuYW1lcyI6WyJ1bmFtYmlndW91cyIsImxvZyIsImV4cG9ydENhY2hlIiwiTWFwIiwidGh1bmtGb3IiLCJwIiwiY29udGV4dCIsIkV4cG9ydE1hcEJ1aWxkZXIiLCJzb3VyY2UiLCJwYXRoIiwiY2FjaGVLZXkiLCJkaWdlc3QiLCJleHBvcnRNYXAiLCJnZXQiLCJzdGF0cyIsImZzIiwic3RhdFN5bmMiLCJtdGltZSIsInNldCIsImNvbnRlbnQiLCJyZWFkRmlsZVN5bmMiLCJlbmNvZGluZyIsInRlc3QiLCJwYXJzZSIsInZpc2l0b3JLZXlzIiwiRXhwb3J0TWFwIiwiaXNFc01vZHVsZUludGVyb3BUcnVlIiwiYXN0IiwicmVzdWx0IiwiZXJyIiwiZXJyb3JzIiwicHVzaCIsImhhc0R5bmFtaWNJbXBvcnRzIiwicmVtb3RlUGF0aFJlc29sdmVyIiwiUmVtb3RlUGF0aCIsInByb2Nlc3NEeW5hbWljSW1wb3J0IiwidHlwZSIsInJlc29sdmUiLCJ2YWx1ZSIsImltcG9ydGVkU3BlY2lmaWVycyIsIlNldCIsImFkZCIsImdldHRlciIsImltcG9ydHMiLCJkZWNsYXJhdGlvbnMiLCJsb2MiLCJkeW5hbWljIiwiSW1wb3J0RXhwcmVzc2lvbiIsIm5vZGUiLCJDYWxsRXhwcmVzc2lvbiIsImNhbGxlZSIsImFyZ3VtZW50cyIsInVuYW1iaWd1b3VzbHlFU00iLCJpc01vZHVsZSIsImNvbW1lbnRzIiwic29tZSIsImMiLCJkb2MiLCJkb2N0c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NYXAubmFtZXNwYWNlLmhhcygnZGVmYXVsdCcpIC8vIGFuZCBkZWZhdWx0IGlzbid0IGFkZGVkIGFscmVhZHlcbiAgICApIHtcbiAgICAgIGV4cG9ydE1hcC5uYW1lc3BhY2Uuc2V0KCdkZWZhdWx0Jywge30pOyAvLyBhZGQgZGVmYXVsdCBleHBvcnRcbiAgICB9XG5cbiAgICBpZiAodW5hbWJpZ3VvdXNseUVTTSkge1xuICAgICAgZXhwb3J0TWFwLnBhcnNlR29hbCA9ICdNb2R1bGUnO1xuICAgIH1cbiAgICByZXR1cm4gZXhwb3J0TWFwO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/captureDependency.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/captureDependency.js new file mode 100644 index 0000000000000000000000000000000000000000..5a863b60d12a3505fa2971765064bb9dd20bf47b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/captureDependency.js @@ -0,0 +1,61 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.captureDependency = captureDependency;exports. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +captureDependencyWithSpecifiers = captureDependencyWithSpecifiers;function captureDependency(_ref, isOnlyImportingTypes, remotePathResolver, exportMap, context, thunkFor) {var source = _ref.source;var importedSpecifiers = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new Set();if (source == null) {return null;}var p = remotePathResolver.resolve(source.value);if (p == null) {return null;}var declarationMetadata = { // capturing actual node reference holds full AST in memory! + source: { value: source.value, loc: source.loc }, isOnlyImportingTypes: isOnlyImportingTypes, importedSpecifiers: importedSpecifiers };var existing = exportMap.imports.get(p);if (existing != null) {existing.declarations.add(declarationMetadata);return existing.getter;}var getter = thunkFor(p, context);exportMap.imports.set(p, { getter: getter, declarations: new Set([declarationMetadata]) });return getter;}var supportedImportTypes = new Set(['ImportDefaultSpecifier', 'ImportNamespaceSpecifier']);function captureDependencyWithSpecifiers(n, +remotePathResolver, +exportMap, +context, +thunkFor) +{ + // import type { Foo } (TS and Flow); import typeof { Foo } (Flow) + var declarationIsType = n.importKind === 'type' || n.importKind === 'typeof'; + // import './foo' or import {} from './foo' (both 0 specifiers) is a side effect and + // shouldn't be considered to be just importing types + var specifiersOnlyImportingTypes = n.specifiers.length > 0; + var importedSpecifiers = new Set(); + n.specifiers.forEach(function (specifier) { + if (specifier.type === 'ImportSpecifier') { + importedSpecifiers.add(specifier.imported.name || specifier.imported.value); + } else if (supportedImportTypes.has(specifier.type)) { + importedSpecifiers.add(specifier.type); + } + + // import { type Foo } (Flow); import { typeof Foo } (Flow) + specifiersOnlyImportingTypes = specifiersOnlyImportingTypes && ( + specifier.importKind === 'type' || specifier.importKind === 'typeof'); + }); + captureDependency(n, declarationIsType || specifiersOnlyImportingTypes, remotePathResolver, exportMap, context, thunkFor, importedSpecifiers); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvY2FwdHVyZURlcGVuZGVuY3kuanMiXSwibmFtZXMiOlsiY2FwdHVyZURlcGVuZGVuY3kiLCJjYXB0dXJlRGVwZW5kZW5jeVdpdGhTcGVjaWZpZXJzIiwiaXNPbmx5SW1wb3J0aW5nVHlwZXMiLCJyZW1vdGVQYXRoUmVzb2x2ZXIiLCJleHBvcnRNYXAiLCJjb250ZXh0IiwidGh1bmtGb3IiLCJzb3VyY2UiLCJpbXBvcnRlZFNwZWNpZmllcnMiLCJTZXQiLCJwIiwicmVzb2x2ZSIsInZhbHVlIiwiZGVjbGFyYXRpb25NZXRhZGF0YSIsImxvYyIsImV4aXN0aW5nIiwiaW1wb3J0cyIsImdldCIsImRlY2xhcmF0aW9ucyIsImFkZCIsImdldHRlciIsInNldCIsInN1cHBvcnRlZEltcG9ydFR5cGVz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Q== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/childContext.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/childContext.js new file mode 100644 index 0000000000000000000000000000000000000000..930a627be875ba2eba57e972253ed4b5d3fe7c12 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/childContext.js @@ -0,0 +1,57 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] = + + + + + + + + + + + + + + + + + + +childContext;var _hash = require('eslint-module-utils/hash');var optionsHash = '';var prevOptions = '';var settingsHash = '';var prevSettings = ''; // Replacer function helps us with serializing the parser nested within `languageOptions`. +function stringifyReplacerFn(_, value) {if (typeof value === 'function') {return String(value);}return value;} /** + * don't hold full context object in memory, just grab what we need. + * also calculate a cacheKey, where parts of the cacheKey hash are memoized + */function childContext(path, context) {var settings = context.settings,parserOptions = context.parserOptions,parserPath = context.parserPath,languageOptions = context.languageOptions;if (JSON.stringify(settings) !== prevSettings) {settingsHash = (0, _hash.hashObject)({ settings: settings }).digest('hex'); + prevSettings = JSON.stringify(settings); + } + + // We'll use either a combination of `parserOptions` and `parserPath` or `languageOptions` + // to construct the cache key, depending on whether this is using a flat config or not. + var optionsToken = void 0; + if (!parserPath && languageOptions) { + if (JSON.stringify(languageOptions, stringifyReplacerFn) !== prevOptions) { + optionsHash = (0, _hash.hashObject)({ languageOptions: languageOptions }).digest('hex'); + prevOptions = JSON.stringify(languageOptions, stringifyReplacerFn); + } + // For languageOptions, we're just using the hashed options as the options token + optionsToken = optionsHash; + } else { + if (JSON.stringify(parserOptions) !== prevOptions) { + optionsHash = (0, _hash.hashObject)({ parserOptions: parserOptions }).digest('hex'); + prevOptions = JSON.stringify(parserOptions); + } + // When not using flat config, we use a combination of the hashed parserOptions + // and parserPath as the token + optionsToken = String(parserPath) + optionsHash; + } + + return { + cacheKey: optionsToken + settingsHash + String(path), + settings: settings, + parserOptions: parserOptions, + parserPath: parserPath, + path: path, + languageOptions: languageOptions }; + +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvY2hpbGRDb250ZXh0LmpzIl0sIm5hbWVzIjpbImNoaWxkQ29udGV4dCIsIm9wdGlvbnNIYXNoIiwicHJldk9wdGlvbnMiLCJzZXR0aW5nc0hhc2giLCJwcmV2U2V0dGluZ3MiLCJzdHJpbmdpZnlSZXBsYWNlckZuIiwiXyIsInZhbHVlIiwiU3RyaW5nIiwicGF0aCIsImNvbnRleHQiLCJzZXR0aW5ncyIsInBhcnNlck9wdGlvbnMiLCJwYXJzZXJQYXRoIiwibGFuZ3VhZ2VPcHRpb25zIiwiSlNPTiIsInN0cmluZ2lmeSIsImRpZ2VzdCIsIm9wdGlvbnNUb2tlbiIsImNhY2hlS2V5Il0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBbUJ3QkEsWSxDQW5CeEIsZ0RBRUEsSUFBSUMsY0FBYyxFQUFsQixDQUNBLElBQUlDLGNBQWMsRUFBbEIsQ0FDQSxJQUFJQyxlQUFlLEVBQW5CLENBQ0EsSUFBSUMsZUFBZSxFQUFuQixDLENBRUE7QUFDQSxTQUFTQyxtQkFBVCxDQUE2QkMsQ0FBN0IsRUFBZ0NDLEtBQWhDLEVBQXVDLENBQ3JDLElBQUksT0FBT0EsS0FBUCxLQUFpQixVQUFyQixFQUFpQyxDQUMvQixPQUFPQyxPQUFPRCxLQUFQLENBQVAsQ0FDRCxDQUNELE9BQU9BLEtBQVAsQ0FDRCxDLENBRUQ7OztrSEFJZSxTQUFTUCxZQUFULENBQXNCUyxJQUF0QixFQUE0QkMsT0FBNUIsRUFBcUMsS0FDMUNDLFFBRDBDLEdBQ2VELE9BRGYsQ0FDMUNDLFFBRDBDLENBQ2hDQyxhQURnQyxHQUNlRix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sc2Uge1xuICAgIGlmIChKU09OLnN0cmluZ2lmeShwYXJzZXJPcHRpb25zKSAhPT0gcHJldk9wdGlvbnMpIHtcbiAgICAgIG9wdGlvbnNIYXNoID0gaGFzaE9iamVjdCh7IHBhcnNlck9wdGlvbnMgfSkuZGlnZXN0KCdoZXgnKTtcbiAgICAgIHByZXZPcHRpb25zID0gSlNPTi5zdHJpbmdpZnkocGFyc2VyT3B0aW9ucyk7XG4gICAgfVxuICAgIC8vIFdoZW4gbm90IHVzaW5nIGZsYXQgY29uZmlnLCB3ZSB1c2UgYSBjb21iaW5hdGlvbiBvZiB0aGUgaGFzaGVkIHBhcnNlck9wdGlvbnNcbiAgICAvLyBhbmQgcGFyc2VyUGF0aCBhcyB0aGUgdG9rZW5cbiAgICBvcHRpb25zVG9rZW4gPSBTdHJpbmcocGFyc2VyUGF0aCkgKyBvcHRpb25zSGFzaDtcbiAgfVxuXG4gIHJldHVybiB7XG4gICAgY2FjaGVLZXk6IG9wdGlvbnNUb2tlbiArIHNldHRpbmdzSGFzaCArIFN0cmluZyhwYXRoKSxcbiAgICBzZXR0aW5ncyxcbiAgICBwYXJzZXJPcHRpb25zLFxuICAgIHBhcnNlclBhdGgsXG4gICAgcGF0aCxcbiAgICBsYW5ndWFnZU9wdGlvbnMsXG4gIH07XG59XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/doc.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/doc.js new file mode 100644 index 0000000000000000000000000000000000000000..e2ceaa98a66e72933952ededa80f7c09c271972e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/doc.js @@ -0,0 +1,90 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.availableDocStyleParsers = undefined;exports. + + + + +captureDoc = captureDoc;var _doctrine = require('doctrine');var _doctrine2 = _interopRequireDefault(_doctrine);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /** + * parse docs from the first node that has leading comments + */function captureDoc(source, docStyleParsers) {var metadata = {}; + // 'some' short-circuits on first 'true' + for (var _len = arguments.length, nodes = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {nodes[_key - 2] = arguments[_key];}nodes.some(function (n) { + try { + + var leadingComments = void 0; + + // n.leadingComments is legacy `attachComments` behavior + if ('leadingComments' in n) { + leadingComments = n.leadingComments; + } else if (n.range) { + leadingComments = source.getCommentsBefore(n); + } + + if (!leadingComments || leadingComments.length === 0) {return false;} + + for (var name in docStyleParsers) { + var doc = docStyleParsers[name](leadingComments); + if (doc) { + metadata.doc = doc; + } + } + + return true; + } catch (err) { + return false; + } + }); + + return metadata; +} + +/** + * parse JSDoc from leading comments + * @param {object[]} comments + * @return {{ doc: object }} + */ +function captureJsDoc(comments) { + var doc = void 0; + + // capture XSDoc + comments.forEach(function (comment) { + // skip non-block comments + if (comment.type !== 'Block') {return;} + try { + doc = _doctrine2['default'].parse(comment.value, { unwrap: true }); + } catch (err) { + /* don't care, for now? maybe add to `errors?` */ + } + }); + + return doc; +} + +/** + * parse TomDoc section from comments + */ +function captureTomDoc(comments) { + // collect lines up to first paragraph break + var lines = []; + for (var i = 0; i < comments.length; i++) { + var comment = comments[i]; + if (comment.value.match(/^\s*$/)) {break;} + lines.push(comment.value.trim()); + } + + // return doctrine-like object + var statusMatch = lines.join(' ').match(/^(Public|Internal|Deprecated):\s*(.+)/); + if (statusMatch) { + return { + description: statusMatch[2], + tags: [{ + title: statusMatch[1].toLowerCase(), + description: statusMatch[2] }] }; + + + } +} + +var availableDocStyleParsers = exports.availableDocStyleParsers = { + jsdoc: captureJsDoc, + tomdoc: captureTomDoc }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvZG9jLmpzIl0sIm5hbWVzIjpbIm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ICAgICAgIHRpdGxlOiBzdGF0dXNNYXRjaFsxXS50b0xvd2VyQ2FzZSgpLFxuICAgICAgICBkZXNjcmlwdGlvbjogc3RhdHVzTWF0Y2hbMl0sXG4gICAgICB9XSxcbiAgICB9O1xuICB9XG59XG5cbmV4cG9ydCBjb25zdCBhdmFpbGFibGVEb2NTdHlsZVBhcnNlcnMgPSB7XG4gIGpzZG9jOiBjYXB0dXJlSnNEb2MsXG4gIHRvbWRvYzogY2FwdHVyZVRvbURvYyxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/index.js new file mode 100644 index 0000000000000000000000000000000000000000..802da1e87327c07847c3f9b5346ba56bd9d1cd05 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/index.js @@ -0,0 +1,180 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}var ExportMap = function () { + function ExportMap(path) {_classCallCheck(this, ExportMap); + this.path = path; + this.namespace = new Map(); + // todo: restructure to key on path, value is resolver + map of names + this.reexports = new Map(); + /** + * star-exports + * @type {Set<() => ExportMap>} + */ + this.dependencies = new Set(); + /** + * dependencies of this module that are not explicitly re-exported + * @type {Map ExportMap>} + */ + this.imports = new Map(); + this.errors = []; + /** + * type {'ambiguous' | 'Module' | 'Script'} + */ + this.parseGoal = 'ambiguous'; + }_createClass(ExportMap, [{ key: 'has', + + + + + + + + + + + + + + + /** + * Note that this does not check explicitly re-exported names for existence + * in the base namespace, but it will expand all `export * from '...'` exports + * if not found in the explicit namespace. + * @param {string} name + * @return {boolean} true if `name` is exported by this module. + */value: function () {function has( + name) { + if (this.namespace.has(name)) {return true;} + if (this.reexports.has(name)) {return true;} + + // default exports must be explicitly re-exported (#328) + if (name !== 'default') {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = this.dependencies[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var dep = _step.value; + var innerMap = dep(); + + // todo: report as unresolved? + if (!innerMap) {continue;} + + if (innerMap.has(name)) {return true;} + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + } + + return false; + }return has;}() + + /** + * ensure that imported name fully resolves. + * @param {string} name + * @return {{ found: boolean, path: ExportMap[] }} + */ }, { key: 'hasDeep', value: function () {function hasDeep( + name) { + if (this.namespace.has(name)) {return { found: true, path: [this] };} + + if (this.reexports.has(name)) { + var reexports = this.reexports.get(name); + var imported = reexports.getImport(); + + // if import is ignored, return explicit 'null' + if (imported == null) {return { found: true, path: [this] };} + + // safeguard against cycles, only if name matches + if (imported.path === this.path && reexports.local === name) { + return { found: false, path: [this] }; + } + + var deep = imported.hasDeep(reexports.local); + deep.path.unshift(this); + + return deep; + } + + // default exports must be explicitly re-exported (#328) + if (name !== 'default') {var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try { + for (var _iterator2 = this.dependencies[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var dep = _step2.value; + var innerMap = dep(); + if (innerMap == null) {return { found: true, path: [this] };} + // todo: report as unresolved? + if (!innerMap) {continue;} + + // safeguard against cycles + if (innerMap.path === this.path) {continue;} + + var innerValue = innerMap.hasDeep(name); + if (innerValue.found) { + innerValue.path.unshift(this); + return innerValue; + } + }} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}} + } + + return { found: false, path: [this] }; + }return hasDeep;}() }, { key: 'get', value: function () {function get( + + name) { + if (this.namespace.has(name)) {return this.namespace.get(name);} + + if (this.reexports.has(name)) { + var reexports = this.reexports.get(name); + var imported = reexports.getImport(); + + // if import is ignored, return explicit 'null' + if (imported == null) {return null;} + + // safeguard against cycles, only if name matches + if (imported.path === this.path && reexports.local === name) {return undefined;} + + return imported.get(reexports.local); + } + + // default exports must be explicitly re-exported (#328) + if (name !== 'default') {var _iteratorNormalCompletion3 = true;var _didIteratorError3 = false;var _iteratorError3 = undefined;try { + for (var _iterator3 = this.dependencies[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {var dep = _step3.value; + var innerMap = dep(); + // todo: report as unresolved? + if (!innerMap) {continue;} + + // safeguard against cycles + if (innerMap.path === this.path) {continue;} + + var innerValue = innerMap.get(name); + if (innerValue !== undefined) {return innerValue;} + }} catch (err) {_didIteratorError3 = true;_iteratorError3 = err;} finally {try {if (!_iteratorNormalCompletion3 && _iterator3['return']) {_iterator3['return']();}} finally {if (_didIteratorError3) {throw _iteratorError3;}}} + } + + return undefined; + }return get;}() }, { key: 'forEach', value: function () {function forEach( + + callback, thisArg) {var _this = this; + this.namespace.forEach(function (v, n) {callback.call(thisArg, v, n, _this);}); + + this.reexports.forEach(function (reexports, name) { + var reexported = reexports.getImport(); + // can't look up meta for ignored re-exports (#348) + callback.call(thisArg, reexported && reexported.get(reexports.local), name, _this); + }); + + this.dependencies.forEach(function (dep) { + var d = dep(); + // CJS / ignored dependencies won't exist (#717) + if (d == null) {return;} + + d.forEach(function (v, n) { + if (n !== 'default') { + callback.call(thisArg, v, n, _this); + } + }); + }); + }return forEach;}() + + // todo: keys, values, entries? + }, { key: 'reportErrors', value: function () {function reportErrors( + context, declaration) { + var msg = this.errors. + map(function (e) {return String(e.message) + ' (' + String(e.lineNumber) + ':' + String(e.column) + ')';}). + join(', '); + context.report({ + node: declaration.source, + message: 'Parse errors in imported module \'' + String(declaration.source.value) + '\': ' + String(msg) }); + + }return reportErrors;}() }, { key: 'hasDefault', get: function () {function get() {return this.get('default') != null;}return get;}() // stronger than this.has + }, { key: 'size', get: function () {function get() {var size = this.namespace.size + this.reexports.size;this.dependencies.forEach(function (dep) {var d = dep(); // CJS / ignored dependencies won't exist (#717) + if (d == null) {return;}size += d.size;});return size;}return get;}() }]);return ExportMap;}();exports['default'] = ExportMap; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvaW5kZXguanMiXSwibmFtZXMiOlsiRXhwb3J0TWFwIiwicGF0aCIsIm5hbWVzcGFjZSIsIk1hcCIsInJlZXhwb3J0cyIsImRlcGVuZGVuY2llcyIsIlNldCIsImltcG9ydHMiLCJlcnJvcnMiLCJwYXJzZUdvYWwiLCJuYW1lIiwiaGFzIiwiZGVwIiwiaW5uZXJNYXAiLCJmb3VuZCIsImdldCIsImltcG9ydGVkIiwiZ2V0SW1wb3J0IiwibG9jYWwiLCJkZWVwIiwiaGFzRGVlcCIsInVuc2hpZnQiLCJpbm5lclZhbHVlIiwidW5kZWZpbmVkIiwiY2FsbGJhY2siLCJ0aGlzQXJnIiwiZm9yRWFjaCIsInYiLCJuIiwiY2FsbCIsInJlZXhwb3J0ZWQiLCJkIiwiY29udGV4dCIsImRlY2xhcmF0aW9uIiwibXNnIiwibWFwIiwiZSIsIm1lc3NhZ2UiLCJsaW5lTnVtYmVyIiwiY29sdW1uIiwiam9pbiIsIn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VleHBvcnRlZC5nZXQocmVleHBvcnRzLmxvY2FsKSwgbmFtZSwgdGhpcyk7XG4gICAgfSk7XG5cbiAgICB0aGlzLmRlcGVuZGVuY2llcy5mb3JFYWNoKChkZXApID0+IHtcbiAgICAgIGNvbnN0IGQgPSBkZXAoKTtcbiAgICAgIC8vIENKUyAvIGlnbm9yZWQgZGVwZW5kZW5jaWVzIHdvbid0IGV4aXN0ICgjNzE3KVxuICAgICAgaWYgKGQgPT0gbnVsbCkgeyByZXR1cm47IH1cblxuICAgICAgZC5mb3JFYWNoKCh2LCBuKSA9PiB7XG4gICAgICAgIGlmIChuICE9PSAnZGVmYXVsdCcpIHtcbiAgICAgICAgICBjYWxsYmFjay5jYWxsKHRoaXNBcmcsIHYsIG4sIHRoaXMpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9KTtcbiAgfVxuXG4gIC8vIHRvZG86IGtleXMsIHZhbHVlcywgZW50cmllcz9cblxuICByZXBvcnRFcnJvcnMoY29udGV4dCwgZGVjbGFyYXRpb24pIHtcbiAgICBjb25zdCBtc2cgPSB0aGlzLmVycm9yc1xuICAgICAgLm1hcCgoZSkgPT4gYCR7ZS5tZXNzYWdlfSAoJHtlLmxpbmVOdW1iZXJ9OiR7ZS5jb2x1bW59KWApXG4gICAgICAuam9pbignLCAnKTtcbiAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICBub2RlOiBkZWNsYXJhdGlvbi5zb3VyY2UsXG4gICAgICBtZXNzYWdlOiBgUGFyc2UgZXJyb3JzIGluIGltcG9ydGVkIG1vZHVsZSAnJHtkZWNsYXJhdGlvbi5zb3VyY2UudmFsdWV9JzogJHttc2d9YCxcbiAgICB9KTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/namespace.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..0b07bdd8c1d94dbb972c43b417968c0d0ae6d12d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/namespace.js @@ -0,0 +1,39 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();var _childContext = require('./childContext');var _childContext2 = _interopRequireDefault(_childContext); +var _remotePath = require('./remotePath');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}var + +Namespace = function () { + function Namespace( + path, + context, + ExportMapBuilder) + {_classCallCheck(this, Namespace); + this.remotePathResolver = new _remotePath.RemotePath(path, context); + this.context = context; + this.ExportMapBuilder = ExportMapBuilder; + this.namespaces = new Map(); + }_createClass(Namespace, [{ key: 'resolveImport', value: function () {function resolveImport( + + value) { + var rp = this.remotePathResolver.resolve(value); + if (rp == null) {return null;} + return this.ExportMapBuilder['for']((0, _childContext2['default'])(rp, this.context)); + }return resolveImport;}() }, { key: 'getNamespace', value: function () {function getNamespace( + + identifier) {var _this = this; + if (!this.namespaces.has(identifier.name)) {return;} + return function () {return _this.resolveImport(_this.namespaces.get(identifier.name));}; + }return getNamespace;}() }, { key: 'add', value: function () {function add( + + object, identifier) { + var nsfn = this.getNamespace(identifier); + if (nsfn) { + Object.defineProperty(object, 'namespace', { get: nsfn }); + } + + return object; + }return add;}() }, { key: 'rawSet', value: function () {function rawSet( + + name, value) { + this.namespaces.set(name, value); + }return rawSet;}() }]);return Namespace;}();exports['default'] = Namespace; +//# sourceMappingUR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xuICAgIHRoaXMuRXhwb3J0TWFwQnVpbGRlciA9IEV4cG9ydE1hcEJ1aWxkZXI7XG4gICAgdGhpcy5uYW1lc3BhY2VzID0gbmV3IE1hcCgpO1xuICB9XG5cbiAgcmVzb2x2ZUltcG9ydCh2YWx1ZSkge1xuICAgIGNvbnN0IHJwID0gdGhpcy5yZW1vdGVQYXRoUmVzb2x2ZXIucmVzb2x2ZSh2YWx1ZSk7XG4gICAgaWYgKHJwID09IG51bGwpIHsgcmV0dXJuIG51bGw7IH1cbiAgICByZXR1cm4gdGhpcy5FeHBvcnRNYXBCdWlsZGVyLmZvcihjaGlsZENvbnRleHQocnAsIHRoaXMuY29udGV4dCkpO1xuICB9XG5cbiAgZ2V0TmFtZXNwYWNlKGlkZW50aWZpZXIpIHtcbiAgICBpZiAoIXRoaXMubmFtZXNwYWNlcy5oYXMoaWRlbnRpZmllci5uYW1lKSkgeyByZXR1cm47IH1cbiAgICByZXR1cm4gKCkgPT4gdGhpcy5yZXNvbHZlSW1wb3J0KHRoaXMubmFtZXNwYWNlcy5nZXQoaWRlbnRpZmllci5uYW1lKSk7XG4gIH1cblxuICBhZGQob2JqZWN0LCBpZGVudGlmaWVyKSB7XG4gICAgY29uc3QgbnNmbiA9IHRoaXMuZ2V0TmFtZXNwYWNlKGlkZW50aWZpZXIpO1xuICAgIGlmIChuc2ZuKSB7XG4gICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkob2JqZWN0LCAnbmFtZXNwYWNlJywgeyBnZXQ6IG5zZm4gfSk7XG4gICAgfVxuXG4gICAgcmV0dXJuIG9iamVjdDtcbiAgfVxuXG4gIHJhd1NldChuYW1lLCB2YWx1ZSkge1xuICAgIHRoaXMubmFtZXNwYWNlcy5zZXQobmFtZSwgdmFsdWUpO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/patternCapture.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/patternCapture.js new file mode 100644 index 0000000000000000000000000000000000000000..de0888a884190c5d6395523c62e246246794415d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/patternCapture.js @@ -0,0 +1,41 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] = + + + + + + +recursivePatternCapture; /** + * Traverse a pattern/identifier node, calling 'callback' + * for each leaf identifier. + * @param {node} pattern + * @param {Function} callback + * @return {void} + */function recursivePatternCapture(pattern, callback) {switch (pattern.type) {case 'Identifier': // base case + callback(pattern);break;case 'ObjectPattern':pattern.properties.forEach(function (p) { + if (p.type === 'ExperimentalRestProperty' || p.type === 'RestElement') { + callback(p.argument); + return; + } + recursivePatternCapture(p.value, callback); + }); + break; + + case 'ArrayPattern': + pattern.elements.forEach(function (element) { + if (element == null) {return;} + if (element.type === 'ExperimentalRestProperty' || element.type === 'RestElement') { + callback(element.argument); + return; + } + recursivePatternCapture(element, callback); + }); + break; + + case 'AssignmentPattern': + callback(pattern.left); + break; + default:} + +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvcGF0dGVybkNhcHR1cmUuanMiXSwibmFtZXMiOlsicmVjdXJzaXZlUGF0dGVybkNhcHR1cmUiLCJwYXR0ZXJuIiwiY2FsbGJhY2siLCJ0eXBlIiwicHJvcGVydGllcyIsImZvckVhY2giLCJwIiwiYXJndW1lbnQiLCJ2YWx1ZSIsImVsZW1lbnRzIiwiZWxlbWVudCIsImxlZnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFPd0JBLHVCLEVBUHhCOzs7Ozs7NEJBT2UsU0FBU0EsdUJBQVQsQ0FBaUNDLE9BQWpDLEVBQTBDQyxRQUExQyxFQUFvRCxDQUNqRSxRQUFRRCxRQUFRRSxJQUFoQixHQUNFLEtBQUssWUFBTCxFQUFtQjtB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xuXG4gICAgY2FzZSAnQXNzaWdubWVudFBhdHRlcm4nOlxuICAgICAgY2FsbGJhY2socGF0dGVybi5sZWZ0KTtcbiAgICAgIGJyZWFrO1xuICAgIGRlZmF1bHQ6XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/remotePath.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/remotePath.js new file mode 100644 index 0000000000000000000000000000000000000000..c9906d3cf478d359a7daeda36258244e8d340b28 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/remotePath.js @@ -0,0 +1,12 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.RemotePath = undefined;var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();var _resolve2 = require('eslint-module-utils/resolve');var _resolve3 = _interopRequireDefault(_resolve2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}var + +RemotePath = exports.RemotePath = function () { + function RemotePath(path, context) {_classCallCheck(this, RemotePath); + this.path = path; + this.context = context; + }_createClass(RemotePath, [{ key: 'resolve', value: function () {function resolve( + + value) { + return _resolve3['default'].relative(value, this.path, this.context.settings); + }return resolve;}() }]);return RemotePath;}(); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvcmVtb3RlUGF0aC5qcyJdLCJuYW1lcyI6WyJSZW1vdGVQYXRoIiwicGF0aCIsImNvbnRleHQiLCJ2YWx1ZSIsInJlc29sdmUiLCJyZWxhdGl2ZSIsInNldHRpbmdzIl0sIm1hcHBpbmdzIjoiK29CQUFBLHVEOztBQUVhQSxVLFdBQUFBLFU7QUFDWCxzQkFBWUMsSUFBWixFQUFrQkMsT0FBbEIsRUFBMkI7QUFDekIsU0FBS0QsSUFBTCxHQUFZQSxJQUFaO0FBQ0EsU0FBS0MsT0FBTCxHQUFlQSxPQUFmO0FBQ0QsRzs7QUFFT0MsVyxFQUFPO0FBQ2IsZUFBT0MscUJBQVFDLFFBQVIsQ0FBaUJGLEtBQWpCLEVBQXdCLEtBQUtGLElBQTdCLEVBQW1DLEtBQUtDLE9BQUwsQ0FBYUksUUFBaEQsQ0FBUDtBQUNELE8iLCJmaWxlIjoicmVtb3RlUGF0aC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCByZXNvbHZlIGZyb20gJ2VzbGludC1tb2R1bGUtdXRpbHMvcmVzb2x2ZSc7XG5cbmV4cG9ydCBjbGFzcyBSZW1vdGVQYXRoIHtcbiAgY29uc3RydWN0b3IocGF0aCwgY29udGV4dCkge1xuICAgIHRoaXMucGF0aCA9IHBhdGg7XG4gICAgdGhpcy5jb250ZXh0ID0gY29udGV4dDtcbiAgfVxuXG4gIHJlc29sdmUodmFsdWUpIHtcbiAgICByZXR1cm4gcmVzb2x2ZS5yZWxhdGl2ZSh2YWx1ZSwgdGhpcy5wYXRoLCB0aGlzLmNvbnRleHQuc2V0dGluZ3MpO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/specifier.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/specifier.js new file mode 100644 index 0000000000000000000000000000000000000000..7670c0cde2d3af146deafea2aed2fba0ed84ede4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/specifier.js @@ -0,0 +1,33 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] = processSpecifier;function processSpecifier(specifier, astNode, exportMap, namespace) { + var nsource = astNode.source && astNode.source.value; + var exportMeta = {}; + var local = void 0; + + switch (specifier.type) { + case 'ExportDefaultSpecifier': + if (!nsource) {return;} + local = 'default'; + break; + case 'ExportNamespaceSpecifier': + exportMap.namespace.set(specifier.exported.name, Object.defineProperty(exportMeta, 'namespace', { + get: function () {function get() {return namespace.resolveImport(nsource);}return get;}() })); + + return; + case 'ExportAllDeclaration': + exportMap.namespace.set(specifier.exported.name || specifier.exported.value, namespace.add(exportMeta, specifier.source.value)); + return; + case 'ExportSpecifier': + if (!astNode.source) { + exportMap.namespace.set(specifier.exported.name || specifier.exported.value, namespace.add(exportMeta, specifier.local)); + return; + } + // else falls through + default: + local = specifier.local.name; + break;} + + + // todo: JSDoc + exportMap.reexports.set(specifier.exported.name, { local: local, getImport: function () {function getImport() {return namespace.resolveImport(nsource);}return getImport;}() }); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvc3BlY2lmaWVyLmpzIl0sIm5hbWVzIjpbInByb2Nlc3NTcGVjaWZpZXIiLCJzcGVjaWZpZXIiLCJhc3ROb2RlIiwiZXhwb3J0TWFwIiwibmFtZXNwYWNlIiwibnNvdXJjZSIsInNvdXJjZSIsInZhbHVlIiwiZXhwb3J0TWV0YSIsImxvY2FsIiwidHlwZSIsInNldCIsImV4cG9ydGVkIiwibmFtZSIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZ2V0IiwicmVzb2x2ZUltcG9ydCIsImFkZCIsInJlZXhwb3J0cyIsImdldEltcG9ydCJdLCJtYXBwaW5ncyI6ImdHQUF3QkEsZ0IsQ0FBVCxTQUFTQSxnQkFBVCxDQUEwQkMsU0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geyByZXR1cm4gbmFtZXNwYWNlLnJlc29sdmVJbXBvcnQobnNvdXJjZSk7IH0sXG4gICAgICB9KSk7XG4gICAgICByZXR1cm47XG4gICAgY2FzZSAnRXhwb3J0QWxsRGVjbGFyYXRpb24nOlxuICAgICAgZXhwb3J0TWFwLm5hbWVzcGFjZS5zZXQoc3BlY2lmaWVyLmV4cG9ydGVkLm5hbWUgfHwgc3BlY2lmaWVyLmV4cG9ydGVkLnZhbHVlLCBuYW1lc3BhY2UuYWRkKGV4cG9ydE1ldGEsIHNwZWNpZmllci5zb3VyY2UudmFsdWUpKTtcbiAgICAgIHJldHVybjtcbiAgICBjYXNlICdFeHBvcnRTcGVjaWZpZXInOlxuICAgICAgaWYgKCFhc3ROb2RlLnNvdXJjZSkge1xuICAgICAgICBleHBvcnRNYXAubmFtZXNwYWNlLnNldChzcGVjaWZpZXIuZXhwb3J0ZWQubmFtZSB8fCBzcGVjaWZpZXIuZXhwb3J0ZWQudmFsdWUsIG5hbWVzcGFjZS5hZGQoZXhwb3J0TWV0YSwgc3BlY2lmaWVyLmxvY2FsKSk7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cbiAgICAvLyBlbHNlIGZhbGxzIHRocm91Z2hcbiAgICBkZWZhdWx0OlxuICAgICAgbG9jYWwgPSBzcGVjaWZpZXIubG9jYWwubmFtZTtcbiAgICAgIGJyZWFrO1xuICB9XG5cbiAgLy8gdG9kbzogSlNEb2NcbiAgZXhwb3J0TWFwLnJlZXhwb3J0cy5zZXQoc3BlY2lmaWVyLmV4cG9ydGVkLm5hbWUsIHsgbG9jYWwsIGdldEltcG9ydDogKCkgPT4gbmFtZXNwYWNlLnJlc29sdmVJbXBvcnQobnNvdXJjZSkgfSk7XG59XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/typescript.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/typescript.js new file mode 100644 index 0000000000000000000000000000000000000000..5aad0ce08b103e99d335bdb397fa7b167f0cf97c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/typescript.js @@ -0,0 +1,44 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +isEsModuleInterop = isEsModuleInterop;var _path = require('path');var _tsconfigLoader = require('tsconfig-paths/lib/tsconfig-loader');var _hash = require('eslint-module-utils/hash');var ts = void 0;var tsconfigCache = new Map();function readTsConfig(context) {var tsconfigInfo = (0, _tsconfigLoader.tsConfigLoader)({ cwd: context.parserOptions && context.parserOptions.tsconfigRootDir || process.cwd(), getEnv: function () {function getEnv(key) {return process.env[key];}return getEnv;}() });try {if (tsconfigInfo.tsConfigPath !== undefined) {// Projects not using TypeScript won't have `typescript` installed. + if (!ts) {ts = require('typescript');} // eslint-disable-line import/no-extraneous-dependencies + var configFile = ts.readConfigFile(tsconfigInfo.tsConfigPath, ts.sys.readFile);return ts.parseJsonConfigFileContent(configFile.config, ts.sys, (0, _path.dirname)(tsconfigInfo.tsConfigPath));}} catch (e) {// Catch any errors + }return null;}function isEsModuleInterop(context) {var cacheKey = (0, _hash.hashObject)({ tsconfigRootDir: context.parserOptions && context.parserOptions.tsconfigRootDir }).digest('hex'); + var tsConfig = tsconfigCache.get(cacheKey); + if (typeof tsConfig === 'undefined') { + tsConfig = readTsConfig(context); + tsconfigCache.set(cacheKey, tsConfig); + } + + return tsConfig && tsConfig.options ? tsConfig.options.esModuleInterop : false; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvdHlwZXNjcmlwdC5qcyJdLCJuYW1lcyI6WyJpc0VzTW9kdWxlSW50ZXJvcCIsInRzIiwidHNjb25maWdDYWNoZSIsIk1hcCIsInJlYWRUc0NvbmZpZyIsImNvbnRleHQiLCJ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O1xufVxuXG5leHBvcnQgZnVuY3Rpb24gaXNFc01vZHVsZUludGVyb3AoY29udGV4dCkge1xuICBjb25zdCBjYWNoZUtleSA9IGhhc2hPYmplY3Qoe1xuICAgIHRzY29uZmlnUm9vdERpcjogY29udGV4dC5wYXJzZXJPcHRpb25zICYmIGNvbnRleHQucGFyc2VyT3B0aW9ucy50c2NvbmZpZ1Jvb3REaXIsXG4gIH0pLmRpZ2VzdCgnaGV4Jyk7XG4gIGxldCB0c0NvbmZpZyA9IHRzY29uZmlnQ2FjaGUuZ2V0KGNhY2hlS2V5KTtcbiAgaWYgKHR5cGVvZiB0c0NvbmZpZyA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICB0c0NvbmZpZyA9IHJlYWRUc0NvbmZpZyhjb250ZXh0KTtcbiAgICB0c2NvbmZpZ0NhY2hlLnNldChjYWNoZUtleSwgdHNDb25maWcpO1xuICB9XG5cbiAgcmV0dXJuIHRzQ29uZmlnICYmIHRzQ29uZmlnLm9wdGlvbnMgPyB0c0NvbmZpZy5vcHRpb25zLmVzTW9kdWxlSW50ZXJvcCA6IGZhbHNlO1xufVxuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/visitor.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/visitor.js new file mode 100644 index 0000000000000000000000000000000000000000..38f51889f1a05b8bf14d46e95220ab15f77e6797 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/exportMap/visitor.js @@ -0,0 +1,171 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();var _arrayIncludes = require('array-includes');var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes); +var _eslint = require('eslint'); +var _doc = require('./doc'); +var _namespace = require('./namespace');var _namespace2 = _interopRequireDefault(_namespace); +var _specifier = require('./specifier');var _specifier2 = _interopRequireDefault(_specifier); +var _captureDependency = require('./captureDependency'); +var _patternCapture = require('./patternCapture');var _patternCapture2 = _interopRequireDefault(_patternCapture); +var _remotePath = require('./remotePath');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} + +/** + * sometimes legacy support isn't _that_ hard... right? + */ +function makeSourceCode(text, ast) { + if (_eslint.SourceCode.length > 1) { + // ESLint 3 + return new _eslint.SourceCode(text, ast); + } else { + // ESLint 4, 5 + return new _eslint.SourceCode({ text: text, ast: ast }); + } +}var + +ImportExportVisitorBuilder = function () { + function ImportExportVisitorBuilder( + path, + context, + exportMap, + ExportMapBuilder, + content, + ast, + isEsModuleInteropTrue, + thunkFor) + {var _this = this;_classCallCheck(this, ImportExportVisitorBuilder); + this.context = context; + this.namespace = new _namespace2['default'](path, context, ExportMapBuilder); + this.remotePathResolver = new _remotePath.RemotePath(path, context); + this.source = makeSourceCode(content, ast); + this.exportMap = exportMap; + this.ast = ast; + this.isEsModuleInteropTrue = isEsModuleInteropTrue; + this.thunkFor = thunkFor; + var docstyle = this.context.settings && this.context.settings['import/docstyle'] || ['jsdoc']; + this.docStyleParsers = {}; + docstyle.forEach(function (style) { + _this.docStyleParsers[style] = _doc.availableDocStyleParsers[style]; + }); + }_createClass(ImportExportVisitorBuilder, [{ key: 'build', value: function () {function build( + + astNode) {var _this3 = this; + return Object.assign({ + ExportDefaultDeclaration: function () {function ExportDefaultDeclaration() { + var exportMeta = (0, _doc.captureDoc)(this.source, this.docStyleParsers, astNode); + if (astNode.declaration.type === 'Identifier') { + this.namespace.add(exportMeta, astNode.declaration); + } + this.exportMap.namespace.set('default', exportMeta); + }return ExportDefaultDeclaration;}(), + ExportAllDeclaration: function () {function ExportAllDeclaration() { + var getter = (0, _captureDependency.captureDependency)(astNode, astNode.exportKind === 'type', this.remotePathResolver, this.exportMap, this.context, this.thunkFor); + if (getter) {this.exportMap.dependencies.add(getter);} + if (astNode.exported) { + (0, _specifier2['default'])(astNode, astNode.exported, this.exportMap, this.namespace); + } + }return ExportAllDeclaration;}(), + /** capture namespaces in case of later export */ + ImportDeclaration: function () {function ImportDeclaration() { + (0, _captureDependency.captureDependencyWithSpecifiers)(astNode, this.remotePathResolver, this.exportMap, this.context, this.thunkFor); + var ns = astNode.specifiers.find(function (s) {return s.type === 'ImportNamespaceSpecifier';}); + if (ns) { + this.namespace.rawSet(ns.local.name, astNode.source.value); + } + }return ImportDeclaration;}(), + ExportNamedDeclaration: function () {function ExportNamedDeclaration() {var _this2 = this; + (0, _captureDependency.captureDependencyWithSpecifiers)(astNode, this.remotePathResolver, this.exportMap, this.context, this.thunkFor); + // capture declaration + if (astNode.declaration != null) { + switch (astNode.declaration.type) { + case 'FunctionDeclaration': + case 'ClassDeclaration': + case 'TypeAlias': // flowtype with babel-eslint parser + case 'InterfaceDeclaration': + case 'DeclareFunction': + case 'TSDeclareFunction': + case 'TSEnumDeclaration': + case 'TSTypeAliasDeclaration': + case 'TSInterfaceDeclaration': + case 'TSAbstractClassDeclaration': + case 'TSModuleDeclaration': + this.exportMap.namespace.set(astNode.declaration.id.name, (0, _doc.captureDoc)(this.source, this.docStyleParsers, astNode)); + break; + case 'VariableDeclaration': + astNode.declaration.declarations.forEach(function (d) { + (0, _patternCapture2['default'])( + d.id, + function (id) {return _this2.exportMap.namespace.set(id.name, (0, _doc.captureDoc)(_this2.source, _this2.docStyleParsers, d, astNode));}); + + }); + break; + default:} + + } + astNode.specifiers.forEach(function (s) {return (0, _specifier2['default'])(s, astNode, _this2.exportMap, _this2.namespace);}); + }return ExportNamedDeclaration;}(), + TSExportAssignment: function () {function TSExportAssignment() {return _this3.typeScriptExport(astNode);}return TSExportAssignment;}() }, + this.isEsModuleInteropTrue && { TSNamespaceExportDeclaration: function () {function TSNamespaceExportDeclaration() {return _this3.typeScriptExport(astNode);}return TSNamespaceExportDeclaration;}() }); + + }return build;}() + + // This doesn't declare anything, but changes what's being exported. + }, { key: 'typeScriptExport', value: function () {function typeScriptExport(astNode) {var _this4 = this; + var exportedName = astNode.type === 'TSNamespaceExportDeclaration' ? + (astNode.id || astNode.name).name : + astNode.expression && astNode.expression.name || astNode.expression.id && astNode.expression.id.name || null; + var declTypes = [ + 'VariableDeclaration', + 'ClassDeclaration', + 'TSDeclareFunction', + 'TSEnumDeclaration', + 'TSTypeAliasDeclaration', + 'TSInterfaceDeclaration', + 'TSAbstractClassDeclaration', + 'TSModuleDeclaration']; + + var exportedDecls = this.ast.body.filter(function (_ref) {var type = _ref.type,id = _ref.id,declarations = _ref.declarations;return (0, _arrayIncludes2['default'])(declTypes, type) && ( + id && id.name === exportedName || declarations && declarations.find(function (d) {return d.id.name === exportedName;}));}); + + if (exportedDecls.length === 0) { + // Export is not referencing any local declaration, must be re-exporting + this.exportMap.namespace.set('default', (0, _doc.captureDoc)(this.source, this.docStyleParsers, astNode)); + return; + } + if ( + this.isEsModuleInteropTrue // esModuleInterop is on in tsconfig + && !this.exportMap.namespace.has('default') // and default isn't added already + ) { + this.exportMap.namespace.set('default', {}); // add default export + } + exportedDecls.forEach(function (decl) { + if (decl.type === 'TSModuleDeclaration') { + if (decl.body && decl.body.type === 'TSModuleDeclaration') { + _this4.exportMap.namespace.set(decl.body.id.name, (0, _doc.captureDoc)(_this4.source, _this4.docStyleParsers, decl.body)); + } else if (decl.body && decl.body.body) { + decl.body.body.forEach(function (moduleBlockNode) { + // Export-assignment exports all members in the namespace, + // explicitly exported or not. + var namespaceDecl = moduleBlockNode.type === 'ExportNamedDeclaration' ? + moduleBlockNode.declaration : + moduleBlockNode; + + if (!namespaceDecl) { + // TypeScript can check this for us; we needn't + } else if (namespaceDecl.type === 'VariableDeclaration') { + namespaceDecl.declarations.forEach(function (d) {return (0, _patternCapture2['default'])(d.id, function (id) {return _this4.exportMap.namespace.set( + id.name, + (0, _doc.captureDoc)(_this4.source, _this4.docStyleParsers, decl, namespaceDecl, moduleBlockNode));});}); + + + } else { + _this4.exportMap.namespace.set( + namespaceDecl.id.name, + (0, _doc.captureDoc)(_this4.source, _this4.docStyleParsers, moduleBlockNode)); + } + }); + } + } else { + // Export as default + _this4.exportMap.namespace.set('default', (0, _doc.captureDoc)(_this4.source, _this4.docStyleParsers, decl)); + } + }); + }return typeScriptExport;}() }]);return ImportExportVisitorBuilder;}();exports['default'] = ImportExportVisitorBuilder; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvdmlzaXRvci5qcyJdLCJuYW1lcyI6WyJtYWtlU291cmNlQ29kZSIsInRleHQiLCJhc3QiLCJTb3VyY2VDb2RlIiwibGVuZ3RoIiwiSW1wb3J0RXhwb3J0VmlzaXRvckJ1aWxkZXIiLCJwYXRoIiwiY29udGV4dCIsImV4cG9ydE1hcCIsIkV4cG9ydE1hcEJ1aWxkZXIiLCJjb250ZW50IiwiaXNFc01vZHVsZUludGVyb3BUcnVlIiwidGh1bmtGb3IiLCJuYW1lc3BhY2UiLCJOYW1lc3BhY2UiLCJyZW1vdGVQYXRoUmVzb2x2ZXIiLCJSZW1vdGVQYXRoIiwic291cmNlIiwiZG9jc3R5bGUiLCJzZXR0aW5ncyIsImRvY1N0eWxlUGFyc2VycyIsImZvckVhY2giLCJzdHlsZSIsImF2YWlsYWJsZURvY1N0eWxlUGFyc2VycyIsImFzdE5vZGUiLCJFeHBvcnREZWZhdWx0RGVjbGFyYXRpb24iLCJleHBvcnRNZXRhIiwiZGVjbGFyYXRpb24iLCJ0eXBlIiwiYWRkIiwic2V0Iiw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gICAgICAgICAgICAgIGNhcHR1cmVEb2ModGhpcy5zb3VyY2UsIHRoaXMuZG9jU3R5bGVQYXJzZXJzLCBtb2R1bGVCbG9ja05vZGUpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgLy8gRXhwb3J0IGFzIGRlZmF1bHRcbiAgICAgICAgdGhpcy5leHBvcnRNYXAubmFtZXNwYWNlLnNldCgnZGVmYXVsdCcsIGNhcHR1cmVEb2ModGhpcy5zb3VyY2UsIHRoaXMuZG9jU3R5bGVQYXJzZXJzLCBkZWNsKSk7XG4gICAgICB9XG4gICAgfSk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/importDeclaration.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/importDeclaration.js new file mode 100644 index 0000000000000000000000000000000000000000..8afc58f96ae6e3edbbc25c562634c52d22faae46 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/importDeclaration.js @@ -0,0 +1,7 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] = + +importDeclaration;var _contextCompat = require('eslint-module-utils/contextCompat');function importDeclaration(context, node) { + var ancestors = (0, _contextCompat.getAncestors)(context, node); + return ancestors[ancestors.length - 1]; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbXBvcnREZWNsYXJhdGlvbi5qcyJdLCJuYW1lcyI6WyJpbXBvcnREZWNsYXJhdGlvbiIsImNvbnRleHQiLCJub2RlIiwiYW5jZXN0b3JzIiwibGVuZ3RoIl0sIm1hcHBpbmdzIjoiOztBQUV3QkEsaUIsQ0FGeEIsa0VBRWUsU0FBU0EsaUJBQVQsQ0FBMkJDLE9BQTNCLEVBQW9DQyxJQUFwQyxFQUEwQztBQUN2RCxNQUFNQyxZQUFZLGlDQUFhRixPQUFiLEVBQXNCQyxJQUF0QixDQUFsQjtBQUNBLFNBQU9DLFVBQVVBLFVBQVVDLE1BQVYsR0FBbUIsQ0FBN0IsQ0FBUDtBQUNEIiwiZmlsZSI6ImltcG9ydERlY2xhcmF0aW9uLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgZ2V0QW5jZXN0b3JzIH0gZnJvbSAnZXNsaW50LW1vZHVsZS11dGlscy9jb250ZXh0Q29tcGF0JztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gaW1wb3J0RGVjbGFyYXRpb24oY29udGV4dCwgbm9kZSkge1xuICBjb25zdCBhbmNlc3RvcnMgPSBnZXRBbmNlc3RvcnMoY29udGV4dCwgbm9kZSk7XG4gIHJldHVybiBhbmNlc3RvcnNbYW5jZXN0b3JzLmxlbmd0aCAtIDFdO1xufVxuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..74d22a4f26f811be79a37d002276480cc97b37c8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/index.js @@ -0,0 +1,103 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.flatConfigs = exports.configs = exports.rules = undefined;var _package = require('../package.json'); + +var rules = exports.rules = { + 'no-unresolved': require('./rules/no-unresolved'), + named: require('./rules/named'), + 'default': require('./rules/default'), + namespace: require('./rules/namespace'), + 'no-namespace': require('./rules/no-namespace'), + 'export': require('./rules/export'), + 'no-mutable-exports': require('./rules/no-mutable-exports'), + extensions: require('./rules/extensions'), + 'no-restricted-paths': require('./rules/no-restricted-paths'), + 'no-internal-modules': require('./rules/no-internal-modules'), + 'group-exports': require('./rules/group-exports'), + 'no-relative-packages': require('./rules/no-relative-packages'), + 'no-relative-parent-imports': require('./rules/no-relative-parent-imports'), + 'consistent-type-specifier-style': require('./rules/consistent-type-specifier-style'), + + 'no-self-import': require('./rules/no-self-import'), + 'no-cycle': require('./rules/no-cycle'), + 'no-named-default': require('./rules/no-named-default'), + 'no-named-as-default': require('./rules/no-named-as-default'), + 'no-named-as-default-member': require('./rules/no-named-as-default-member'), + 'no-anonymous-default-export': require('./rules/no-anonymous-default-export'), + 'no-unused-modules': require('./rules/no-unused-modules'), + + 'no-commonjs': require('./rules/no-commonjs'), + 'no-amd': require('./rules/no-amd'), + 'no-duplicates': require('./rules/no-duplicates'), + first: require('./rules/first'), + 'max-dependencies': require('./rules/max-dependencies'), + 'no-extraneous-dependencies': require('./rules/no-extraneous-dependencies'), + 'no-absolute-path': require('./rules/no-absolute-path'), + 'no-nodejs-modules': require('./rules/no-nodejs-modules'), + 'no-webpack-loader-syntax': require('./rules/no-webpack-loader-syntax'), + order: require('./rules/order'), + 'newline-after-import': require('./rules/newline-after-import'), + 'prefer-default-export': require('./rules/prefer-default-export'), + 'no-default-export': require('./rules/no-default-export'), + 'no-named-export': require('./rules/no-named-export'), + 'no-dynamic-require': require('./rules/no-dynamic-require'), + unambiguous: require('./rules/unambiguous'), + 'no-unassigned-import': require('./rules/no-unassigned-import'), + 'no-useless-path-segments': require('./rules/no-useless-path-segments'), + 'dynamic-import-chunkname': require('./rules/dynamic-import-chunkname'), + 'no-import-module-exports': require('./rules/no-import-module-exports'), + 'no-empty-named-blocks': require('./rules/no-empty-named-blocks'), + 'enforce-node-protocol-usage': require('./rules/enforce-node-protocol-usage'), + + // export + 'exports-last': require('./rules/exports-last'), + + // metadata-based + 'no-deprecated': require('./rules/no-deprecated'), + + // deprecated aliases to rules + 'imports-first': require('./rules/imports-first') }; + + +var configs = exports.configs = { + recommended: require('../config/recommended'), + + errors: require('../config/errors'), + warnings: require('../config/warnings'), + + // shhhh... work in progress "secret" rules + 'stage-0': require('../config/stage-0'), + + // useful stuff for folks using various environments + react: require('../config/react'), + 'react-native': require('../config/react-native'), + electron: require('../config/electron'), + typescript: require('../config/typescript') }; + + +// Base Plugin Object +var importPlugin = { + meta: { name: _package.name, version: _package.version }, + rules: rules }; + + +// Create flat configs (Only ones that declare plugins and parser options need to be different from the legacy config) +var createFlatConfig = function createFlatConfig(baseConfig, configName) {return Object.assign({}, + baseConfig, { + name: 'import/' + String(configName), + plugins: { 'import': importPlugin } });}; + + +var flatConfigs = exports.flatConfigs = { + recommended: createFlatConfig( + require('../config/flat/recommended'), + 'recommended'), + + + errors: createFlatConfig(require('../config/flat/errors'), 'errors'), + warnings: createFlatConfig(require('../config/flat/warnings'), 'warnings'), + + // useful stuff for folks using various environments + react: createFlatConfig(require('../config/flat/react'), 'react'), + 'react-native': createFlatConfig(configs['react-native'], 'react-native'), + electron: createFlatConfig(configs.electron, 'electron'), + typescript: createFlatConfig(configs.typescript, 'typescript') }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJydWxlcyIsInJlcXVpcmUiLCJuYW1lZCIsIm5hbWVzcGFjZSIsImV4dGVuc2lvbnMiLCJmaXJzdCIsIm9yZGVyIiwidW5hbWJpZ3VvdXMiLCJjb25maWdzIiwicmVjb21tZW5kZWQiLCJlcnJvcnMiLCJ3YXJuaW5ncyIsInJlYWN0IiwiZWxlY3Ryb24iLCJ0eXBlc2NyaXB0IiwiaW1wb3J0UGx1Z2luIiwibWV0YSIsIm5hbWUiLCJ2ZXJzaW9uIiwiY3JlYXRlRmxhdENvbmZpZyIsImJhc2VDb25maWciLCJjb25maWdOYW1lIiwicGx1Z2lucyIsImZsYXRDb25maWdzIl0sIm1hcHBpbmdzIjoiNklBQUE7O0FBRU8sSUFBTUEsd0JBQVE7QUFDbkIsbUJBQWlCQyxRQUFRLHVCQUFSLENBREU7QUFFbkJDLFNBQU9ELFFBQVEsZUF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ybmluZ3M6IGNyZWF0ZUZsYXRDb25maWcocmVxdWlyZSgnLi4vY29uZmlnL2ZsYXQvd2FybmluZ3MnKSwgJ3dhcm5pbmdzJyksXG5cbiAgLy8gdXNlZnVsIHN0dWZmIGZvciBmb2xrcyB1c2luZyB2YXJpb3VzIGVudmlyb25tZW50c1xuICByZWFjdDogY3JlYXRlRmxhdENvbmZpZyhyZXF1aXJlKCcuLi9jb25maWcvZmxhdC9yZWFjdCcpLCAncmVhY3QnKSxcbiAgJ3JlYWN0LW5hdGl2ZSc6IGNyZWF0ZUZsYXRDb25maWcoY29uZmlnc1sncmVhY3QtbmF0aXZlJ10sICdyZWFjdC1uYXRpdmUnKSxcbiAgZWxlY3Ryb246IGNyZWF0ZUZsYXRDb25maWcoY29uZmlncy5lbGVjdHJvbiwgJ2VsZWN0cm9uJyksXG4gIHR5cGVzY3JpcHQ6IGNyZWF0ZUZsYXRDb25maWcoY29uZmlncy50eXBlc2NyaXB0LCAndHlwZXNjcmlwdCcpLFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/consistent-type-specifier-style.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/consistent-type-specifier-style.js new file mode 100644 index 0000000000000000000000000000000000000000..13ebee958509052192a487a9e68b5623934f7e68 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/consistent-type-specifier-style.js @@ -0,0 +1,238 @@ +'use strict';var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function isComma(token) { + return token.type === 'Punctuator' && token.value === ','; +} + +/** + * @param {import('eslint').Rule.Fix[]} fixes + * @param {import('eslint').Rule.RuleFixer} fixer + * @param {import('eslint').SourceCode.SourceCode} sourceCode + * @param {(ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[]} specifiers + * */ +function removeSpecifiers(fixes, fixer, sourceCode, specifiers) {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = specifiers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var specifier = _step.value; + // remove the trailing comma + var token = sourceCode.getTokenAfter(specifier); + if (token && isComma(token)) { + fixes.push(fixer.remove(token)); + } + fixes.push(fixer.remove(specifier)); + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} +} + +/** @type {(node: import('estree').Node, sourceCode: import('eslint').SourceCode.SourceCode, specifiers: (ImportSpecifier | ImportNamespaceSpecifier)[], kind: 'type' | 'typeof') => string} */ +function getImportText( +node, +sourceCode, +specifiers, +kind) +{ + var sourceString = sourceCode.getText(node.source); + if (specifiers.length === 0) { + return ''; + } + + var names = specifiers.map(function (s) { + if (s.imported.name === s.local.name) { + return s.imported.name; + } + return String(s.imported.name) + ' as ' + String(s.local.name); + }); + // insert a fresh top-level import + return 'import ' + String(kind) + ' {' + String(names.join(', ')) + '} from ' + String(sourceString) + ';'; +} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Enforce or ban the use of inline type-only markers for named imports.', + url: (0, _docsUrl2['default'])('consistent-type-specifier-style') }, + + fixable: 'code', + schema: [ + { + type: 'string', + 'enum': ['prefer-inline', 'prefer-top-level'], + 'default': 'prefer-inline' }] }, + + + + + create: function () {function create(context) { + var sourceCode = (0, _contextCompat.getSourceCode)(context); + + if (context.options[0] === 'prefer-inline') { + return { + ImportDeclaration: function () {function ImportDeclaration(node) { + if (node.importKind === 'value' || node.importKind == null) { + // top-level value / unknown is valid + return; + } + + if ( + // no specifiers (import type {} from '') have no specifiers to mark as inline + node.specifiers.length === 0 || + node.specifiers.length === 1 + // default imports are both "inline" and "top-level" + && ( + node.specifiers[0].type === 'ImportDefaultSpecifier' + // namespace imports are both "inline" and "top-level" + || node.specifiers[0].type === 'ImportNamespaceSpecifier')) + + { + return; + } + + context.report({ + node: node, + message: 'Prefer using inline {{kind}} specifiers instead of a top-level {{kind}}-only import.', + data: { + kind: node.importKind }, + + fix: function () {function fix(fixer) { + var kindToken = sourceCode.getFirstToken(node, { skip: 1 }); + + return [].concat( + kindToken ? fixer.remove(kindToken) : [], + node.specifiers.map(function (specifier) {return fixer.insertTextBefore(specifier, String(node.importKind) + ' ');})); + + }return fix;}() }); + + }return ImportDeclaration;}() }; + + } + + // prefer-top-level + return { + /** @param {import('estree').ImportDeclaration} node */ + ImportDeclaration: function () {function ImportDeclaration(node) { + if ( + // already top-level is valid + node.importKind === 'type' || + node.importKind === 'typeof' + // no specifiers (import {} from '') cannot have inline - so is valid + || node.specifiers.length === 0 || + node.specifiers.length === 1 + // default imports are both "inline" and "top-level" + && ( + node.specifiers[0].type === 'ImportDefaultSpecifier' + // namespace imports are both "inline" and "top-level" + || node.specifiers[0].type === 'ImportNamespaceSpecifier')) + + { + return; + } + + /** @type {typeof node.specifiers} */ + var typeSpecifiers = []; + /** @type {typeof node.specifiers} */ + var typeofSpecifiers = []; + /** @type {typeof node.specifiers} */ + var valueSpecifiers = []; + /** @type {typeof node.specifiers[number]} */ + var defaultSpecifier = null;var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try { + for (var _iterator2 = node.specifiers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var specifier = _step2.value; + if (specifier.type === 'ImportDefaultSpecifier') { + defaultSpecifier = specifier; + continue; + } + + if (specifier.importKind === 'type') { + typeSpecifiers.push(specifier); + } else if (specifier.importKind === 'typeof') { + typeofSpecifiers.push(specifier); + } else if (specifier.importKind === 'value' || specifier.importKind == null) { + valueSpecifiers.push(specifier); + } + }} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}} + + var typeImport = getImportText(node, sourceCode, typeSpecifiers, 'type'); + var typeofImport = getImportText(node, sourceCode, typeofSpecifiers, 'typeof'); + var newImports = (String(typeImport) + '\n' + String(typeofImport)).trim(); + + if (typeSpecifiers.length + typeofSpecifiers.length === node.specifiers.length) { + /** @type {('type' | 'typeof')[]} */ + // all specifiers have inline specifiers - so we replace the entire import + var kind = [].concat( + typeSpecifiers.length > 0 ? 'type' : [], + typeofSpecifiers.length > 0 ? 'typeof' : []); + + + context.report({ + node: node, + message: 'Prefer using a top-level {{kind}}-only import instead of inline {{kind}} specifiers.', + data: { + kind: kind.join('/') }, + + fix: function () {function fix(fixer) { + return fixer.replaceText(node, newImports); + }return fix;}() }); + + } else { + // remove specific specifiers and insert new imports for them + typeSpecifiers.concat(typeofSpecifiers).forEach(function (specifier) { + context.report({ + node: specifier, + message: 'Prefer using a top-level {{kind}}-only import instead of inline {{kind}} specifiers.', + data: { + kind: specifier.importKind }, + + fix: function () {function fix(fixer) { + /** @type {import('eslint').Rule.Fix[]} */ + var fixes = []; + + // if there are no value specifiers, then the other report fixer will be called, not this one + + if (valueSpecifiers.length > 0) { + // import { Value, type Type } from 'mod'; + + // we can just remove the type specifiers + removeSpecifiers(fixes, fixer, sourceCode, typeSpecifiers); + removeSpecifiers(fixes, fixer, sourceCode, typeofSpecifiers); + + // make the import nicely formatted by also removing the trailing comma after the last value import + // eg + // import { Value, type Type } from 'mod'; + // to + // import { Value } from 'mod'; + // not + // import { Value, } from 'mod'; + var maybeComma = sourceCode.getTokenAfter(valueSpecifiers[valueSpecifiers.length - 1]); + if (isComma(maybeComma)) { + fixes.push(fixer.remove(maybeComma)); + } + } else if (defaultSpecifier) { + // import Default, { type Type } from 'mod'; + + // remove the entire curly block so we don't leave an empty one behind + // NOTE - the default specifier *must* be the first specifier always! + // so a comma exists that we also have to clean up or else it's bad syntax + var comma = sourceCode.getTokenAfter(defaultSpecifier, isComma); + var closingBrace = sourceCode.getTokenAfter( + node.specifiers[node.specifiers.length - 1], + function (token) {return token.type === 'Punctuator' && token.value === '}';}); + + fixes.push(fixer.removeRange([ + comma.range[0], + closingBrace.range[1]])); + + } + + return fixes.concat( + // insert the new imports after the old declaration + fixer.insertTextAfter(node, '\n' + String(newImports))); + + }return fix;}() }); + + }); + } + }return ImportDeclaration;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9jb25zaXN0ZW50LXR5cGUtc3BlY2lmaWVyLXN0eWxlLmpzIl0sIm5hbWVzIjpbImlzQ29tbWEiLCJ0b2tlbiIsInR5cGUiLCJ2YWx1ZSIsInJlbW92ZVNwZWNpZmllcnMiLCJmaXhlcyIsImZpeGVyIiwic291cmNlQ29kZSIsInNwZWNpZmllcnMiLCJzcGVjaWZpZXIiLCJnZXRUb2tlbkFmdGVyIiwicHVzaCIsInJlbW92ZSIsImdldEltcG9ydFRleHQiLCJub2RlIiwia2luZCIsInNvdXJjZVN0cmluZyIsImdldFRleHQiLCJzb3VyY2UiLCJsZW5ndGgiLCJuYW1lcyIsIm1hcCIsInMiLCJpbXBvcnRlZCIsIm5hbWUiLCJsb2NhbCIsImpvaW4iLCJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwiZml4YWJsZSIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJvcHRpb25zIiwiSW1wb3J0RGVjbGFyYXRpb24iLCJpbXBvcnRLaW5kIiwicmVwb3J0IiwibWVzc2FnZSIsImRhdGEiLCJmaXgiLCJraW5kVG9rZW4iLCJn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ZW50LXR5cGUtc3BlY2lmaWVyLXN0eWxlJyksXG4gICAgfSxcbiAgICBmaXhhYmxlOiAnY29kZScsXG4gICAgc2NoZW1hOiBbXG4gICAgICB7XG4gICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICBlbnVtOiBbJ3ByZWZlci1pbmxpbmUnLCAncHJlZmVyLXRvcC1sZXZlbCddLFxuICAgICAgICBkZWZhdWx0OiAncHJlZmVyLWlubGluZScsXG4gICAgICB9LFxuICAgIF0sXG4gIH0sXG5cbiAgY3JlYXRlKGNvbnRleHQpIHtcbiAgICBjb25zdCBzb3VyY2VDb2RlID0gZ2V0U291cmNlQ29kZShjb250ZXh0KTtcblxuICAgIGlmIChjb250ZXh0Lm9wdGlvbnNbMF0gPT09ICdwcmVmZXItaW5saW5lJykge1xuICAgICAgcmV0dXJuIHtcbiAgICAgICAgSW1wb3J0RGVjbGFyYXRpb24obm9kZSkge1xuICAgICAgICAgIGlmIChub2RlLmltcG9ydEtpbmQgPT09ICd2YWx1ZScgfHwgbm9kZS5pbXBvcnRLaW5kID09IG51bGwpIHtcbiAgICAgICAgICAgIC8vIHRvcC1sZXZlbCB2YWx1ZSAvIHVua25vd24gaXMgdmFsaWRcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAvLyBubyBzcGVjaWZpZXJzIChpbXBvcnQgdHlwZSB7fSBmcm9tICcnKSBoYXZlIG5vIHNwZWNpZmllcnMgdG8gbWFyayBhcyBpbmxpbmVcbiAgICAgICAgICAgIG5vZGUuc3BlY2lmaWVycy5sZW5ndGggPT09IDBcbiAgICAgICAgICAgIHx8IG5vZGUuc3BlY2lmaWVycy5sZW5ndGggPT09IDFcbiAgICAgICAgICAgIC8vIGRlZmF1bHQgaW1wb3J0cyBhcmUgYm90aCBcImlubGluZVwiIGFuZCBcInRvcC1sZXZlbFwiXG4gICAgICAgICAgICAmJiAoXG4gICAgICAgICAgICAgIG5vZGUuc3BlY2lmaWVyc1swXS50eXBlID09PSAnSW1wb3J0RGVmYXVsdFNwZWNpZmllcidcbiAgICAgICAgICAgICAgLy8gbmFtZXNwYWNlIGltcG9ydHMgYXJlIGJvdGggXCJpbmxpbmVcIiBhbmQgXCJ0b3AtbGV2ZWxcIlxuICAgICAgICAgICAgICB8fCBub2RlLnNwZWNpZmllcnNbMF0udHlwZSA9PT0gJ0ltcG9ydE5hbWVzcGFjZVNwZWNpZmllcidcbiAgICAgICAgICAgIClcbiAgICAgICAgICApIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgbWVzc2FnZTogJ1ByZWZlciB1c2luZyBpbmxpbmUge3traW5kfX0gc3BlY2lmaWVycyBpbnN0ZWFkIG9mIGEgdG9wLWxldmVsIHt7a2luZH19LW9ubHkgaW1wb3J0LicsXG4gICAgICAgICAgICBkYXRhOiB7XG4gICAgICAgICAgICAgIGtpbmQ6IG5vZGUuaW1wb3J0S2luZCxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBmaXgoZml4ZXIpIHtcbiAgICAgICAgICAgICAgY29uc3Qga2luZFRva2VuID0gc291cmNlQ29kZS5nZXRGaXJzdFRva2VuKG5vZGUsIHsgc2tpcDogMSB9KTtcblxuICAgICAgICAgICAgICByZXR1cm4gW10uY29uY2F0KFxuICAgICAgICAgICAgICAgIGtpbmRUb2tlbiA/IGZpeGVyLnJlbW92ZShraW5kVG9rZW4pIDogW10sXG4gICAgICAgICAgICAgICAgbm9kZS5zcGVjaWZpZXJzLm1hcCgoc3BlY2lmaWVyKSA9PiBmaXhlci5pbnNlcnRUZXh0QmVmb3JlKHNwZWNpZmllciwgYCR7bm9kZS5pbXBvcnRLaW5kfSBgKSksXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0pO1xuIC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dXNoKHNwZWNpZmllcik7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgdHlwZUltcG9ydCA9IGdldEltcG9ydFRleHQobm9kZSwgc291cmNlQ29kZSwgdHlwZVNwZWNpZmllcnMsICd0eXBlJyk7XG4gICAgICAgIGNvbnN0IHR5cGVvZkltcG9ydCA9IGdldEltcG9ydFRleHQobm9kZSwgc291cmNlQ29kZSwgdHlwZW9mU3BlY2lmaWVycywgJ3R5cGVvZicpO1xuICAgICAgICBjb25zdCBuZXdJbXBvcnRzID0gYCR7dHlwZUltcG9ydH1cXG4ke3R5cGVvZkltcG9ydH1gLnRyaW0oKTtcblxuICAgICAgICBpZiAodHlwZVNwZWNpZmllcnMubGVuZ3RoICsgdHlwZW9mU3BlY2lmaWVycy5sZW5ndGggPT09IG5vZGUuc3BlY2lmaWVycy5sZW5ndGgpIHtcbiAgICAgICAgICAvKiogQHR5cGUgeygndHlwZScgfCAndHlwZW9mJylbXX0gKi9cbiAgICAgICAgICAvLyBhbGwgc3BlY2lmaWVycyBoYXZlIGlubGluZSBzcGVjaWZpZXJzIC0gc28gd2UgcmVwbGFjZSB0aGUgZW50aXJlIGltcG9ydFxuICAgICAgICAgIGNvbnN0IGtpbmQgPSBbXS5jb25jYXQoXG4gICAgICAgICAgICB0eXBlU3BlY2lmaWVycy5sZW5ndGggPiAwID8gJ3R5cGUnIDogW10sXG4gICAgICAgICAgICB0eXBlb2ZTcGVjaWZpZXJzLmxlbmd0aCA+IDAgPyAndHlwZW9mJyA6IFtdLFxuICAgICAgICAgICk7XG5cbiAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgbWVzc2FnZTogJ1ByZWZlciB1c2luZyBhIHRvcC1sZXZlbCB7e2tpbmR9fS1vbmx5IGltcG9ydCBpbnN0ZWFkIG9mIGlubGluZSB7e2tpbmR9fSBzcGVjaWZpZXJzLicsXG4gICAgICAgICAgICBkYXRhOiB7XG4gICAgICAgICAgICAgIGtpbmQ6IGtpbmQuam9pbignLycpLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZpeChmaXhlcikge1xuICAgICAgICAgICAgICByZXR1cm4gZml4ZXIucmVwbGFjZVRleHQobm9kZSwgbmV3SW1wb3J0cyk7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIHJlbW92ZSBzcGVjaWZpYyBzcGVjaWZpZXJzIGFuZCBpbnNlcnQgbmV3IGltcG9ydHMgZm9yIHRoZW1cbiAgICAgICAgICB0eXBlU3BlY2lmaWVycy5jb25jYXQodHlwZW9mU3BlY2lmaWVycykuZm9yRWFjaCgoc3BlY2lmaWVyKSA9PiB7XG4gICAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgICAgIG5vZGU6IHNwZWNpZmllcixcbiAgICAgICAgICAgICAgbWVzc2FnZTogJ1ByZWZlciB1c2luZyBhIHRvcC1sZXZlbCB7e2tpbmR9fS1vbmx5IGltcG9ydCBpbnN0ZWFkIG9mIGlubGluZSB7e2tpbmR9fSBzcGVjaWZpZXJzLicsXG4gICAgICAgICAgICAgIGRhdGE6IHtcbiAgICAgICAgICAgICAgICBraW5kOiBzcGVjaWZpZXIuaW1wb3J0S2luZCxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgZml4KGZpeGVyKSB7XG4gICAgICAgICAgICAgICAgLyoqIEB0eXBlIHtpbXBvcnQoJ2VzbGludCcpLlJ1bGUuRml4W119ICovXG4gICAgICAgICAgICAgICAgY29uc3QgZml4ZXMgPSBbXTtcblxuICAgICAgICAgICAgICAgIC8vIGlmIHRoZXJlIGFyZSBubyB2YWx1ZSBzcGVjaWZpZXJzLCB0aGVuIHRoZSBvdGhlciByZXBvcnQgZml4ZXIgd2lsbCBiZSBjYWxsZWQsIG5vdCB0aGlzIG9uZVxuXG4gICAgICAgICAgICAg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ZVJhbmdlKFtcbiAgICAgICAgICAgICAgICAgICAgY29tbWEucmFuZ2VbMF0sXG4gICAgICAgICAgICAgICAgICAgIGNsb3NpbmdCcmFjZS5yYW5nZVsxXSxcbiAgICAgICAgICAgICAgICAgIF0pKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gZml4ZXMuY29uY2F0KFxuICAgICAgICAgICAgICAgICAgLy8gaW5zZXJ0IHRoZSBuZXcgaW1wb3J0cyBhZnRlciB0aGUgb2xkIGRlY2xhcmF0aW9uXG4gICAgICAgICAgICAgICAgICBmaXhlci5pbnNlcnRUZXh0QWZ0ZXIobm9kZSwgYFxcbiR7bmV3SW1wb3J0c31gKSxcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/default.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/default.js new file mode 100644 index 0000000000000000000000000000000000000000..fbb4f6cbcbee42c2fc7f605bcf798b5c75eb8615 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/default.js @@ -0,0 +1,40 @@ +'use strict';var _builder = require('../exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Static analysis', + description: 'Ensure a default export is present, given a default import.', + url: (0, _docsUrl2['default'])('default') }, + + schema: [] }, + + + create: function () {function create(context) { + function checkDefault(specifierType, node) { + var defaultSpecifier = node.specifiers.find( + function (specifier) {return specifier.type === specifierType;}); + + + if (!defaultSpecifier) {return;} + var imports = _builder2['default'].get(node.source.value, context); + if (imports == null) {return;} + + if (imports.errors.length) { + imports.reportErrors(context, node); + } else if (imports.get('default') === undefined) { + context.report({ + node: defaultSpecifier, + message: 'No default export found in imported module "' + String(node.source.value) + '".' }); + + } + } + + return { + ImportDeclaration: checkDefault.bind(null, 'ImportDefaultSpecifier'), + ExportNamedDeclaration: checkDefault.bind(null, 'ExportDefaultSpecifier') }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsImNoZWNrRGVmYXVsdCIsInNwZWNpZmllclR5cGUiLCJub2RlIiwiZGVmYXVsdFNwZWNpZmllciIsInNwZWNpZmllcnMiLCJmaW5kIiwic3BlY2lmaWVyIiwiaW1wb3J0cyIsIkV4cG9ydE1hcEJ1aWxkZXIiLCJnZXQiLCJzb3VyY2UiLCJ2YWx1ZSIsImVycm9ycyIsImxlbmd0aCIsInJlcG9ydEVycm9ycyIsInVuZGVmaW5lZCIsInJlcG9ydCIsIm1lc3NhZ2UiLCJJbXBvcnREZWNsYXJhdGlvbiIsImJpbmQiLCJFeHBvcnROYW1lZERlY2xhcmF0aW9uIl0sIm1hcHBpbmdzIjoiYUFBQSwrQztBQUNBLHFDOztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTSxTQURGO0FBRUpDLFVBQU07QUFDSkMsZ0JBQVUsaUJBRE47QUFFSkMsbUJBQWEsNkRBRlQ7QUFHSkMsV0FBSywwQkFBUSxTQUFSLENBSEQsRUFGRjs7QUFPSk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dWx0JykgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgbm9kZTogZGVmYXVsdFNwZWNpZmllcixcbiAgICAgICAgICBtZXNzYWdlOiBgTm8gZGVmYXVsdCBleHBvcnQgZm91bmQgaW4gaW1wb3J0ZWQgbW9kdWxlIFwiJHtub2RlLnNvdXJjZS52YWx1ZX1cIi5gLFxuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgSW1wb3J0RGVjbGFyYXRpb246IGNoZWNrRGVmYXVsdC5iaW5kKG51bGwsICdJbXBvcnREZWZhdWx0U3BlY2lmaWVyJyksXG4gICAgICBFeHBvcnROYW1lZERlY2xhcmF0aW9uOiBjaGVja0RlZmF1bHQuYmluZChudWxsLCAnRXhwb3J0RGVmYXVsdFNwZWNpZmllcicpLFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/dynamic-import-chunkname.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/dynamic-import-chunkname.js new file mode 100644 index 0000000000000000000000000000000000000000..f79271a50c6cfc9bd70fcdb6770050b5c05112a5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/dynamic-import-chunkname.js @@ -0,0 +1,172 @@ +'use strict';var _contextCompat = require('eslint-module-utils/contextCompat'); +var _vm = require('vm');var _vm2 = _interopRequireDefault(_vm); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Enforce a leading comment with the webpackChunkName for dynamic imports.', + url: (0, _docsUrl2['default'])('dynamic-import-chunkname') }, + + schema: [{ + type: 'object', + properties: { + importFunctions: { + type: 'array', + uniqueItems: true, + items: { + type: 'string' } }, + + + allowEmpty: { + type: 'boolean' }, + + webpackChunknameFormat: { + type: 'string' } } }], + + + + hasSuggestions: true }, + + + create: function () {function create(context) { + var config = context.options[0];var _ref = + config || {},_ref$importFunctions = _ref.importFunctions,importFunctions = _ref$importFunctions === undefined ? [] : _ref$importFunctions,_ref$allowEmpty = _ref.allowEmpty,allowEmpty = _ref$allowEmpty === undefined ? false : _ref$allowEmpty;var _ref2 = + config || {},_ref2$webpackChunknam = _ref2.webpackChunknameFormat,webpackChunknameFormat = _ref2$webpackChunknam === undefined ? '([0-9a-zA-Z-_/.]|\\[(request|index)\\])+' : _ref2$webpackChunknam; + + var paddedCommentRegex = /^ (\S[\s\S]+\S) $/; + var commentStyleRegex = /^( ((webpackChunkName: .+)|((webpackPrefetch|webpackPreload): (true|false|-?[0-9]+))|(webpackIgnore: (true|false))|((webpackInclude|webpackExclude): \/.*\/)|(webpackMode: ["'](lazy|lazy-once|eager|weak)["'])|(webpackExports: (['"]\w+['"]|\[(['"]\w+['"], *)+(['"]\w+['"]*)\]))),?)+ $/; + var chunkSubstrFormat = 'webpackChunkName: ["\']' + String(webpackChunknameFormat) + '["\'],? '; + var chunkSubstrRegex = new RegExp(chunkSubstrFormat); + var eagerModeFormat = 'webpackMode: ["\']eager["\'],? '; + var eagerModeRegex = new RegExp(eagerModeFormat); + + function run(node, arg) { + var sourceCode = (0, _contextCompat.getSourceCode)(context); + var leadingComments = sourceCode.getCommentsBefore ? + sourceCode.getCommentsBefore(arg) // This method is available in ESLint >= 4. + : sourceCode.getComments(arg).leading; // This method is deprecated in ESLint 7. + + if ((!leadingComments || leadingComments.length === 0) && !allowEmpty) { + context.report({ + node: node, + message: 'dynamic imports require a leading comment with the webpack chunkname' }); + + return; + } + + var isChunknamePresent = false; + var isEagerModePresent = false;var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + + for (var _iterator = leadingComments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var comment = _step.value; + if (comment.type !== 'Block') { + context.report({ + node: node, + message: 'dynamic imports require a /* foo */ style comment, not a // foo comment' }); + + return; + } + + if (!paddedCommentRegex.test(comment.value)) { + context.report({ + node: node, + message: 'dynamic imports require a block comment padded with spaces - /* foo */' }); + + return; + } + + try { + // just like webpack itself does + _vm2['default'].runInNewContext('(function() {return {' + String(comment.value) + '}})()'); + } catch (error) { + context.report({ + node: node, + message: 'dynamic imports require a "webpack" comment with valid syntax' }); + + return; + } + + if (!commentStyleRegex.test(comment.value)) { + context.report({ + node: node, + message: 'dynamic imports require a "webpack" comment with valid syntax' }); + + + return; + } + + if (eagerModeRegex.test(comment.value)) { + isEagerModePresent = true; + } + + if (chunkSubstrRegex.test(comment.value)) { + isChunknamePresent = true; + } + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + + if (isChunknamePresent && isEagerModePresent) { + context.report({ + node: node, + message: 'dynamic imports using eager mode do not need a webpackChunkName', + suggest: [ + { + desc: 'Remove webpackChunkName', + fix: function () {function fix(fixer) {var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try { + for (var _iterator2 = leadingComments[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var _comment = _step2.value; + if (chunkSubstrRegex.test(_comment.value)) { + var replacement = _comment.value.replace(chunkSubstrRegex, '').trim().replace(/,$/, ''); + if (replacement === '') { + return fixer.remove(_comment); + } else { + return fixer.replaceText(_comment, '/* ' + String(replacement) + ' */'); + } + } + }} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}} + }return fix;}() }, + + { + desc: 'Remove webpackMode', + fix: function () {function fix(fixer) {var _iteratorNormalCompletion3 = true;var _didIteratorError3 = false;var _iteratorError3 = undefined;try { + for (var _iterator3 = leadingComments[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {var _comment2 = _step3.value; + if (eagerModeRegex.test(_comment2.value)) { + var replacement = _comment2.value.replace(eagerModeRegex, '').trim().replace(/,$/, ''); + if (replacement === '') { + return fixer.remove(_comment2); + } else { + return fixer.replaceText(_comment2, '/* ' + String(replacement) + ' */'); + } + } + }} catch (err) {_didIteratorError3 = true;_iteratorError3 = err;} finally {try {if (!_iteratorNormalCompletion3 && _iterator3['return']) {_iterator3['return']();}} finally {if (_didIteratorError3) {throw _iteratorError3;}}} + }return fix;}() }] }); + + + + } + + if (!isChunknamePresent && !allowEmpty && !isEagerModePresent) { + context.report({ + node: node, + message: 'dynamic imports require a leading comment in the form /*' + + chunkSubstrFormat + '*/' }); + + } + } + + return { + ImportExpression: function () {function ImportExpression(node) { + run(node, node.source); + }return ImportExpression;}(), + + CallExpression: function () {function CallExpression(node) { + if (node.callee.type !== 'Import' && importFunctions.indexOf(node.callee.name) < 0) { + return; + } + + run(node, node.arguments[0]); + }return CallExpression;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9keW5hbWljLWltcG9ydC1jaHVua25hbWUuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJzY2hlbWEiLCJwcm9wZXJ0aWVzIiwiaW1wb3J0RnVuY3Rpb25zIiwidW5pcXVlSXRlbXMiLCJpdGVtcyIsImFsbG93RW1wdHkiLCJ3ZWJwYWNrQ2h1bmtuYW1lRm9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O1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIGxldCBpc0NodW5rbmFtZVByZXNlbnQgPSBmYWxzZTtcbiAgICAgIGxldCBpc0VhZ2VyTW9kZVByZXNlbnQgPSBmYWxzZTtcblxuICAgICAgZm9yIChjb25zdCBjb21tZW50IG9mIGxlYWRpbmdDb21tZW50cykge1xuICAgICAgICBpZiAoY29tbWVudC50eXBlICE9PSAnQmxvY2snKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgIG1lc3NhZ2U6ICdkeW5hbWljIGltcG9ydHMgcmVxdWlyZSBhIC8qIGZvbyAqLyBzdHlsZSBjb21tZW50LCBub3QgYSAvLyBmb28gY29tbWVudCcsXG4gICAgICAgICAgfSk7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCFwYWRkZWRDb21tZW50UmVnZXgudGVzdChjb21tZW50LnZhbHVlKSkge1xuICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICBtZXNzYWdlOiBgZHluYW1pYyBpbXBvcnRzIHJlcXVpcmUgYSBibG9jayBjb21tZW50IHBhZGRlZCB3aXRoIHNwYWNlcyAtIC8qIGZvbyAqL2AsXG4gICAgICAgICAgfSk7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAvLyBqdXN0IGxpa2Ugd2VicGFjayBpdHNlbGYgZG9lc1xuICAgICAgICAgIHZtLnJ1bkluTmV3Q29udGV4dChgKGZ1bmN0aW9uKCkge3JldHVybiB7JHtjb21tZW50LnZhbHVlfX19KSgpYCk7XG4gICAgICAgIH0gY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgIG1lc3NhZ2U6IGBkeW5hbWljIGltcG9ydHMgcmVxdWlyZSBhIFwid2VicGFja1wiIGNvbW1lbnQgd2l0aCB2YWxpZCBzeW50YXhgLFxuICAgICAgICAgIH0pO1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghY29tbWVudFN0eWxlUmVnZXgudGVzdChjb21tZW50LnZhbHVlKSkge1xuICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICBtZXNzYWdlOlxuICAgICAgICAgICAgICBgZHluYW1pYyBpbXBvcnRzIHJlcXVpcmUgYSBcIndlYnBhY2tcIiBjb21tZW50IHdpdGggdmFsaWQgc3ludGF4YCxcbiAgICAgICAgICB9KTtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoZWFnZXJNb2RlUmVnZXgudGVzdChjb21tZW50LnZhbHVlKSkge1xuICAgICAgICAgIGlzRWFnZXJNb2RlUHJlc2VudCA9IHRydWU7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoY2h1bmtTdWJzdHJSZWdleC50ZXN0KGNvbW1lbnQudmFsdWUpKSB7XG4gICAgICAgICAgaXNDaHVua25hbWVQcmVzZW50ID0gdHJ1ZTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpZiAoaXNDaHVua25hbWVQcmVzZW50ICYmIGlzRWFnZXJNb2RlUHJlc2VudCkge1xuICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgbm9kZSxcbiAgICAgICAgICBtZXNzYWdlOiAnZHluYW1pYyBpbXBvcnRzIHVzaW5nIGVhZ2VyIG1vZGUgZG8gbm90IG5lZWQgYSB3ZWJwYWNrQ2h1bmtOYW1lJyxcbiAgICAgICAgICBzdWdnZXN0OiBbXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIGRlc2M6ICdSZW1vdmUgd2VicGFja0NodW5rTmFtZScsXG4gICAgICAgICAgICAgIGZpeChmaXhlcikge1xuICAgICAgICAgICAgICAgIGZvciAoY29uc3QgY29tbWVudCBvZiBsZWFkaW5nQ29tbWVudHMpIHtcbiAgICAgICAgICAgICAgICAgIGlmIChjaHVua1N1YnN0clJlZ2V4LnRlc3QoY29tbWVudC52YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcmVwbGFjZW1lbnQgPSBjb21tZW50LnZhbHVlLnJlcGxhY2UoY2h1bmtTdWJzdHJSZWdleCwgJycpLnRyaW0oKS5yZXBsYWNlKC8sJC8sICcnKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50ID09PSAnJykge1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmaXhlci5yZW1vdmUoY29tbWVudCk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZpeGVyLnJlcGxhY2VUZXh0KGNvbW1lbnQsIGAvKiAke3JlcGxhY2VtZW50fSAqL2ApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgZGVzYzogJ1JlbW92ZSB3ZWJwYWNrTW9kZScsXG4gICAgICAgICAgICAgIGZpeChmaXhlcikge1xuICAgICAgICAgICAgICAgIGZvciAoY29uc3QgY29tbWVudCBvZiBsZWFkaW5nQ29tbWVudHMpIHtcbiAgICAgICAgICAgICAgICAgIGlmIChlYWdlck1vZGVSZWdleC50ZXN0KGNvbW1lbnQudmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlcGxhY2VtZW50ID0gY29tbWVudC52YWx1ZS5yZXBsYWNlKGVhZ2VyTW9kZVJlZ2V4LCAnJykudHJpbSgpLnJlcGxhY2UoLywkLywgJycpO1xuICAgICAgICAgICAgICAgICAgICBpZiAocmVwbGFjZW1lbnQgPT09ICcnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZpeGVyLnJlbW92ZShjb21tZW50KTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZml4ZXIucmVwbGFjZVRleHQoY29tbWVudCwgYC8qICR7cmVwbGFjZW1lbnR9ICovYCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgIF0sXG4gICAgICAgIH0pO1xuICAgICAgfVxuXG4gICAgICBpZiAoIWlzQ2h1bmtuYW1lUHJlc2VudCAmJiAhYWxsb3dFbXB0eSAmJiAhaXNFYWdlck1vZGVQcmVzZW50KSB7XG4gICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICBub2RlLFxuICAgICAgICAgIG1lc3NhZ2U6XG4gICAgICAgICAgICBgZHluYW1pYyBpbXBvcnRzIHJlcXVpcmUgYSBsZWFkaW5nIGNvbW1lbnQgaW4gdGhlIGZvcm0gLyoke2NodW5rU3Vic3RyRm9ybWF0fSovYCxcbiAgICAgICAgfSk7XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIHtcbiAgICAgIEltcG9ydEV4cHJlc3Npb24obm9kZSkge1xuICAgICAgICBydW4obm9kZSwgbm9kZS5zb3VyY2UpO1xuICAgICAgfSxcblxuICAgICAgQ2FsbEV4cHJlc3Npb24obm9kZSkge1xuICAgICAgICBpZiAobm9kZS5jYWxsZWUudHlwZSAhPT0gJ0ltcG9ydCcgJiYgaW1wb3J0RnVuY3Rpb25zLmluZGV4T2Yobm9kZS5jYWxsZWUubmFtZSkgPCAwKSB7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgcnVuKG5vZGUsIG5vZGUuYXJndW1lbnRzWzBdKTtcbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/enforce-node-protocol-usage.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/enforce-node-protocol-usage.js new file mode 100644 index 0000000000000000000000000000000000000000..6cb45dcd6146eb318cccb93f1b96367326a976bf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/enforce-node-protocol-usage.js @@ -0,0 +1,147 @@ +'use strict';var _messages;function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;} + +var isCoreModule = require('is-core-module');var _require = +require('../docsUrl'),docsUrl = _require['default']; + +var DO_PREFER_MESSAGE_ID = 'requireNodeProtocol'; +var NEVER_PREFER_MESSAGE_ID = 'forbidNodeProtocol'; +var messages = (_messages = {}, _defineProperty(_messages, +DO_PREFER_MESSAGE_ID, 'Prefer `node:{{moduleName}}` over `{{moduleName}}`.'), _defineProperty(_messages, +NEVER_PREFER_MESSAGE_ID, 'Prefer `{{moduleName}}` over `node:{{moduleName}}`.'), _messages); + + +function replaceStringLiteral( +fixer, +node, +text, +relativeRangeStart, +relativeRangeEnd) +{ + var firstCharacterIndex = node.range[0] + 1; + var start = Number.isInteger(relativeRangeEnd) ? + relativeRangeStart + firstCharacterIndex : + firstCharacterIndex; + var end = Number.isInteger(relativeRangeEnd) ? + relativeRangeEnd + firstCharacterIndex : + node.range[1] - 1; + + return fixer.replaceTextRange([start, end], text); +} + +function isStringLiteral(node) { + return node && node.type === 'Literal' && typeof node.value === 'string'; +} + +function isStaticRequireWith1Param(node) { + return !node.optional && + node.callee.type === 'Identifier' && + node.callee.name === 'require' + // check for only 1 argument + && node.arguments.length === 1 && + node.arguments[0] && + isStringLiteral(node.arguments[0]); +} + +function checkAndReport(src, context) { + // TODO use src.quasis[0].value.raw + if (!src || src.type === 'TemplateLiteral') {return;} + var moduleName = 'value' in src ? src.value : src.name; + if (typeof moduleName !== 'string') {console.log(src, moduleName);}var + settings = context.settings; + var nodeVersion = settings && settings['import/node-version']; + if ( + typeof nodeVersion !== 'undefined' && ( + + typeof nodeVersion !== 'string' || + !/^[0-9]+\.[0-9]+\.[0-9]+$/.test(nodeVersion))) + + { + throw new TypeError('`import/node-version` setting must be a string in the format "10.23.45" (a semver version, with no leading zero)'); + } + + if (context.options[0] === 'never') { + if (!moduleName.startsWith('node:')) {return;} + + var actualModuleName = moduleName.slice(5); + if (!isCoreModule(actualModuleName, nodeVersion || undefined)) {return;} + + context.report({ + node: src, + message: messages[NEVER_PREFER_MESSAGE_ID], + data: { moduleName: actualModuleName }, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix: function () {function fix(fixer) { + return replaceStringLiteral(fixer, src, '', 0, 5); + }return fix;}() }); + + } else if (context.options[0] === 'always') { + if ( + moduleName.startsWith('node:') || + !isCoreModule(moduleName, nodeVersion || undefined) || + !isCoreModule('node:' + String(moduleName), nodeVersion || undefined)) + { + return; + } + + context.report({ + node: src, + message: messages[DO_PREFER_MESSAGE_ID], + data: { moduleName: moduleName }, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix: function () {function fix(fixer) { + return replaceStringLiteral(fixer, src, 'node:', 0, 0); + }return fix;}() }); + + } else if (typeof context.options[0] === 'undefined') { + throw new Error('Missing option'); + } else { + throw new Error('Unexpected option: ' + String(context.options[0])); + } +} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + meta: { + type: 'suggestion', + docs: { + description: 'Enforce either using, or omitting, the `node:` protocol when importing Node.js builtin modules.', + recommended: true, + category: 'Static analysis', + url: docsUrl('enforce-node-protocol-usage') }, + + fixable: 'code', + schema: { + type: 'array', + minItems: 1, + maxItems: 1, + items: [ + { + 'enum': ['always', 'never'] }] }, + + + + messages: messages }, + + create: function () {function create(context) { + return { + CallExpression: function () {function CallExpression(node) { + if (!isStaticRequireWith1Param(node)) {return;} + + var arg = node.arguments[0]; + + return checkAndReport(arg, context); + }return CallExpression;}(), + ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { + return checkAndReport(node.source, context); + }return ExportNamedDeclaration;}(), + ImportDeclaration: function () {function ImportDeclaration(node) { + return checkAndReport(node.source, context); + }return ImportDeclaration;}(), + ImportExpression: function () {function ImportExpression(node) { + if (!isStringLiteral(node.source)) {return;} + + return checkAndReport(node.source, context); + }return ImportExpression;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9lbmZvcmNlLW5vZGUtcHJvdG9jb2wtdXNhZ2UuanMiXSwibmFtZXMiOlsiaXNDb3JlTW9kdWxlIiwicmVxdWlyZSIsImRvY3NVcmwiLCJET19QUkVGRVJfTUVTU0FHRV9JRCIsIk5FVkVSX1BSRUZFUl9NRVNTQUdFX0lEIiwibWVzc2FnZXMiLCJyZXBsYWNlU3RyaW5nTGl0ZXJhbCIsImZpeGVyIiwibm9kZSIsInRleHQiLCJyZWxhdGl2ZVJhbmdlU3RhcnQiLCJyZWxhdGl2ZVJhbmdlRW5kIiwiZmlyc3RDaGFyYWN0ZXJJbmRleCIsInJhbmdlIiwic3RhcnQiLCJOdW1iZXIiLCJpc0ludGVnZXIiLCJlbmQiLCJyZXBsYWNlVGV4dFJhbmdlIiwiaXNTdHJpbmdMaXRlcmFsIiwidHlwZSIsInZhbHVlIiwiaXNTdGF0aWNSZXF1aXJlV2l0aDFQYXJhbSIsIm9wdGlvbmFsIiwiY2FsbGVlIiwibmFtZSIsImFyZ3VtZW50cyIsImxlbmd0aCIsImNoZWNrQW5kUmVwb3J0Iiwic3JjIiwiY29udGV4dCIsIm1vZHVsZU5hbWUiLCJjb25zb2xlIiwib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BjaGVja0FuZFJlcG9ydChhcmcsIGNvbnRleHQpO1xuICAgICAgfSxcbiAgICAgIEV4cG9ydE5hbWVkRGVjbGFyYXRpb24obm9kZSkge1xuICAgICAgICByZXR1cm4gY2hlY2tBbmRSZXBvcnQobm9kZS5zb3VyY2UsIGNvbnRleHQpO1xuICAgICAgfSxcbiAgICAgIEltcG9ydERlY2xhcmF0aW9uKG5vZGUpIHtcbiAgICAgICAgcmV0dXJuIGNoZWNrQW5kUmVwb3J0KG5vZGUuc291cmNlLCBjb250ZXh0KTtcbiAgICAgIH0sXG4gICAgICBJbXBvcnRFeHByZXNzaW9uKG5vZGUpIHtcbiAgICAgICAgaWYgKCFpc1N0cmluZ0xpdGVyYWwobm9kZS5zb3VyY2UpKSB7IHJldHVybjsgfVxuXG4gICAgICAgIHJldHVybiBjaGVja0FuZFJlcG9ydChub2RlLnNvdXJjZSwgY29udGV4dCk7XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/export.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/export.js new file mode 100644 index 0000000000000000000000000000000000000000..1c045d372e1f401e10835a4b1e575ab183f522e5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/export.js @@ -0,0 +1,235 @@ +'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _builder = require('../exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _patternCapture = require('../exportMap/patternCapture');var _patternCapture2 = _interopRequireDefault(_patternCapture); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl); +var _arrayIncludes = require('array-includes');var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +/* + Notes on TypeScript namespaces aka TSModuleDeclaration: + + There are two forms: + - active namespaces: namespace Foo {} / module Foo {} + - ambient modules; declare module "eslint-plugin-import" {} + + active namespaces: + - cannot contain a default export + - cannot contain an export all + - cannot contain a multi name export (export { a, b }) + - can have active namespaces nested within them + + ambient namespaces: + - can only be defined in .d.ts files + - cannot be nested within active namespaces + - have no other restrictions + */ + +var rootProgram = 'root'; +var tsTypePrefix = 'type:'; + +/** + * remove function overloads like: + * ```ts + * export function foo(a: number); + * export function foo(a: string); + * ``` + * @param {Set} nodes + */ +function removeTypescriptFunctionOverloads(nodes) { + nodes.forEach(function (node) { + var declType = node.type === 'ExportDefaultDeclaration' ? node.declaration.type : node.parent.type; + if ( + // eslint 6+ + declType === 'TSDeclareFunction' + // eslint 4-5 + || declType === 'TSEmptyBodyFunctionDeclaration') + { + nodes['delete'](node); + } + }); +} + +/** + * Detect merging Namespaces with Classes, Functions, or Enums like: + * ```ts + * export class Foo { } + * export namespace Foo { } + * ``` + * @param {Set} nodes + * @returns {boolean} + */ +function isTypescriptNamespaceMerging(nodes) { + var types = new Set(Array.from(nodes, function (node) {return node.parent.type;})); + var noNamespaceNodes = Array.from(nodes).filter(function (node) {return node.parent.type !== 'TSModuleDeclaration';}); + + return types.has('TSModuleDeclaration') && ( + + types.size === 1 + // Merging with functions + || types.size === 2 && (types.has('FunctionDeclaration') || types.has('TSDeclareFunction')) || + types.size === 3 && types.has('FunctionDeclaration') && types.has('TSDeclareFunction') + // Merging with classes or enums + || types.size === 2 && (types.has('ClassDeclaration') || types.has('TSEnumDeclaration')) && noNamespaceNodes.length === 1); + +} + +/** + * Detect if a typescript namespace node should be reported as multiple export: + * ```ts + * export class Foo { } + * export function Foo(); + * export namespace Foo { } + * ``` + * @param {Object} node + * @param {Set} nodes + * @returns {boolean} + */ +function shouldSkipTypescriptNamespace(node, nodes) { + var types = new Set(Array.from(nodes, function (node) {return node.parent.type;})); + + return !isTypescriptNamespaceMerging(nodes) && + node.parent.type === 'TSModuleDeclaration' && ( + + types.has('TSEnumDeclaration') || + types.has('ClassDeclaration') || + types.has('FunctionDeclaration') || + types.has('TSDeclareFunction')); + +} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Helpful warnings', + description: 'Forbid any invalid exports, i.e. re-export of the same name.', + url: (0, _docsUrl2['default'])('export') }, + + schema: [] }, + + + create: function () {function create(context) { + var namespace = new Map([[rootProgram, new Map()]]); + + function addNamed(name, node, parent, isType) { + if (!namespace.has(parent)) { + namespace.set(parent, new Map()); + } + var named = namespace.get(parent); + + var key = isType ? '' + tsTypePrefix + String(name) : name; + var nodes = named.get(key); + + if (nodes == null) { + nodes = new Set(); + named.set(key, nodes); + } + + nodes.add(node); + } + + function getParent(node) { + if (node.parent && node.parent.type === 'TSModuleBlock') { + return node.parent.parent; + } + + // just in case somehow a non-ts namespace export declaration isn't directly + // parented to the root Program node + return rootProgram; + } + + return { + ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) { + addNamed('default', node, getParent(node)); + }return ExportDefaultDeclaration;}(), + + ExportSpecifier: function () {function ExportSpecifier(node) { + addNamed( + node.exported.name || node.exported.value, + node.exported, + getParent(node.parent)); + + }return ExportSpecifier;}(), + + ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { + if (node.declaration == null) {return;} + + var parent = getParent(node); + // support for old TypeScript versions + var isTypeVariableDecl = node.declaration.kind === 'type'; + + if (node.declaration.id != null) { + if ((0, _arrayIncludes2['default'])([ + 'TSTypeAliasDeclaration', + 'TSInterfaceDeclaration'], + node.declaration.type)) { + addNamed(node.declaration.id.name, node.declaration.id, parent, true); + } else { + addNamed(node.declaration.id.name, node.declaration.id, parent, isTypeVariableDecl); + } + } + + if (node.declaration.declarations != null) {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = node.declaration.declarations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var declaration = _step.value; + (0, _patternCapture2['default'])(declaration.id, function (v) {addNamed(v.name, v, parent, isTypeVariableDecl);}); + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + } + }return ExportNamedDeclaration;}(), + + ExportAllDeclaration: function () {function ExportAllDeclaration(node) { + if (node.source == null) {return;} // not sure if this is ever true + + // `export * as X from 'path'` does not conflict + if (node.exported && node.exported.name) {return;} + + var remoteExports = _builder2['default'].get(node.source.value, context); + if (remoteExports == null) {return;} + + if (remoteExports.errors.length) { + remoteExports.reportErrors(context, node); + return; + } + + var parent = getParent(node); + + var any = false; + remoteExports.forEach(function (v, name) { + if (name !== 'default') { + any = true; // poor man's filter + addNamed(name, node, parent); + } + }); + + if (!any) { + context.report( + node.source, 'No named exports found in module \'' + String( + node.source.value) + '\'.'); + + } + }return ExportAllDeclaration;}(), + + 'Program:exit': function () {function ProgramExit() {var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try { + for (var _iterator2 = namespace[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var _ref = _step2.value;var _ref2 = _slicedToArray(_ref, 2);var named = _ref2[1];var _iteratorNormalCompletion3 = true;var _didIteratorError3 = false;var _iteratorError3 = undefined;try { + for (var _iterator3 = named[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {var _ref3 = _step3.value;var _ref4 = _slicedToArray(_ref3, 2);var name = _ref4[0];var nodes = _ref4[1]; + removeTypescriptFunctionOverloads(nodes); + + if (nodes.size <= 1) {continue;} + + if (isTypescriptNamespaceMerging(nodes)) {continue;}var _iteratorNormalCompletion4 = true;var _didIteratorError4 = false;var _iteratorError4 = undefined;try { + + for (var _iterator4 = nodes[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {var node = _step4.value; + if (shouldSkipTypescriptNamespace(node, nodes)) {continue;} + + if (name === 'default') { + context.report(node, 'Multiple default exports.'); + } else { + context.report( + node, 'Multiple exports of name \'' + String( + name.replace(tsTypePrefix, '')) + '\'.'); + + } + }} catch (err) {_didIteratorError4 = true;_iteratorError4 = err;} finally {try {if (!_iteratorNormalCompletion4 && _iterator4['return']) {_iterator4['return']();}} finally {if (_didIteratorError4) {throw _iteratorError4;}}} + }} catch (err) {_didIteratorError3 = true;_iteratorError3 = err;} finally {try {if (!_iteratorNormalCompletion3 && _iterator3['return']) {_iterator3['return']();}} finally {if (_didIteratorError3) {throw _iteratorError3;}}} + }} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}} + }return ProgramExit;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9leHBvcnQuanMiXSwibmFtZXMiOlsicm9vdFByb2dyYW0iLCJ0c1R5cGVQcmVmaXgiLCJyZW1vdmVUeXBlc2NyaXB0RnVuY3Rpb25PdmVybG9hZHMiLCJub2RlcyIsImZvckVhY2giLCJub2RlIiwiZGVjbFR5cGUiLCJ0eXBlIiwiZGVjbGFyYXRpb24iLCJwYXJlbnQiLCJpc1R5cGVzY3JpcHROYW1lc3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1vdGVFeHBvcnRzLnJlcG9ydEVycm9ycyhjb250ZXh0LCBub2RlKTtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCBwYXJlbnQgPSBnZXRQYXJlbnQobm9kZSk7XG5cbiAgICAgICAgbGV0IGFueSA9IGZhbHNlO1xuICAgICAgICByZW1vdGVFeHBvcnRzLmZvckVhY2goKHYsIG5hbWUpID0+IHtcbiAgICAgICAgICBpZiAobmFtZSAhPT0gJ2RlZmF1bHQnKSB7XG4gICAgICAgICAgICBhbnkgPSB0cnVlOyAvLyBwb29yIG1hbidzIGZpbHRlclxuICAgICAgICAgICAgYWRkTmFtZWQobmFtZSwgbm9kZSwgcGFyZW50KTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmICghYW55KSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoXG4gICAgICAgICAgICBub2RlLnNvdXJjZSxcbiAgICAgICAgICAgIGBObyBuYW1lZCBleHBvcnRzIGZvdW5kIGluIG1vZHVsZSAnJHtub2RlLnNvdXJjZS52YWx1ZX0nLmAsXG4gICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgICAgfSxcblxuICAgICAgJ1Byb2dyYW06ZXhpdCcoKSB7XG4gICAgICAgIGZvciAoY29uc3QgWywgbmFtZWRdIG9mIG5hbWVzcGFjZSkge1xuICAgICAgICAgIGZvciAoY29uc3QgW25hbWUsIG5vZGVzXSBvZiBuYW1lZCkge1xuICAgICAgICAgICAgcmVtb3ZlVHlwZXNjcmlwdEZ1bmN0aW9uT3ZlcmxvYWRzKG5vZGVzKTtcblxuICAgICAgICAgICAgaWYgKG5vZGVzLnNpemUgPD0gMSkgeyBjb250aW51ZTsgfVxuXG4gICAgICAgICAgICBpZiAoaXNUeXBlc2NyaXB0TmFtZXNwYWNlTWVyZ2luZyhub2RlcykpIHsgY29udGludWU7IH1cblxuICAgICAgICAgICAgZm9yIChjb25zdCBub2RlIG9mIG5vZGVzKSB7XG4gICAgICAgICAgICAgIGlmIChzaG91bGRTa2lwVHlwZXNjcmlwdE5hbWVzcGFjZShub2RlLCBub2RlcykpIHsgY29udGludWU7IH1cblxuICAgICAgICAgICAgICBpZiAobmFtZSA9PT0gJ2RlZmF1bHQnKSB7XG4gICAgICAgICAgICAgICAgY29udGV4dC5yZXBvcnQobm9kZSwgJ011bHRpcGxlIGRlZmF1bHQgZXhwb3J0cy4nKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0LnJlcG9ydChcbiAgICAgICAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICAgICAgICBgTXVsdGlwbGUgZXhwb3J0cyBvZiBuYW1lICcke25hbWUucmVwbGFjZSh0c1R5cGVQcmVmaXgsICcnKX0nLmAsXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/exports-last.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/exports-last.js new file mode 100644 index 0000000000000000000000000000000000000000..de4a2ebdff03909ffc1fffcd52a0777d0f6dcead --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/exports-last.js @@ -0,0 +1,40 @@ +'use strict';var _arrayPrototype = require('array.prototype.findlastindex');var _arrayPrototype2 = _interopRequireDefault(_arrayPrototype); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function isNonExportStatement(_ref) {var type = _ref.type; + return type !== 'ExportDefaultDeclaration' && + type !== 'ExportNamedDeclaration' && + type !== 'ExportAllDeclaration'; +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Ensure all exports appear after other statements.', + url: (0, _docsUrl2['default'])('exports-last') }, + + schema: [] }, + + + create: function () {function create(context) { + return { + Program: function () {function Program(_ref2) {var body = _ref2.body; + var lastNonExportStatementIndex = (0, _arrayPrototype2['default'])(body, isNonExportStatement); + + if (lastNonExportStatementIndex !== -1) { + body.slice(0, lastNonExportStatementIndex).forEach(function (node) { + if (!isNonExportStatement(node)) { + context.report({ + node: node, + message: 'Export statements should appear at the end of the file' }); + + } + }); + } + }return Program;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9leHBvcnRzLWxhc3QuanMiXSwibmFtZXMiOlsiaXNOb25FeHBvcnRTdGF0ZW1lbnQiLCJ0eXBlIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJkb2NzIiwiY2F0ZWdvcnkiLCJkZXNjcmlwdGlvbiIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJQcm9ncmFtIiwiYm9keSIsImxhc3ROb25FeHBvcnRTdGF0ZW1lbnRJbmRleCIsInNsaWNlIiwiZm9yRWFjaCIsIm5vZGUiLCJyZXBvcnQiLCJtZXNzYWdlIl0sIm1hcHBpbmdzIjoiYUFBQSwrRDs7QUFFQSxxQzs7QUFFQSxTQUFTQSxvQkFBVCxPQUF3QyxLQUFSQyxJQUFRLFFBQVJBLElBQVE7QUFDdEMsU0FBT0EsU0FBUywwQkFBVDtBQUNGQSxXQUFTLHdCQURQO0FBRUZBLFdBQVMsc0JBRmQ7QUFHRDs7QUFFREMsT0FBT0MsT0FBUCxHQUFpQjtBQUNmQyxRQUFNO0FBQ0pILFVBQU0sWUFERjtBQUVKSSxVQUFNO0FBQ0pDLGdCQUFVLGFBRE47QUFFSkMsbUJBQWEsbURBRlQ7QUFHSkMsV0FBSyww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1ldGE6IHtcbiAgICB0eXBlOiAnc3VnZ2VzdGlvbicsXG4gICAgZG9jczoge1xuICAgICAgY2F0ZWdvcnk6ICdTdHlsZSBndWlkZScsXG4gICAgICBkZXNjcmlwdGlvbjogJ0Vuc3VyZSBhbGwgZXhwb3J0cyBhcHBlYXIgYWZ0ZXIgb3RoZXIgc3RhdGVtZW50cy4nLFxuICAgICAgdXJsOiBkb2NzVXJsKCdleHBvcnRzLWxhc3QnKSxcbiAgICB9LFxuICAgIHNjaGVtYTogW10sXG4gIH0sXG5cbiAgY3JlYXRlKGNvbnRleHQpIHtcbiAgICByZXR1cm4ge1xuICAgICAgUHJvZ3JhbSh7IGJvZHkgfSkge1xuICAgICAgICBjb25zdCBsYXN0Tm9uRXhwb3J0U3RhdGVtZW50SW5kZXggPSBmaW5kTGFzdEluZGV4KGJvZHksIGlzTm9uRXhwb3J0U3RhdGVtZW50KTtcblxuICAgICAgICBpZiAobGFzdE5vbkV4cG9ydFN0YXRlbWVudEluZGV4ICE9PSAtMSkge1xuICAgICAgICAgIGJvZHkuc2xpY2UoMCwgbGFzdE5vbkV4cG9ydFN0YXRlbWVudEluZGV4KS5mb3JFYWNoKChub2RlKSA9PiB7XG4gICAgICAgICAgICBpZiAoIWlzTm9uRXhwb3J0U3RhdGVtZW50KG5vZGUpKSB7XG4gICAgICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdFeHBvcnQgc3RhdGVtZW50cyBzaG91bGQgYXBwZWFyIGF0IHRoZSBlbmQgb2YgdGhlIGZpbGUnLFxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/extensions.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/extensions.js new file mode 100644 index 0000000000000000000000000000000000000000..54e60e1094fd3e6dcae5d789f502984b76248e79 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/extensions.js @@ -0,0 +1,242 @@ +'use strict';var _path = require('path');var _path2 = _interopRequireDefault(_path); + +var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _importType = require('../core/importType'); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +var enumValues = { 'enum': ['always', 'ignorePackages', 'never'] }; +var patternProperties = { + type: 'object', + patternProperties: { '.*': enumValues } }; + +var properties = { + type: 'object', + properties: { + pattern: patternProperties, + checkTypeImports: { type: 'boolean' }, + ignorePackages: { type: 'boolean' }, + pathGroupOverrides: { + type: 'array', + items: { + type: 'object', + properties: { + pattern: { + type: 'string' }, + + patternOptions: { + type: 'object' }, + + action: { + type: 'string', + 'enum': ['enforce', 'ignore'] } }, + + + additionalProperties: false, + required: ['pattern', 'action'] } } } }; + + + + + +function buildProperties(context) { + + var result = { + defaultConfig: 'never', + pattern: {}, + ignorePackages: false }; + + + context.options.forEach(function (obj) { + + // If this is a string, set defaultConfig to its value + if (typeof obj === 'string') { + result.defaultConfig = obj; + return; + } + + // If this is not the new structure, transfer all props to result.pattern + if (obj.pattern === undefined && obj.ignorePackages === undefined && obj.checkTypeImports === undefined) { + Object.assign(result.pattern, obj); + return; + } + + // If pattern is provided, transfer all props + if (obj.pattern !== undefined) { + Object.assign(result.pattern, obj.pattern); + } + + // If ignorePackages is provided, transfer it to result + if (obj.ignorePackages !== undefined) { + result.ignorePackages = obj.ignorePackages; + } + + if (obj.checkTypeImports !== undefined) { + result.checkTypeImports = obj.checkTypeImports; + } + + if (obj.pathGroupOverrides !== undefined) { + result.pathGroupOverrides = obj.pathGroupOverrides; + } + }); + + if (result.defaultConfig === 'ignorePackages') { + result.defaultConfig = 'always'; + result.ignorePackages = true; + } + + return result; +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Ensure consistent use of file extension within the import path.', + url: (0, _docsUrl2['default'])('extensions') }, + + + schema: { + anyOf: [ + { + type: 'array', + items: [enumValues], + additionalItems: false }, + + { + type: 'array', + items: [ + enumValues, + properties], + + additionalItems: false }, + + { + type: 'array', + items: [properties], + additionalItems: false }, + + { + type: 'array', + items: [patternProperties], + additionalItems: false }, + + { + type: 'array', + items: [ + enumValues, + patternProperties], + + additionalItems: false }] } }, + + + + + + create: function () {function create(context) { + + var props = buildProperties(context); + + function getModifier(extension) { + return props.pattern[extension] || props.defaultConfig; + } + + function isUseOfExtensionRequired(extension, isPackage) { + return getModifier(extension) === 'always' && (!props.ignorePackages || !isPackage); + } + + function isUseOfExtensionForbidden(extension) { + return getModifier(extension) === 'never'; + } + + function isResolvableWithoutExtension(file) { + var extension = _path2['default'].extname(file); + var fileWithoutExtension = file.slice(0, -extension.length); + var resolvedFileWithoutExtension = (0, _resolve2['default'])(fileWithoutExtension, context); + + return resolvedFileWithoutExtension === (0, _resolve2['default'])(file, context); + } + + function isExternalRootModule(file) { + if (file === '.' || file === '..') {return false;} + var slashCount = file.split('/').length - 1; + + if (slashCount === 0) {return true;} + if ((0, _importType.isScoped)(file) && slashCount <= 1) {return true;} + return false; + } + + function computeOverrideAction(pathGroupOverrides, path) { + for (var i = 0, l = pathGroupOverrides.length; i < l; i++) {var _pathGroupOverrides$i = + pathGroupOverrides[i],pattern = _pathGroupOverrides$i.pattern,patternOptions = _pathGroupOverrides$i.patternOptions,action = _pathGroupOverrides$i.action; + if ((0, _minimatch2['default'])(path, pattern, patternOptions || { nocomment: true })) { + return action; + } + } + } + + function checkFileExtension(source, node) { + // bail if the declaration doesn't have a source, e.g. "export { foo };", or if it's only partially typed like in an editor + if (!source || !source.value) {return;} + + var importPathWithQueryString = source.value; + + // If not undefined, the user decided if rules are enforced on this import + var overrideAction = computeOverrideAction( + props.pathGroupOverrides || [], + importPathWithQueryString); + + + if (overrideAction === 'ignore') { + return; + } + + // don't enforce anything on builtins + if (!overrideAction && (0, _importType.isBuiltIn)(importPathWithQueryString, context.settings)) {return;} + + var importPath = importPathWithQueryString.replace(/\?(.*)$/, ''); + + // don't enforce in root external packages as they may have names with `.js`. + // Like `import Decimal from decimal.js`) + if (!overrideAction && isExternalRootModule(importPath)) {return;} + + var resolvedPath = (0, _resolve2['default'])(importPath, context); + + // get extension from resolved path, if possible. + // for unresolved, use source value. + var extension = _path2['default'].extname(resolvedPath || importPath).substring(1); + + // determine if this is a module + var isPackage = (0, _importType.isExternalModule)( + importPath, + (0, _resolve2['default'])(importPath, context), + context) || + (0, _importType.isScoped)(importPath); + + if (!extension || !importPath.endsWith('.' + String(extension))) { + // ignore type-only imports and exports + if (!props.checkTypeImports && (node.importKind === 'type' || node.exportKind === 'type')) {return;} + var extensionRequired = isUseOfExtensionRequired(extension, !overrideAction && isPackage); + var extensionForbidden = isUseOfExtensionForbidden(extension); + if (extensionRequired && !extensionForbidden) { + context.report({ + node: source, + message: 'Missing file extension ' + ( + extension ? '"' + String(extension) + '" ' : '') + 'for "' + String(importPathWithQueryString) + '"' }); + + } + } else if (extension) { + if (isUseOfExtensionForbidden(extension) && isResolvableWithoutExtension(importPath)) { + context.report({ + node: source, + message: 'Unexpected use of file extension "' + String(extension) + '" for "' + String(importPathWithQueryString) + '"' }); + + } + } + } + + return (0, _moduleVisitor2['default'])(checkFileExtension, { commonjs: true }); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9leHRlbnN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ZGRpdGlvbmFsSXRlbXM6IGZhbHNlLFxuICAgICAgICB9LFxuICAgICAgICB7XG4gICAgICAgICAgdHlwZTogJ2FycmF5JyxcbiAgICAgICAgICBpdGVtczogW1xuICAgICAgICAgICAgZW51bVZhbHVlcyxcbiAgICAgICAgICAgIHByb3BlcnRpZXMsXG4gICAgICAgICAgXSxcbiAgICAgICAgICBhZGRpdGlvbmFsSXRlbXM6IGZhbHNlLFxuICAgICAgICB9LFxuICAgICAgICB7XG4gICAgICAgICAgdHlwZTogJ2FycmF5JyxcbiAgICAgICAgICBpdGVtczogW3Byb3BlcnRpZXNdLFxuICAgICAgICAgIGFkZGl0aW9uYWxJdGVtczogZmFsc2UsXG4gICAgICAgIH0sXG4gICAgICAgIHtcbiAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgIGl0ZW1zOiBbcGF0dGVyblByb3BlcnRpZXNdLFxuICAgICAgICAgIGFkZGl0aW9uYWxJdGVtczogZmFsc2UsXG4gICAgICAgIH0sXG4gICAgICAgIHtcbiAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgIGl0ZW1zOiBbXG4gICAgICAgICAgICBlbnVtVmFsdWVzLFxuICAgICAgICAgICAgcGF0dGVyblByb3BlcnRpZXMsXG4gICAgICAgICAgXSxcbiAgICAgICAgICBhZGRpdGlvbmFsSXRlbXM6IGZhbHNlLFxuICAgICAgICB9LFxuICAgICAgXSxcbiAgICB9LFxuICB9LFxuXG4gIGNyZWF0ZShjb250ZXh0KSB7XG5cbiAgICBjb25zdCBwcm9wcyA9IGJ1aWxkUHJvcGVydGllcyhjb250ZXh0KTtcblxuICAgIGZ1bmN0aW9uIGdldE1vZGlmaWVyKGV4dGVuc2lvbikge1xuICAgICAgcmV0dXJuIHByb3BzLnBhdHRlcm5bZXh0ZW5zaW9uXSB8fCBwcm9wcy5kZWZhdWx0Q29uZmlnO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGlzVXNlT2ZFeHRlbnNp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m9yIFwiJHtpbXBvcnRQYXRoV2l0aFF1ZXJ5U3RyaW5nfVwiYCxcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIGlmIChleHRlbnNpb24pIHtcbiAgICAgICAgaWYgKGlzVXNlT2ZFeHRlbnNpb25Gb3JiaWRkZW4oZXh0ZW5zaW9uKSAmJiBpc1Jlc29sdmFibGVXaXRob3V0RXh0ZW5zaW9uKGltcG9ydFBhdGgpKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgbm9kZTogc291cmNlLFxuICAgICAgICAgICAgbWVzc2FnZTogYFVuZXhwZWN0ZWQgdXNlIG9mIGZpbGUgZXh0ZW5zaW9uIFwiJHtleHRlbnNpb259XCIgZm9yIFwiJHtpbXBvcnRQYXRoV2l0aFF1ZXJ5U3RyaW5nfVwiYCxcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBtb2R1bGVWaXNpdG9yKGNoZWNrRmlsZUV4dGVuc2lvbiwgeyBjb21tb25qczogdHJ1ZSB9KTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/first.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/first.js new file mode 100644 index 0000000000000000000000000000000000000000..ef20658873073af87151c71f9c6082226f7eb9f3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/first.js @@ -0,0 +1,146 @@ +'use strict';var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function getImportValue(node) { + return node.type === 'ImportDeclaration' ? + node.source.value : + node.moduleReference.expression.value; +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Ensure all imports appear before other statements.', + url: (0, _docsUrl2['default'])('first') }, + + fixable: 'code', + schema: [ + { + type: 'string', + 'enum': ['absolute-first', 'disable-absolute-first'] }] }, + + + + + create: function () {function create(context) { + function isPossibleDirective(node) { + return node.type === 'ExpressionStatement' && + node.expression.type === 'Literal' && + typeof node.expression.value === 'string'; + } + + return { + Program: function () {function Program(n) { + var body = n.body; + if (!body) { + return; + } + var absoluteFirst = context.options[0] === 'absolute-first'; + var message = 'Import in body of module; reorder to top.'; + var sourceCode = (0, _contextCompat.getSourceCode)(context); + var originSourceCode = sourceCode.getText(); + var nonImportCount = 0; + var anyExpressions = false; + var anyRelative = false; + var lastLegalImp = null; + var errorInfos = []; + var shouldSort = true; + var lastSortNodesIndex = 0; + body.forEach(function (node, index) { + if (!anyExpressions && isPossibleDirective(node)) { + return; + } + + anyExpressions = true; + + if (node.type === 'ImportDeclaration' || node.type === 'TSImportEqualsDeclaration') { + if (absoluteFirst) { + if (/^\./.test(getImportValue(node))) { + anyRelative = true; + } else if (anyRelative) { + context.report({ + node: node.type === 'ImportDeclaration' ? node.source : node.moduleReference, + message: 'Absolute imports should come before relative imports.' }); + + } + } + if (nonImportCount > 0) {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = (0, _contextCompat.getDeclaredVariables)(context, node)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var variable = _step.value; + if (!shouldSort) {break;} + var references = variable.references; + if (references.length) {var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try { + for (var _iterator2 = references[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var reference = _step2.value; + if (reference.identifier.range[0] < node.range[1]) { + shouldSort = false; + break; + } + }} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}} + } + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + shouldSort && (lastSortNodesIndex = errorInfos.length); + errorInfos.push({ + node: node, + range: [body[index - 1].range[1], node.range[1]] }); + + } else { + lastLegalImp = node; + } + } else { + nonImportCount++; + } + }); + if (!errorInfos.length) {return;} + errorInfos.forEach(function (errorInfo, index) { + var node = errorInfo.node; + var infos = { + node: node, + message: message }; + + if (index < lastSortNodesIndex) { + infos.fix = function (fixer) { + return fixer.insertTextAfter(node, ''); + }; + } else if (index === lastSortNodesIndex) { + var sortNodes = errorInfos.slice(0, lastSortNodesIndex + 1); + infos.fix = function (fixer) { + var removeFixers = sortNodes.map(function (_errorInfo) { + return fixer.removeRange(_errorInfo.range); + }); + var range = [0, removeFixers[removeFixers.length - 1].range[1]]; + var insertSourceCode = sortNodes.map(function (_errorInfo) { + var nodeSourceCode = String.prototype.slice.apply( + originSourceCode, _errorInfo.range); + + if (/\S/.test(nodeSourceCode[0])) { + return '\n' + String(nodeSourceCode); + } + return nodeSourceCode; + }).join(''); + var insertFixer = null; + var replaceSourceCode = ''; + if (!lastLegalImp) { + insertSourceCode = insertSourceCode.trim() + insertSourceCode.match(/^(\s+)/)[0]; + } + insertFixer = lastLegalImp ? + fixer.insertTextAfter(lastLegalImp, insertSourceCode) : + fixer.insertTextBefore(body[0], insertSourceCode); + + var fixers = [insertFixer].concat(removeFixers); + fixers.forEach(function (computedFixer, i) { + replaceSourceCode += originSourceCode.slice( + fixers[i - 1] ? fixers[i - 1].range[1] : 0, computedFixer.range[0]) + + computedFixer.text; + }); + + return fixer.replaceTextRange(range, replaceSourceCode); + }; + } + context.report(infos); + }); + }return Program;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ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0gMDtcbiAgICAgICAgYm9keS5mb3JFYWNoKGZ1bmN0aW9uIChub2RlLCBpbmRleCkge1xuICAgICAgICAgIGlmICghYW55RXhwcmVzc2lvbnMgJiYgaXNQb3NzaWJsZURpcmVjdGl2ZShub2RlKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGFueUV4cHJlc3Npb25zID0gdHJ1ZTtcblxuICAgICAgICAgIGlmIChub2RlLnR5cGUgPT09ICdJbXBvcnREZWNsYXJhdGlvbicgfHwgbm9kZS50eXBlID09PSAnVFNJbXBvcnRFcXVhbHNEZWNsYXJhdGlvbicpIHtcbiAgICAgICAgICAgIGlmIChhYnNvbHV0ZUZpcnN0KSB7XG4gICAgICAgICAgICAgIGlmICgoL15cXC4vKS50ZXN0KGdldEltcG9ydFZhbHVlKG5vZGUpKSkge1xuICAgICAgICAgICAgICAgIGFueVJlbGF0aXZlID0gdHJ1ZTtcbiAgICAgICAgICAgICAgfSBlbHNlIGlmIChhbnlSZWxhdGl2ZSkge1xuICAgICAgICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgICAgICAgIG5vZGU6IG5vZGUudHlwZSA9PT0gJ0ltcG9ydERlY2xhcmF0aW9uJyA/IG5vZGUuc291cmNlIDogbm9kZS5tb2R1bGVSZWZlcmVuY2UsXG4gICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnQWJzb2x1dGUgaW1wb3J0cyBzaG91bGQgY29tZSBiZWZvcmUgcmVsYXRpdmUgaW1wb3J0cy4nLFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm9uSW1wb3J0Q291bnQgPiAwKSB7XG4gICAgICAgICAgICAgIGZvciAoY29uc3QgdmFyaWFibGUgb2YgZ2V0RGVjbGFyZWRWYXJpYWJsZXMoY29udGV4dCwgbm9kZSkpIHtcbiAgICAgICAgICAgICAgICBpZiAoIXNob3VsZFNvcnQpIHsgYnJlYWs7IH1cbiAgICAgICAgICAgICAgICBjb25zdCByZWZlcmVuY2VzID0gdmFyaWFibGUucmVmZXJlbmNlcztcbiAgICAgICAgICAgICAgICBpZiAocmVmZXJlbmNlcy5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcmVmZXJlbmNlIG9mIHJlZmVyZW5jZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlZmVyZW5jZS5pZGVudGlmaWVyLnJhbmdlWzBdIDwgbm9kZS5yYW5nZVsxXSkge1xuICAgICAgICAgICAgICAgICAgICAgIHNob3VsZFNvcnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBzaG91bGRTb3J0ICYmIChsYXN0U29ydE5vZGVzSW5kZXggPSBlcnJvckluZm9zLmxlbmd0aCk7XG4gICAgICAgICAgICAgIGVycm9ySW5mb3MucHVzaCh7XG4gICAgICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgICAgICByYW5nZTogW2JvZHlbaW5kZXggLSAxXS5yYW5nZVsxXSwgbm9kZS5yYW5nZVsxXV0sXG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgbGFzdExlZ2FsSW1wID0gbm9kZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgbm9uSW1wb3J0Q291bnQrKztcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICBpZiAoIWVycm9ySW5mb3MubGVuZ3RoKSB7IHJldHVybjsgfVxuICAgICAgICBlcnJvckluZm9zLmZvckVhY2goZnVuY3Rpb24gKGVycm9ySW5mbywgaW5kZXgpIHtcbiAgICAgICAgICBjb25zdCBub2RlID0gZXJyb3JJbmZvLm5vZGU7XG4gICAgICAgICAgY29uc3QgaW5mb3MgPSB7XG4gICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgbWVzc2FnZSxcbiAgICAgICAgICB9O1xuICAgICAgICAgIGlmIChpbmRleCA8IGxhc3RTb3J0Tm9kZXNJbmRleCkge1xuICAgICAgICAgICAgaW5mb3MuZml4ID0gZnVuY3Rpb24gKGZpeGVyKSB7XG4gICAgICAgICAgICAgIHJldHVybiBmaXhlci5pbnNlcnRUZXh0QWZ0ZXIobm9kZSwgJycpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICB9IGVsc2UgaWYgKGluZGV4ID09PSBsYXN0U29ydE5vZGVzSW5kZXgpIHtcbiAgICAgICAgICAgIGNvbnN0IHNvcnROb2RlcyA9IGVycm9ySW5mb3Muc2xpY2UoMCwgbGFzdFNvcnROb2Rlc0luZGV4ICsgMSk7XG4gICAgICAgICAgICBpbmZvcy5maXggPSBmdW5jdGlvbiAoZml4ZXIpIHtcbiAgICAgICAgICAgICAgY29uc3QgcmVtb3ZlRml4ZXJzID0gc29ydE5vZGVzLm1hcChmdW5jdGlvbiAoX2Vycm9ySW5mbykge1xuICAgICAgICAgICAgICAgIHJldHVybiBmaXhlci5yZW1vdmVSYW5nZShfZXJyb3JJbmZvLnJhbmdlKTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgIGNvbnN0IHJhbmdlID0gWzAsIHJlbW92ZUZpeGVyc1tyZW1vdmVGaXhlcnMubGVuZ3RoIC0gMV0ucmFuZ2VbMV1dO1xuICAgICAgICAgICAgICBsZXQgaW5zZXJ0U291cmNlQ29kZSA9IHNvcnROb2Rlcy5tYXAoZnVuY3Rpb24gKF9lcnJvckluZm8pIHtcbiAgICAgICAgICAgICAgICBjb25zdCBub2RlU291cmNlQ29kZSA9IFN0cmluZy5wcm90b3R5cGUuc2xpY2UuYXBwbHkoXG4gICAgICAgICAgICAgICAgICBvcmlnaW5Tb3VyY2VDb2RlLCBfZXJyb3JJbmZvLnJhbmdlLFxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgaWYgKCgvXFxTLykudGVzdChub2RlU291cmNlQ29kZVswXSkpIHtcbiAgICAgICAgICAgICAgICAgIHJldHVybiBgXFxuJHtub2RlU291cmNlQ29kZX1gO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZVNvdXJjZUNvZGU7XG4gICAgICAgICAgICAgIH0pLmpvaW4oJycpO1xuICAgICAgICAgICAgICBsZXQgaW5zZXJ0Rml4ZXIgPSBudWxsO1xuICAgICAgICAgICAgICBsZXQgcmVwbGFjZVNvdXJjZUNvZGUgPSAnJztcbiAgICAgICAgICAgICAgaWYgKCFsYXN0TGVnYWxJbXApIHtcbiAgICAgICAgICAgICAgICBpbnNlcnRTb3VyY2VDb2RlID0gaW5zZXJ0U291cmNlQ29kZS50cmltKCkgKyBpbnNlcnRTb3VyY2VDb2RlLm1hdGNoKC9eKFxccyspLylbMF07XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaW5zZXJ0Rml4ZXIgPSBsYXN0TGVnYWxJbXBcbiAgICAgICAgICAgICAgICA/IGZpeGVyLmluc2VydFRleHRBZnRlcihsYXN0TGVnYWxJbXAsIGluc2VydFNvdXJjZUNvZGUpXG4gICAgICAgICAgICAgICAgOiBmaXhlci5pbnNlcnRUZXh0QmVmb3JlKGJvZHlbMF0sIGluc2VydFNvdXJjZUNvZGUpO1xuXG4gICAgICAgICAgICAgIGNvbnN0IGZpeGVycyA9IFtpbnNlcnRGaXhlcl0uY29uY2F0KHJlbW92ZUZpeGVycyk7XG4gICAgICAgICAgICAgIGZpeGVycy5mb3JFYWNoKChjb21wdXRlZEZpeGVyLCBpKSA9PiB7XG4gICAgICAgICAgICAgICAgcmVwbGFjZVNvdXJjZUNvZGUgKz0gb3JpZ2luU291cmNlQ29kZS5zbGljZShcbiAgICAgICAgICAgICAgICAgIGZpeGVyc1tpIC0gMV0gPyBmaXhlcnNbaSAtIDFdLnJhbmdlWzFdIDogMCwgY29tcHV0ZWRGaXhlci5yYW5nZVswXSxcbiAgICAgICAgICAgICAgICApICsgY29tcHV0ZWRGaXhlci50ZXh0O1xuICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICByZXR1cm4gZml4ZXIucmVwbGFjZVRleHRSYW5nZShyYW5nZSwgcmVwbGFjZVNvdXJjZUNvZGUpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICB9XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoaW5mb3MpO1xuICAgICAgICB9KTtcbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/group-exports.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/group-exports.js new file mode 100644 index 0000000000000000000000000000000000000000..e108fa2c4736c1628627ead4db51a5fe65ad9186 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/group-exports.js @@ -0,0 +1,155 @@ +'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl); +var _object = require('object.values');var _object2 = _interopRequireDefault(_object); +var _arrayPrototype = require('array.prototype.flat');var _arrayPrototype2 = _interopRequireDefault(_arrayPrototype);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +var meta = { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Prefer named exports to be grouped together in a single export declaration', + url: (0, _docsUrl2['default'])('group-exports') } }; + + +/* eslint-disable max-len */ +var errors = { + ExportNamedDeclaration: 'Multiple named export declarations; consolidate all named exports into a single export declaration', + AssignmentExpression: 'Multiple CommonJS exports; consolidate all exports into a single assignment to `module.exports`' }; + +/* eslint-enable max-len */ + +/** + * Returns an array with names of the properties in the accessor chain for MemberExpression nodes + * + * Example: + * + * `module.exports = {}` => ['module', 'exports'] + * `module.exports.property = true` => ['module', 'exports', 'property'] + * + * @param {Node} node AST Node (MemberExpression) + * @return {Array} Array with the property names in the chain + * @private + */ +function accessorChain(node) { + var chain = []; + + do { + chain.unshift(node.property.name); + + if (node.object.type === 'Identifier') { + chain.unshift(node.object.name); + break; + } + + node = node.object; + } while (node.type === 'MemberExpression'); + + return chain; +} + +function create(context) { + var nodes = { + modules: { + set: new Set(), + sources: {} }, + + types: { + set: new Set(), + sources: {} }, + + commonjs: { + set: new Set() } }; + + + + return { + ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { + var target = node.exportKind === 'type' ? nodes.types : nodes.modules; + if (!node.source) { + target.set.add(node); + } else if (Array.isArray(target.sources[node.source.value])) { + target.sources[node.source.value].push(node); + } else { + target.sources[node.source.value] = [node]; + } + }return ExportNamedDeclaration;}(), + + AssignmentExpression: function () {function AssignmentExpression(node) { + if (node.left.type !== 'MemberExpression') { + return; + } + + var chain = accessorChain(node.left); + + // Assignments to module.exports + // Deeper assignments are ignored since they just modify what's already being exported + // (ie. module.exports.exported.prop = true is ignored) + if (chain[0] === 'module' && chain[1] === 'exports' && chain.length <= 3) { + nodes.commonjs.set.add(node); + return; + } + + // Assignments to exports (exports.* = *) + if (chain[0] === 'exports' && chain.length === 2) { + nodes.commonjs.set.add(node); + return; + } + }return AssignmentExpression;}(), + + 'Program:exit': function () {function onExit() { + // Report multiple `export` declarations (ES2015 modules) + if (nodes.modules.set.size > 1) { + nodes.modules.set.forEach(function (node) { + context.report({ + node: node, + message: errors[node.type] }); + + }); + } + + // Report multiple `aggregated exports` from the same module (ES2015 modules) + (0, _arrayPrototype2['default'])((0, _object2['default'])(nodes.modules.sources). + filter(function (nodesWithSource) {return Array.isArray(nodesWithSource) && nodesWithSource.length > 1;})). + forEach(function (node) { + context.report({ + node: node, + message: errors[node.type] }); + + }); + + // Report multiple `export type` declarations (FLOW ES2015 modules) + if (nodes.types.set.size > 1) { + nodes.types.set.forEach(function (node) { + context.report({ + node: node, + message: errors[node.type] }); + + }); + } + + // Report multiple `aggregated type exports` from the same module (FLOW ES2015 modules) + (0, _arrayPrototype2['default'])((0, _object2['default'])(nodes.types.sources). + filter(function (nodesWithSource) {return Array.isArray(nodesWithSource) && nodesWithSource.length > 1;})). + forEach(function (node) { + context.report({ + node: node, + message: errors[node.type] }); + + }); + + // Report multiple `module.exports` assignments (CommonJS) + if (nodes.commonjs.set.size > 1) { + nodes.commonjs.set.forEach(function (node) { + context.report({ + node: node, + message: errors[node.type] }); + + }); + } + }return onExit;}() }; + +} + +module.exports = { + meta: meta, + create: create }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9ncm91cC1leHBvcnRzLmpzIl0sIm5hbWVzIjpbIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJlcnJvcnMiLCJFeHBvcnROYW1lZERlY2xhcmF0aW9uIiwiQXNzaWdubWVudEV4cHJlc3Npb24iLCJhY2Nlc3NvckNoYWluIiwibm9kZSIsImNoYWluIiwidW5zaGlmdCIsInByb3BlcnR5IiwibmFtZSIsIm9iamVjdCIsImNyZWF0ZSIsImNvbnRleHQiLCJub2RlcyIsIm1vZHVsZXMiLCJzZXQiLCJTZXQiLCJzb3VyY2VzIiwidHlwZXMiLCJjb21tb25qcyIsInRhcmdldCIsImV4cG9ydEtpbmQiLCJzb3VyY2UiLCJhZGQiLCJBcnJheSIsImlzQXJyYXkiLCJ2YWx1ZSIsInB1c2giLCJsZWZ0IiwibGVuZ3RoIiwib25FeGl0Iiwic2l6ZSIsImZvckVhY2giLCJyZXBvcnQiLCJtZXNzYWdlIiwiZmlsdGVyIiwibm9kZXNXaXRoU291cmNlIiwibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncy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mpzLnNldC5hZGQobm9kZSk7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgLy8gQXNzaWdubWVudHMgdG8gZXhwb3J0cyAoZXhwb3J0cy4qID0gKilcbiAgICAgIGlmIChjaGFpblswXSA9PT0gJ2V4cG9ydHMnICYmIGNoYWluLmxlbmd0aCA9PT0gMikge1xuICAgICAgICBub2Rlcy5jb21tb25qcy5zZXQuYWRkKG5vZGUpO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG4gICAgfSxcblxuICAgICdQcm9ncmFtOmV4aXQnOiBmdW5jdGlvbiBvbkV4aXQoKSB7XG4gICAgICAvLyBSZXBvcnQgbXVsdGlwbGUgYGV4cG9ydGAgZGVjbGFyYXRpb25zIChFUzIwMTUgbW9kdWxlcylcbiAgICAgIGlmIChub2Rlcy5tb2R1bGVzLnNldC5zaXplID4gMSkge1xuICAgICAgICBub2Rlcy5tb2R1bGVzLnNldC5mb3JFYWNoKChub2RlKSA9PiB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgIG1lc3NhZ2U6IGVycm9yc1tub2RlLnR5cGVdLFxuICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgIH1cblxuICAgICAgLy8gUmVwb3J0IG11bHRpcGxlIGBhZ2dyZWdhdGVkIGV4cG9ydHNgIGZyb20gdGhlIHNhbWUgbW9kdWxlIChFUzIwMTUgbW9kdWxlcylcbiAgICAgIGZsYXQodmFsdWVzKG5vZGVzLm1vZHVsZXMuc291cmNlcylcbiAgICAgICAgLmZpbHRlcigobm9kZXNXaXRoU291cmNlKSA9PiBBcnJheS5pc0FycmF5KG5vZGVzV2l0aFNvdXJjZSkgJiYgbm9kZXNXaXRoU291cmNlLmxlbmd0aCA+IDEpKVxuICAgICAgICAuZm9yRWFjaCgobm9kZSkgPT4ge1xuICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAg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29tbW9uanMuc2V0LnNpemUgPiAxKSB7XG4gICAgICAgIG5vZGVzLmNvbW1vbmpzLnNldC5mb3JFYWNoKChub2RlKSA9PiB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgIG1lc3NhZ2U6IGVycm9yc1tub2RlLnR5cGVdLFxuICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9LFxuICB9O1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtcbiAgbWV0YSxcbiAgY3JlYXRlLFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/imports-first.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/imports-first.js new file mode 100644 index 0000000000000000000000000000000000000000..f242ac782923257ab079422c64e20d79278a512b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/imports-first.js @@ -0,0 +1,16 @@ +'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +var first = require('./first'); + +var newMeta = Object.assign({}, +first.meta, { + deprecated: true, + docs: { + category: 'Style guide', + description: 'Replaced by `import/first`.', + url: (0, _docsUrl2['default'])('imports-first', '7b25c1cb95ee18acc1531002fd343e1e6031f9ed') } }); + + + +module.exports = Object.assign({}, first, { meta: newMeta }); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9pbXBvcnRzLWZpcnN0LmpzIl0sIm5hbWVzIjpbImZpcnN0IiwicmVxdWlyZSIsIm5ld01ldGEiLCJtZXRhIiwiZGVwcmVjYXRlZCIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6ImFBQUEscUM7O0FBRUEsSUFBTUEsUUFBUUMsUUFBUSxTQUFSLENBQWQ7O0FBRUEsSUFBTUM7QUFDREYsTUFBTUcsSUFETDtBQUVKQyxjQUFZLElBRlI7QUFHSkMsUUFBTTtBQUNKQyxjQUFVLGFBRE47QUFFSkMsaUJBQWEsNkJBRlQ7QUFHSkMsU0FBSywwQkFBUSxlQUFSLEVBQXlCLDBDQUF6QixDQUhELEVBSEYsR0FBTjs7OztBQVVBQyxPQUFPQyxPQUFQLHFCQUFzQlYsS0FBdEIsSUFBNkJHLE1BQU1ELE9BQW5DIiwiZmlsZSI6ImltcG9ydHMtZmlyc3QuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgZG9jc1VybCBmcm9tICcuLi9kb2NzVXJsJztcblxuY29uc3QgZmlyc3QgPSByZXF1aXJlKCcuL2ZpcnN0Jyk7XG5cbmNvbnN0IG5ld01ldGEgPSB7XG4gIC4uLmZpcnN0Lm1ldGEsXG4gIGRlcHJlY2F0ZWQ6IHRydWUsXG4gIGRvY3M6IHtcbiAgICBjYXRlZ29yeTogJ1N0eWxlIGd1aWRlJyxcbiAgICBkZXNjcmlwdGlvbjogJ1JlcGxhY2VkIGJ5IGBpbXBvcnQvZmlyc3RgLicsXG4gICAgdXJsOiBkb2NzVXJsKCdpbXBvcnRzLWZpcnN0JywgJzdiMjVjMWNiOTVlZTE4YWNjMTUzMTAwMmZkMzQzZTFlNjAzMWY5ZWQnKSxcbiAgfSxcbn07XG5cbm1vZHVsZS5leHBvcnRzID0geyAuLi5maXJzdCwgbWV0YTogbmV3TWV0YSB9O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/max-dependencies.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/max-dependencies.js new file mode 100644 index 0000000000000000000000000000000000000000..48809701092800f84b60ed0c08443ade4553e632 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/max-dependencies.js @@ -0,0 +1,60 @@ +'use strict';var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +var DEFAULT_MAX = 10; +var DEFAULT_IGNORE_TYPE_IMPORTS = false; +var TYPE_IMPORT = 'type'; + +var countDependencies = function countDependencies(dependencies, lastNode, context) {var _ref = + context.options[0] || { max: DEFAULT_MAX },max = _ref.max; + + if (dependencies.size > max) { + context.report(lastNode, 'Maximum number of dependencies (' + String(max) + ') exceeded.'); + } +}; + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Enforce the maximum number of dependencies a module can have.', + url: (0, _docsUrl2['default'])('max-dependencies') }, + + + schema: [ + { + type: 'object', + properties: { + max: { type: 'number' }, + ignoreTypeImports: { type: 'boolean' } }, + + additionalProperties: false }] }, + + + + + create: function () {function create(context) {var _ref2 = + + + context.options[0] || {},_ref2$ignoreTypeImpor = _ref2.ignoreTypeImports,ignoreTypeImports = _ref2$ignoreTypeImpor === undefined ? DEFAULT_IGNORE_TYPE_IMPORTS : _ref2$ignoreTypeImpor; + + var dependencies = new Set(); // keep track of dependencies + var lastNode = void 0; // keep track of the last node to report on + + return Object.assign({ + 'Program:exit': function () {function ProgramExit() { + countDependencies(dependencies, lastNode, context); + }return ProgramExit;}() }, + (0, _moduleVisitor2['default'])( + function (source, _ref3) {var importKind = _ref3.importKind; + if (importKind !== TYPE_IMPORT || !ignoreTypeImports) { + dependencies.add(source.value); + } + lastNode = source; + }, + { commonjs: true })); + + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2Vz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251bWJlcicgfSxcbiAgICAgICAgICBpZ25vcmVUeXBlSW1wb3J0czogeyB0eXBlOiAnYm9vbGVhbicgfSxcbiAgICAgICAgfSxcbiAgICAgICAgYWRkaXRpb25hbFByb3BlcnRpZXM6IGZhbHNlLFxuICAgICAgfSxcbiAgICBdLFxuICB9LFxuXG4gIGNyZWF0ZShjb250ZXh0KSB7XG4gICAgY29uc3Qge1xuICAgICAgaWdub3JlVHlwZUltcG9ydHMgPSBERUZBVUxUX0lHTk9SRV9UWVBFX0lNUE9SVFMsXG4gICAgfSA9IGNvbnRleHQub3B0aW9uc1swXSB8fCB7fTtcblxuICAgIGNvbnN0IGRlcGVuZGVuY2llcyA9IG5ldyBTZXQoKTsgLy8ga2VlcCB0cmFjayBvZiBkZXBlbmRlbmNpZXNcbiAgICBsZXQgbGFzdE5vZGU7IC8vIGtlZXAgdHJhY2sgb2YgdGhlIGxhc3Qgbm9kZSB0byByZXBvcnQgb25cblxuICAgIHJldHVybiB7XG4gICAgICAnUHJvZ3JhbTpleGl0JygpIHtcbiAgICAgICAgY291bnREZXBlbmRlbmNpZXMoZGVwZW5kZW5jaWVzLCBsYXN0Tm9kZSwgY29udGV4dCk7XG4gICAgICB9LFxuICAgICAgLi4ubW9kdWxlVmlzaXRvcihcbiAgICAgICAgKHNvdXJjZSwgeyBpbXBvcnRLaW5kIH0pID0+IHtcbiAgICAgICAgICBpZiAoaW1wb3J0S2luZCAhPT0gVFlQRV9JTVBPUlQgfHwgIWlnbm9yZVR5cGVJbXBvcnRzKSB7XG4gICAgICAgICAgICBkZXBlbmRlbmNpZXMuYWRkKHNvdXJjZS52YWx1ZSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGxhc3ROb2RlID0gc291cmNlO1xuICAgICAgICB9LFxuICAgICAgICB7IGNvbW1vbmpzOiB0cnVlIH0sXG4gICAgICApLFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/named.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/named.js new file mode 100644 index 0000000000000000000000000000000000000000..6340cf3f98881ed9a18cdf3236fb1f71eb3dd134 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/named.js @@ -0,0 +1,145 @@ +'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _path = require('path');var path = _interopRequireWildcard(_path); +var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _builder = require('../exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _interopRequireWildcard(obj) {if (obj && obj.__esModule) {return obj;} else {var newObj = {};if (obj != null) {for (var key in obj) {if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];}}newObj['default'] = obj;return newObj;}} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Static analysis', + description: 'Ensure named imports correspond to a named export in the remote file.', + url: (0, _docsUrl2['default'])('named') }, + + schema: [ + { + type: 'object', + properties: { + commonjs: { + type: 'boolean' } }, + + + additionalProperties: false }] }, + + + + + create: function () {function create(context) { + var options = context.options[0] || {}; + + function checkSpecifiers(key, type, node) { + // ignore local exports and type imports/exports + if ( + node.source == null || + node.importKind === 'type' || + node.importKind === 'typeof' || + node.exportKind === 'type') + { + return; + } + + if (!node.specifiers.some(function (im) {return im.type === type;})) { + return; // no named imports/exports + } + + var imports = _builder2['default'].get(node.source.value, context); + if (imports == null || imports.parseGoal === 'ambiguous') { + return; + } + + if (imports.errors.length) { + imports.reportErrors(context, node); + return; + } + + node.specifiers.forEach(function (im) { + if ( + im.type !== type + // ignore type imports + || im.importKind === 'type' || im.importKind === 'typeof') + { + return; + } + + var name = im[key].name || im[key].value; + + var deepLookup = imports.hasDeep(name); + + if (!deepLookup.found) { + if (deepLookup.path.length > 1) { + var deepPath = deepLookup.path. + map(function (i) {return path.relative(path.dirname((0, _contextCompat.getPhysicalFilename)(context)), i.path);}). + join(' -> '); + + context.report(im[key], String(name) + ' not found via ' + String(deepPath)); + } else { + context.report(im[key], String(name) + ' not found in \'' + String(node.source.value) + '\''); + } + } + }); + } + + function checkRequire(node) { + if ( + !options.commonjs || + node.type !== 'VariableDeclarator' + // return if it's not an object destructure or it's an empty object destructure + || !node.id || node.id.type !== 'ObjectPattern' || node.id.properties.length === 0 + // return if there is no call expression on the right side + || !node.init || node.init.type !== 'CallExpression') + { + return; + } + + var call = node.init;var _call$arguments = _slicedToArray( + call.arguments, 1),source = _call$arguments[0]; + var variableImports = node.id.properties; + var variableExports = _builder2['default'].get(source.value, context); + + if ( + // return if it's not a commonjs require statement + call.callee.type !== 'Identifier' || call.callee.name !== 'require' || call.arguments.length !== 1 + // return if it's not a string source + || source.type !== 'Literal' || + variableExports == null || + variableExports.parseGoal === 'ambiguous') + { + return; + } + + if (variableExports.errors.length) { + variableExports.reportErrors(context, node); + return; + } + + variableImports.forEach(function (im) { + if (im.type !== 'Property' || !im.key || im.key.type !== 'Identifier') { + return; + } + + var deepLookup = variableExports.hasDeep(im.key.name); + + if (!deepLookup.found) { + if (deepLookup.path.length > 1) { + var deepPath = deepLookup.path. + map(function (i) {return path.relative(path.dirname((0, _contextCompat.getFilename)(context)), i.path);}). + join(' -> '); + + context.report(im.key, String(im.key.name) + ' not found via ' + String(deepPath)); + } else { + context.report(im.key, String(im.key.name) + ' not found in \'' + String(source.value) + '\''); + } + } + }); + } + + return { + ImportDeclaration: checkSpecifiers.bind(null, 'imported', 'ImportSpecifier'), + + ExportNamedDeclaration: checkSpecifiers.bind(null, 'local', 'ExportSpecifier'), + + VariableDeclarator: checkRequire }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uYW1lZC5qcyJdLCJuYW1lcyI6WyJwYXRoIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJzY2hlbWEiLCJwcm9wZXJ0aWVzIiwiY29tbW9uanMiLCJhZGRpdGlvbmFsUHJvcGVydGllcyIsImNyZWF0ZSIsImNvbnRleHQiLCJvcHRpb25zIiwiY2hlY2tTcGVjaWZpZXJzIiwia2V5Iiwibm9kZSIsInNvdXJjZSIsImltcG9ydEtpbmQiLCJleHBvcnRLaW5kIiwic3BlY2lmaWVycyIsInNvbWUiLCJpbSIsImltcG9ydHMiLCJFeHBvcnRNYXBCdWlsZGVyIiwiZ2V0IiwidmFsdWUiLCJwYXJzZUdvYWwiLCJlcnJvcnMiLCJsZW5ndGgiLCJyZXBvcnRFcnJvcnMiLCJmb3JFYWNoIiwibmFtZSIsImRlZXBMb29rdXAiLCJoYXNEZWVwIiwiZm91bmQiLCJkZWVwUGF0aCIsIm1hcCIsImkiLCJyZWxhdGl2ZSIsImRpcm5hbWUiLCJqb2luIiwicmVwb3J0IiwiY2hlY2tSZXF1aXJlIiwiaWQiLCJpbml0IiwiY2FsbCIsImFyZ3VtZW50cyIsInZhcmlhYmxlSW1wb3J0cyIsInZhcmlhYmxlRXhwb3J0cyIsImNhbGxlZSIsIkltcG9ydERlY2xhcmF0aW9uIiwiYmluZCIsIkV4cG9ydE5hbWVkRGV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lLnZhbHVlLCBjb250ZXh0KTtcbiAgICAgIGlmIChpbXBvcnRzID09IG51bGwgfHwgaW1wb3J0cy5wYXJzZUdvYWwgPT09ICdhbWJpZ3VvdXMnKSB7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgaWYgKGltcG9ydHMuZXJyb3JzLmxlbmd0aCkge1xuICAgICAgICBpbXBvcnRzLnJlcG9ydEVycm9ycyhjb250ZXh0LCBub2RlKTtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuXG4gICAgICBub2RlLnNwZWNpZmllcnMuZm9yRWFjaChmdW5jdGlvbiAoaW0pIHtcbiAgICAgICAgaWYgKFxuICAgICAgICAgIGltLnR5cGUgIT09IHR5cGVcbiAgICAgICAgICAvLyBpZ25vcmUgdHlwZSBpbXBvcnRzXG4gICAgICAgICAgfHwgaW0uaW1wb3J0S2luZCA9PT0gJ3R5cGUnIHx8IGltLmltcG9ydEtpbmQgPT09ICd0eXBlb2YnXG4gICAgICAgICkge1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN0IG5hbWUgPSBpbVtrZXldLm5hbWUgfHwgaW1ba2V5XS52YWx1ZTtcblxuICAgICAgICBjb25zdCBkZWVwTG9va3VwID0gaW1wb3J0cy5oYXNEZWVwKG5hbWUpO1xuXG4gICAgICAgIGlmICghZGVlcExvb2t1cC5mb3VuZCkge1xuICAgICAgICAgIGlmIChkZWVwTG9va3VwLnBhdGgubGVuZ3RoID4gMSkge1xuICAgICAgICAgICAgY29uc3QgZGVlcFBhdGggPSBkZWVwTG9va3VwLnBhdGhcbiAgICAgICAgICAgICAgLm1hcCgoaSkgPT4gcGF0aC5yZWxhdGl2ZShwYXRoLmRpcm5hbWUoZ2V0UGh5c2ljYWxGaWxlbmFtZShjb250ZXh0KSksIGkucGF0aCkpXG4gICAgICAgICAgICAgIC5qb2luKCcgLT4gJyk7XG5cbiAgICAgICAgICAgIGNvbnRleHQucmVwb3J0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XBMb29rdXAucGF0aC5sZW5ndGggPiAxKSB7XG4gICAgICAgICAgICBjb25zdCBkZWVwUGF0aCA9IGRlZXBMb29rdXAucGF0aFxuICAgICAgICAgICAgICAubWFwKChpKSA9PiBwYXRoLnJlbGF0aXZlKHBhdGguZGlybmFtZShnZXRGaWxlbmFtZShjb250ZXh0KSksIGkucGF0aCkpXG4gICAgICAgICAgICAgIC5qb2luKCcgLT4gJyk7XG5cbiAgICAgICAgICAgIGNvbnRleHQucmVwb3J0KGltLmtleSwgYCR7aW0ua2V5Lm5hbWV9IG5vdCBmb3VuZCB2aWEgJHtkZWVwUGF0aH1gKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgY29udGV4dC5yZXBvcnQoaW0ua2V5LCBgJHtpbS5rZXkubmFtZX0gbm90IGZvdW5kIGluICcke3NvdXJjZS52YWx1ZX0nYCk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgSW1wb3J0RGVjbGFyYXRpb246IGNoZWNrU3BlY2lmaWVycy5iaW5kKG51bGwsICdpbXBvcnRlZCcsICdJbXBvcnRTcGVjaWZpZXInKSxcblxuICAgICAgRXhwb3J0TmFtZWREZWNsYXJhdGlvbjogY2hlY2tTcGVjaWZpZXJzLmJpbmQobnVsbCwgJ2xvY2FsJywgJ0V4cG9ydFNwZWNpZmllcicpLFxuXG4gICAgICBWYXJpYWJsZURlY2xhcmF0b3I6IGNoZWNrUmVxdWlyZSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/namespace.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..217c1d1b6b0fcf280f164dcbe1939820cd70c76f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/namespace.js @@ -0,0 +1,219 @@ +'use strict';var _declaredScope = require('eslint-module-utils/declaredScope');var _declaredScope2 = _interopRequireDefault(_declaredScope); +var _builder = require('../exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _exportMap = require('../exportMap');var _exportMap2 = _interopRequireDefault(_exportMap); +var _importDeclaration = require('../importDeclaration');var _importDeclaration2 = _interopRequireDefault(_importDeclaration); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function processBodyStatement(context, namespaces, declaration) { + if (declaration.type !== 'ImportDeclaration') {return;} + + if (declaration.specifiers.length === 0) {return;} + + var imports = _builder2['default'].get(declaration.source.value, context); + if (imports == null) {return null;} + + if (imports.errors.length > 0) { + imports.reportErrors(context, declaration); + return; + } + + declaration.specifiers.forEach(function (specifier) { + switch (specifier.type) { + case 'ImportNamespaceSpecifier': + if (!imports.size) { + context.report( + specifier, 'No exported names found in module \'' + String( + declaration.source.value) + '\'.'); + + } + namespaces.set(specifier.local.name, imports); + break; + case 'ImportDefaultSpecifier': + case 'ImportSpecifier':{ + var meta = imports.get( + // default to 'default' for default https://i.imgur.com/nj6qAWy.jpg + specifier.imported ? specifier.imported.name || specifier.imported.value : 'default'); + + if (!meta || !meta.namespace) {break;} + namespaces.set(specifier.local.name, meta.namespace); + break; + } + default:} + + }); +} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Static analysis', + description: 'Ensure imported namespaces contain dereferenced properties as they are dereferenced.', + url: (0, _docsUrl2['default'])('namespace') }, + + + schema: [ + { + type: 'object', + properties: { + allowComputed: { + description: 'If `false`, will report computed (and thus, un-lintable) references to namespace members.', + type: 'boolean', + 'default': false } }, + + + additionalProperties: false }] }, + + + + + create: function () {function namespaceRule(context) { + // read options + var _ref = + + context.options[0] || {},_ref$allowComputed = _ref.allowComputed,allowComputed = _ref$allowComputed === undefined ? false : _ref$allowComputed; + + var namespaces = new Map(); + + function makeMessage(last, namepath) { + return '\'' + String(last.name) + '\' not found in ' + (namepath.length > 1 ? 'deeply ' : '') + 'imported namespace \'' + String(namepath.join('.')) + '\'.'; + } + + return { + // pick up all imports at body entry time, to properly respect hoisting + Program: function () {function Program(_ref2) {var body = _ref2.body; + body.forEach(function (x) {processBodyStatement(context, namespaces, x);}); + }return Program;}(), + + // same as above, but does not add names to local map + ExportNamespaceSpecifier: function () {function ExportNamespaceSpecifier(namespace) { + var declaration = (0, _importDeclaration2['default'])(context, namespace); + + var imports = _builder2['default'].get(declaration.source.value, context); + if (imports == null) {return null;} + + if (imports.errors.length) { + imports.reportErrors(context, declaration); + return; + } + + if (!imports.size) { + context.report( + namespace, 'No exported names found in module \'' + String( + declaration.source.value) + '\'.'); + + } + }return ExportNamespaceSpecifier;}(), + + // todo: check for possible redefinition + + MemberExpression: function () {function MemberExpression(dereference) { + if (dereference.object.type !== 'Identifier') {return;} + if (!namespaces.has(dereference.object.name)) {return;} + if ((0, _declaredScope2['default'])(context, dereference.object.name, dereference) !== 'module') {return;} + + if (dereference.parent.type === 'AssignmentExpression' && dereference.parent.left === dereference) { + context.report( + dereference.parent, 'Assignment to member of namespace \'' + String( + dereference.object.name) + '\'.'); + + } + + // go deep + var namespace = namespaces.get(dereference.object.name); + var namepath = [dereference.object.name]; + // while property is namespace and parent is member expression, keep validating + while (namespace instanceof _exportMap2['default'] && dereference.type === 'MemberExpression') { + if (dereference.computed) { + if (!allowComputed) { + context.report( + dereference.property, 'Unable to validate computed reference to imported namespace \'' + String( + dereference.object.name) + '\'.'); + + } + return; + } + + if (!namespace.has(dereference.property.name)) { + context.report( + dereference.property, + makeMessage(dereference.property, namepath)); + + break; + } + + var exported = namespace.get(dereference.property.name); + if (exported == null) {return;} + + // stash and pop + namepath.push(dereference.property.name); + namespace = exported.namespace; + dereference = dereference.parent; + } + }return MemberExpression;}(), + + VariableDeclarator: function () {function VariableDeclarator(_ref3) {var id = _ref3.id,init = _ref3.init; + if (init == null) {return;} + if (init.type !== 'Identifier') {return;} + if (!namespaces.has(init.name)) {return;} + + // check for redefinition in intermediate scopes + if ((0, _declaredScope2['default'])(context, init.name, init) !== 'module') {return;} + + // DFS traverse child namespaces + function testKey(pattern, namespace) {var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [init.name]; + if (!(namespace instanceof _exportMap2['default'])) {return;} + + if (pattern.type !== 'ObjectPattern') {return;}var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + + for (var _iterator = pattern.properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var property = _step.value; + if ( + property.type === 'ExperimentalRestProperty' || + property.type === 'RestElement' || + !property.key) + { + continue; + } + + if (property.key.type !== 'Identifier') { + context.report({ + node: property, + message: 'Only destructure top-level names.' }); + + continue; + } + + if (!namespace.has(property.key.name)) { + context.report({ + node: property, + message: makeMessage(property.key, path) }); + + continue; + } + + path.push(property.key.name); + var dependencyExportMap = namespace.get(property.key.name); + // could be null when ignored or ambiguous + if (dependencyExportMap !== null) { + testKey(property.value, dependencyExportMap.namespace, path); + } + path.pop(); + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + } + + testKey(id, namespaces.get(init.name)); + }return VariableDeclarator;}(), + + JSXMemberExpression: function () {function JSXMemberExpression(_ref4) {var object = _ref4.object,property = _ref4.property; + if (!namespaces.has(object.name)) {return;} + var namespace = namespaces.get(object.name); + if (!namespace.has(property.name)) { + context.report({ + node: property, + message: makeMessage(property, [object.name]) }); + + } + }return JSXMemberExpression;}() }; + + }return namespaceRule;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uYW1lc3BhY2UuanMiXSwibmFtZXM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G9yKHsgaWQsIGluaXQgfSkge1xuICAgICAgICBpZiAoaW5pdCA9PSBudWxsKSB7IHJldHVybjsgfVxuICAgICAgICBpZiAoaW5pdC50eXBlICE9PSAnSWRlbnRpZmllcicpIHsgcmV0dXJuOyB9XG4gICAgICAgIGlmICghbmFtZXNwYWNlcy5oYXMoaW5pdC5uYW1lKSkgeyByZXR1cm47IH1cblxuICAgICAgICAvLyBjaGVjayBmb3IgcmVkZWZpbml0aW9uIGluIGludGVybWVkaWF0ZSBzY29wZXNcbiAgICAgICAgaWYgKGRlY2xhcmVkU2NvcGUoY29udGV4dCwgaW5pdC5uYW1lLCBpbml0KSAhPT0gJ21vZHVsZScpIHsgcmV0dXJuOyB9XG5cbiAgICAgICAgLy8gREZTIHRyYXZlcnNlIGNoaWxkIG5hbWVzcGFjZXNcbiAgICAgICAgZnVuY3Rpb24gdGVzdEtleShwYXR0ZXJuLCBuYW1lc3BhY2UsIHBhdGggPSBbaW5pdC5uYW1lXSkge1xuICAgICAgICAgIGlmICghKG5hbWVzcGFjZSBpbnN0YW5jZW9mIEV4cG9ydE1hcCkpIHsgcmV0dXJuOyB9XG5cbiAgICAgICAgICBpZiAocGF0dGVybi50eXBlICE9PSAnT2JqZWN0UGF0dGVybicpIHsgcmV0dXJuOyB9XG5cbiAgICAgICAgICBmb3IgKGNvbnN0IHByb3BlcnR5IG9mIHBhdHRlcm4ucHJvcGVydGllcykge1xuICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICBwcm9wZXJ0eS50eXBlID09PSAnRXhwZXJpbWVudGFsUmVzdFByb3BlcnR5J1xuICAgICAgICAgICAgICB8fCBwcm9wZXJ0eS50eXBlID09PSAnUmVzdEVsZW1lbnQnXG4gICAgICAgICAgICAgIHx8ICFwcm9wZXJ0eS5rZXlcbiAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHByb3BlcnR5LmtleS50eXBlICE9PSAnSWRlbnRpZmllcicpIHtcbiAgICAgICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgICAgIG5vZGU6IHByb3BlcnR5LFxuICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdPbmx5IGRlc3RydWN0dXJlIHRvcC1sZXZlbCBuYW1lcy4nLFxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghbmFtZXNwYWNlLmhhcyhwcm9wZXJ0eS5rZXkubmFtZSkpIHtcbiAgICAgICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgICAgIG5vZGU6IHByb3BlcnR5LFxuICAgICAgICAgICAgICAgIG1lc3NhZ2U6IG1ha2VNZXNzYWdlKHByb3BlcnR5LmtleSwgcGF0aCksXG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcGF0aC5wdXNoKHByb3BlcnR5LmtleS5uYW1lKTtcbiAgICAgICAgICAgIGNvbnN0IGRlcGVuZGVuY3lFeHBvcnRNYXAgPSBuYW1lc3BhY2UuZ2V0KHByb3BlcnR5LmtleS5uYW1lKTtcbiAgICAgICAgICAgIC8vIGNvdWxkIGJlIG51bGwgd2hlbiBpZ25vcmVkIG9yIGFtYmlndW91c1xuICAgICAgICAgICAgaWYgKGRlcGVuZGVuY3lFeHBvcnRNYXAgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgdGVzdEtleShwcm9wZXJ0eS52YWx1ZSwgZGVwZW5kZW5jeUV4cG9ydE1hcC5uYW1lc3BhY2UsIHBhdGgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcGF0aC5wb3AoKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB0ZXN0S2V5KGlkLCBuYW1lc3BhY2VzLmdldChpbml0Lm5hbWUpKTtcbiAgICAgIH0sXG5cbiAgICAgIEpTWE1lbWJlckV4cHJlc3Npb24oeyBvYmplY3QsIHByb3BlcnR5IH0pIHtcbiAgICAgICAgaWYgKCFuYW1lc3BhY2VzLmhhcyhvYmplY3QubmFtZSkpIHsgcmV0dXJuOyB9XG4gICAgICAgIGNvbnN0IG5hbWVzcGFjZSA9IG5hbWVzcGFjZXMuZ2V0KG9iamVjdC5uYW1lKTtcbiAgICAgICAgaWYgKCFuYW1lc3BhY2UuaGFzKHByb3BlcnR5Lm5hbWUpKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgbm9kZTogcHJvcGVydHksXG4gICAgICAgICAgICBtZXNzYWdlOiBtYWtlTWVzc2FnZShwcm9wZXJ0eSwgW29iamVjdC5uYW1lXSksXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/newline-after-import.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/newline-after-import.js new file mode 100644 index 0000000000000000000000000000000000000000..f58f55e3a06a819920ae5cdb7bce808385513259 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/newline-after-import.js @@ -0,0 +1,249 @@ +'use strict'; + + + + +var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _staticRequire = require('../core/staticRequire');var _staticRequire2 = _interopRequireDefault(_staticRequire); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl); + +var _debug = require('debug');var _debug2 = _interopRequireDefault(_debug);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /** + * @fileoverview Rule to enforce new line after import not followed by another import. + * @author Radek Benkel + */var log = (0, _debug2['default'])('eslint-plugin-import:rules:newline-after-import'); //------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +function containsNodeOrEqual(outerNode, innerNode) { + return outerNode.range[0] <= innerNode.range[0] && outerNode.range[1] >= innerNode.range[1]; +} + +function getScopeBody(scope) { + if (scope.block.type === 'SwitchStatement') { + log('SwitchStatement scopes not supported'); + return null; + }var + + body = scope.block.body; + if (body && body.type === 'BlockStatement') { + return body.body; + } + + return body; +} + +function findNodeIndexInScopeBody(body, nodeToFind) { + return body.findIndex(function (node) {return containsNodeOrEqual(node, nodeToFind);}); +} + +function getLineDifference(node, nextNode) { + return nextNode.loc.start.line - node.loc.end.line; +} + +function isClassWithDecorator(node) { + return node.type === 'ClassDeclaration' && node.decorators && node.decorators.length; +} + +function isExportDefaultClass(node) { + return node.type === 'ExportDefaultDeclaration' && node.declaration.type === 'ClassDeclaration'; +} + +function isExportNameClass(node) { + + return node.type === 'ExportNamedDeclaration' && node.declaration && node.declaration.type === 'ClassDeclaration'; +} + +module.exports = { + meta: { + type: 'layout', + docs: { + category: 'Style guide', + description: 'Enforce a newline after import statements.', + url: (0, _docsUrl2['default'])('newline-after-import') }, + + fixable: 'whitespace', + schema: [ + { + type: 'object', + properties: { + count: { + type: 'integer', + minimum: 1 }, + + exactCount: { type: 'boolean' }, + considerComments: { type: 'boolean' } }, + + additionalProperties: false }] }, + + + + create: function () {function create(context) { + var level = 0; + var requireCalls = []; + var options = Object.assign({ + count: 1, + exactCount: false, + considerComments: false }, + context.options[0]); + + + function checkForNewLine(node, nextNode, type) { + if (isExportDefaultClass(nextNode) || isExportNameClass(nextNode)) { + var classNode = nextNode.declaration; + + if (isClassWithDecorator(classNode)) { + nextNode = classNode.decorators[0]; + } + } else if (isClassWithDecorator(nextNode)) { + nextNode = nextNode.decorators[0]; + } + + var lineDifference = getLineDifference(node, nextNode); + var EXPECTED_LINE_DIFFERENCE = options.count + 1; + + if ( + lineDifference < EXPECTED_LINE_DIFFERENCE || + options.exactCount && lineDifference !== EXPECTED_LINE_DIFFERENCE) + { + var column = node.loc.start.column; + + if (node.loc.start.line !== node.loc.end.line) { + column = 0; + } + + context.report({ + loc: { + line: node.loc.end.line, + column: column }, + + message: 'Expected ' + String(options.count) + ' empty line' + (options.count > 1 ? 's' : '') + ' after ' + String(type) + ' statement not followed by another ' + String(type) + '.', + fix: options.exactCount && EXPECTED_LINE_DIFFERENCE < lineDifference ? undefined : function (fixer) {return fixer.insertTextAfter( + node, + '\n'.repeat(EXPECTED_LINE_DIFFERENCE - lineDifference));} }); + + + } + } + + function commentAfterImport(node, nextComment, type) { + var lineDifference = getLineDifference(node, nextComment); + var EXPECTED_LINE_DIFFERENCE = options.count + 1; + + if (lineDifference < EXPECTED_LINE_DIFFERENCE) { + var column = node.loc.start.column; + + if (node.loc.start.line !== node.loc.end.line) { + column = 0; + } + + context.report({ + loc: { + line: node.loc.end.line, + column: column }, + + message: 'Expected ' + String(options.count) + ' empty line' + (options.count > 1 ? 's' : '') + ' after ' + String(type) + ' statement not followed by another ' + String(type) + '.', + fix: options.exactCount && EXPECTED_LINE_DIFFERENCE < lineDifference ? undefined : function (fixer) {return fixer.insertTextAfter( + node, + '\n'.repeat(EXPECTED_LINE_DIFFERENCE - lineDifference));} }); + + + } + } + + function incrementLevel() { + level++; + } + function decrementLevel() { + level--; + } + + function checkImport(node) {var + parent = node.parent; + + if (!parent || !parent.body) { + return; + } + + var nodePosition = parent.body.indexOf(node); + var nextNode = parent.body[nodePosition + 1]; + var endLine = node.loc.end.line; + var nextComment = void 0; + + if (typeof parent.comments !== 'undefined' && options.considerComments) { + nextComment = parent.comments.find(function (o) {return o.loc.start.line >= endLine && o.loc.start.line <= endLine + options.count + 1;}); + } + + // skip "export import"s + if (node.type === 'TSImportEqualsDeclaration' && node.isExport) { + return; + } + + if (nextComment && typeof nextComment !== 'undefined') { + commentAfterImport(node, nextComment, 'import'); + } else if (nextNode && nextNode.type !== 'ImportDeclaration' && (nextNode.type !== 'TSImportEqualsDeclaration' || nextNode.isExport)) { + checkForNewLine(node, nextNode, 'import'); + } + } + + return { + ImportDeclaration: checkImport, + TSImportEqualsDeclaration: checkImport, + CallExpression: function () {function CallExpression(node) { + if ((0, _staticRequire2['default'])(node) && level === 0) { + requireCalls.push(node); + } + }return CallExpression;}(), + 'Program:exit': function () {function ProgramExit(node) { + log('exit processing for', (0, _contextCompat.getPhysicalFilename)(context)); + var scopeBody = getScopeBody((0, _contextCompat.getScope)(context, node)); + log('got scope:', scopeBody); + + requireCalls.forEach(function (node, index) { + var nodePosition = findNodeIndexInScopeBody(scopeBody, node); + log('node position in scope:', nodePosition); + + var statementWithRequireCall = scopeBody[nodePosition]; + var nextStatement = scopeBody[nodePosition + 1]; + var nextRequireCall = requireCalls[index + 1]; + + if (nextRequireCall && containsNodeOrEqual(statementWithRequireCall, nextRequireCall)) { + return; + } + + if ( + nextStatement && ( + !nextRequireCall || + !containsNodeOrEqual(nextStatement, nextRequireCall))) + + { + var nextComment = void 0; + if (typeof statementWithRequireCall.parent.comments !== 'undefined' && options.considerComments) { + var endLine = node.loc.end.line; + nextComment = statementWithRequireCall.parent.comments.find(function (o) {return o.loc.start.line >= endLine && o.loc.start.line <= endLine + options.count + 1;}); + } + + if (nextComment && typeof nextComment !== 'undefined') { + + commentAfterImport(statementWithRequireCall, nextComment, 'require'); + } else { + checkForNewLine(statementWithRequireCall, nextStatement, 'require'); + } + } + }); + }return ProgramExit;}(), + FunctionDeclaration: incrementLevel, + FunctionExpression: incrementLevel, + ArrowFunctionExpression: incrementLevel, + BlockStatement: incrementLevel, + ObjectExpression: incrementLevel, + Decorator: incrementLevel, + 'FunctionDeclaration:exit': decrementLevel, + 'FunctionExpression:exit': decrementLevel, + 'ArrowFunctionExpression:exit': decrementLevel, + 'BlockStatement:exit': decrementLevel, + 'ObjectExpression:exit': decrementLevel, + 'Decorator:exit': decrementLevel }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydW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gICAgICAgICBjb3VudDoge1xuICAgICAgICAgICAgdHlwZTogJ2ludGVnZXInLFxuICAgICAgICAgICAgbWluaW11bTogMSxcbiAgICAgICAgICB9LFxuICAgICAgICAgIGV4YWN0Q291bnQ6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sXG4gICAgICAgICAgY29uc2lkZXJDb21tZW50czogeyB0eXBlOiAnYm9vbGVhbicgfSxcbiAgICAgICAgfSxcbiAgICAgICAgYWRkaXRpb25hbFByb3BlcnRpZXM6IGZhbHNlLFxuICAgICAgfSxcbiAgICBdLFxuICB9LFxuICBjcmVhdGUoY29udGV4dCkge1xuICAgIGxldCBsZXZlbCA9IDA7XG4gICAgY29uc3QgcmVxdWlyZUNhbGxzID0gW107XG4gICAgY29uc3Qgb3B0aW9ucyA9IHtcbiAgICAgIGNvdW50OiAxLFxuICAgICAgZXhhY3RDb3VudDogZmFsc2UsXG4gICAgICBjb25zaWRlckNvbW1lbnRzOiBmYWxzZSxcbiAgICAgIC4uLmNvbnRleHQub3B0aW9uc1swXSxcbiAgICB9O1xuXG4gICAgZnVuY3Rpb24gY2hlY2tGb3JOZXdMaW5lKG5vZGUsIG5leHROb2RlLCB0eXBlKSB7XG4gICAgICBpZiAoaXNFeHBvcnREZWZhdWx0Q2xhc3MobmV4dE5vZGUpIHx8IGlzRXhwb3J0TmFtZUNsYXNzKG5leHROb2RlKSkge1xuICAgICAgICBjb25zdCBjbGFzc05vZGUgPSBuZXh0Tm9kZS5kZWNsYXJhdGlvbjtcblxuICAgICAgICBpZiAoaXNDbGFzc1dpdGhEZWNvcmF0b3IoY2xhc3NOb2RlKSkge1xuICAgICAgICAgIG5leHROb2RlID0gY2xhc3NOb2RlLmRlY29yYXRvcnNbMF07XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSBpZiAoaXNDbGFzc1dpdGhEZWNvcmF0b3IobmV4dE5vZGUpKSB7XG4gICAgICAgIG5leHROb2RlID0gbmV4dE5vZGUuZGVjb3JhdG9yc1swXTtc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W9uOiBpbmNyZW1lbnRMZXZlbCxcbiAgICAgIERlY29yYXRvcjogaW5jcmVtZW50TGV2ZWwsXG4gICAgICAnRnVuY3Rpb25EZWNsYXJhdGlvbjpleGl0JzogZGVjcmVtZW50TGV2ZWwsXG4gICAgICAnRnVuY3Rpb25FeHByZXNzaW9uOmV4aXQnOiBkZWNyZW1lbnRMZXZlbCxcbiAgICAgICdBcnJvd0Z1bmN0aW9uRXhwcmVzc2lvbjpleGl0JzogZGVjcmVtZW50TGV2ZWwsXG4gICAgICAnQmxvY2tTdGF0ZW1lbnQ6ZXhpdCc6IGRlY3JlbWVudExldmVsLFxuICAgICAgJ09iamVjdEV4cHJlc3Npb246ZXhpdCc6IGRlY3JlbWVudExldmVsLFxuICAgICAgJ0RlY29yYXRvcjpleGl0JzogZGVjcmVtZW50TGV2ZWwsXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-absolute-path.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-absolute-path.js new file mode 100644 index 0000000000000000000000000000000000000000..294e233c7adc32a150f6faa52bb704594e8eebab --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-absolute-path.js @@ -0,0 +1,41 @@ +'use strict';var _path = require('path');var _path2 = _interopRequireDefault(_path); +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); + +var _importType = require('../core/importType'); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Static analysis', + description: 'Forbid import of modules using absolute paths.', + url: (0, _docsUrl2['default'])('no-absolute-path') }, + + fixable: 'code', + schema: [(0, _moduleVisitor.makeOptionsSchema)()] }, + + + create: function () {function create(context) { + function reportIfAbsolute(source) { + if ((0, _importType.isAbsolute)(source.value)) { + context.report({ + node: source, + message: 'Do not import modules using an absolute path', + fix: function () {function fix(fixer) { + // node.js and web imports work with posix style paths ("/") + var relativePath = _path2['default'].posix.relative(_path2['default'].dirname((0, _contextCompat.getPhysicalFilename)(context)), source.value); + if (!relativePath.startsWith('.')) { + relativePath = './' + String(relativePath); + } + return fixer.replaceText(source, JSON.stringify(relativePath)); + }return fix;}() }); + + } + } + + var options = Object.assign({ esmodule: true, commonjs: true }, context.options[0]); + return (0, _moduleVisitor2['default'])(reportIfAbsolute, options); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1hYnNvbHV0ZS1wYXRoLmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwiZml4YWJsZSIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJyZXBvcnRJZkFic29sdXRlIiwic291cmNlIiwidmFsdWUiLCJyZXBvcnQiLCJub2RlIiwibWVzc2FnZSIsImZpeCIsImZpeGVyIiwicmVsYXRpdmVQYXRoIiwicGF0aCIsInBvc2l4IiwicmVsYXRpdmUiLCJkaXJuYW1lIiwic3RhcnRzV2l0aCIsInJlcGxhY2VUZXh0IiwiSlNPTiIsInN0cmluZ2lmeSIsIm9wdGlvbnMiLCJlc21vZHVsZSIsImNvbW1vbmpzIl0sIm1hcHBpbmdzIjoiYUFBQSw0QjtBQUNBO0FBQ0Esa0U7O0FBRUE7QUFDQSxxQzs7QUFFQUEsT0FBT0MsT0FBUCxHQUFpQjtBQUNmQyxRQUFNO0FBQ0pDLFVBQU0sWUFERjtBQUVKQyxVQUFN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sXG4gICAgICAgICAgZml4KGZpeGVyKSB7XG4gICAgICAgICAgICAvLyBub2RlLmpzIGFuZCB3ZWIgaW1wb3J0cyB3b3JrIHdpdGggcG9zaXggc3R5bGUgcGF0aHMgKFwiL1wiKVxuICAgICAgICAgICAgbGV0IHJlbGF0aXZlUGF0aCA9IHBhdGgucG9zaXgucmVsYXRpdmUocGF0aC5kaXJuYW1lKGdldFBoeXNpY2FsRmlsZW5hbWUoY29udGV4dCkpLCBzb3VyY2UudmFsdWUpO1xuICAgICAgICAgICAgaWYgKCFyZWxhdGl2ZVBhdGguc3RhcnRzV2l0aCgnLicpKSB7XG4gICAgICAgICAgICAgIHJlbGF0aXZlUGF0aCA9IGAuLyR7cmVsYXRpdmVQYXRofWA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZml4ZXIucmVwbGFjZVRleHQoc291cmNlLCBKU09OLnN0cmluZ2lmeShyZWxhdGl2ZVBhdGgpKTtcbiAgICAgICAgICB9LFxuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICBjb25zdCBvcHRpb25zID0geyBlc21vZHVsZTogdHJ1ZSwgY29tbW9uanM6IHRydWUsIC4uLmNvbnRleHQub3B0aW9uc1swXSB9O1xuICAgIHJldHVybiBtb2R1bGVWaXNpdG9yKHJlcG9ydElmQWJzb2x1dGUsIG9wdGlvbnMpO1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-amd.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-amd.js new file mode 100644 index 0000000000000000000000000000000000000000..8b9a70c98e5a551892e3a853f21f1b4a9f009ff5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-amd.js @@ -0,0 +1,46 @@ +'use strict'; + + + + +var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ +/** + * @fileoverview Rule to prefer imports to AMD + * @author Jamund Ferguson + */module.exports = { meta: { type: 'suggestion', + docs: { + category: 'Module systems', + description: 'Forbid AMD `require` and `define` calls.', + url: (0, _docsUrl2['default'])('no-amd') }, + + schema: [] }, + + + create: function () {function create(context) { + return { + CallExpression: function () {function CallExpression(node) { + if ((0, _contextCompat.getScope)(context, node).type !== 'module') {return;} + + if (node.callee.type !== 'Identifier') {return;} + if (node.callee.name !== 'require' && node.callee.name !== 'define') {return;} + + // todo: capture define((require, module, exports) => {}) form? + if (node.arguments.length !== 2) {return;} + + var modules = node.arguments[0]; + if (modules.type !== 'ArrayExpression') {return;} + + // todo: check second arg type? (identifier or callback) + + context.report(node, 'Expected imports instead of AMD ' + String(node.callee.name) + '().'); + }return CallExpression;}() }; + + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1hbWQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJjb250ZXh0IiwiQ2FsbEV4cHJlc3Npb24iLCJub2RlIiwiY2FsbGVlIiwibmFtZSIsImFyZ3VtZW50cyIsImxlbmd0aCIsIm1vZHVsZXMiLCJyZXBvcnQiXSwibWFwcGluZ3MiOiI7Ozs7O0FBS0E7O0FBRUEscUM7O0FBRUE7QUFDQTtBQUNBO0FBWEE7OztHQWFBQSxPQUFPQyxPQUFQLEdBQWlCLEVBQ2ZDLE1BQU0sRUFDSkMsTUFBTSxZQURGO0FBRUpDLFVBQU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aW5lJykgeyByZXR1cm47IH1cblxuICAgICAgICAvLyB0b2RvOiBjYXB0dXJlIGRlZmluZSgocmVxdWlyZSwgbW9kdWxlLCBleHBvcnRzKSA9PiB7fSkgZm9ybT9cbiAgICAgICAgaWYgKG5vZGUuYXJndW1lbnRzLmxlbmd0aCAhPT0gMikgeyByZXR1cm47IH1cblxuICAgICAgICBjb25zdCBtb2R1bGVzID0gbm9kZS5hcmd1bWVudHNbMF07XG4gICAgICAgIGlmIChtb2R1bGVzLnR5cGUgIT09ICdBcnJheUV4cHJlc3Npb24nKSB7IHJldHVybjsgfVxuXG4gICAgICAgIC8vIHRvZG86IGNoZWNrIHNlY29uZCBhcmcgdHlwZT8gKGlkZW50aWZpZXIgb3IgY2FsbGJhY2spXG5cbiAgICAgICAgY29udGV4dC5yZXBvcnQobm9kZSwgYEV4cGVjdGVkIGltcG9ydHMgaW5zdGVhZCBvZiBBTUQgJHtub2RlLmNhbGxlZS5uYW1lfSgpLmApO1xuICAgICAgfSxcbiAgICB9O1xuXG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-anonymous-default-export.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-anonymous-default-export.js new file mode 100644 index 0000000000000000000000000000000000000000..82c8303e065bee6b68675e8dbeaa4087977834b9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-anonymous-default-export.js @@ -0,0 +1,103 @@ +'use strict'; + + + + +var _hasown = require('hasown');var _hasown2 = _interopRequireDefault(_hasown); +var _object = require('object.values');var _object2 = _interopRequireDefault(_object); +var _object3 = require('object.fromentries');var _object4 = _interopRequireDefault(_object3); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /** + * @fileoverview Rule to disallow anonymous default exports. + * @author Duncan Beevers + */var defs = { ArrayExpression: { + option: 'allowArray', + description: 'If `false`, will report default export of an array', + message: 'Assign array to a variable before exporting as module default' }, + + ArrowFunctionExpression: { + option: 'allowArrowFunction', + description: 'If `false`, will report default export of an arrow function', + message: 'Assign arrow function to a variable before exporting as module default' }, + + CallExpression: { + option: 'allowCallExpression', + description: 'If `false`, will report default export of a function call', + message: 'Assign call result to a variable before exporting as module default', + 'default': true }, + + ClassDeclaration: { + option: 'allowAnonymousClass', + description: 'If `false`, will report default export of an anonymous class', + message: 'Unexpected default export of anonymous class', + forbid: function () {function forbid(node) {return !node.declaration.id;}return forbid;}() }, + + FunctionDeclaration: { + option: 'allowAnonymousFunction', + description: 'If `false`, will report default export of an anonymous function', + message: 'Unexpected default export of anonymous function', + forbid: function () {function forbid(node) {return !node.declaration.id;}return forbid;}() }, + + Literal: { + option: 'allowLiteral', + description: 'If `false`, will report default export of a literal', + message: 'Assign literal to a variable before exporting as module default' }, + + ObjectExpression: { + option: 'allowObject', + description: 'If `false`, will report default export of an object expression', + message: 'Assign object to a variable before exporting as module default' }, + + TemplateLiteral: { + option: 'allowLiteral', + description: 'If `false`, will report default export of a literal', + message: 'Assign literal to a variable before exporting as module default' }, + + NewExpression: { + option: 'allowNew', + description: 'If `false`, will report default export of a class instantiation', + message: 'Assign instance to a variable before exporting as module default' } }; + + + +var schemaProperties = (0, _object4['default'])((0, _object2['default'])(defs).map(function (def) {return [def.option, { + description: def.description, + type: 'boolean' }];})); + + +var defaults = (0, _object4['default'])((0, _object2['default'])(defs).map(function (def) {return [def.option, (0, _hasown2['default'])(def, 'default') ? def['default'] : false];})); + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Forbid anonymous values as default exports.', + url: (0, _docsUrl2['default'])('no-anonymous-default-export') }, + + + schema: [ + { + type: 'object', + properties: schemaProperties, + additionalProperties: false }] }, + + + + + create: function () {function create(context) { + var options = Object.assign({}, defaults, context.options[0]); + + return { + ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) { + var def = defs[node.declaration.type]; + + // Recognized node type and allowed by configuration, + // and has no forbid check, or forbid check return value is truthy + if (def && !options[def.option] && (!def.forbid || def.forbid(node))) { + context.report({ node: node, message: def.message }); + } + }return ExportDefaultDeclaration;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1hbm9ueW1vdXMtZGVmYXVsdC1leHBvcnQuanMiXSwibmFtZXMiOlsiZGVmcyIsIkFycmF5RXhwcmVzc2lvbiIsIm9wdGlvbiIsImRlc2NyaXB0aW9uIiwibWVzc2FnZSIsIkFycm93RnVuY3Rpb25FeHByZXNzaW9uIiwiQ2FsbEV4cHJlc3Npb24iLCJDbGFzc0RlY2xhcmF0aW9uIiwiZm9yYmlkIiwibm9kZSIsImRlY2xhcmF0aW9uIiwiaWQiLCJGdW5jdGlvbkRlY2xhcmF0aW9uIiwiTGl0ZXJhbCIsIk9iamVjdEV4cHJlc3Npb24iLCJUZW1wbGF0ZUxpdGVyYWwiLCJOZXdFeHByZXNzaW9uIiwic2NoZW1hUHJvcGVydGllcyIsIm1hcCIsImRlZiIsInR5cGUiLCJkZWZhdWx0cyIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwiZG9jcyIsImNhdGVnb3J5IiwidXJsIiwic2NoZW1hIiwicHJvcGVydGllcyIsImFkZGl0aW9uYWxQcm9wZXJ0aWVzIiwiY3JlYXRlIiwiY29udGV4dCIsIm9wdGlvbnMiLCJFeHBvcnREZWZhdWx0RGVjbGFyYXRpb24iLCJyZXBvcnQiXSwibWFwcGluZ3MiOiI7Ozs7O0FBS0EsZ0M7QUFDQSx1QztBQUNBLDZDOztBQUVBLHFDLGlKQVRBOzs7eUxBV0EsSUFBTUEsT0FBTyxFQUNYQyxpQkFBaUI7QUFDZkMsWUFBUSxZQURPO0FBRWZDLGlCQUFhL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gIF0sXG4gIH0sXG5cbiAgY3JlYXRlKGNvbnRleHQpIHtcbiAgICBjb25zdCBvcHRpb25zID0geyAuLi5kZWZhdWx0cywgLi4uY29udGV4dC5vcHRpb25zWzBdIH07XG5cbiAgICByZXR1cm4ge1xuICAgICAgRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uKG5vZGUpIHtcbiAgICAgICAgY29uc3QgZGVmID0gZGVmc1tub2RlLmRlY2xhcmF0aW9uLnR5cGVdO1xuXG4gICAgICAgIC8vIFJlY29nbml6ZWQgbm9kZSB0eXBlIGFuZCBhbGxvd2VkIGJ5IGNvbmZpZ3VyYXRpb24sXG4gICAgICAgIC8vICAgYW5kIGhhcyBubyBmb3JiaWQgY2hlY2ssIG9yIGZvcmJpZCBjaGVjayByZXR1cm4gdmFsdWUgaXMgdHJ1dGh5XG4gICAgICAgIGlmIChkZWYgJiYgIW9wdGlvbnNbZGVmLm9wdGlvbl0gJiYgKCFkZWYuZm9yYmlkIHx8IGRlZi5mb3JiaWQobm9kZSkpKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoeyBub2RlLCBtZXNzYWdlOiBkZWYubWVzc2FnZSB9KTtcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-commonjs.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-commonjs.js new file mode 100644 index 0000000000000000000000000000000000000000..2d8656970b58d6963407eb9cbeeb2406385595bd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-commonjs.js @@ -0,0 +1,143 @@ +'use strict'; + + + + +var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /** + * @fileoverview Rule to prefer ES6 to CJS + * @author Jamund Ferguson + */var EXPORT_MESSAGE = 'Expected "export" or "export default"';var IMPORT_MESSAGE = 'Expected "import" instead of "require()"'; + +function normalizeLegacyOptions(options) { + if (options.indexOf('allow-primitive-modules') >= 0) { + return { allowPrimitiveModules: true }; + } + return options[0] || {}; +} + +function allowPrimitive(node, options) { + if (!options.allowPrimitiveModules) {return false;} + if (node.parent.type !== 'AssignmentExpression') {return false;} + return node.parent.right.type !== 'ObjectExpression'; +} + +function allowRequire(node, options) { + return options.allowRequire; +} + +function allowConditionalRequire(node, options) { + return options.allowConditionalRequire !== false; +} + +function validateScope(scope) { + return scope.variableScope.type === 'module'; +} + +// https://github.com/estree/estree/blob/HEAD/es5.md +function isConditional(node) { + if ( + node.type === 'IfStatement' || + node.type === 'TryStatement' || + node.type === 'LogicalExpression' || + node.type === 'ConditionalExpression') + { + return true; + } + if (node.parent) {return isConditional(node.parent);} + return false; +} + +function isLiteralString(node) { + return node.type === 'Literal' && typeof node.value === 'string' || + node.type === 'TemplateLiteral' && node.expressions.length === 0; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +var schemaString = { 'enum': ['allow-primitive-modules'] }; +var schemaObject = { + type: 'object', + properties: { + allowPrimitiveModules: { type: 'boolean' }, + allowRequire: { type: 'boolean' }, + allowConditionalRequire: { type: 'boolean' } }, + + additionalProperties: false }; + + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Module systems', + description: 'Forbid CommonJS `require` calls and `module.exports` or `exports.*`.', + url: (0, _docsUrl2['default'])('no-commonjs') }, + + + schema: { + anyOf: [ + { + type: 'array', + items: [schemaString], + additionalItems: false }, + + { + type: 'array', + items: [schemaObject], + additionalItems: false }] } }, + + + + + + create: function () {function create(context) { + var options = normalizeLegacyOptions(context.options); + + return { + + MemberExpression: function () {function MemberExpression(node) { + + // module.exports + if (node.object.name === 'module' && node.property.name === 'exports') { + if (allowPrimitive(node, options)) {return;} + context.report({ node: node, message: EXPORT_MESSAGE }); + } + + // exports. + if (node.object.name === 'exports') { + var isInScope = (0, _contextCompat.getScope)(context, node). + variables. + some(function (variable) {return variable.name === 'exports';}); + if (!isInScope) { + context.report({ node: node, message: EXPORT_MESSAGE }); + } + } + + }return MemberExpression;}(), + CallExpression: function () {function CallExpression(call) { + if (!validateScope((0, _contextCompat.getScope)(context, call))) {return;} + + if (call.callee.type !== 'Identifier') {return;} + if (call.callee.name !== 'require') {return;} + + if (call.arguments.length !== 1) {return;} + if (!isLiteralString(call.arguments[0])) {return;} + + if (allowRequire(call, options)) {return;} + + if (allowConditionalRequire(call, options) && isConditional(call.parent)) {return;} + + // keeping it simple: all 1-string-arg `require` calls are reported + context.report({ + node: call.callee, + message: IMPORT_MESSAGE }); + + }return CallExpression;}() }; + + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1jb21tb25qcy5qcyJdLCJuYW1lcyI6WyJFWFBPUlRfTUVTU0FHRSIsIklNUE9SVF9NRVNTQUdFIiwibm9ybWFsaXplTGVnYWN5T3B0aW9ucyIsIm9wdGlvbnMiLCJpbmRleE9mIiwiYWxsb3dQcmltaXRpdmVNb2R1bGVzIiwiYWxsb3dQcmltaXRpdmUiLCJub2RlIiwicGFyZW50IiwidHlwZSIsInJpZ2h0IiwiYWxsb3dSZXF1aXJlIiwiYWxsb3dDb25kaXRpb25hbFJlcXVpcmUiLCJ2YWxpZGF0ZVNjb3BlIiwic2NvcGUiLCJ2YXJpYWJsZVNjb3BlIiwiaXNDb25kaXRpb25hbCIsImlzTGl0ZXJhbFN0cmluZyIsInZhbHVlIiwiZXhwcmVzc2lvbnMiLCJsZW5ndGgiLCJzY2hlbWFTdHJpbmciLCJzY2hlbWFPYmplY3QiLCJwcm9wZXJ0aWVzIiwiYWRkaXRpb25hbFByb3BlcnRpZXMiLCJtb2R1bGUiLC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J0cy5cbiAgICAgICAgaWYgKG5vZGUub2JqZWN0Lm5hbWUgPT09ICdleHBvcnRzJykge1xuICAgICAgICAgIGNvbnN0IGlzSW5TY29wZSA9IGdldFNjb3BlKGNvbnRleHQsIG5vZGUpXG4gICAgICAgICAgICAudmFyaWFibGVzXG4gICAgICAgICAgICAuc29tZSgodmFyaWFibGUpID0+IHZhcmlhYmxlLm5hbWUgPT09ICdleHBvcnRzJyk7XG4gICAgICAgICAgaWYgKCFpc0luU2NvcGUpIHtcbiAgICAgICAgICAgIGNvbnRleHQucmVwb3J0KHsgbm9kZSwgbWVzc2FnZTogRVhQT1JUX01FU1NBR0UgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgIH0sXG4gICAgICBDYWxsRXhwcmVzc2lvbihjYWxsKSB7XG4gICAgICAgIGlmICghdmFsaWRhdGVTY29wZShnZXRTY29wZShjb250ZXh0LCBjYWxsKSkpIHsgcmV0dXJuOyB9XG5cbiAgICAgICAgaWYgKGNhbGwuY2FsbGVlLnR5cGUgIT09ICdJZGVudGlmaWVyJykgeyByZXR1cm47IH1cbiAgICAgICAgaWYgKGNhbGwuY2FsbGVlLm5hbWUgIT09ICdyZXF1aXJlJykgeyByZXR1cm47IH1cblxuICAgICAgICBpZiAoY2FsbC5hcmd1bWVudHMubGVuZ3RoICE9PSAxKSB7IHJldHVybjsgfVxuICAgICAgICBpZiAoIWlzTGl0ZXJhbFN0cmluZyhjYWxsLmFyZ3VtZW50c1swXSkpIHsgcmV0dXJuOyB9XG5cbiAgICAgICAgaWYgKGFsbG93UmVxdWlyZShjYWxsLCBvcHRpb25zKSkgeyByZXR1cm47IH1cblxuICAgICAgICBpZiAoYWxsb3dDb25kaXRpb25hbFJlcXVpcmUoY2FsbCwgb3B0aW9ucykgJiYgaXNDb25kaXRpb25hbChjYWxsLnBhcmVudCkpIHsgcmV0dXJuOyB9XG5cbiAgICAgICAgLy8ga2VlcGluZyBpdCBzaW1wbGU6IGFsbCAxLXN0cmluZy1hcmcgYHJlcXVpcmVgIGNhbGxzIGFyZSByZXBvcnRlZFxuICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgbm9kZTogY2FsbC5jYWxsZWUsXG4gICAgICAgICAgbWVzc2FnZTogSU1QT1JUX01FU1NBR0UsXG4gICAgICAgIH0pO1xuICAgICAgfSxcbiAgICB9O1xuXG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-cycle.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-cycle.js new file mode 100644 index 0000000000000000000000000000000000000000..1451dc1a47687bdb1277017bc60293ad1292f0d8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-cycle.js @@ -0,0 +1,180 @@ +'use strict';var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}(); /** + * @fileOverview Ensures that no imported module imports the linted module. + * @author Ben Mosher + */ + +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); + +var _builder = require('../exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _scc = require('../scc');var _scc2 = _interopRequireDefault(_scc); +var _importType = require('../core/importType'); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _toConsumableArray(arr) {if (Array.isArray(arr)) {for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {arr2[i] = arr[i];}return arr2;} else {return Array.from(arr);}} + +var traversed = new Set(); + +function routeString(route) { + return route.map(function (s) {return String(s.value) + ':' + String(s.loc.start.line);}).join('=>'); +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Static analysis', + description: 'Forbid a module from importing a module with a dependency path back to itself.', + url: (0, _docsUrl2['default'])('no-cycle') }, + + schema: [(0, _moduleVisitor.makeOptionsSchema)({ + maxDepth: { + anyOf: [ + { + description: 'maximum dependency depth to traverse', + type: 'integer', + minimum: 1 }, + + { + 'enum': ['∞'], + type: 'string' }] }, + + + + ignoreExternal: { + description: 'ignore external modules', + type: 'boolean', + 'default': false }, + + allowUnsafeDynamicCyclicDependency: { + description: 'Allow cyclic dependency if there is at least one dynamic import in the chain', + type: 'boolean', + 'default': false }, + + disableScc: { + description: 'When true, don\'t calculate a strongly-connected-components graph. SCC is used to reduce the time-complexity of cycle detection, but adds overhead.', + type: 'boolean', + 'default': false } })] }, + + + + + create: function () {function create(context) { + var myPath = (0, _contextCompat.getPhysicalFilename)(context); + if (myPath === '') {return {};} // can't cycle-check a non-file + + var options = context.options[0] || {}; + var maxDepth = typeof options.maxDepth === 'number' ? options.maxDepth : Infinity; + var ignoreModule = function () {function ignoreModule(name) {return options.ignoreExternal && (0, _importType.isExternalModule)( + name, + (0, _resolve2['default'])(name, context), + context);}return ignoreModule;}(); + + + var scc = options.disableScc ? {} : _scc2['default'].get(myPath, context); + + function checkSourceValue(sourceNode, importer) { + if (ignoreModule(sourceNode.value)) { + return; // ignore external modules + } + if ( + options.allowUnsafeDynamicCyclicDependency && ( + // Ignore `import()` + importer.type === 'ImportExpression' + // `require()` calls are always checked (if possible) + || importer.type === 'CallExpression' && importer.callee.name !== 'require')) + + { + return; // cycle via dynamic import allowed by config + } + + if ( + importer.type === 'ImportDeclaration' && ( + // import type { Foo } (TS and Flow) + importer.importKind === 'type' + // import { type Foo } (Flow) + || importer.specifiers.every(function (_ref) {var importKind = _ref.importKind;return importKind === 'type';}))) + + { + return; // ignore type imports + } + + var imported = _builder2['default'].get(sourceNode.value, context); + + if (imported == null) { + return; // no-unresolved territory + } + + if (imported.path === myPath) { + return; // no-self-import territory + } + + /* If we're in the same Strongly Connected Component, + * Then there exists a path from each node in the SCC to every other node in the SCC, + * Then there exists at least one path from them to us and from us to them, + * Then we have a cycle between us. + */ + var hasDependencyCycle = options.disableScc || scc[myPath] === scc[imported.path]; + if (!hasDependencyCycle) { + return; + } + + var untraversed = [{ mget: function () {function mget() {return imported;}return mget;}(), route: [] }]; + function detectCycle(_ref2) {var mget = _ref2.mget,route = _ref2.route; + var m = mget(); + if (m == null) {return;} + if (traversed.has(m.path)) {return;} + traversed.add(m.path);var _loop = function () {function _loop( + + path, getter, declarations) { + // If we're in different SCCs, we can't have a circular dependency + if (!options.disableScc && scc[myPath] !== scc[path]) {return 'continue';} + + if (traversed.has(path)) {return 'continue';} + var toTraverse = [].concat(_toConsumableArray(declarations)).filter(function (_ref5) {var source = _ref5.source,isOnlyImportingTypes = _ref5.isOnlyImportingTypes;return !ignoreModule(source.value) + // Ignore only type imports + && !isOnlyImportingTypes;}); + + + /* + If cyclic dependency is allowed via dynamic import, skip checking if any module is imported dynamically + */ + if (options.allowUnsafeDynamicCyclicDependency && toTraverse.some(function (d) {return d.dynamic;})) {return { v: void 0 };} + + /* + Only report as a cycle if there are any import declarations that are considered by + the rule. For example: + a.ts: + import { foo } from './b' // should not be reported as a cycle + b.ts: + import type { Bar } from './a' + */ + + + if (path === myPath && toTraverse.length > 0) {return { v: true };} + if (route.length + 1 < maxDepth) { + toTraverse.forEach(function (_ref6) {var source = _ref6.source; + untraversed.push({ mget: getter, route: route.concat(source) }); + }); + }}return _loop;}();var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try {for (var _iterator = m.imports[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var _ref3 = _step.value;var _ref4 = _slicedToArray(_ref3, 2);var path = _ref4[0];var _ref4$ = _ref4[1];var getter = _ref4$.getter;var declarations = _ref4$.declarations;var _ret = _loop(path, getter, declarations);switch (_ret) {case 'continue':continue;default:if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;} + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + } + + while (untraversed.length > 0) { + var next = untraversed.shift(); // bfs! + if (detectCycle(next)) { + var message = next.route.length > 0 ? 'Dependency cycle via ' + String( + routeString(next.route)) : + 'Dependency cycle detected.'; + context.report(importer, message); + return; + } + } + } + + return Object.assign((0, _moduleVisitor2['default'])(checkSourceValue, context.options[0]), { + 'Program:exit': function () {function ProgramExit() { + traversed.clear(); + }return ProgramExit;}() }); + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1jeWNsZS5qcyJdLCJuYW1lcyI6WyJ0cmF2ZXJzZWQiLCJTZXQiLCJyb3V0ZVN0cmluZyIsInJvdXRlIiwibWFwIiwicyIsInZhbHVlIiwibG9jIiwic3RhcnQiLCJsaW5lIiwiam9pbiIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwibW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BtZXNzYWdlKTtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gT2JqZWN0LmFzc2lnbihtb2R1bGVWaXNpdG9yKGNoZWNrU291cmNlVmFsdWUsIGNvbnRleHQub3B0aW9uc1swXSksIHtcbiAgICAgICdQcm9ncmFtOmV4aXQnKCkge1xuICAgICAgICB0cmF2ZXJzZWQuY2xlYXIoKTtcbiAgICAgIH0sXG4gICAgfSk7XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-default-export.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-default-export.js new file mode 100644 index 0000000000000000000000000000000000000000..2fc8b0f950014c09cea77f5cad98b0d3007f5009 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-default-export.js @@ -0,0 +1,46 @@ +'use strict';var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl); +var _sourceType = require('../core/sourceType');var _sourceType2 = _interopRequireDefault(_sourceType);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Forbid default exports.', + url: (0, _docsUrl2['default'])('no-default-export') }, + + schema: [] }, + + + create: function () {function create(context) { + // ignore non-modules + if ((0, _sourceType2['default'])(context) !== 'module') { + return {}; + } + + var preferNamed = 'Prefer named exports.'; + var noAliasDefault = function () {function noAliasDefault(_ref) {var local = _ref.local;return 'Do not alias `' + String(local.name) + '` as `default`. Just export `' + String(local.name) + '` itself instead.';}return noAliasDefault;}(); + + return { + ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) {var _ref2 = + (0, _contextCompat.getSourceCode)(context).getFirstTokens(node)[1] || {},loc = _ref2.loc; + context.report({ node: node, message: preferNamed, loc: loc }); + }return ExportDefaultDeclaration;}(), + + ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { + node.specifiers. + filter(function (specifier) {return (specifier.exported.name || specifier.exported.value) === 'default';}). + forEach(function (specifier) {var _ref3 = + (0, _contextCompat.getSourceCode)(context).getFirstTokens(node)[1] || {},loc = _ref3.loc; + if (specifier.type === 'ExportDefaultSpecifier') { + context.report({ node: node, message: preferNamed, loc: loc }); + } else if (specifier.type === 'ExportSpecifier') { + context.report({ node: node, message: noAliasDefault(specifier), loc: loc }); + } + }); + }return ExportNamedDeclaration;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1kZWZhdWx0LWV4cG9ydC5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwiY2F0ZWdvcnkiLCJkZXNjcmlwdGlvbiIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJwcmVmZXJOYW1lZCIsIm5vQWxpYXNEZWZhdWx0IiwibG9jYWwiLCJuYW1lIiwiRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uIiwibm9kZSIsImdldEZpcnN0VG9rZW5zIiwibG9jIiwicmVwb3J0IiwibWVzc2FnZSIsIkV4cG9ydE5hbWVkRGVjbGFyYXRpb24iLCJzcGVjaWZpZXJzIiwiZmlsdGVyIiwic3BlY2lmaWVyIiwiZXhwb3J0ZWQiLCJ2YWx1ZSIsImZvckVhY2giXSwibWFwcGluZ3MiOiJhQUFBOztBQUVBLHFDO0FBQ0EsZ0Q7O0FBRUFBLE9BQU9DLE9BQVAsR0FBaUI7QUFDZkMsUUFBTTtBQUNKQyxVQUFNLFlBREY7QUFFSkMsVUFBTTtBQUNKQyxnQkFBVSxhQUROO0FBRUpDLG1CQUFhLH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c3NhZ2U6IHByZWZlck5hbWVkLCBsb2MgfSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHNwZWNpZmllci50eXBlID09PSAnRXhwb3J0U3BlY2lmaWVyJykge1xuICAgICAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7IG5vZGUsIG1lc3NhZ2U6IG5vQWxpYXNEZWZhdWx0KHNwZWNpZmllciksIGxvYyAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSk7XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-deprecated.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-deprecated.js new file mode 100644 index 0000000000000000000000000000000000000000..f103a3d957030052a5933560783b227cf5c3f80e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-deprecated.js @@ -0,0 +1,139 @@ +'use strict';var _declaredScope = require('eslint-module-utils/declaredScope');var _declaredScope2 = _interopRequireDefault(_declaredScope); +var _builder = require('../exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _exportMap = require('../exportMap');var _exportMap2 = _interopRequireDefault(_exportMap); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function message(deprecation) { + return 'Deprecated' + (deprecation.description ? ': ' + String(deprecation.description) : '.'); +} + +function getDeprecation(metadata) { + if (!metadata || !metadata.doc) {return;} + + return metadata.doc.tags.find(function (t) {return t.title === 'deprecated';}); +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Helpful warnings', + description: 'Forbid imported names marked with `@deprecated` documentation tag.', + url: (0, _docsUrl2['default'])('no-deprecated') }, + + schema: [] }, + + + create: function () {function create(context) { + var deprecated = new Map(); + var namespaces = new Map(); + + function checkSpecifiers(node) { + if (node.type !== 'ImportDeclaration') {return;} + if (node.source == null) {return;} // local export, ignore + + var imports = _builder2['default'].get(node.source.value, context); + if (imports == null) {return;} + + var moduleDeprecation = imports.doc && imports.doc.tags.find(function (t) {return t.title === 'deprecated';}); + if (moduleDeprecation) { + context.report({ node: node, message: message(moduleDeprecation) }); + } + + if (imports.errors.length) { + imports.reportErrors(context, node); + return; + } + + node.specifiers.forEach(function (im) { + var imported = void 0;var local = void 0; + switch (im.type) { + + case 'ImportNamespaceSpecifier':{ + if (!imports.size) {return;} + namespaces.set(im.local.name, imports); + return; + } + + case 'ImportDefaultSpecifier': + imported = 'default'; + local = im.local.name; + break; + + case 'ImportSpecifier': + imported = im.imported.name; + local = im.local.name; + break; + + default:return; // can't handle this one + } + + // unknown thing can't be deprecated + var exported = imports.get(imported); + if (exported == null) {return;} + + // capture import of deep namespace + if (exported.namespace) {namespaces.set(local, exported.namespace);} + + var deprecation = getDeprecation(imports.get(imported)); + if (!deprecation) {return;} + + context.report({ node: im, message: message(deprecation) }); + + deprecated.set(local, deprecation); + + }); + } + + return { + Program: function () {function Program(_ref) {var body = _ref.body;return body.forEach(checkSpecifiers);}return Program;}(), + + Identifier: function () {function Identifier(node) { + if (node.parent.type === 'MemberExpression' && node.parent.property === node) { + return; // handled by MemberExpression + } + + // ignore specifier identifiers + if (node.parent.type.slice(0, 6) === 'Import') {return;} + + if (!deprecated.has(node.name)) {return;} + + if ((0, _declaredScope2['default'])(context, node.name, node) !== 'module') {return;} + context.report({ + node: node, + message: message(deprecated.get(node.name)) }); + + }return Identifier;}(), + + MemberExpression: function () {function MemberExpression(dereference) { + if (dereference.object.type !== 'Identifier') {return;} + if (!namespaces.has(dereference.object.name)) {return;} + + if ((0, _declaredScope2['default'])(context, dereference.object.name, dereference) !== 'module') {return;} + + // go deep + var namespace = namespaces.get(dereference.object.name); + var namepath = [dereference.object.name]; + // while property is namespace and parent is member expression, keep validating + while (namespace instanceof _exportMap2['default'] && dereference.type === 'MemberExpression') { + // ignore computed parts for now + if (dereference.computed) {return;} + + var metadata = namespace.get(dereference.property.name); + + if (!metadata) {break;} + var deprecation = getDeprecation(metadata); + + if (deprecation) { + context.report({ node: dereference.property, message: message(deprecation) }); + } + + // stash and pop + namepath.push(dereference.property.name); + namespace = metadata.namespace; + dereference = dereference.parent; + } + }return MemberExpression;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1kZXByZWNhdGVkLmpzIl0sIm5hbWVzIjpbIm1lc3NhZ2UiLCJkZXByZWNhdGlvbiIsImRlc2NyaXB0aW9uIiwiZ2V0RGVwcmVjYXRpb24iLCJtZXRhZGF0YSIsImRvYyIsInRhZ3MiLCJmaW5kIiwidCIsInRpdGxlIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsImRlcHJlY2F0ZWQiLCJNYXAiLCJuYW1lc3BhY2VzIiwiY2hlY2tTcGVjaWZpZXJzIiwibm9kZSIsInNvdXJjZSIsImltcG9ydHMiLCJFeHBvcnRNYXBCdWlsZGVyIiwiZ2V0IiwidmFsdWUiLCJtb2R1bGVEZXByZWNhdGlvbiIsInJlcG9ydCIsImVycm9ycyIsImxlbmd0aCIsInJlcG9ydEVycm9ycyIsInNwZWNpZmllcnMiLCJmb3JFYWNoIiwiaW0iLCJpbXBvcnRlZCIsImxvY2FsIiwic2l6ZSIsInNldCIsIm5hbWUiLCJleHBvcnRlZCIsIm5hbWVzcGFjZSIsIlByb2dyYW0iLCJib2R5IiwiSWRlbnRpZmllciIsInBhcmVudCIsInByb3BlcnR5Iiwic2xpY2UiLCJoYXMiLCJNZW1iZXJFeHByZXNzaW9uIiwiZGVyZWZlcmVuY2UiLCJvYmplY3QiLCJuYW1lcGF0aCIsI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mZXJlbmNlLnBhcmVudDtcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-duplicates.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-duplicates.js new file mode 100644 index 0000000000000000000000000000000000000000..ab8010673a59de6d1f93e595c1b9561673098eca --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-duplicates.js @@ -0,0 +1,379 @@ +'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _contextCompat = require('eslint-module-utils/contextCompat'); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _semver = require('semver');var _semver2 = _interopRequireDefault(_semver); +var _arrayPrototype = require('array.prototype.flatmap');var _arrayPrototype2 = _interopRequireDefault(_arrayPrototype); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _toArray(arr) {return Array.isArray(arr) ? arr : Array.from(arr);} + +var typescriptPkg = void 0; +try { + typescriptPkg = require('typescript/package.json'); // eslint-disable-line import/no-extraneous-dependencies +} catch (e) {/**/} + +function isPunctuator(node, value) { + return node.type === 'Punctuator' && node.value === value; +} + +// Get the name of the default import of `node`, if any. +function getDefaultImportName(node) { + var defaultSpecifier = node.specifiers. + find(function (specifier) {return specifier.type === 'ImportDefaultSpecifier';}); + return defaultSpecifier != null ? defaultSpecifier.local.name : undefined; +} + +// Checks whether `node` has a namespace import. +function hasNamespace(node) { + var specifiers = node.specifiers. + filter(function (specifier) {return specifier.type === 'ImportNamespaceSpecifier';}); + return specifiers.length > 0; +} + +// Checks whether `node` has any non-default specifiers. +function hasSpecifiers(node) { + var specifiers = node.specifiers. + filter(function (specifier) {return specifier.type === 'ImportSpecifier';}); + return specifiers.length > 0; +} + +// Checks whether `node` has a comment (that ends) on the previous line or on +// the same line as `node` (starts). +function hasCommentBefore(node, sourceCode) { + return sourceCode.getCommentsBefore(node). + some(function (comment) {return comment.loc.end.line >= node.loc.start.line - 1;}); +} + +// Checks whether `node` has a comment (that starts) on the same line as `node` +// (ends). +function hasCommentAfter(node, sourceCode) { + return sourceCode.getCommentsAfter(node). + some(function (comment) {return comment.loc.start.line === node.loc.end.line;}); +} + +// Checks whether `node` has any comments _inside,_ except inside the `{...}` +// part (if any). +function hasCommentInsideNonSpecifiers(node, sourceCode) { + var tokens = sourceCode.getTokens(node); + var openBraceIndex = tokens.findIndex(function (token) {return isPunctuator(token, '{');}); + var closeBraceIndex = tokens.findIndex(function (token) {return isPunctuator(token, '}');}); + // Slice away the first token, since we're no looking for comments _before_ + // `node` (only inside). If there's a `{...}` part, look for comments before + // the `{`, but not before the `}` (hence the `+1`s). + var someTokens = openBraceIndex >= 0 && closeBraceIndex >= 0 ? + tokens.slice(1, openBraceIndex + 1).concat(tokens.slice(closeBraceIndex + 1)) : + tokens.slice(1); + return someTokens.some(function (token) {return sourceCode.getCommentsBefore(token).length > 0;}); +} + +// It's not obvious what the user wants to do with comments associated with +// duplicate imports, so skip imports with comments when autofixing. +function hasProblematicComments(node, sourceCode) { + return ( + hasCommentBefore(node, sourceCode) || + hasCommentAfter(node, sourceCode) || + hasCommentInsideNonSpecifiers(node, sourceCode)); + +} + +/** @type {(first: import('estree').ImportDeclaration, rest: import('estree').ImportDeclaration[], sourceCode: import('eslint').SourceCode.SourceCode, context: import('eslint').Rule.RuleContext) => import('eslint').Rule.ReportFixer | undefined} */ +function getFix(first, rest, sourceCode, context) { + // Sorry ESLint <= 3 users, no autofix for you. Autofixing duplicate imports + // requires multiple `fixer.whatever()` calls in the `fix`: We both need to + // update the first one, and remove the rest. Support for multiple + // `fixer.whatever()` in a single `fix` was added in ESLint 4.1. + // `sourceCode.getCommentsBefore` was added in 4.0, so that's an easy thing to + // check for. + if (typeof sourceCode.getCommentsBefore !== 'function') { + return undefined; + } + + // Adjusting the first import might make it multiline, which could break + // `eslint-disable-next-line` comments and similar, so bail if the first + // import has comments. Also, if the first import is `import * as ns from + // './foo'` there's nothing we can do. + if (hasProblematicComments(first, sourceCode) || hasNamespace(first)) { + return undefined; + } + + var defaultImportNames = new Set( + (0, _arrayPrototype2['default'])([].concat(first, rest || []), function (x) {return getDefaultImportName(x) || [];})); + + + // Bail if there are multiple different default import names – it's up to the + // user to choose which one to keep. + if (defaultImportNames.size > 1) { + return undefined; + } + + // Leave it to the user to handle comments. Also skip `import * as ns from + // './foo'` imports, since they cannot be merged into another import. + var restWithoutComments = rest.filter(function (node) {return !hasProblematicComments(node, sourceCode) && !hasNamespace(node);}); + + var specifiers = restWithoutComments. + map(function (node) { + var tokens = sourceCode.getTokens(node); + var openBrace = tokens.find(function (token) {return isPunctuator(token, '{');}); + var closeBrace = tokens.find(function (token) {return isPunctuator(token, '}');}); + + if (openBrace == null || closeBrace == null) { + return undefined; + } + + return { + importNode: node, + identifiers: sourceCode.text.slice(openBrace.range[1], closeBrace.range[0]).split(','), // Split the text into separate identifiers (retaining any whitespace before or after) + isEmpty: !hasSpecifiers(node) }; + + }). + filter(function (x) {return !!x;}); + + var unnecessaryImports = restWithoutComments.filter(function (node) {return !hasSpecifiers(node) && + !hasNamespace(node) && + !specifiers.some(function (specifier) {return specifier.importNode === node;});}); + + + var shouldAddDefault = getDefaultImportName(first) == null && defaultImportNames.size === 1; + var shouldAddSpecifiers = specifiers.length > 0; + var shouldRemoveUnnecessary = unnecessaryImports.length > 0; + var preferInline = context.options[0] && context.options[0]['prefer-inline']; + + if (!(shouldAddDefault || shouldAddSpecifiers || shouldRemoveUnnecessary)) { + return undefined; + } + + /** @type {import('eslint').Rule.ReportFixer} */ + return function (fixer) { + var tokens = sourceCode.getTokens(first); + var openBrace = tokens.find(function (token) {return isPunctuator(token, '{');}); + var closeBrace = tokens.find(function (token) {return isPunctuator(token, '}');}); + var firstToken = sourceCode.getFirstToken(first);var _defaultImportNames = _slicedToArray( + defaultImportNames, 1),defaultImportName = _defaultImportNames[0]; + + var firstHasTrailingComma = closeBrace != null && isPunctuator(sourceCode.getTokenBefore(closeBrace), ','); + var firstIsEmpty = !hasSpecifiers(first); + var firstExistingIdentifiers = firstIsEmpty ? + new Set() : + new Set(sourceCode.text.slice(openBrace.range[1], closeBrace.range[0]). + split(','). + map(function (x) {return x.trim();}));var _specifiers$reduce = + + + specifiers.reduce( + function (_ref, specifier) {var _ref2 = _slicedToArray(_ref, 3),result = _ref2[0],needsComma = _ref2[1],existingIdentifiers = _ref2[2]; + var isTypeSpecifier = specifier.importNode.importKind === 'type'; + + // a user might set prefer-inline but not have a supporting TypeScript version. Flow does not support inline types so this should fail in that case as well. + if (preferInline && (!typescriptPkg || !_semver2['default'].satisfies(typescriptPkg.version, '>= 4.5'))) { + throw new Error('Your version of TypeScript does not support inline type imports.'); + } + + // Add *only* the new identifiers that don't already exist, and track any new identifiers so we don't add them again in the next loop + var _specifier$identifier = specifier.identifiers.reduce(function (_ref3, cur) {var _ref4 = _slicedToArray(_ref3, 2),text = _ref4[0],set = _ref4[1]; + var trimmed = cur.trim(); // Trim whitespace before/after to compare to our set of existing identifiers + var curWithType = trimmed.length > 0 && preferInline && isTypeSpecifier ? 'type ' + String(cur) : cur; + if (existingIdentifiers.has(trimmed)) { + return [text, set]; + } + return [text.length > 0 ? String(text) + ',' + String(curWithType) : curWithType, set.add(trimmed)]; + }, ['', existingIdentifiers]),_specifier$identifier2 = _slicedToArray(_specifier$identifier, 2),specifierText = _specifier$identifier2[0],updatedExistingIdentifiers = _specifier$identifier2[1]; + + return [ + needsComma && !specifier.isEmpty && specifierText.length > 0 ? String( + result) + ',' + String(specifierText) : '' + String( + result) + String(specifierText), + specifier.isEmpty ? needsComma : true, + updatedExistingIdentifiers]; + + }, + ['', !firstHasTrailingComma && !firstIsEmpty, firstExistingIdentifiers]),_specifiers$reduce2 = _slicedToArray(_specifiers$reduce, 1),specifiersText = _specifiers$reduce2[0]; + + + /** @type {import('eslint').Rule.Fix[]} */ + var fixes = []; + + if (shouldAddSpecifiers && preferInline && first.importKind === 'type') { + // `import type {a} from './foo'` → `import {type a} from './foo'` + var typeIdentifierToken = tokens.find(function (token) {return token.type === 'Identifier' && token.value === 'type';}); + fixes.push(fixer.removeRange([typeIdentifierToken.range[0], typeIdentifierToken.range[1] + 1])); + + tokens. + filter(function (token) {return firstExistingIdentifiers.has(token.value);}). + forEach(function (identifier) { + fixes.push(fixer.replaceTextRange([identifier.range[0], identifier.range[1]], 'type ' + String(identifier.value))); + }); + } + + if (shouldAddDefault && openBrace == null && shouldAddSpecifiers) { + // `import './foo'` → `import def, {...} from './foo'` + fixes.push( + fixer.insertTextAfter(firstToken, ' ' + String(defaultImportName) + ', {' + String(specifiersText) + '} from')); + + } else if (shouldAddDefault && openBrace == null && !shouldAddSpecifiers) { + // `import './foo'` → `import def from './foo'` + fixes.push(fixer.insertTextAfter(firstToken, ' ' + String(defaultImportName) + ' from')); + } else if (shouldAddDefault && openBrace != null && closeBrace != null) { + // `import {...} from './foo'` → `import def, {...} from './foo'` + fixes.push(fixer.insertTextAfter(firstToken, ' ' + String(defaultImportName) + ',')); + if (shouldAddSpecifiers) { + // `import def, {...} from './foo'` → `import def, {..., ...} from './foo'` + fixes.push(fixer.insertTextBefore(closeBrace, specifiersText)); + } + } else if (!shouldAddDefault && openBrace == null && shouldAddSpecifiers) { + if (first.specifiers.length === 0) { + // `import './foo'` → `import {...} from './foo'` + fixes.push(fixer.insertTextAfter(firstToken, ' {' + String(specifiersText) + '} from')); + } else { + // `import def from './foo'` → `import def, {...} from './foo'` + fixes.push(fixer.insertTextAfter(first.specifiers[0], ', {' + String(specifiersText) + '}')); + } + } else if (!shouldAddDefault && openBrace != null && closeBrace != null) { + // `import {...} './foo'` → `import {..., ...} from './foo'` + fixes.push(fixer.insertTextBefore(closeBrace, specifiersText)); + } + + // Remove imports whose specifiers have been moved into the first import. + specifiers.forEach(function (specifier) { + var importNode = specifier.importNode; + fixes.push(fixer.remove(importNode)); + + var charAfterImportRange = [importNode.range[1], importNode.range[1] + 1]; + var charAfterImport = sourceCode.text.substring(charAfterImportRange[0], charAfterImportRange[1]); + if (charAfterImport === '\n') { + fixes.push(fixer.removeRange(charAfterImportRange)); + } + }); + + // Remove imports whose default import has been moved to the first import, + // and side-effect-only imports that are unnecessary due to the first + // import. + unnecessaryImports.forEach(function (node) { + fixes.push(fixer.remove(node)); + + var charAfterImportRange = [node.range[1], node.range[1] + 1]; + var charAfterImport = sourceCode.text.substring(charAfterImportRange[0], charAfterImportRange[1]); + if (charAfterImport === '\n') { + fixes.push(fixer.removeRange(charAfterImportRange)); + } + }); + + return fixes; + }; +} + +/** @type {(imported: Map, context: import('eslint').Rule.RuleContext) => void} */ +function checkImports(imported, context) {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = imported.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var _ref5 = _step.value;var _ref6 = _slicedToArray(_ref5, 2);var _module = _ref6[0];var nodes = _ref6[1]; + if (nodes.length > 1) {(function () { + var message = '\'' + String(_module) + '\' imported multiple times.';var _nodes = _toArray( + nodes),first = _nodes[0],rest = _nodes.slice(1); + var sourceCode = (0, _contextCompat.getSourceCode)(context); + var fix = getFix(first, rest, sourceCode, context); + + context.report({ + node: first.source, + message: message, + fix: fix // Attach the autofix (if any) to the first import. + }); + + rest.forEach(function (node) { + context.report({ + node: node.source, + message: message }); + + });})(); + } + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} +} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Style guide', + description: 'Forbid repeated import of the same module in multiple places.', + url: (0, _docsUrl2['default'])('no-duplicates') }, + + fixable: 'code', + schema: [ + { + type: 'object', + properties: { + considerQueryString: { + type: 'boolean' }, + + 'prefer-inline': { + type: 'boolean' } }, + + + additionalProperties: false }] }, + + + + + /** @param {import('eslint').Rule.RuleContext} context */ + create: function () {function create(context) { + /** @type {boolean} */ + // Prepare the resolver from options. + var considerQueryStringOption = context.options[0] && context.options[0].considerQueryString; + /** @type {boolean} */ + var preferInline = context.options[0] && context.options[0]['prefer-inline']; + var defaultResolver = function () {function defaultResolver(sourcePath) {return (0, _resolve2['default'])(sourcePath, context) || sourcePath;}return defaultResolver;}(); + var resolver = considerQueryStringOption ? function (sourcePath) { + var parts = sourcePath.match(/^([^?]*)\?(.*)$/); + if (!parts) { + return defaultResolver(sourcePath); + } + return String(defaultResolver(parts[1])) + '?' + String(parts[2]); + } : defaultResolver; + + /** @type {Map, nsImported: Map, defaultTypesImported: Map, namedTypesImported: Map}>} */ + var moduleMaps = new Map(); + + /** @param {import('estree').ImportDeclaration} n */ + /** @returns {typeof moduleMaps[keyof typeof moduleMaps]} */ + function getImportMap(n) { + if (!moduleMaps.has(n.parent)) { + moduleMaps.set(n.parent, /** @type {typeof moduleMaps} */{ + imported: new Map(), + nsImported: new Map(), + defaultTypesImported: new Map(), + namedTypesImported: new Map() }); + + } + var map = moduleMaps.get(n.parent); + if (!preferInline && n.importKind === 'type') { + return n.specifiers.length > 0 && n.specifiers[0].type === 'ImportDefaultSpecifier' ? map.defaultTypesImported : map.namedTypesImported; + } + if (!preferInline && n.specifiers.some(function (spec) {return spec.importKind === 'type';})) { + return map.namedTypesImported; + } + + return hasNamespace(n) ? map.nsImported : map.imported; + } + + return { + /** @param {import('estree').ImportDeclaration} n */ + ImportDeclaration: function () {function ImportDeclaration(n) { + /** @type {string} */ + // resolved path will cover aliased duplicates + var resolvedPath = resolver(n.source.value); + var importMap = getImportMap(n); + + if (importMap.has(resolvedPath)) { + importMap.get(resolvedPath).push(n); + } else { + importMap.set(resolvedPath, [n]); + } + }return ImportDeclaration;}(), + + 'Program:exit': function () {function ProgramExit() {var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try { + for (var _iterator2 = moduleMaps.values()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var map = _step2.value; + checkImports(map.imported, context); + checkImports(map.nsImported, context); + checkImports(map.defaultTypesImported, context); + checkImports(map.namedTypesImported, context); + }} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}} + }return ProgramExit;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1kdXBsaWNhdGVzLmpzIl0sIm5hbWVzIjpbInR5cGVzY3JpcHRQa2ciLCJyZXF1aXJlIiwiZSIsImlzUHVuY3R1YXRvciIsIm5vZGUiLCJ2YWx1ZSIsInR5cGUiLCJnZXREZWZhdWx0SW1wb3J0TmFtZSIsImRlZmF1bHRTcGVjaWZpZXIiLCJzcGVjaWZpZXJzIiwiZmluZCIsInNwZWNpZmllciIsImxvY2FsIiwibmFtZSIsInVuZGVmaW5lZCIsImhhc05hbWVzcGFjZSIsImZpbHRlciIsImxlbmd0aCIsImhhc1NwZWNpZmllcnM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ge1xuICAgICAgICAgIGNoZWNrSW1wb3J0cyhtYXAuaW1wb3J0ZWQsIGNvbnRleHQpO1xuICAgICAgICAgIGNoZWNrSW1wb3J0cyhtYXAubnNJbXBvcnRlZCwgY29udGV4dCk7XG4gICAgICAgICAgY2hlY2tJbXBvcnRzKG1hcC5kZWZhdWx0VHlwZXNJbXBvcnRlZCwgY29udGV4dCk7XG4gICAgICAgICAgY2hlY2tJbXBvcnRzKG1hcC5uYW1lZFR5cGVzSW1wb3J0ZWQsIGNvbnRleHQpO1xuICAgICAgICB9XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-dynamic-require.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-dynamic-require.js new file mode 100644 index 0000000000000000000000000000000000000000..1e30975598f9c1503b3521170a6a1761ca5aa117 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-dynamic-require.js @@ -0,0 +1,77 @@ +'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function isRequire(node) { + return node && + node.callee && + node.callee.type === 'Identifier' && + node.callee.name === 'require' && + node.arguments.length >= 1; +} + +function isDynamicImport(node) { + return node && + node.callee && + node.callee.type === 'Import'; +} + +function isStaticValue(arg) { + return arg.type === 'Literal' || + arg.type === 'TemplateLiteral' && arg.expressions.length === 0; +} + +var dynamicImportErrorMessage = 'Calls to import() should use string literals'; + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Static analysis', + description: 'Forbid `require()` calls with expressions.', + url: (0, _docsUrl2['default'])('no-dynamic-require') }, + + schema: [ + { + type: 'object', + properties: { + esmodule: { + type: 'boolean' } }, + + + additionalProperties: false }] }, + + + + + create: function () {function create(context) { + var options = context.options[0] || {}; + + return { + CallExpression: function () {function CallExpression(node) { + if (!node.arguments[0] || isStaticValue(node.arguments[0])) { + return; + } + if (isRequire(node)) { + return context.report({ + node: node, + message: 'Calls to require() should use string literals' }); + + } + if (options.esmodule && isDynamicImport(node)) { + return context.report({ + node: node, + message: dynamicImportErrorMessage }); + + } + }return CallExpression;}(), + ImportExpression: function () {function ImportExpression(node) { + if (!options.esmodule || isStaticValue(node.source)) { + return; + } + return context.report({ + node: node, + message: dynamicImportErrorMessage }); + + }return ImportExpression;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1keW5hbWljLXJlcXVpcmUuanMiXSwibmFtZXMiOlsiaXNSZXF1aXJlIiwibm9kZSIsImNhbGxlZSIsInR5cGUiLCJuYW1lIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwiaXNEeW5hbWljSW1wb3J0IiwiaXNTdGF0aWNWYWx1ZSIsImFyZyIsImV4cHJlc3Npb25zIiwiZHluYW1pY0ltcG9ydEVycm9yTWVzc2FnZSIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJzY2hlbWEiLCJwcm9wZXJ0aWVzIiwiZXNtb2R1bGUiLCJhZGRpdGlvbmFsUHJvcGVydGllcyIsImNyZWF0ZSIsImNvbnRleHQiLCJvcHRpb25zIiwiQ2FsbEV4cHJlc3Npb24iLCJyZXBvcnQiLCJtZXNzYWdlIiwiSW1wb3J0RXhwcmVzc2lvbiIsInNvdXJjZSJdLCJtYXBwaW5ncyI6ImFBQUEscUM7O0FBRUEsU0FBU0EsU0FBVCxDQUFtQkMsSUFBbkIsRUFBeUI7QUFDdkIsU0FBT0E7QUFDRkEsT0FBS0MsTUFESDtBQUVGRCxPQUFLQyxNQUFMLENBQVlDLElBQVosS0FBcUIs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iAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-empty-named-blocks.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-empty-named-blocks.js new file mode 100644 index 0000000000000000000000000000000000000000..6e2e67400fa8b5d84b294eb309b0a255122882d3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-empty-named-blocks.js @@ -0,0 +1,107 @@ +'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function getEmptyBlockRange(tokens, index) { + var token = tokens[index]; + var nextToken = tokens[index + 1]; + var prevToken = tokens[index - 1]; + var start = token.range[0]; + var end = nextToken.range[1]; + + // Remove block tokens and the previous comma + if (prevToken.value === ',' || prevToken.value === 'type' || prevToken.value === 'typeof') { + start = prevToken.range[0]; + } + + return [start, end]; +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Helpful warnings', + description: 'Forbid empty named import blocks.', + url: (0, _docsUrl2['default'])('no-empty-named-blocks') }, + + fixable: 'code', + schema: [], + hasSuggestions: true }, + + + create: function () {function create(context) { + var importsWithoutNameds = []; + + return { + ImportDeclaration: function () {function ImportDeclaration(node) { + if (!node.specifiers.some(function (x) {return x.type === 'ImportSpecifier';})) { + importsWithoutNameds.push(node); + } + }return ImportDeclaration;}(), + + 'Program:exit': function () {function ProgramExit(program) { + var importsTokens = importsWithoutNameds.map(function (node) {return [node, program.tokens.filter(function (x) {return x.range[0] >= node.range[0] && x.range[1] <= node.range[1];})];}); + + importsTokens.forEach(function (_ref) {var _ref2 = _slicedToArray(_ref, 2),node = _ref2[0],tokens = _ref2[1]; + tokens.forEach(function (token) { + var idx = program.tokens.indexOf(token); + var nextToken = program.tokens[idx + 1]; + + if (nextToken && token.value === '{' && nextToken.value === '}') { + var hasOtherIdentifiers = tokens.some(function (token) {return token.type === 'Identifier' && + token.value !== 'from' && + token.value !== 'type' && + token.value !== 'typeof';}); + + + // If it has no other identifiers it's the only thing in the import, so we can either remove the import + // completely or transform it in a side-effects only import + if (!hasOtherIdentifiers) { + context.report({ + node: node, + message: 'Unexpected empty named import block', + suggest: [ + { + desc: 'Remove unused import', + fix: function () {function fix(fixer) { + // Remove the whole import + return fixer.remove(node); + }return fix;}() }, + + { + desc: 'Remove empty import block', + fix: function () {function fix(fixer) { + // Remove the empty block and the 'from' token, leaving the import only for its side + // effects, e.g. `import 'mod'` + var sourceCode = (0, _contextCompat.getSourceCode)(context); + var fromToken = program.tokens.find(function (t) {return t.value === 'from';}); + var importToken = program.tokens.find(function (t) {return t.value === 'import';}); + var hasSpaceAfterFrom = sourceCode.isSpaceBetween(fromToken, sourceCode.getTokenAfter(fromToken)); + var hasSpaceAfterImport = sourceCode.isSpaceBetween(importToken, sourceCode.getTokenAfter(fromToken));var _getEmptyBlockRange = + + getEmptyBlockRange(program.tokens, idx),_getEmptyBlockRange2 = _slicedToArray(_getEmptyBlockRange, 1),start = _getEmptyBlockRange2[0];var _fromToken$range = _slicedToArray( + fromToken.range, 2),end = _fromToken$range[1]; + var range = [start, hasSpaceAfterFrom ? end + 1 : end]; + + return fixer.replaceTextRange(range, hasSpaceAfterImport ? '' : ' '); + }return fix;}() }] }); + + + + } else { + context.report({ + node: node, + message: 'Unexpected empty named import block', + fix: function () {function fix(fixer) { + return fixer.removeRange(getEmptyBlockRange(program.tokens, idx)); + }return fix;}() }); + + } + } + }); + }); + }return ProgramExit;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1lbXB0eS1uYW1lZC1ibG9ja3MuanMiXSwibmFtZXMiOlsiZ2V0RW1wdHlCbG9ja1JhbmdlIiwidG9rZW5zIiwiaW5kZXgiLCJ0b2tlbiIsIm5leHRUb2tlbiIsInByZXZUb2tlbiIsInN0YXJ0IiwicmFuZ2UiLCJlbmQiLCJ2YWx1ZSIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwiZml4YWJsZSIsInNjaGVtYSIsImhhc1N1Z2dlc3Rpb25zIiwiY3JlYXRlIiwiY29udGV4dCIsImltcG9ydHNXaXRob3V0TmFtZWRzIiwiSW1wb3J0RGVjbGFyYXRpb24iLCJub2RlIiwic3BlY2lmaWVycyIsInNvbWUiLCJ4IiwicHVzaCIsInByb2dyYW0iLCJpbXBvcnRzVG9rZW5zIiwibWFwIiwiZmlsdGVyIiwiZm9yRWFjaCIsImlkeCIsImluZGV4T2YiLCJoYXNPdGhlcklkZW50aWZpZXJzIiwicmVwb3J0IiwibWVzc2FnZSIsInN1Z2dlc3QiLCJkZXNjIiwiZml4IiwiZml4ZXIiLCJyZW1vdmUiLCJzb3VyY2VDb2RlIiwiZnJvbVRva2VuIiwiZmluZCIsInQiLCJpbXBvcnRUb2tlbiIsImhhc1NwYWNlQWZ0ZXJGcm9tIiwiaXNTcGFjZUJldHdlZW4iLCJnZXRUb2tlbkFmdGVyIiwiaGFzU3BhY2VBZnRlckltcG9ydCIs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ICAgICBJbXBvcnREZWNsYXJhdGlvbihub2RlKSB7XG4gICAgICAgIGlmICghbm9kZS5zcGVjaWZpZXJzLnNvbWUoKHgpID0+IHgudHlwZSA9PT0gJ0ltcG9ydFNwZWNpZmllcicpKSB7XG4gICAgICAgICAgaW1wb3J0c1dpdGhvdXROYW1lZHMucHVzaChub2RlKTtcbiAgICAgICAgfVxuICAgICAgfSxcblxuICAgICAgJ1Byb2dyYW06ZXhpdCcocHJvZ3JhbSkge1xuICAgICAgICBjb25zdCBpbXBvcnRzVG9rZW5zID0gaW1wb3J0c1dpdGhvdXROYW1lZHMubWFwKChub2RlKSA9PiBbbm9kZSwgcHJvZ3JhbS50b2tlbnMuZmlsdGVyKCh4KSA9PiB4LnJhbmdlWzBdID49IG5vZGUucmFuZ2VbMF0gJiYgeC5yYW5nZVsxXSA8PSBub2RlLnJhbmdlWzFdKV0pO1xuXG4gICAgICAgIGltcG9ydHNUb2tlbnMuZm9yRWFjaCgoW25vZGUsIHRva2Vuc10pID0+IHtcbiAgICAgICAgICB0b2tlbnMuZm9yRWFjaCgodG9rZW4pID0+IHtcbiAgICAgICAgICAgIGNvbnN0IGlkeCA9IHByb2dyYW0udG9rZW5zLmluZGV4T2YodG9rZW4pO1xuICAgICAgICAgICAgY29uc3QgbmV4dFRva2VuID0gcHJvZ3JhbS50b2tlbnNbaWR4ICsgMV07XG5cbiAgICAgICAgICAgIGlmIChuZXh0VG9rZW4gJiYgdG9rZW4udmFsdWUgPT09ICd7JyAmJiBuZXh0VG9rZW4udmFsdWUgPT09ICd9Jykge1xuICAgICAgICAgICAgICBjb25zdCBoYXNPdGhlcklkZW50aWZpZXJzID0gdG9rZW5zLnNvbWUoKHRva2VuKSA9PiB0b2tlbi50eXBlID09PSAnSWRlbnRpZmllcidcbiAgICAgICAgICAgICAgICAgICYmIHRva2VuLnZhbHVlICE9PSAnZnJvbSdcbiAgICAgICAgICAgICAgICAgICYmIHRva2VuLnZhbHVlICE9PSAndHlwZSdcbiAgICAgICAgICAgICAgICAgICYmIHRva2VuLnZhbHVlICE9PSAndHlwZW9mJyxcbiAgICAgICAgICAgICAgKTtcblxuICAgICAgICAgICAgICAvLyBJZiBpdCBoYXMgbm8gb3RoZXIgaWRlbnRpZmllcnMgaXQncyB0aGUgb25seSB0aGluZyBpbiB0aGUgaW1wb3J0LCBzbyB3ZSBjYW4gZWl0aGVyIHJlbW92ZSB0aGUgaW1wb3J0XG4gICAgICAgICAgICAgIC8vIGNvbXBsZXRlbHkgb3IgdHJhbnNmb3JtIGl0IGluIGEgc2lkZS1lZmZlY3RzIG9ubHkgaW1wb3J0XG4gICAgICAgICAgICAgIGlmICghaGFzT3RoZXJJZGVudGlmaWVycykge1xuICAgICAgICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnVW5leHBlY3RlZCBlbXB0eSBuYW1lZCBpbXBvcnQgYmxvY2snLFxuICAgICAgICAgICAgICAgICAgc3VnZ2VzdDogW1xuICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgZGVzYzogJ1JlbW92ZSB1bnVzZWQgaW1wb3J0JyxcbiAgICAgICAgICAgICAgICAgICAgICBmaXgoZml4ZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFJlbW92ZSB0aGUgd2hvbGUgaW1wb3J0XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZml4ZXIucmVtb3ZlKG5vZGUpO1xuICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICBkZXNjOiAnUmVtb3ZlIGVtcHR5IGltcG9ydCBibG9jaycsXG4gICAgICAgICAgICAgICAgICAgICAgZml4KGZpeGVyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBSZW1vdmUgdG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lckZyb20gPyBlbmQgKyAxIDogZW5kXTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZpeGVyLnJlcGxhY2VUZXh0UmFuZ2UocmFuZ2UsIGhhc1NwYWNlQWZ0ZXJJbXBvcnQgPyAnJyA6ICcgJyk7XG4gICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgIF0sXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdVbmV4cGVjdGVkIGVtcHR5IG5hbWVkIGltcG9ydCBibG9jaycsXG4gICAgICAgICAgICAgICAgICBmaXgoZml4ZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZpeGVyLnJlbW92ZVJhbmdlKGdldEVtcHR5QmxvY2tSYW5nZShwcm9ncmFtLnRva2VucywgaWR4KSk7XG4gICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-extraneous-dependencies.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-extraneous-dependencies.js new file mode 100644 index 0000000000000000000000000000000000000000..0dcf9d0544610dcdfa04409d438e2f82b3b4b718 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-extraneous-dependencies.js @@ -0,0 +1,308 @@ +'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _path = require('path');var _path2 = _interopRequireDefault(_path); +var _fs = require('fs');var _fs2 = _interopRequireDefault(_fs); +var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch); +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _pkgUp = require('eslint-module-utils/pkgUp');var _pkgUp2 = _interopRequireDefault(_pkgUp); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); + +var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType); +var _packagePath = require('../core/packagePath'); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +var depFieldCache = new Map(); + +function hasKeys() {var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + return Object.keys(obj).length > 0; +} + +function arrayOrKeys(arrayOrObject) { + return Array.isArray(arrayOrObject) ? arrayOrObject : Object.keys(arrayOrObject); +} + +function readJSON(jsonPath, throwException) { + try { + return JSON.parse(_fs2['default'].readFileSync(jsonPath, 'utf8')); + } catch (err) { + if (throwException) { + throw err; + } + } +} + +function extractDepFields(pkg) { + return { + dependencies: pkg.dependencies || {}, + devDependencies: pkg.devDependencies || {}, + optionalDependencies: pkg.optionalDependencies || {}, + peerDependencies: pkg.peerDependencies || {}, + // BundledDeps should be in the form of an array, but object notation is also supported by + // `npm`, so we convert it to an array if it is an object + bundledDependencies: arrayOrKeys(pkg.bundleDependencies || pkg.bundledDependencies || []) }; + +} + +function getPackageDepFields(packageJsonPath, throwAtRead) { + if (!depFieldCache.has(packageJsonPath)) { + var packageJson = readJSON(packageJsonPath, throwAtRead); + if (packageJson) { + var depFields = extractDepFields(packageJson); + depFieldCache.set(packageJsonPath, depFields); + } + } + + return depFieldCache.get(packageJsonPath); +} + +function getDependencies(context, packageDir) { + var paths = []; + try { + var packageContent = { + dependencies: {}, + devDependencies: {}, + optionalDependencies: {}, + peerDependencies: {}, + bundledDependencies: [] }; + + + if (packageDir && packageDir.length > 0) { + if (!Array.isArray(packageDir)) { + paths = [_path2['default'].resolve(packageDir)]; + } else { + paths = packageDir.map(function (dir) {return _path2['default'].resolve(dir);}); + } + } + + if (paths.length > 0) { + // use rule config to find package.json + paths.forEach(function (dir) { + var packageJsonPath = _path2['default'].join(dir, 'package.json'); + var _packageContent = getPackageDepFields(packageJsonPath, paths.length === 1); + if (_packageContent) { + Object.keys(packageContent).forEach(function (depsKey) { + Object.assign(packageContent[depsKey], _packageContent[depsKey]); + }); + } + }); + } else { + var packageJsonPath = (0, _pkgUp2['default'])({ + cwd: (0, _contextCompat.getPhysicalFilename)(context), + normalize: false }); + + + // use closest package.json + Object.assign( + packageContent, + getPackageDepFields(packageJsonPath, false)); + + } + + if (![ + packageContent.dependencies, + packageContent.devDependencies, + packageContent.optionalDependencies, + packageContent.peerDependencies, + packageContent.bundledDependencies]. + some(hasKeys)) { + return null; + } + + return packageContent; + } catch (e) { + if (paths.length > 0 && e.code === 'ENOENT') { + context.report({ + message: 'The package.json file could not be found.', + loc: { line: 0, column: 0 } }); + + } + if (e.name === 'JSONError' || e instanceof SyntaxError) { + context.report({ + message: 'The package.json file could not be parsed: ' + String(e.message), + loc: { line: 0, column: 0 } }); + + } + + return null; + } +} + +function missingErrorMessage(packageName) { + return '\'' + String(packageName) + '\' should be listed in the project\'s dependencies. Run \'npm i -S ' + String(packageName) + '\' to add it'; +} + +function devDepErrorMessage(packageName) { + return '\'' + String(packageName) + '\' should be listed in the project\'s dependencies, not devDependencies.'; +} + +function optDepErrorMessage(packageName) { + return '\'' + String(packageName) + '\' should be listed in the project\'s dependencies, not optionalDependencies.'; +} + +function getModuleOriginalName(name) {var _name$split = + name.split('/'),_name$split2 = _slicedToArray(_name$split, 2),first = _name$split2[0],second = _name$split2[1]; + return first.startsWith('@') ? String(first) + '/' + String(second) : first; +} + +function getModuleRealName(resolved) { + return (0, _packagePath.getFilePackageName)(resolved); +} + +function checkDependencyDeclaration(deps, packageName, declarationStatus) { + var newDeclarationStatus = declarationStatus || { + isInDeps: false, + isInDevDeps: false, + isInOptDeps: false, + isInPeerDeps: false, + isInBundledDeps: false }; + + + // in case of sub package.json inside a module + // check the dependencies on all hierarchy + var packageHierarchy = []; + var packageNameParts = packageName ? packageName.split('/') : []; + packageNameParts.forEach(function (namePart, index) { + if (!namePart.startsWith('@')) { + var ancestor = packageNameParts.slice(0, index + 1).join('/'); + packageHierarchy.push(ancestor); + } + }); + + return packageHierarchy.reduce(function (result, ancestorName) {return { + isInDeps: result.isInDeps || deps.dependencies[ancestorName] !== undefined, + isInDevDeps: result.isInDevDeps || deps.devDependencies[ancestorName] !== undefined, + isInOptDeps: result.isInOptDeps || deps.optionalDependencies[ancestorName] !== undefined, + isInPeerDeps: result.isInPeerDeps || deps.peerDependencies[ancestorName] !== undefined, + isInBundledDeps: + result.isInBundledDeps || deps.bundledDependencies.indexOf(ancestorName) !== -1 };}, + newDeclarationStatus); +} + +function reportIfMissing(context, deps, depsOptions, node, name) { + // Do not report when importing types unless option is enabled + if ( + !depsOptions.verifyTypeImports && ( + + node.importKind === 'type' || + node.importKind === 'typeof' || + node.exportKind === 'type' || + Array.isArray(node.specifiers) && node.specifiers.length && node.specifiers.every(function (specifier) {return specifier.importKind === 'type' || specifier.importKind === 'typeof';}))) + + { + return; + } + + var typeOfImport = (0, _importType2['default'])(name, context); + + if ( + typeOfImport !== 'external' && ( + typeOfImport !== 'internal' || !depsOptions.verifyInternalDeps)) + { + return; + } + + var resolved = (0, _resolve2['default'])(name, context); + if (!resolved) {return;} + + var importPackageName = getModuleOriginalName(name); + var declarationStatus = checkDependencyDeclaration(deps, importPackageName); + + if ( + declarationStatus.isInDeps || + depsOptions.allowDevDeps && declarationStatus.isInDevDeps || + depsOptions.allowPeerDeps && declarationStatus.isInPeerDeps || + depsOptions.allowOptDeps && declarationStatus.isInOptDeps || + depsOptions.allowBundledDeps && declarationStatus.isInBundledDeps) + { + return; + } + + // test the real name from the resolved package.json + // if not aliased imports (alias/react for example), importPackageName can be misinterpreted + var realPackageName = getModuleRealName(resolved); + if (realPackageName && realPackageName !== importPackageName) { + declarationStatus = checkDependencyDeclaration(deps, realPackageName, declarationStatus); + + if ( + declarationStatus.isInDeps || + depsOptions.allowDevDeps && declarationStatus.isInDevDeps || + depsOptions.allowPeerDeps && declarationStatus.isInPeerDeps || + depsOptions.allowOptDeps && declarationStatus.isInOptDeps || + depsOptions.allowBundledDeps && declarationStatus.isInBundledDeps) + { + return; + } + } + + if (declarationStatus.isInDevDeps && !depsOptions.allowDevDeps) { + context.report(node, devDepErrorMessage(realPackageName || importPackageName)); + return; + } + + if (declarationStatus.isInOptDeps && !depsOptions.allowOptDeps) { + context.report(node, optDepErrorMessage(realPackageName || importPackageName)); + return; + } + + context.report(node, missingErrorMessage(realPackageName || importPackageName)); +} + +function testConfig(config, filename) { + // Simplest configuration first, either a boolean or nothing. + if (typeof config === 'boolean' || typeof config === 'undefined') { + return config; + } + // Array of globs. + return config.some(function (c) {return (0, _minimatch2['default'])(filename, c) || + (0, _minimatch2['default'])(filename, _path2['default'].join(process.cwd(), c));}); + +} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Helpful warnings', + description: 'Forbid the use of extraneous packages.', + url: (0, _docsUrl2['default'])('no-extraneous-dependencies') }, + + + schema: [ + { + type: 'object', + properties: { + devDependencies: { type: ['boolean', 'array'] }, + optionalDependencies: { type: ['boolean', 'array'] }, + peerDependencies: { type: ['boolean', 'array'] }, + bundledDependencies: { type: ['boolean', 'array'] }, + packageDir: { type: ['string', 'array'] }, + includeInternal: { type: ['boolean'] }, + includeTypes: { type: ['boolean'] } }, + + additionalProperties: false }] }, + + + + + create: function () {function create(context) { + var options = context.options[0] || {}; + var filename = (0, _contextCompat.getPhysicalFilename)(context); + var deps = getDependencies(context, options.packageDir) || extractDepFields({}); + + var depsOptions = { + allowDevDeps: testConfig(options.devDependencies, filename) !== false, + allowOptDeps: testConfig(options.optionalDependencies, filename) !== false, + allowPeerDeps: testConfig(options.peerDependencies, filename) !== false, + allowBundledDeps: testConfig(options.bundledDependencies, filename) !== false, + verifyInternalDeps: !!options.includeInternal, + verifyTypeImports: !!options.includeTypes }; + + + return (0, _moduleVisitor2['default'])(function (source, node) { + reportIfMissing(context, deps, depsOptions, node, source.value); + }, { commonjs: true }); + }return create;}(), + + 'Program:exit': function () {function ProgramExit() { + depFieldCache.clear(); + }return ProgramExit;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1leHRyYW5lb3VzLWRlcGVuZGVuY2llcy5qcyJdLCJuYW1lcyI6WyJkZXBGaWVsZENhY2hlIiwiTWFwIiwiaGFzS2V5cyIsIm9iaiIsIk9iamVjdCIsImtleXMiLCJsZW5ndGgiLCJhcnJheU9yS2V5cyIsImFycmF5T3JPYmplY3QiLCJBcnJheSIsImlzQXJyYXkiLCJyZWFkSlNPTiIsImpzb25QYXRoIiwidGhyb3dFeGNlcHRpb24iLCJKU09OIiwicGFyc2UiLCJmcyIsInJlYWRGaWxlU3luYyIsImVyciIsImV4dHJhY3REZXBGaWVsZHMiLCJwa2ciLCJkZXBlbmRlbmNpZXMiLCJkZXZEZXBlbmRlbmNpZXMiLCJvcHRpb25hbERlcGVuZGVuY2llcyIsInBlZXJE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9LFxuICAgICAgYnVuZGxlZERlcGVuZGVuY2llczogW10sXG4gICAgfTtcblxuICAgIGlmIChwYWNrYWdlRGlyICYmIHBhY2thZ2VEaXIubGVuZ3RoID4gMCkge1xuICAgICAgaWYgKCFBcnJheS5pc0FycmF5KHBhY2thZ2VEaXIpKSB7XG4gICAgICAgIHBhdGhzID0gW3BhdGgucmVzb2x2ZShwYWNrYWdlRGlyKV07XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBwYXRocyA9IHBhY2thZ2VEaXIubWFwKChkaXIpID0+IHBhdGgucmVzb2x2ZShkaXIpKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICBpZiAocGF0aHMubGVuZ3RoID4gMCkge1xuICAgICAgLy8gdXNlIHJ1bGUgY29uZmlnIHRvIGZpbmQgcGFja2FnZS5qc29uXG4gICAgICBwYXRocy5mb3JFYWNoKChkaXIpID0+IHtcbiAgICAgICAgY29uc3QgcGFja2FnZUpzb25QYXRoID0gcGF0aC5qb2luKGRpciwgJ3BhY2thZ2UuanNvbicpO1xuICAgICAgICBjb25zdCBfcGFja2FnZUNvbnRlbnQgPSBnZXRQYWNrYWdlRGVwRmllbGRzKHBhY2thZ2VKc29uUGF0aCwgcGF0aHMubGVuZ3RoID09PSAxKTtcbiAgICAgICAgaWYgKF9wYWNrYWdlQ29udGVudCkge1xuICAgICAgICAgIE9iamVjdC5rZXlzKHBhY2thZ2VDb250ZW50KS5mb3JFYWNoKChkZXBzS2V5KSA9PiB7XG4gICAgICAgICAgICBPYmplY3QuYXNzaWduKHBhY2thZ2VDb250ZW50W2RlcHNLZXldLCBfcGFja2FnZUNvbnRlbnRbZGVwc0tleV0pO1xuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9IGVsc2Uge1xuICAgICAgY29uc3QgcGFja2FnZUpzb25QYXRoID0gcGtnVXAoe1xuICAgICAgICBjd2Q6IGdldFBoeXNpY2FsRmlsZW5hbWUoY29udGV4dCksXG4gICAgICA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Sxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-import-module-exports.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-import-module-exports.js new file mode 100644 index 0000000000000000000000000000000000000000..c54dddeb5421c164b480883f3227760c4a33291d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-import-module-exports.js @@ -0,0 +1,86 @@ +'use strict';var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch); +var _path = require('path');var _path2 = _interopRequireDefault(_path); +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _pkgUp = require('eslint-module-utils/pkgUp');var _pkgUp2 = _interopRequireDefault(_pkgUp);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function getEntryPoint(context) { + var pkgPath = (0, _pkgUp2['default'])({ cwd: (0, _contextCompat.getPhysicalFilename)(context) }); + try { + return require.resolve(_path2['default'].dirname(pkgPath)); + } catch (error) { + // Assume the package has no entrypoint (e.g. CLI packages) + // in which case require.resolve would throw. + return null; + } +} + +function findScope(context, identifier) {var _getSourceCode = + (0, _contextCompat.getSourceCode)(context),scopeManager = _getSourceCode.scopeManager; + + return scopeManager && scopeManager.scopes.slice().reverse().find(function (scope) {return scope.variables.some(function (variable) {return variable.identifiers.some(function (node) {return node.name === identifier;});});}); +} + +function findDefinition(objectScope, identifier) { + var variable = objectScope.variables.find(function (variable) {return variable.name === identifier;}); + return variable.defs.find(function (def) {return def.name.name === identifier;}); +} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Module systems', + description: 'Forbid import statements with CommonJS module.exports.', + recommended: true }, + + fixable: 'code', + schema: [ + { + type: 'object', + properties: { + exceptions: { type: 'array' } }, + + additionalProperties: false }] }, + + + + create: function () {function create(context) { + var importDeclarations = []; + var entryPoint = getEntryPoint(context); + var options = context.options[0] || {}; + var alreadyReported = false; + + function report(node) { + var fileName = (0, _contextCompat.getPhysicalFilename)(context); + var isEntryPoint = entryPoint === fileName; + var isIdentifier = node.object.type === 'Identifier'; + var hasKeywords = /^(module|exports)$/.test(node.object.name); + var objectScope = hasKeywords && findScope(context, node.object.name); + var variableDefinition = objectScope && findDefinition(objectScope, node.object.name); + var isImportBinding = variableDefinition && variableDefinition.type === 'ImportBinding'; + var hasCJSExportReference = hasKeywords && (!objectScope || objectScope.type === 'module'); + var isException = !!options.exceptions && options.exceptions.some(function (glob) {return (0, _minimatch2['default'])(fileName, glob);}); + + if (isIdentifier && hasCJSExportReference && !isEntryPoint && !isException && !isImportBinding) { + importDeclarations.forEach(function (importDeclaration) { + context.report({ + node: importDeclaration, + message: 'Cannot use import declarations in modules that export using CommonJS (module.exports = \'foo\' or exports.bar = \'hi\')' }); + + }); + alreadyReported = true; + } + } + + return { + ImportDeclaration: function () {function ImportDeclaration(node) { + importDeclarations.push(node); + }return ImportDeclaration;}(), + MemberExpression: function () {function MemberExpression(node) { + if (!alreadyReported) { + report(node); + } + }return MemberExpression;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1pbXBvcnQtbW9kdWxlLWV4cG9ydHMuanMiXSwibmFtZXMiOlsiZ2V0RW50cnlQb2ludCIsImNvbnRleHQiLCJwa2dQYXRoIiwiY3dkIiwicmVxdWlyZSIsInJlc29sdmUiLCJwYXRoIiwiZGlybmFtZSIsImVycm9yIiwiZmluZFNjb3BlIiwiaWRlbnRpZmllciIsInNjb3BlTWFuYWdlciIsInNjb3BlcyIsInNsaWNlIiwicmV2ZXJzZSIsImZpbmQiLCJzY29wZSIsInZhcmlhYmxlcyIsInNvbWUiLCJ2YXJpYWJsZSIsImlkZW50aWZpZXJzIiwibm9kZSIsIm5hbWUiLCJmaW5kRGVmaW5pdGlvbiIsIm9iamVjdFNjb3BlIiwi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HVzZSBpbXBvcnQgZGVjbGFyYXRpb25zIGluIG1vZHVsZXMgdGhhdCBleHBvcnQgdXNpbmcgQ29tbW9uSlMgKG1vZHVsZS5leHBvcnRzID0gJ2Zvbycgb3IgZXhwb3J0cy5iYXIgPSAnaGknKWAsXG4gICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBhbHJlYWR5UmVwb3J0ZWQgPSB0cnVlO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBJbXBvcnREZWNsYXJhdGlvbihub2RlKSB7XG4gICAgICAgIGltcG9ydERlY2xhcmF0aW9ucy5wdXNoKG5vZGUpO1xuICAgICAgfSxcbiAgICAgIE1lbWJlckV4cHJlc3Npb24obm9kZSkge1xuICAgICAgICBpZiAoIWFscmVhZHlSZXBvcnRlZCkge1xuICAgICAgICAgIHJlcG9ydChub2RlKTtcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-internal-modules.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-internal-modules.js new file mode 100644 index 0000000000000000000000000000000000000000..3b20616a24314b815c11561faeaa6a32ea629e4e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-internal-modules.js @@ -0,0 +1,144 @@ +'use strict';var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch); + +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Static analysis', + description: 'Forbid importing the submodules of other modules.', + url: (0, _docsUrl2['default'])('no-internal-modules') }, + + + schema: [ + { + anyOf: [ + { + type: 'object', + properties: { + allow: { + type: 'array', + items: { + type: 'string' } } }, + + + + additionalProperties: false }, + + { + type: 'object', + properties: { + forbid: { + type: 'array', + items: { + type: 'string' } } }, + + + + additionalProperties: false }] }] }, + + + + + + + create: function () {function noReachingInside(context) { + var options = context.options[0] || {}; + var allowRegexps = (options.allow || []).map(function (p) {return _minimatch2['default'].makeRe(p);}); + var forbidRegexps = (options.forbid || []).map(function (p) {return _minimatch2['default'].makeRe(p);}); + + // minimatch patterns are expected to use / path separators, like import + // statements, so normalize paths to use the same + function normalizeSep(somePath) { + return somePath.split('\\').join('/'); + } + + function toSteps(somePath) { + return normalizeSep(somePath). + split('/'). + filter(function (step) {return step && step !== '.';}). + reduce(function (acc, step) { + if (step === '..') { + return acc.slice(0, -1); + } + return acc.concat(step); + }, []); + } + + // test if reaching to this destination is allowed + function reachingAllowed(importPath) { + return allowRegexps.some(function (re) {return re.test(importPath);}); + } + + // test if reaching to this destination is forbidden + function reachingForbidden(importPath) { + return forbidRegexps.some(function (re) {return re.test(importPath);}); + } + + function isAllowViolation(importPath) { + var steps = toSteps(importPath); + + var nonScopeSteps = steps.filter(function (step) {return step.indexOf('@') !== 0;}); + if (nonScopeSteps.length <= 1) {return false;} + + // before trying to resolve, see if the raw import (with relative + // segments resolved) matches an allowed pattern + var justSteps = steps.join('/'); + if (reachingAllowed(justSteps) || reachingAllowed('/' + String(justSteps))) {return false;} + + // if the import statement doesn't match directly, try to match the + // resolved path if the import is resolvable + var resolved = (0, _resolve2['default'])(importPath, context); + if (!resolved || reachingAllowed(normalizeSep(resolved))) {return false;} + + // this import was not allowed by the allowed paths, and reaches + // so it is a violation + return true; + } + + function isForbidViolation(importPath) { + var steps = toSteps(importPath); + + // before trying to resolve, see if the raw import (with relative + // segments resolved) matches a forbidden pattern + var justSteps = steps.join('/'); + + if (reachingForbidden(justSteps) || reachingForbidden('/' + String(justSteps))) {return true;} + + // if the import statement doesn't match directly, try to match the + // resolved path if the import is resolvable + var resolved = (0, _resolve2['default'])(importPath, context); + if (resolved && reachingForbidden(normalizeSep(resolved))) {return true;} + + // this import was not forbidden by the forbidden paths so it is not a violation + return false; + } + + // find a directory that is being reached into, but which shouldn't be + var isReachViolation = options.forbid ? isForbidViolation : isAllowViolation; + + function checkImportForReaching(importPath, node) { + var potentialViolationTypes = ['parent', 'index', 'sibling', 'external', 'internal']; + if ( + potentialViolationTypes.indexOf((0, _importType2['default'])(importPath, context)) !== -1 && + isReachViolation(importPath)) + { + context.report({ + node: node, + message: 'Reaching to "' + String(importPath) + '" is not allowed.' }); + + } + } + + return (0, _moduleVisitor2['default'])( + function (source) { + checkImportForReaching(source.value, source); + }, + { commonjs: true }); + + }return noReachingInside;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1pbnRlcm5hbC1tb2R1bGVzLmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwiYW55T2YiLCJwcm9wZXJ0aWVzIiwiYWxsb3ciLCJpdGVtcyIsImFkZGl0aW9uYWxQcm9wZXJ0aWVzIiwiZm9yYmlkIiwiY3JlYXRlIiwibm9SZWFjaGluZ0luc2lkZSIsImNvbnRleHQiLCJvcHRpb25zIiwiYWxsb3dSZWdleHBzIiwibWFwIiwicCIsIm1pbmltYXRjaCIsIm1ha2VSZSIsImZvcmJpZFJlZ2V4cHMiLCJub3JtYWxpemVTZXAiLCJzb21lUGF0aCIsInNwbGl0Iiwiam9pbiIsInRvU3RlcHMiLCJmaWx0ZXIiLCJzdGVwIiwicmV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mplY3QnLFxuICAgICAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgICAgICBhbGxvdzoge1xuICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgICAgICAgaXRlbXM6IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYWRkaXRpb25hbFByb3BlcnRpZXM6IGZhbHNlLFxuICAgICAgICAgIH0sXG4gICAgICAgICAge1xuICAgICAgICAgICAgdHlwZTogJ29iamVjdCcsXG4gICAgICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgICAgIGZvcmJpZDoge1xuICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgICAgICAgaXRlbXM6IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYWRkaXRpb25hbFByb3BlcnRpZXM6IGZhbHNlLFxuICAgICAgICAgIH0sXG4gICAgICAgIF0sXG4gICAgICB9LFxuICAgIF0sXG4gIH0sXG5cbiAgY3JlYXRlOiBmdW5jdGlvbiBub1JlYWNoaW5nSW5zaWRlKGNvbnRleHQpIHtcbiAgICBjb25zdCBvcHRpb25zID0gY29udGV4dC5vcHRpb25zWzBdIHx8IHt9O1xuICAgIGNvbnN0IGFsbG93UmVnZXhwcyA9IChvcHRpb25zLmFsbG93IHx8IFtdKS5tYXAoKHApID0+IG1pbmltYXRjaC5tYWtlUmUocCkpO1xuICAgIGNvbnN0IGZvcmJpZFJlZ2V4cHMgPSAob3B0aW9ucy5mb3JiaWQgfHwgW10pLm1hcCgocCkgPT4gbWluaW1hdGNoLm1ha2VSZShwKSk7XG5cbiAgICAvLyBtaW5pbWF0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AgKTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-mutable-exports.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-mutable-exports.js new file mode 100644 index 0000000000000000000000000000000000000000..96098759beff575035fc67070ab83c1e5943af9d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-mutable-exports.js @@ -0,0 +1,62 @@ +'use strict';var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Helpful warnings', + description: 'Forbid the use of mutable exports with `var` or `let`.', + url: (0, _docsUrl2['default'])('no-mutable-exports') }, + + schema: [] }, + + + create: function () {function create(context) { + function checkDeclaration(node) {var + kind = node.kind; + if (kind === 'var' || kind === 'let') { + context.report(node, 'Exporting mutable \'' + String(kind) + '\' binding, use \'const\' instead.'); + } + } + + /** @type {(scope: import('eslint').Scope.Scope, name: string) => void} */ + function checkDeclarationsInScope(_ref, name) {var variables = _ref.variables; + variables. + filter(function (variable) {return variable.name === name;}). + forEach(function (variable) { + variable.defs. + filter(function (def) {return def.type === 'Variable' && def.parent;}). + forEach(function (def) { + checkDeclaration(def.parent); + }); + }); + } + + return { + /** @param {import('estree').ExportDefaultDeclaration} node */ + ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) { + var scope = (0, _contextCompat.getScope)(context, node); + + if ('name' in node.declaration && node.declaration.name) { + checkDeclarationsInScope(scope, node.declaration.name); + } + }return ExportDefaultDeclaration;}(), + + /** @param {import('estree').ExportNamedDeclaration} node */ + ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { + var scope = (0, _contextCompat.getScope)(context, node); + + if ('declaration' in node && node.declaration) { + checkDeclaration(node.declaration); + } else if (!('source' in node) || !node.source) { + node.specifiers.forEach(function (specifier) { + checkDeclarationsInScope(scope, specifier.local.name); + }); + } + }return ExportNamedDeclaration;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1tdXRhYmxlLWV4cG9ydHMuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJjb250ZXh0IiwiY2hlY2tEZWNsYXJhdGlvbiIsIm5vZGUiLCJraW5kIiwicmVwb3J0IiwiY2hlY2tEZWNsYXJhdGlvbnNJblNjb3BlIiwibmFtZSIsInZhcmlhYmxlcyIsImZpbHRlciIsInZhcmlhYmxlIiwiZm9yRWFjaCIsImRlZnMiLCJkZWYiLCJwYXJlbnQiLCJFeHBvcnREZWZhdWx0RGVjbGFyYXRpb24iLCJzY29wZSIsImRlY2xhcmF0aW9uIiwiRXhwb3J0TmFtZWREZWNsYXJhdGlvbiIsInNvdXJjZSIsInNwZWNpZmllcnMiLCJzcGVjaWZpZXIiLCJsb2NhbCJdLCJtYXBwaW5ncyI6ImFBQUE7O0FBRUEscUM7O0FBRUE7QUFDQUEsT0FBT0MsT0FBUCxHQUFpQjtBQUNmQyxRQUFNO0FBQ0pDLFVBQU0sWUFERjtBQUVKQyxVQUFNO0FBQ0pDLGdCQUFVLGtCQUROO0FBRUpDLG1CQUFhLHdEQUZUO0FBR0pDLFdBQUssMEJBQVEsb0JBQVIsQ0FIRCxFQUZGOztBQU9KQyxZQUFRLEVBUEosRUFEUzs7O0FBV2ZDLFFBWGUsK0JBV1JDLE9BWFEsRUFXQztBQUNkLGVBQVNDLGdCQUFULENBQT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vbnN0IHNjb3BlID0gZ2V0U2NvcGUoY29udGV4dCwgbm9kZSk7XG5cbiAgICAgICAgaWYgKCduYW1lJyBpbiBub2RlLmRlY2xhcmF0aW9uICYmIG5vZGUuZGVjbGFyYXRpb24ubmFtZSkge1xuICAgICAgICAgIGNoZWNrRGVjbGFyYXRpb25zSW5TY29wZShzY29wZSwgbm9kZS5kZWNsYXJhdGlvbi5uYW1lKTtcbiAgICAgICAgfVxuICAgICAgfSxcblxuICAgICAgLyoqIEBwYXJhbSB7aW1wb3J0KCdlc3RyZWUnKS5FeHBvcnROYW1lZERlY2xhcmF0aW9ufSBub2RlICovXG4gICAgICBFeHBvcnROYW1lZERlY2xhcmF0aW9uKG5vZGUpIHtcbiAgICAgICAgY29uc3Qgc2NvcGUgPSBnZXRTY29wZShjb250ZXh0LCBub2RlKTtcblxuICAgICAgICBpZiAoJ2RlY2xhcmF0aW9uJyBpbiBub2RlICYmIG5vZGUuZGVjbGFyYXRpb24pICB7XG4gICAgICAgICAgY2hlY2tEZWNsYXJhdGlvbihub2RlLmRlY2xhcmF0aW9uKTtcbiAgICAgICAgfSBlbHNlIGlmICghKCdzb3VyY2UnIGluIG5vZGUpIHx8ICFub2RlLnNvdXJjZSkge1xuICAgICAgICAgIG5vZGUuc3BlY2lmaWVycy5mb3JFYWNoKChzcGVjaWZpZXIpID0+IHtcbiAgICAgICAgICAgIGNoZWNrRGVjbGFyYXRpb25zSW5TY29wZShzY29wZSwgc3BlY2lmaWVyLmxvY2FsLm5hbWUpO1xuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-as-default-member.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-as-default-member.js new file mode 100644 index 0000000000000000000000000000000000000000..d8cdf78c2781d5b3057f2a98906729b2464ce4e8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-as-default-member.js @@ -0,0 +1,96 @@ +'use strict'; + + + + + +var _builder = require('../exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _importDeclaration = require('../importDeclaration');var _importDeclaration2 = _interopRequireDefault(_importDeclaration); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Helpful warnings', + description: 'Forbid use of exported name as property of default export.', + url: (0, _docsUrl2['default'])('no-named-as-default-member') }, + + schema: [] }, + + + create: function () {function create(context) { + var fileImports = new Map(); + var allPropertyLookups = new Map(); + + function storePropertyLookup(objectName, propName, node) { + var lookups = allPropertyLookups.get(objectName) || []; + lookups.push({ node: node, propName: propName }); + allPropertyLookups.set(objectName, lookups); + } + + return { + ImportDefaultSpecifier: function () {function ImportDefaultSpecifier(node) { + var declaration = (0, _importDeclaration2['default'])(context, node); + var exportMap = _builder2['default'].get(declaration.source.value, context); + if (exportMap == null) {return;} + + if (exportMap.errors.length) { + exportMap.reportErrors(context, declaration); + return; + } + + fileImports.set(node.local.name, { + exportMap: exportMap, + sourcePath: declaration.source.value }); + + }return ImportDefaultSpecifier;}(), + + MemberExpression: function () {function MemberExpression(node) { + var objectName = node.object.name; + var propName = node.property.name; + storePropertyLookup(objectName, propName, node); + }return MemberExpression;}(), + + VariableDeclarator: function () {function VariableDeclarator(node) { + var isDestructure = node.id.type === 'ObjectPattern' && + node.init != null && + node.init.type === 'Identifier'; + if (!isDestructure) {return;} + + var objectName = node.init.name;var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = node.id.properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var _ref = _step.value;var key = _ref.key; + if (key == null) {continue;} // true for rest properties + storePropertyLookup(objectName, key.name, key); + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + }return VariableDeclarator;}(), + + 'Program:exit': function () {function ProgramExit() { + allPropertyLookups.forEach(function (lookups, objectName) { + var fileImport = fileImports.get(objectName); + if (fileImport == null) {return;}var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try { + + for (var _iterator2 = lookups[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var _ref2 = _step2.value;var propName = _ref2.propName,node = _ref2.node; + // the default import can have a "default" property + if (propName === 'default') {continue;} + if (!fileImport.exportMap.namespace.has(propName)) {continue;} + + context.report({ + node: node, + message: 'Caution: `' + String(objectName) + '` also has a named export `' + String(propName) + '`. Check if you meant to write `import {' + String(propName) + '} from \'' + String(fileImport.sourcePath) + '\'` instead.' }); + + }} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}} + }); + }return ProgramExit;}() }; + + }return create;}() }; /** + * @fileoverview Rule to warn about potentially confused use of name exports + * @author Desmond Brand + * @copyright 2016 Desmond Brand. All rights reserved. + * See LICENSE in root directory for full license. + */ +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1hcy1kZWZhdWx0LW1lbWJlci5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwiY2F0ZWdvcnkiLCJkZXNjcmlwdGlvbiIsInVybCIsInNjaG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AuIENoZWNrIGlmIHlvdSBtZWFudCB0byB3cml0ZSBcXGBpbXBvcnQgeyR7cHJvcE5hbWV9fSBmcm9tICcke2ZpbGVJbXBvcnQuc291cmNlUGF0aH0nXFxgIGluc3RlYWQuYCxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-as-default.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-as-default.js new file mode 100644 index 0000000000000000000000000000000000000000..a4368907980ee530f6cdb79b6a132e1b99c5dd4a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-as-default.js @@ -0,0 +1,88 @@ +'use strict';var _builder = require('../exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _importDeclaration = require('../importDeclaration');var _importDeclaration2 = _interopRequireDefault(_importDeclaration); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Helpful warnings', + description: 'Forbid use of exported name as identifier of default export.', + url: (0, _docsUrl2['default'])('no-named-as-default') }, + + schema: [] }, + + + create: function () {function create(context) { + function checkDefault(nameKey, defaultSpecifier) { + /** + * For ImportDefaultSpecifier we're interested in the "local" name (`foo` for `import {bar as foo} ...`) + * For ExportDefaultSpecifier we're interested in the "exported" name (`foo` for `export {bar as foo} ...`) + */ + var analyzedName = defaultSpecifier[nameKey].name; + + // #566: default is a valid specifier + if (analyzedName === 'default') {return;} + + var declaration = (0, _importDeclaration2['default'])(context, defaultSpecifier); + /** @type {import('../exportMap').default | null} */ + var importedModule = _builder2['default'].get(declaration.source.value, context); + if (importedModule == null) {return;} + + if (importedModule.errors.length > 0) { + importedModule.reportErrors(context, declaration); + return; + } + + if (!importedModule.hasDefault) { + // The rule is triggered for default imports/exports, so if the imported module has no default + // this means we're dealing with incorrect source code anyway + return; + } + + if (!importedModule.has(analyzedName)) { + // The name used locally for the default import was not even used in the imported module. + return; + } + + /** + * FIXME: We can verify if a default and a named export are pointing to the same symbol only + * if they are both `reexports`. In case one of the symbols is not a re-export, but defined + * in the file, the ExportMap structure has no info about what actually is being exported -- + * the value in the `namespace` Map is an empty object. + * + * To solve this, it would require not relying on the ExportMap, but on some other way of + * accessing the imported module and its exported values. + * + * Additionally, although `ExportMap.get` is a unified way to get info from both `reexports` + * and `namespace` maps, it does not return valid output we need here, and I think this is + * related to the "cycle safeguards" in the `get` function. + */ + + if (importedModule.reexports.has(analyzedName) && importedModule.reexports.has('default')) { + var thingImportedWithNamedImport = importedModule.reexports.get(analyzedName).getImport(); + var thingImportedWithDefaultImport = importedModule.reexports.get('default').getImport(); + + // Case: both imports point to the same file and they both refer to the same symbol in this file. + if ( + thingImportedWithNamedImport.path === thingImportedWithDefaultImport.path && + thingImportedWithNamedImport.local === thingImportedWithDefaultImport.local) + { + // #1594: the imported module exports the same thing via a default export and a named export + return; + } + } + + context.report( + defaultSpecifier, 'Using exported name \'' + String( + defaultSpecifier[nameKey].name) + '\' as identifier for default ' + (nameKey === 'local' ? 'import' : 'export') + '.'); + + + } + + return { + ImportDefaultSpecifier: checkDefault.bind(null, 'local'), + ExportDefaultSpecifier: checkDefault.bind(null, 'exported') }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1hcy1kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwiY3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luIHRoaXMgZmlsZS5cbiAgICAgICAgaWYgKFxuICAgICAgICAgIHRoaW5nSW1wb3J0ZWRXaXRoTmFtZWRJbXBvcnQucGF0aCA9PT0gdGhpbmdJbXBvcnRlZFdpdGhEZWZhdWx0SW1wb3J0LnBhdGhcbiAgICAgICAgICAmJiB0aGluZ0ltcG9ydGVkV2l0aE5hbWVkSW1wb3J0LmxvY2FsID09PSB0aGluZ0ltcG9ydGVkV2l0aERlZmF1bHRJbXBvcnQubG9jYWxcbiAgICAgICAgKSB7XG4gICAgICAgICAgLy8gIzE1OTQ6IHRoZSBpbXBvcnRlZCBtb2R1bGUgZXhwb3J0cyB0aGUgc2FtZSB0aGluZyB2aWEgYSBkZWZhdWx0IGV4cG9ydCBhbmQgYSBuYW1lZCBleHBvcnRcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgY29udGV4dC5yZXBvcnQoXG4gICAgICAgIGRlZmF1bHRTcGVjaWZpZXIsXG4gICAgICAgIGBVc2luZyBleHBvcnRlZCBuYW1lICcke2RlZmF1bHRTcGVjaWZpZXJbbmFtZUtleV0ubmFtZX0nIGFzIGlkZW50aWZpZXIgZm9yIGRlZmF1bHQgJHtuYW1lS2V5ID09PSAnbG9jYWwnID8gYGltcG9ydGAgOiBgZXhwb3J0YH0uYCxcbiAgICAgICk7XG5cbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgSW1wb3J0RGVmYXVsdFNwZWNpZmllcjogY2hlY2tEZWZhdWx0LmJpbmQobnVsbCwgJ2xvY2FsJyksXG4gICAgICBFeHBvcnREZWZhdWx0U3BlY2lmaWVyOiBjaGVja0RlZmF1bHQuYmluZChudWxsLCAnZXhwb3J0ZWQnKSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-default.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-default.js new file mode 100644 index 0000000000000000000000000000000000000000..41e3bba366605cfc369f0977a8ff636abd7d8f7a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-default.js @@ -0,0 +1,31 @@ +'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Forbid named default exports.', + url: (0, _docsUrl2['default'])('no-named-default') }, + + schema: [] }, + + + create: function () {function create(context) { + return { + ImportDeclaration: function () {function ImportDeclaration(node) { + node.specifiers.forEach(function (im) { + if (im.importKind === 'type' || im.importKind === 'typeof') { + return; + } + + if (im.type === 'ImportSpecifier' && (im.imported.name || im.imported.value) === 'default') { + context.report({ + node: im.local, + message: 'Use default import syntax to import \'' + String(im.local.name) + '\'.' }); + } + }); + }return ImportDeclaration;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsIkltcG9ydERlY2xhcmF0aW9uIiwibm9kZSIsInNwZWNpZmllcnMiLCJmb3JFYWNoIiwiaW0iLCJpbXBvcnRLaW5kIiwiaW1wb3J0ZWQiLCJuYW1lIiwidmFsdWUiLCJyZXBvcnQiLCJsb2NhbCIsIm1lc3NhZ2UiXSwibWFwcGluZ3MiOiJhQUFBLHFDOztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFB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ZWZhdWx0IGV4cG9ydHMuJyxcbiAgICAgIHVybDogZG9jc1VybCgnbm8tbmFtZWQtZGVmYXVsdCcpLFxuICAgIH0sXG4gICAgc2NoZW1hOiBbXSxcbiAgfSxcblxuICBjcmVhdGUoY29udGV4dCkge1xuICAgIHJldHVybiB7XG4gICAgICBJbXBvcnREZWNsYXJhdGlvbihub2RlKSB7XG4gICAgICAgIG5vZGUuc3BlY2lmaWVycy5mb3JFYWNoKGZ1bmN0aW9uIChpbSkge1xuICAgICAgICAgIGlmIChpbS5pbXBvcnRLaW5kID09PSAndHlwZScgfHwgaW0uaW1wb3J0S2luZCA9PT0gJ3R5cGVvZicpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoaW0udHlwZSA9PT0gJ0ltcG9ydFNwZWNpZmllcicgJiYgKGltLmltcG9ydGVkLm5hbWUgfHwgaW0uaW1wb3J0ZWQudmFsdWUpID09PSAnZGVmYXVsdCcpIHtcbiAgICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgICAgbm9kZTogaW0ubG9jYWwsXG4gICAgICAgICAgICAgIG1lc3NhZ2U6IGBVc2UgZGVmYXVsdCBpbXBvcnQgc3ludGF4IHRvIGltcG9ydCAnJHtpbS5sb2NhbC5uYW1lfScuYCB9KTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-export.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-export.js new file mode 100644 index 0000000000000000000000000000000000000000..37c95885e96e5d840022e257303888858a253f30 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-named-export.js @@ -0,0 +1,40 @@ +'use strict';var _sourceType = require('../core/sourceType');var _sourceType2 = _interopRequireDefault(_sourceType); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Forbid named exports.', + url: (0, _docsUrl2['default'])('no-named-export') }, + + schema: [] }, + + + create: function () {function create(context) { + // ignore non-modules + if ((0, _sourceType2['default'])(context) !== 'module') { + return {}; + } + + var message = 'Named exports are not allowed.'; + + return { + ExportAllDeclaration: function () {function ExportAllDeclaration(node) { + context.report({ node: node, message: message }); + }return ExportAllDeclaration;}(), + + ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { + if (node.specifiers.length === 0) { + return context.report({ node: node, message: message }); + } + + var someNamed = node.specifiers.some(function (specifier) {return (specifier.exported.name || specifier.exported.value) !== 'default';}); + if (someNamed) { + context.report({ node: node, message: message }); + } + }return ExportNamedDeclaration;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1leHBvcnQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJjb250ZXh0IiwibWVzc2FnZSIsIkV4cG9ydEFsbERlY2xhcmF0aW9uIiwibm9kZSIsInJlcG9ydCIsIkV4cG9ydE5hbWVkRGVjbGFyYXRpb24iLCJzcGVjaWZpZXJzIiwibGVuZ3RoIiwic29tZU5hbWVkIiwic29tZSIsInNwZWNpZmllciIsImV4cG9ydGVkIiwibmFtZSIsInZhbHVlIl0sIm1hcHBpbmdzIjoiYUFBQSxnRDtBQUNBLHFDOztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ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WNpZmllcikgPT4gKHNwZWNpZmllci5leHBvcnRlZC5uYW1lIHx8IHNwZWNpZmllci5leHBvcnRlZC52YWx1ZSkgIT09ICdkZWZhdWx0Jyk7XG4gICAgICAgIGlmIChzb21lTmFtZWQpIHtcbiAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7IG5vZGUsIG1lc3NhZ2UgfSk7XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-namespace.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..c858db0c0c3a84d1712b8f61cc69998e4c6275c2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-namespace.js @@ -0,0 +1,172 @@ +'use strict'; + + + + +var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch); +var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +/** + * @param {MemberExpression} memberExpression + * @returns {string} the name of the member in the object expression, e.g. the `x` in `namespace.x` + */ +function getMemberPropertyName(memberExpression) { + return memberExpression.property.type === 'Identifier' ? + memberExpression.property.name : + memberExpression.property.value; +} + +/** + * @param {ScopeManager} scopeManager + * @param {ASTNode} node + * @return {Set} + */ /** + * @fileoverview Rule to disallow namespace import + * @author Radek Benkel + */function getVariableNamesInScope(scopeManager, node) {var currentNode = node;var scope = scopeManager.acquire(currentNode); + while (scope == null) { + currentNode = currentNode.parent; + scope = scopeManager.acquire(currentNode, true); + } + return new Set(scope.variables.concat(scope.upper.variables).map(function (variable) {return variable.name;})); +} + +/** + * + * @param {*} names + * @param {*} nameConflicts + * @param {*} namespaceName + */ +function generateLocalNames(names, nameConflicts, namespaceName) { + var localNames = {}; + names.forEach(function (name) { + var localName = void 0; + if (!nameConflicts[name].has(name)) { + localName = name; + } else if (!nameConflicts[name].has(String(namespaceName) + '_' + String(name))) { + localName = String(namespaceName) + '_' + String(name); + } else { + for (var i = 1; i < Infinity; i++) { + if (!nameConflicts[name].has(String(namespaceName) + '_' + String(name) + '_' + String(i))) { + localName = String(namespaceName) + '_' + String(name) + '_' + String(i); + break; + } + } + } + localNames[name] = localName; + }); + return localNames; +} + +/** + * @param {Identifier[]} namespaceIdentifiers + * @returns {boolean} `true` if the namespace variable is more than just a glorified constant + */ +function usesNamespaceAsObject(namespaceIdentifiers) { + return !namespaceIdentifiers.every(function (identifier) { + var parent = identifier.parent; + + // `namespace.x` or `namespace['x']` + return ( + parent && + parent.type === 'MemberExpression' && ( + parent.property.type === 'Identifier' || parent.property.type === 'Literal')); + + }); +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Forbid namespace (a.k.a. "wildcard" `*`) imports.', + url: (0, _docsUrl2['default'])('no-namespace') }, + + fixable: 'code', + schema: [{ + type: 'object', + properties: { + ignore: { + type: 'array', + items: { + type: 'string' }, + + uniqueItems: true } } }] }, + + + + + + create: function () {function create(context) { + var firstOption = context.options[0] || {}; + var ignoreGlobs = firstOption.ignore; + + return { + ImportNamespaceSpecifier: function () {function ImportNamespaceSpecifier(node) { + if (ignoreGlobs && ignoreGlobs.find(function (glob) {return (0, _minimatch2['default'])(node.parent.source.value, glob, { matchBase: true });})) { + return; + } + + var scopeVariables = (0, _contextCompat.getScope)(context, node).variables; + var namespaceVariable = scopeVariables.find(function (variable) {return variable.defs[0].node === node;}); + var namespaceReferences = namespaceVariable.references; + var namespaceIdentifiers = namespaceReferences.map(function (reference) {return reference.identifier;}); + var canFix = namespaceIdentifiers.length > 0 && !usesNamespaceAsObject(namespaceIdentifiers); + + context.report({ + node: node, + message: 'Unexpected namespace import.', + fix: canFix && function (fixer) {var _getSourceCode = + (0, _contextCompat.getSourceCode)(context),scopeManager = _getSourceCode.scopeManager; + var fixes = []; + + // Pass 1: Collect variable names that are already in scope for each reference we want + // to transform, so that we can be sure that we choose non-conflicting import names + var importNameConflicts = {}; + namespaceIdentifiers.forEach(function (identifier) { + var parent = identifier.parent; + if (parent && parent.type === 'MemberExpression') { + var importName = getMemberPropertyName(parent); + var localConflicts = getVariableNamesInScope(scopeManager, parent); + if (!importNameConflicts[importName]) { + importNameConflicts[importName] = localConflicts; + } else { + localConflicts.forEach(function (c) {return importNameConflicts[importName].add(c);}); + } + } + }); + + // Choose new names for each import + var importNames = Object.keys(importNameConflicts); + var importLocalNames = generateLocalNames( + importNames, + importNameConflicts, + namespaceVariable.name); + + + // Replace the ImportNamespaceSpecifier with a list of ImportSpecifiers + var namedImportSpecifiers = importNames.map(function (importName) {return importName === importLocalNames[importName] ? + importName : String( + importName) + ' as ' + String(importLocalNames[importName]);}); + + fixes.push(fixer.replaceText(node, '{ ' + String(namedImportSpecifiers.join(', ')) + ' }')); + + // Pass 2: Replace references to the namespace with references to the named imports + namespaceIdentifiers.forEach(function (identifier) { + var parent = identifier.parent; + if (parent && parent.type === 'MemberExpression') { + var importName = getMemberPropertyName(parent); + fixes.push(fixer.replaceText(parent, importLocalNames[importName])); + } + }); + + return fixes; + } }); + + }return ImportNamespaceSpecifier;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lc3BhY2UuanMiXSwibmFtZXMiOlsiZ2V0TWVtYmVyUHJvcGVydHlOYW1lIiwibWVtYmVyRXhwcmVzc2lvbiIsInByb3BlcnR5IiwidHlwZSIsIm5hbWUiLCJ2YWx1ZSIsImdldFZhcmlhYmxlTmFtZXNJblNjb3BlIiwic2NvcGVNYW5hZ2VyIiwibm9kZSIsImN1cnJlbnROb2RlIiwic2NvcGUiLCJhY3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Db25mbGljdHMgPSB7fTtcbiAgICAgICAgICAgIG5hbWVzcGFjZUlkZW50aWZpZXJzLmZvckVhY2goKGlkZW50aWZpZXIpID0+IHtcbiAgICAgICAgICAgICAgY29uc3QgcGFyZW50ID0gaWRlbnRpZmllci5wYXJlbnQ7XG4gICAgICAgICAgICAgIGlmIChwYXJlbnQgJiYgcGFyZW50LnR5cGUgPT09ICdNZW1iZXJFeHByZXNzaW9uJykge1xuICAgICAgICAgICAgICAgIGNvbnN0IGltcG9ydE5hbWUgPSBnZXRNZW1iZXJQcm9wZXJ0eU5hbWUocGFyZW50KTtcbiAgICAgICAgICAgICAgICBjb25zdCBsb2NhbENvbmZsaWN0cyA9IGdldFZhcmlhYmxlTmFtZXNJblNjb3BlKHNjb3BlTWFuYWdlciwgcGFyZW50KTtcbiAgICAgICAgICAgICAgICBpZiAoIWltcG9ydE5hbWVDb25mbGljdHNbaW1wb3J0TmFtZV0pIHtcbiAgICAgICAgICAgICAgICAgIGltcG9ydE5hbWVDb25mbGljdHNbaW1wb3J0TmFtZV0gPSBsb2NhbENvbmZsaWN0cztcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgbG9jYWxDb25mbGljdHMuZm9yRWFjaCgoYykgPT4gaW1wb3J0TmFtZUNvbmZsaWN0c1tpbXBvcnROYW1lXS5hZGQoYykpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIC8vIENob29zZSBuZXcgbmFtZXMgZm9yIGVhY2ggaW1wb3J0XG4gICAgICAgICAgICBjb25zdCBpbXBvcnROYW1lcyA9IE9iamVjdC5rZXlzKGltcG9ydE5hbWVDb25mbGljdHMpO1xuICAgICAgICAgICAgY29uc3QgaW1wb3J0TG9jYWxOYW1lcyA9IGdlbmVyYXRlTG9jYWxOYW1lcyhcbiAgICAgICAgICAgICAgaW1wb3J0TmFtZXMsXG4gICAgICAgICAgICAg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gICAgICBmaXhlcy5wdXNoKGZpeGVyLnJlcGxhY2VUZXh0KHBhcmVudCwgaW1wb3J0TG9jYWxOYW1lc1tpbXBvcnROYW1lXSkpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgcmV0dXJuIGZpeGVzO1xuICAgICAgICAgIH0pLFxuICAgICAgICB9KTtcbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-nodejs-modules.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-nodejs-modules.js new file mode 100644 index 0000000000000000000000000000000000000000..b25c561b3fe79d41869d29350b1d2ae025c9362d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-nodejs-modules.js @@ -0,0 +1,44 @@ +'use strict';var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function reportIfMissing(context, node, allowed, name) { + if (allowed.indexOf(name) === -1 && (0, _importType2['default'])(name, context) === 'builtin') { + context.report(node, 'Do not import Node.js builtin module "' + String(name) + '"'); + } +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Module systems', + description: 'Forbid Node.js builtin modules.', + url: (0, _docsUrl2['default'])('no-nodejs-modules') }, + + schema: [ + { + type: 'object', + properties: { + allow: { + type: 'array', + uniqueItems: true, + items: { + type: 'string' } } }, + + + + additionalProperties: false }] }, + + + + + create: function () {function create(context) { + var options = context.options[0] || {}; + var allowed = options.allow || []; + + return (0, _moduleVisitor2['default'])(function (source, node) { + reportIfMissing(context, node, allowed, source.value); + }, { commonjs: true }); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1ub2RlanMtbW9kdWxlcy5qcyJdLCJuYW1lcyI6WyJyZXBvcnRJZk1pc3NpbmciLCJjb250ZXh0Iiwibm9kZSIsImFsbG93ZWQiLCJuYW1lIiwiaW5kZXhPZiIsInJlcG9ydCIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwicHJvcGVydGllcyIsImFsbG93IiwidW5pcXVlSXRlbXMiLCJpdGVtcyIsImFkZGl0aW9uYWxQcm9wZXJ0aWVzIiwiY3JlYXRlIiwib3B0aW9ucyIsInNvdXJjZSIsInZhbHVlIiwiY29tbW9uanMiXSwibWFwcGluZ3MiOiJhQUFBLGdEO0FBQ0Esa0U7QUFDQSxxQzs7QUFFQSxTQUFTQSxlQUFULENBQXlCQyxPQUF6QixFQUFrQ0MsSUFBbEMsRUFBd0NDLE9BQXhDLEVBQWlEQyxJQUFqRCxFQUF1RDtBQUNyRCxNQUFJRCxRQUFRRSxPQUFSLENBQWdCRCxJQUFoQixNQUEwQixDQUFDLENBQTNCLElBQWdDLDZCQUFXQSxJQUFYLEVBQWlCSCxPQUFqQixNQUE4QixTQUFsRSxFQUE2RTtBQUMzRUEsWUFBUUssTUFBUixDQUFlSixJQUFmLG9EQUE4REUsSUFBOUQ7QUFDRDtBQUNGOztBQUVERyxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTSxZQURGO0FBRUpDLFVBQU07QUFDSkMsZ0JBQVUsZ0JBRE47QUFFSkMsbUJBQWEsaUNBRlQ7QUFHSkMsV0FBSywwQkFBUSxtQkFBUixDQUhELEVBRkY7O0FBT0pDLFlBQVE7QUFDTjtBQ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7XG4gICAgY29udGV4dC5yZXBvcnQobm9kZSwgYERvIG5vdCBpbXBvcnQgTm9kZS5qcyBidWlsdGluIG1vZHVsZSBcIiR7bmFtZX1cImApO1xuICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0ge1xuICBtZXRhOiB7XG4gICAgdHlwZTogJ3N1Z2dlc3Rpb24nLFxuICAgIGRvY3M6IHtcbiAgICAgIGNhdGVnb3J5OiAnTW9kdWxlIHN5c3RlbXMnLFxuICAgICAgZGVzY3JpcHRpb246ICdGb3JiaWQgTm9kZS5qcyBidWlsdGluIG1vZHVsZXMuJyxcbiAgICAgIHVybDogZG9jc1VybCgnbm8tbm9kZWpzLW1vZHVsZXMnKSxcbiAgICB9LFxuICAgIHNjaGVtYTogW1xuICAgICAge1xuICAgICAgICB0eXBlOiAnb2JqZWN0JyxcbiAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgIGFsbG93OiB7XG4gICAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgICAgdW5pcXVlSXRlbXM6IHRydWUsXG4gICAgICAgICAgICBpdGVtczoge1xuICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgICAgYWRkaXRpb25hbFByb3BlcnRpZXM6IGZhbHNlLFxuICAgICAgfSxcbiAgICBdLFxuICB9LFxuXG4gIGNyZWF0ZShjb250ZXh0KSB7XG4gICAgY29uc3Qgb3B0aW9ucyA9IGNvbnRleHQub3B0aW9uc1swXSB8fCB7fTtcbiAgICBjb25zdCBhbGxvd2VkID0gb3B0aW9ucy5hbGxvdyB8fCBbXTtcblxuICAgIHJldHVybiBtb2R1bGVWaXNpdG9yKChzb3VyY2UsIG5vZGUpID0+IHtcbiAgICAgIHJlcG9ydElmTWlzc2luZyhjb250ZXh0LCBub2RlLCBhbGxvd2VkLCBzb3VyY2UudmFsdWUpO1xuICAgIH0sIHsgY29tbW9uanM6IHRydWUgfSk7XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-relative-packages.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-relative-packages.js new file mode 100644 index 0000000000000000000000000000000000000000..b2e70d06c1bd4dd3343b89ab7134a2c5c43ff64b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-relative-packages.js @@ -0,0 +1,72 @@ +'use strict';var _path = require('path');var _path2 = _interopRequireDefault(_path); +var _readPkgUp = require('eslint-module-utils/readPkgUp');var _readPkgUp2 = _interopRequireDefault(_readPkgUp); + +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +/** @param {string} filePath */ +function toPosixPath(filePath) { + return filePath.replace(/\\/g, '/'); +} + +function findNamedPackage(filePath) { + var found = (0, _readPkgUp2['default'])({ cwd: filePath }); + if (found.pkg && !found.pkg.name) { + return findNamedPackage(_path2['default'].join(found.path, '../..')); + } + return found; +} + +function checkImportForRelativePackage(context, importPath, node) { + var potentialViolationTypes = ['parent', 'index', 'sibling']; + if (potentialViolationTypes.indexOf((0, _importType2['default'])(importPath, context)) === -1) { + return; + } + + var resolvedImport = (0, _resolve2['default'])(importPath, context); + var resolvedContext = (0, _contextCompat.getPhysicalFilename)(context); + + if (!resolvedImport || !resolvedContext) { + return; + } + + var importPkg = findNamedPackage(resolvedImport); + var contextPkg = findNamedPackage(resolvedContext); + + if (importPkg.pkg && contextPkg.pkg && importPkg.pkg.name !== contextPkg.pkg.name) { + var importBaseName = _path2['default'].basename(importPath); + var importRoot = _path2['default'].dirname(importPkg.path); + var properPath = _path2['default'].relative(importRoot, resolvedImport); + var properImport = _path2['default'].join( + importPkg.pkg.name, + _path2['default'].dirname(properPath), + importBaseName === _path2['default'].basename(importRoot) ? '' : importBaseName); + + context.report({ + node: node, + message: 'Relative import from another package is not allowed. Use `' + String(properImport) + '` instead of `' + String(importPath) + '`', + fix: function () {function fix(fixer) {return fixer.replaceText(node, JSON.stringify(toPosixPath(properImport)));}return fix;}() }); + + + } +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Static analysis', + description: 'Forbid importing packages through relative paths.', + url: (0, _docsUrl2['default'])('no-relative-packages') }, + + fixable: 'code', + schema: [(0, _moduleVisitor.makeOptionsSchema)()] }, + + + create: function () {function create(context) { + return (0, _moduleVisitor2['default'])(function (source) {return checkImportForRelativePackage(context, source.value, source);}, context.options[0]); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1yZWxhdGl2ZS1wYWNrYWdlcy5qcyJdLCJuYW1lcyI6WyJ0b1Bvc2l4UGF0aCIsImZpbGVQYXRoIiwicmVwbGFjZSIsImZpbmROYW1lZFBhY2thZ2UiLCJmb3VuZCIsImN3ZCIsInBrZyIsIm5hbWUiLCJwYXRoIiwiam9pbiIsImNoZWNrSW1wb3J0Rm9yUmVsYXRpdmVQYWNrYWdlIiwiY29udGV4dCIsImltcG9ydFBhdGgiLCJub2RlIiwicG90ZW50aWFsVmlvbGF0aW9uVHlwZXMiLCJpbmRleE9mIiwicmVzb2x2ZWRJbXBvcnQiLCJyZXNvbHZlZENvbnRleHQiLCJpbXBvcnRQa2ciLCJjb250ZXh0UGtnIiwiaW1wb3J0QmFzZU5hbWUiLCJiYXNlbmFtZSIsImltcG9ydFJvb3QiLCJkaX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gYCxcbiAgICAgIGZpeDogKGZpeGVyKSA9PiBmaXhlci5yZXBsYWNlVGV4dChub2RlLCBKU09OLnN0cmluZ2lmeSh0b1Bvc2l4UGF0aChwcm9wZXJJbXBvcnQpKSlcbiAgICAgICxcbiAgICB9KTtcbiAgfVxufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtcbiAgbWV0YToge1xuICAgIHR5cGU6ICdzdWdnZXN0aW9uJyxcbiAgICBkb2NzOiB7XG4gICAgICBjYXRlZ29yeTogJ1N0YXRpYyBhbmFseXNpcycsXG4gICAgICBkZXNjcmlwdGlvbjogJ0ZvcmJpZCBpbXBvcnRpbmcgcGFja2FnZXMgdGhyb3VnaCByZWxhdGl2ZSBwYXRocy4nLFxuICAgICAgdXJsOiBkb2NzVXJsKCduby1yZWxhdGl2ZS1wYWNrYWdlcycpLFxuICAgIH0sXG4gICAgZml4YWJsZTogJ2NvZGUnLFxuICAgIHNjaGVtYTogW21ha2VPcHRpb25zU2NoZW1hKCldLFxuICB9LFxuXG4gIGNyZWF0ZShjb250ZXh0KSB7XG4gICAgcmV0dXJuIG1vZHVsZVZpc2l0b3IoKHNvdXJjZSkgPT4gY2hlY2tJbXBvcnRGb3JSZWxhdGl2ZVBhY2thZ2UoY29udGV4dCwgc291cmNlLnZhbHVlLCBzb3VyY2UpLCBjb250ZXh0Lm9wdGlvbnNbMF0pO1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-relative-parent-imports.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-relative-parent-imports.js new file mode 100644 index 0000000000000000000000000000000000000000..84c04fafd3783f6f117e4c87b25f11c155816bb5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-relative-parent-imports.js @@ -0,0 +1,49 @@ +'use strict';var _path = require('path'); +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); + +var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Static analysis', + description: 'Forbid importing modules from parent directories.', + url: (0, _docsUrl2['default'])('no-relative-parent-imports') }, + + schema: [(0, _moduleVisitor.makeOptionsSchema)()] }, + + + create: function () {function noRelativePackages(context) { + var myPath = (0, _contextCompat.getPhysicalFilename)(context); + if (myPath === '') {return {};} // can't check a non-file + + function checkSourceValue(sourceNode) { + var depPath = sourceNode.value; + + if ((0, _importType2['default'])(depPath, context) === 'external') {// ignore packages + return; + } + + var absDepPath = (0, _resolve2['default'])(depPath, context); + + if (!absDepPath) {// unable to resolve path + return; + } + + var relDepPath = (0, _path.relative)((0, _path.dirname)(myPath), absDepPath); + + if ((0, _importType2['default'])(relDepPath, context) === 'parent') { + context.report({ + node: sourceNode, + message: 'Relative imports from parent directories are not allowed. Please either pass what you\'re importing through at runtime (dependency injection), move `' + String((0, _path.basename)(myPath)) + '` to same directory as `' + String(depPath) + '` or consider making `' + String(depPath) + '` a package.' }); + + } + } + + return (0, _moduleVisitor2['default'])(checkSourceValue, context.options[0]); + }return noRelativePackages;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1yZWxhdGl2ZS1wYXJlbnQtaW1wb3J0cy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwiY2F0ZWdvcnkiLCJkZXNjcmlwdGlvbiIsInVybCIsIn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tcbiAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgIG5vZGU6IHNvdXJjZU5vZGUsXG4gICAgICAgICAgbWVzc2FnZTogYFJlbGF0aXZlIGltcG9ydHMgZnJvbSBwYXJlbnQgZGlyZWN0b3JpZXMgYXJlIG5vdCBhbGxvd2VkLiBQbGVhc2UgZWl0aGVyIHBhc3Mgd2hhdCB5b3UncmUgaW1wb3J0aW5nIHRocm91Z2ggYXQgcnVudGltZSAoZGVwZW5kZW5jeSBpbmplY3Rpb24pLCBtb3ZlIFxcYCR7YmFzZW5hbWUobXlQYXRoKX1cXGAgdG8gc2FtZSBkaXJlY3RvcnkgYXMgXFxgJHtkZXBQYXRofVxcYCBvciBjb25zaWRlciBtYWtpbmcgXFxgJHtkZXBQYXRofVxcYCBhIHBhY2thZ2UuYCxcbiAgICAgICAgfSk7XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIG1vZHVsZVZpc2l0b3IoY2hlY2tTb3VyY2VWYWx1ZSwgY29udGV4dC5vcHRpb25zWzBdKTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-restricted-paths.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-restricted-paths.js new file mode 100644 index 0000000000000000000000000000000000000000..890cb05ad06afc4fe76e77a7bd21fb7af64be9a5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-restricted-paths.js @@ -0,0 +1,246 @@ +'use strict';var _path = require('path');var _path2 = _interopRequireDefault(_path); +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _isGlob = require('is-glob');var _isGlob2 = _interopRequireDefault(_isGlob); +var _minimatch = require('minimatch'); + +var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +var containsPath = function containsPath(filepath, target) { + var relative = _path2['default'].relative(target, filepath); + return relative === '' || !relative.startsWith('..'); +}; + +function isMatchingTargetPath(filename, targetPath) { + if ((0, _isGlob2['default'])(targetPath)) { + var mm = new _minimatch.Minimatch(targetPath); + return mm.match(filename); + } + + return containsPath(filename, targetPath); +} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Static analysis', + description: 'Enforce which files can be imported in a given folder.', + url: (0, _docsUrl2['default'])('no-restricted-paths') }, + + + schema: [ + { + type: 'object', + properties: { + zones: { + type: 'array', + minItems: 1, + items: { + type: 'object', + properties: { + target: { + anyOf: [ + { type: 'string' }, + { + type: 'array', + items: { type: 'string' }, + uniqueItems: true, + minLength: 1 }] }, + + + + from: { + anyOf: [ + { type: 'string' }, + { + type: 'array', + items: { type: 'string' }, + uniqueItems: true, + minLength: 1 }] }, + + + + except: { + type: 'array', + items: { + type: 'string' }, + + uniqueItems: true }, + + message: { type: 'string' } }, + + additionalProperties: false } }, + + + basePath: { type: 'string' } }, + + additionalProperties: false }] }, + + + + + create: function () {function noRestrictedPaths(context) { + var options = context.options[0] || {}; + var restrictedPaths = options.zones || []; + var basePath = options.basePath || process.cwd(); + var currentFilename = (0, _contextCompat.getPhysicalFilename)(context); + var matchingZones = restrictedPaths.filter( + function (zone) {return [].concat(zone.target). + map(function (target) {return _path2['default'].resolve(basePath, target);}). + some(function (targetPath) {return isMatchingTargetPath(currentFilename, targetPath);});}); + + + function isValidExceptionPath(absoluteFromPath, absoluteExceptionPath) { + var relativeExceptionPath = _path2['default'].relative(absoluteFromPath, absoluteExceptionPath); + + return (0, _importType2['default'])(relativeExceptionPath, context) !== 'parent'; + } + + function areBothGlobPatternAndAbsolutePath(areGlobPatterns) { + return areGlobPatterns.some(function (isGlob) {return isGlob;}) && areGlobPatterns.some(function (isGlob) {return !isGlob;}); + } + + function reportInvalidExceptionPath(node) { + context.report({ + node: node, + message: 'Restricted path exceptions must be descendants of the configured `from` path for that zone.' }); + + } + + function reportInvalidExceptionMixedGlobAndNonGlob(node) { + context.report({ + node: node, + message: 'Restricted path `from` must contain either only glob patterns or none' }); + + } + + function reportInvalidExceptionGlob(node) { + context.report({ + node: node, + message: 'Restricted path exceptions must be glob patterns when `from` contains glob patterns' }); + + } + + function computeMixedGlobAndAbsolutePathValidator() { + return { + isPathRestricted: function () {function isPathRestricted() {return true;}return isPathRestricted;}(), + hasValidExceptions: false, + reportInvalidException: reportInvalidExceptionMixedGlobAndNonGlob }; + + } + + function computeGlobPatternPathValidator(absoluteFrom, zoneExcept) { + var isPathException = void 0; + + var mm = new _minimatch.Minimatch(absoluteFrom); + var isPathRestricted = function () {function isPathRestricted(absoluteImportPath) {return mm.match(absoluteImportPath);}return isPathRestricted;}(); + var hasValidExceptions = zoneExcept.every(_isGlob2['default']); + + if (hasValidExceptions) { + var exceptionsMm = zoneExcept.map(function (except) {return new _minimatch.Minimatch(except);}); + isPathException = function () {function isPathException(absoluteImportPath) {return exceptionsMm.some(function (mm) {return mm.match(absoluteImportPath);});}return isPathException;}(); + } + + var reportInvalidException = reportInvalidExceptionGlob; + + return { + isPathRestricted: isPathRestricted, + hasValidExceptions: hasValidExceptions, + isPathException: isPathException, + reportInvalidException: reportInvalidException }; + + } + + function computeAbsolutePathValidator(absoluteFrom, zoneExcept) { + var isPathException = void 0; + + var isPathRestricted = function () {function isPathRestricted(absoluteImportPath) {return containsPath(absoluteImportPath, absoluteFrom);}return isPathRestricted;}(); + + var absoluteExceptionPaths = zoneExcept. + map(function (exceptionPath) {return _path2['default'].resolve(absoluteFrom, exceptionPath);}); + var hasValidExceptions = absoluteExceptionPaths. + every(function (absoluteExceptionPath) {return isValidExceptionPath(absoluteFrom, absoluteExceptionPath);}); + + if (hasValidExceptions) { + isPathException = function () {function isPathException(absoluteImportPath) {return absoluteExceptionPaths.some( + function (absoluteExceptionPath) {return containsPath(absoluteImportPath, absoluteExceptionPath);});}return isPathException;}(); + + } + + var reportInvalidException = reportInvalidExceptionPath; + + return { + isPathRestricted: isPathRestricted, + hasValidExceptions: hasValidExceptions, + isPathException: isPathException, + reportInvalidException: reportInvalidException }; + + } + + function reportInvalidExceptions(validators, node) { + validators.forEach(function (validator) {return validator.reportInvalidException(node);}); + } + + function reportImportsInRestrictedZone(validators, node, importPath, customMessage) { + validators.forEach(function () { + context.report({ + node: node, + message: 'Unexpected path "{{importPath}}" imported in restricted zone.' + (customMessage ? ' ' + String(customMessage) : ''), + data: { importPath: importPath } }); + + }); + } + + var makePathValidators = function () {function makePathValidators(zoneFrom) {var zoneExcept = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var allZoneFrom = [].concat(zoneFrom); + var areGlobPatterns = allZoneFrom.map(_isGlob2['default']); + + if (areBothGlobPatternAndAbsolutePath(areGlobPatterns)) { + return [computeMixedGlobAndAbsolutePathValidator()]; + } + + var isGlobPattern = areGlobPatterns.every(function (isGlob) {return isGlob;}); + + return allZoneFrom.map(function (singleZoneFrom) { + var absoluteFrom = _path2['default'].resolve(basePath, singleZoneFrom); + + if (isGlobPattern) { + return computeGlobPatternPathValidator(absoluteFrom, zoneExcept); + } + return computeAbsolutePathValidator(absoluteFrom, zoneExcept); + }); + }return makePathValidators;}(); + + var validators = []; + + function checkForRestrictedImportPath(importPath, node) { + var absoluteImportPath = (0, _resolve2['default'])(importPath, context); + + if (!absoluteImportPath) { + return; + } + + matchingZones.forEach(function (zone, index) { + if (!validators[index]) { + validators[index] = makePathValidators(zone.from, zone.except); + } + + var applicableValidatorsForImportPath = validators[index].filter(function (validator) {return validator.isPathRestricted(absoluteImportPath);}); + + var validatorsWithInvalidExceptions = applicableValidatorsForImportPath.filter(function (validator) {return !validator.hasValidExceptions;}); + reportInvalidExceptions(validatorsWithInvalidExceptions, node); + + var applicableValidatorsForImportPathExcludingExceptions = applicableValidatorsForImportPath. + filter(function (validator) {return validator.hasValidExceptions && !validator.isPathException(absoluteImportPath);}); + reportImportsInRestrictedZone(applicableValidatorsForImportPathExcludingExceptions, node, importPath, zone.message); + }); + } + + return (0, _moduleVisitor2['default'])(function (source) { + checkForRestrictedImportPath(source.value, source); + }, { commonjs: true }); + }return noRestrictedPaths;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1yZXN0cmljdGVkLXBhdGhzLmpzIl0sIm5hbWVzIjpbImNvbnRhaW5zUGF0aCIsImZpbGVwYXRoIiwidGFyZ2V0IiwicmVsYXRpdmUiLCJwYXRoIiwic3RhcnRzV2l0aCIsImlzTWF0Y2hpbmdUYXJnZXRQYXRoIiwiZmlsZW5hbWUiLCJ0YXJnZXRQYXRoIiwibW0iLCJNaW5pbWF0Y2giLCJtYXRjaCIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwicHJvcGVydGllcyIsInpvbmVzIiwibWluSXRlbXMiLCJpdGVtcyIsImFueU9mIiwidW5pcXVlSXRlbXMiLCJtaW5MZW5ndGgiLCJmcm9tIiwiZXhjZXB0IiwibWVzc2FnZSIsImFkZGl0aW9uYWxQcm9wZXJ0aWVzIiwiYmFzZVBhdGgiLCJjcmVhdGUiLCJub1Jlc3RyaWN0ZWRQYXRocyIsImNvbnRleHQiLCJvcHRpb25zIiwicmVzdHJpY3RlZFBhdGhzIiwicHJvY2VzcyIsImN3ZCIsImN1cnJlbnRGaWxlbmFtZSIsIm1hdGNoaW5nWm9uZXMiLCJmaWx0ZXIiLCJ6b25lIiwiY29uY2F0IiwibWFwIiwicmVzb2x2ZSIsInNvbWUiLCJpc1ZhbGlk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bXM6IHtcbiAgICAgICAgICAgICAgdHlwZTogJ29iamVjdCcsXG4gICAgICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgICAgICB0YXJnZXQ6IHtcbiAgICAgICAgICAgICAgICAgIGFueU9mOiBbXG4gICAgICAgICAgICAgICAgICAgIHsgdHlwZTogJ3N0cmluZycgfSxcbiAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgICAgICAgICAgICAgaXRlbXM6IHsgdHlwZTogJ3N0cmluZycgfSxcbiAgICAgICAgICAgICAgICAgICAgICB1bmlxdWVJdGVtczogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICBtaW5MZW5ndGg6IDEsXG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICBdLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgZnJvbToge1xuICAgICAgICAgICAgICAgICAgYW55T2Y6IFtcbiAgICAgICAgICAgICAgICAgICAgeyB0eXBlOiAnc3RyaW5nJyB9LFxuICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JyxcbiAgICAgICAgICAgICAgICAgICAgICBpdGVtczogeyB0eXBlOiAnc3RyaW5nJyB9LFxuICAgICAgICAgICAgICAgICAgICAgIHVuaXF1ZUl0ZW1zOiB0cnVlLFxuICAgICAgICAgICAgICAgICAgICAgIG1pbkxlbmd0aDogMSxcbiAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgIF0sXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBleGNlcHQ6IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgICAgICAgICBpdGVtczoge1xuICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgICAg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bGlkRXhjZXB0aW9ucyk7XG4gICAgICAgIHJlcG9ydEludmFsaWRFeGNlcHRpb25zKHZhbGlkYXRvcnNXaXRoSW52YWxpZEV4Y2VwdGlvbnMsIG5vZGUpO1xuXG4gICAgICAgIGNvbnN0IGFwcGxpY2FibGVWYWxpZGF0b3JzRm9ySW1wb3J0UGF0aEV4Y2x1ZGluZ0V4Y2VwdGlvbnMgPSBhcHBsaWNhYmxlVmFsaWRhdG9yc0ZvckltcG9ydFBhdGhcbiAgICAgICAgICAuZmlsdGVyKCh2YWxpZGF0b3IpID0+IHZhbGlkYXRvci5oYXNWYWxpZEV4Y2VwdGlvbnMgJiYgIXZhbGlkYXRvci5pc1BhdGhFeGNlcHRpb24oYWJzb2x1dGVJbXBvcnRQYXRoKSk7XG4gICAgICAgIHJlcG9ydEltcG9ydHNJblJlc3RyaWN0ZWRab25lKGFwcGxpY2FibGVWYWxpZGF0b3JzRm9ySW1wb3J0UGF0aEV4Y2x1ZGluZ0V4Y2VwdGlvbnMsIG5vZGUsIGltcG9ydFBhdGgsIHpvbmUubWVzc2FnZSk7XG4gICAgICB9KTtcbiAgICB9XG5cbiAgICByZXR1cm4gbW9kdWxlVmlzaXRvcigoc291cmNlKSA9PiB7XG4gICAgICBjaGVja0ZvclJlc3RyaWN0ZWRJbXBvcnRQYXRoKHNvdXJjZS52YWx1ZSwgc291cmNlKTtcbiAgICB9LCB7IGNvbW1vbmpzOiB0cnVlIH0pO1xuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-self-import.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-self-import.js new file mode 100644 index 0000000000000000000000000000000000000000..6a4e0dd3ca43c1cd8e06e7d07e09a660531cc57b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-self-import.js @@ -0,0 +1,41 @@ +'use strict'; + + + + +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /** + * @fileOverview Forbids a module from importing itself + * @author Gio d'Amelio + */function isImportingSelf(context, node, requireName) {var filePath = (0, _contextCompat.getPhysicalFilename)(context); + + // If the input is from stdin, this test can't fail + if (filePath !== '' && filePath === (0, _resolve2['default'])(requireName, context)) { + context.report({ + node: node, + message: 'Module imports itself.' }); + + } +} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Static analysis', + description: 'Forbid a module from importing itself.', + recommended: true, + url: (0, _docsUrl2['default'])('no-self-import') }, + + + schema: [] }, + + create: function () {function create(context) { + return (0, _moduleVisitor2['default'])(function (source, node) { + isImportingSelf(context, node, source.value); + }, { commonjs: true }); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1zZWxmLWltcG9ydC5qcyJdLCJuYW1lcyI6WyJpc0ltcG9ydGluZ1NlbGYiLCJjb250ZXh0Iiwibm9kZSIsInJlcXVpcmVOYW1lIiwiZmlsZVBhdGgiLCJyZXBvcnQiLCJtZXNzYWdlIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJyZWNvbW1lbmRlZCIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsInNvdXJjZSIsInZhbHVlIiwiY29tbW9uanMiXSwibWFwcGluZ3MiOiI7Ozs7O0FBS0E7QUFDQSxzRDtBQUNBLGtFOztBQUVBLHFDLGlKQVRBOzs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AgIHJldHVybiBtb2R1bGVWaXNpdG9yKChzb3VyY2UsIG5vZGUpID0+IHtcbiAgICAgIGlzSW1wb3J0aW5nU2VsZihjb250ZXh0LCBub2RlLCBzb3VyY2UudmFsdWUpO1xuICAgIH0sIHsgY29tbW9uanM6IHRydWUgfSk7XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-unassigned-import.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-unassigned-import.js new file mode 100644 index 0000000000000000000000000000000000000000..121d5110923ca474a7eed915051146ff92f8879b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-unassigned-import.js @@ -0,0 +1,80 @@ +'use strict';var _path = require('path');var _path2 = _interopRequireDefault(_path); +var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch); +var _contextCompat = require('eslint-module-utils/contextCompat'); + +var _staticRequire = require('../core/staticRequire');var _staticRequire2 = _interopRequireDefault(_staticRequire); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function report(context, node) { + context.report({ + node: node, + message: 'Imported module should be assigned' }); + +} + +function testIsAllow(globs, filename, source) { + if (!Array.isArray(globs)) { + return false; // default doesn't allow any patterns + } + + var filePath = void 0; + + if (source[0] !== '.' && source[0] !== '/') {// a node module + filePath = source; + } else { + filePath = _path2['default'].resolve(_path2['default'].dirname(filename), source); // get source absolute path + } + + return globs.find(function (glob) {return (0, _minimatch2['default'])(filePath, glob) || + (0, _minimatch2['default'])(filePath, _path2['default'].join(process.cwd(), glob));}) !== + undefined; +} + +function create(context) { + var options = context.options[0] || {}; + var filename = (0, _contextCompat.getPhysicalFilename)(context); + var isAllow = function isAllow(source) {return testIsAllow(options.allow, filename, source);}; + + return { + ImportDeclaration: function () {function ImportDeclaration(node) { + if (node.specifiers.length === 0 && !isAllow(node.source.value)) { + report(context, node); + } + }return ImportDeclaration;}(), + ExpressionStatement: function () {function ExpressionStatement(node) { + if ( + node.expression.type === 'CallExpression' && + (0, _staticRequire2['default'])(node.expression) && + !isAllow(node.expression.arguments[0].value)) + { + report(context, node.expression); + } + }return ExpressionStatement;}() }; + +} + +module.exports = { + create: create, + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Forbid unassigned imports', + url: (0, _docsUrl2['default'])('no-unassigned-import') }, + + schema: [ + { + type: 'object', + properties: { + devDependencies: { type: ['boolean', 'array'] }, + optionalDependencies: { type: ['boolean', 'array'] }, + peerDependencies: { type: ['boolean', 'array'] }, + allow: { + type: 'array', + items: { + type: 'string' } } }, + + + + additionalProperties: false }] } }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby11bmFzc2lnbmVkLWltcG9ydC5qcyJdLCJuYW1lcyI6WyJyZXBvcnQiLCJjb250ZXh0Iiwibm9kZSIsIm1lc3NhZ2UiLCJ0ZXN0SXNBbGxvdyIsImdsb2JzIiwiZmlsZW5hbWUiLCJzb3VyY2UiLCJBcnJheSIsImlzQXJyYXkiLCJmaWxlUGF0aCIsInBhdGgiLCJyZXNvbHZlIiwiZGlybmFtZSIsImZpbmQiLCJnbG9iIiwiam9pbiIsInByb2Nlc3MiLCJjd2QiLCJ1bmRlZmluZWQiLCJjcmVhdGUiLCJvcHRpb25zIiwiaXNBbGxvdyIsImFsbG93IiwiSW1wb3J0RGVjbGFyYXRpb24iLCJzcGVjaWZpZXJzIiwibGVuZ3RoIiwidmFsdWUiLCJFeHByZXNzaW9uU3RhdGVtZW50IiwiZXhwcmVzc2lvbiIsInR5cGUiLCJhcmd1bWVudHMiLCJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2Nya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c6IHtcbiAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgICBpdGVtczoge1xuICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgICAgYWRkaXRpb25hbFByb3BlcnRpZXM6IGZhbHNlLFxuICAgICAgfSxcbiAgICBdLFxuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-unresolved.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-unresolved.js new file mode 100644 index 0000000000000000000000000000000000000000..b77bd08f619ba63b2d0a690512bfcb40733057a7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-unresolved.js @@ -0,0 +1,60 @@ +'use strict'; + + + + +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _ModuleCache = require('eslint-module-utils/ModuleCache');var _ModuleCache2 = _interopRequireDefault(_ModuleCache); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /** + * @fileOverview Ensures that an imported path exists, given resolution rules. + * @author Ben Mosher + */module.exports = { meta: { + type: 'problem', + docs: { + category: 'Static analysis', + description: 'Ensure imports point to a file/module that can be resolved.', + url: (0, _docsUrl2['default'])('no-unresolved') }, + + + schema: [ + (0, _moduleVisitor.makeOptionsSchema)({ + caseSensitive: { type: 'boolean', 'default': true }, + caseSensitiveStrict: { type: 'boolean', 'default': false } })] }, + + + + + create: function () {function create(context) { + var options = context.options[0] || {}; + + function checkSourceValue(source, node) { + // ignore type-only imports and exports + if (node.importKind === 'type' || node.exportKind === 'type') { + return; + } + + var caseSensitive = !_resolve.CASE_SENSITIVE_FS && options.caseSensitive !== false; + var caseSensitiveStrict = !_resolve.CASE_SENSITIVE_FS && options.caseSensitiveStrict; + + var resolvedPath = (0, _resolve2['default'])(source.value, context); + + if (resolvedPath === undefined) { + context.report( + source, 'Unable to resolve path to module \'' + String( + source.value) + '\'.'); + + } else if (caseSensitive || caseSensitiveStrict) { + var cacheSettings = _ModuleCache2['default'].getSettings(context.settings); + if (!(0, _resolve.fileExistsWithCaseSync)(resolvedPath, cacheSettings, caseSensitiveStrict)) { + context.report( + source, 'Casing of ' + String( + source.value) + ' does not match the underlying filesystem.'); + + } + } + } + + return (0, _moduleVisitor2['default'])(checkSourceValue, options); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby11bnJlc29sdmVkLmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwiY2FzZVNlbnNpdGl2ZSIsImNhc2VTZW5zaXRpdmVTdHJpY3QiLCJjcmVhdGUiLCJjb250ZXh0Iiwib3B0aW9ucyIsImNoZWNrU291cmNlVmFsdWUiLCJzb3VyY2UiLCJub2RlIiwiaW1wb3J0S2luZCIsImV4cG9ydEtpbmQiLCJDQVNFX1NFTlNJVElWRV9GUyIsInJlc29sdmVkUGF0aCIsInZhbHVlIiwidW5kZWZpbmVkIiwicmVwb3J0IiwiY2FjaGVTZXR0aW5ncyIsIk1vZHVsZUNhY2hlIiwiZ2V0U2V0dGluZ3MiLCJzZXR0aW5ncyJdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFLQSxzRDtBQUNBLDhEO0FBQ0Esa0U7QUFDQSxxQyxpSkFSQTs7O3lMQVVBQSxPQUFPQyxPQ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UudmFsdWUsIGNvbnRleHQpO1xuXG4gICAgICBpZiAocmVzb2x2ZWRQYXRoID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgY29udGV4dC5yZXBvcnQoXG4gICAgICAgICAgc291cmNlLFxuICAgICAgICAgIGBVbmFibGUgdG8gcmVzb2x2ZSBwYXRoIHRvIG1vZHVsZSAnJHtzb3VyY2UudmFsdWV9Jy5gLFxuICAgICAgICApO1xuICAgICAgfSBlbHNlIGlmIChjYXNlU2Vuc2l0aXZlIHx8IGNhc2VTZW5zaXRpdmVTdHJpY3QpIHtcbiAgICAgICAgY29uc3QgY2FjaGVTZXR0aW5ncyA9IE1vZHVsZUNhY2hlLmdldFNldHRpbmdzKGNvbnRleHQuc2V0dGluZ3MpO1xuICAgICAgICBpZiAoIWZpbGVFeGlzdHNXaXRoQ2FzZVN5bmMocmVzb2x2ZWRQYXRoLCBjYWNoZVNldHRpbmdzLCBjYXNlU2Vuc2l0aXZlU3RyaWN0KSkge1xuICAgICAgICAgIGNvbnRleHQucmVwb3J0KFxuICAgICAgICAgICAgc291cmNlLFxuICAgICAgICAgICAgYENhc2luZyBvZiAke3NvdXJjZS52YWx1ZX0gZG9lcyBub3QgbWF0Y2ggdGhlIHVuZGVybHlpbmcgZmlsZXN5c3RlbS5gLFxuICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gbW9kdWxlVmlzaXRvcihjaGVja1NvdXJjZVZhbHVlLCBvcHRpb25zKTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js new file mode 100644 index 0000000000000000000000000000000000000000..04e0d6f12bec53c8e1c96f5367a42e5059eb7b5e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js @@ -0,0 +1,1072 @@ +'use strict';var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;}; + + + + + +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _ignore = require('eslint-module-utils/ignore'); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _visit = require('eslint-module-utils/visit');var _visit2 = _interopRequireDefault(_visit); +var _path = require('path'); +var _readPkgUp2 = require('eslint-module-utils/readPkgUp');var _readPkgUp3 = _interopRequireDefault(_readPkgUp2); +var _object = require('object.values');var _object2 = _interopRequireDefault(_object); +var _arrayIncludes = require('array-includes');var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes); +var _arrayPrototype = require('array.prototype.flatmap');var _arrayPrototype2 = _interopRequireDefault(_arrayPrototype); + +var _builder = require('../exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _patternCapture = require('../exportMap/patternCapture');var _patternCapture2 = _interopRequireDefault(_patternCapture); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _toConsumableArray(arr) {if (Array.isArray(arr)) {for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {arr2[i] = arr[i];}return arr2;} else {return Array.from(arr);}} /** + * @fileOverview Ensures that modules contain exports and/or all + * modules are consumed within other modules. + * @author René Fermann + */ /** + * Attempt to load the internal `FileEnumerator` class, which has existed in a couple + * of different places, depending on the version of `eslint`. Try requiring it from both + * locations. + * @returns Returns the `FileEnumerator` class if its requirable, otherwise `undefined`. + */function requireFileEnumerator() {var FileEnumerator = void 0; + + // Try getting it from the eslint private / deprecated api + try {var _require = + require('eslint/use-at-your-own-risk');FileEnumerator = _require.FileEnumerator; + } catch (e) { + // Absorb this if it's MODULE_NOT_FOUND + if (e.code !== 'MODULE_NOT_FOUND') { + throw e; + } + + // If not there, then try getting it from eslint/lib/cli-engine/file-enumerator (moved there in v6) + try {var _require2 = + require('eslint/lib/cli-engine/file-enumerator');FileEnumerator = _require2.FileEnumerator; + } catch (e) { + // Absorb this if it's MODULE_NOT_FOUND + if (e.code !== 'MODULE_NOT_FOUND') { + throw e; + } + } + } + return FileEnumerator; +} + +/** + * Given a FileEnumerator class, instantiate and load the list of files. + * @param FileEnumerator the `FileEnumerator` class from `eslint`'s internal api + * @param {string} src path to the src root + * @param {string[]} extensions list of supported extensions + * @returns {{ filename: string, ignored: boolean }[]} list of files to operate on + */ +function listFilesUsingFileEnumerator(FileEnumerator, src, extensions) { + // We need to know whether this is being run with flat config in order to + // determine how to report errors if FileEnumerator throws due to a lack of eslintrc. + var + ESLINT_USE_FLAT_CONFIG = process.env.ESLINT_USE_FLAT_CONFIG; + + // This condition is sufficient to test in v8, since the environment variable is necessary to turn on flat config + var isUsingFlatConfig = ESLINT_USE_FLAT_CONFIG && process.env.ESLINT_USE_FLAT_CONFIG !== 'false'; + + // In the case of using v9, we can check the `shouldUseFlatConfig` function + // If this function is present, then we assume it's v9 + try {var _require3 = + require('eslint/use-at-your-own-risk'),shouldUseFlatConfig = _require3.shouldUseFlatConfig; + isUsingFlatConfig = shouldUseFlatConfig && ESLINT_USE_FLAT_CONFIG !== 'false'; + } catch (_) { + // We don't want to throw here, since we only want to update the + // boolean if the function is available. + } + + var enumerator = new FileEnumerator({ + extensions: extensions }); + + + try { + return Array.from( + enumerator.iterateFiles(src), + function (_ref) {var filePath = _ref.filePath,ignored = _ref.ignored;return { filename: filePath, ignored: ignored };}); + + } catch (e) { + // If we're using flat config, and FileEnumerator throws due to a lack of eslintrc, + // then we want to throw an error so that the user knows about this rule's reliance on + // the legacy config. + if ( + isUsingFlatConfig && + e.message.includes('No ESLint configuration found')) + { + throw new Error('\nDue to the exclusion of certain internal ESLint APIs when using flat config,\nthe import/no-unused-modules rule requires an .eslintrc file to know which\nfiles to ignore (even when using flat config).\nThe .eslintrc file only needs to contain "ignorePatterns", or can be empty if\nyou do not want to ignore any files.\n\nSee https://github.com/import-js/eslint-plugin-import/issues/3079\nfor additional context.\n'); + + + + + + + + + + } + // If this isn't the case, then we'll just let the error bubble up + throw e; + } +} + +/** + * Attempt to require old versions of the file enumeration capability from v6 `eslint` and earlier, and use + * those functions to provide the list of files to operate on + * @param {string} src path to the src root + * @param {string[]} extensions list of supported extensions + * @returns {string[]} list of files to operate on + */ +function listFilesWithLegacyFunctions(src, extensions) { + try { + // eslint/lib/util/glob-util has been moved to eslint/lib/util/glob-utils with version 5.3 + var _require4 = require('eslint/lib/util/glob-utils'),originalListFilesToProcess = _require4.listFilesToProcess; + // Prevent passing invalid options (extensions array) to old versions of the function. + // https://github.com/eslint/eslint/blob/v5.16.0/lib/util/glob-utils.js#L178-L280 + // https://github.com/eslint/eslint/blob/v5.2.0/lib/util/glob-util.js#L174-L269 + + return originalListFilesToProcess(src, { + extensions: extensions }); + + } catch (e) { + // Absorb this if it's MODULE_NOT_FOUND + if (e.code !== 'MODULE_NOT_FOUND') { + throw e; + } + + // Last place to try (pre v5.3) + var _require5 = + + require('eslint/lib/util/glob-util'),_originalListFilesToProcess = _require5.listFilesToProcess; + var patterns = src.concat( + (0, _arrayPrototype2['default'])( + src, + function (pattern) {return extensions.map(function (extension) {return (/\*\*|\*\./.test(pattern) ? pattern : String(pattern) + '/**/*' + String(extension));});})); + + + + return _originalListFilesToProcess(patterns); + } +} + +/** + * Given a src pattern and list of supported extensions, return a list of files to process + * with this rule. + * @param {string} src - file, directory, or glob pattern of files to act on + * @param {string[]} extensions - list of supported file extensions + * @returns {string[] | { filename: string, ignored: boolean }[]} the list of files that this rule will evaluate. + */ +function listFilesToProcess(src, extensions) { + var FileEnumerator = requireFileEnumerator(); + + // If we got the FileEnumerator, then let's go with that + if (FileEnumerator) { + return listFilesUsingFileEnumerator(FileEnumerator, src, extensions); + } + // If not, then we can try even older versions of this capability (listFilesToProcess) + return listFilesWithLegacyFunctions(src, extensions); +} + +var EXPORT_DEFAULT_DECLARATION = 'ExportDefaultDeclaration'; +var EXPORT_NAMED_DECLARATION = 'ExportNamedDeclaration'; +var EXPORT_ALL_DECLARATION = 'ExportAllDeclaration'; +var IMPORT_DECLARATION = 'ImportDeclaration'; +var IMPORT_NAMESPACE_SPECIFIER = 'ImportNamespaceSpecifier'; +var IMPORT_DEFAULT_SPECIFIER = 'ImportDefaultSpecifier'; +var VARIABLE_DECLARATION = 'VariableDeclaration'; +var FUNCTION_DECLARATION = 'FunctionDeclaration'; +var CLASS_DECLARATION = 'ClassDeclaration'; +var IDENTIFIER = 'Identifier'; +var OBJECT_PATTERN = 'ObjectPattern'; +var ARRAY_PATTERN = 'ArrayPattern'; +var TS_INTERFACE_DECLARATION = 'TSInterfaceDeclaration'; +var TS_TYPE_ALIAS_DECLARATION = 'TSTypeAliasDeclaration'; +var TS_ENUM_DECLARATION = 'TSEnumDeclaration'; +var DEFAULT = 'default'; + +function forEachDeclarationIdentifier(declaration, cb) { + if (declaration) { + var isTypeDeclaration = declaration.type === TS_INTERFACE_DECLARATION || + declaration.type === TS_TYPE_ALIAS_DECLARATION || + declaration.type === TS_ENUM_DECLARATION; + + if ( + declaration.type === FUNCTION_DECLARATION || + declaration.type === CLASS_DECLARATION || + isTypeDeclaration) + { + cb(declaration.id.name, isTypeDeclaration); + } else if (declaration.type === VARIABLE_DECLARATION) { + declaration.declarations.forEach(function (_ref2) {var id = _ref2.id; + if (id.type === OBJECT_PATTERN) { + (0, _patternCapture2['default'])(id, function (pattern) { + if (pattern.type === IDENTIFIER) { + cb(pattern.name, false); + } + }); + } else if (id.type === ARRAY_PATTERN) { + id.elements.forEach(function (_ref3) {var name = _ref3.name; + cb(name, false); + }); + } else { + cb(id.name, false); + } + }); + } + } +} + +/** + * List of imports per file. + * + * Represented by a two-level Map to a Set of identifiers. The upper-level Map + * keys are the paths to the modules containing the imports, while the + * lower-level Map keys are the paths to the files which are being imported + * from. Lastly, the Set of identifiers contains either names being imported + * or a special AST node name listed above (e.g ImportDefaultSpecifier). + * + * For example, if we have a file named foo.js containing: + * + * import { o2 } from './bar.js'; + * + * Then we will have a structure that looks like: + * + * Map { 'foo.js' => Map { 'bar.js' => Set { 'o2' } } } + * + * @type {Map>>} + */ +var importList = new Map(); + +/** + * List of exports per file. + * + * Represented by a two-level Map to an object of metadata. The upper-level Map + * keys are the paths to the modules containing the exports, while the + * lower-level Map keys are the specific identifiers or special AST node names + * being exported. The leaf-level metadata object at the moment only contains a + * `whereUsed` property, which contains a Set of paths to modules that import + * the name. + * + * For example, if we have a file named bar.js containing the following exports: + * + * const o2 = 'bar'; + * export { o2 }; + * + * And a file named foo.js containing the following import: + * + * import { o2 } from './bar.js'; + * + * Then we will have a structure that looks like: + * + * Map { 'bar.js' => Map { 'o2' => { whereUsed: Set { 'foo.js' } } } } + * + * @type {Map>} + */ +var exportList = new Map(); + +var visitorKeyMap = new Map(); + +/** @type {Set} */ +var ignoredFiles = new Set(); +var filesOutsideSrc = new Set(); + +var isNodeModule = function isNodeModule(path) {return (/\/(node_modules)\//.test(path));}; + +/** + * read all files matching the patterns in src and ignoreExports + * + * return all files matching src pattern, which are not matching the ignoreExports pattern + * @type {(src: string, ignoreExports: string, context: import('eslint').Rule.RuleContext) => Set} + */ +function resolveFiles(src, ignoreExports, context) { + var extensions = Array.from((0, _ignore.getFileExtensions)(context.settings)); + + var srcFileList = listFilesToProcess(src, extensions); + + // prepare list of ignored files + var ignoredFilesList = listFilesToProcess(ignoreExports, extensions); + + // The modern api will return a list of file paths, rather than an object + if (ignoredFilesList.length && typeof ignoredFilesList[0] === 'string') { + ignoredFilesList.forEach(function (filename) {return ignoredFiles.add(filename);}); + } else { + ignoredFilesList.forEach(function (_ref4) {var filename = _ref4.filename;return ignoredFiles.add(filename);}); + } + + // prepare list of source files, don't consider files from node_modules + var resolvedFiles = srcFileList.length && typeof srcFileList[0] === 'string' ? + srcFileList.filter(function (filePath) {return !isNodeModule(filePath);}) : + (0, _arrayPrototype2['default'])(srcFileList, function (_ref5) {var filename = _ref5.filename;return isNodeModule(filename) ? [] : filename;}); + + return new Set(resolvedFiles); +} + +/** + * parse all source files and build up 2 maps containing the existing imports and exports + */ +var prepareImportsAndExports = function prepareImportsAndExports(srcFiles, context) { + var exportAll = new Map(); + srcFiles.forEach(function (file) { + var exports = new Map(); + var imports = new Map(); + var currentExports = _builder2['default'].get(file, context); + if (currentExports) {var + + dependencies = + + + + + currentExports.dependencies,reexports = currentExports.reexports,localImportList = currentExports.imports,namespace = currentExports.namespace,visitorKeys = currentExports.visitorKeys; + + visitorKeyMap.set(file, visitorKeys); + // dependencies === export * from + var currentExportAll = new Set(); + dependencies.forEach(function (getDependency) { + var dependency = getDependency(); + if (dependency === null) { + return; + } + + currentExportAll.add(dependency.path); + }); + exportAll.set(file, currentExportAll); + + reexports.forEach(function (value, key) { + if (key === DEFAULT) { + exports.set(IMPORT_DEFAULT_SPECIFIER, { whereUsed: new Set() }); + } else { + exports.set(key, { whereUsed: new Set() }); + } + var reexport = value.getImport(); + if (!reexport) { + return; + } + var localImport = imports.get(reexport.path); + var currentValue = void 0; + if (value.local === DEFAULT) { + currentValue = IMPORT_DEFAULT_SPECIFIER; + } else { + currentValue = value.local; + } + if (typeof localImport !== 'undefined') { + localImport = new Set([].concat(_toConsumableArray(localImport), [currentValue])); + } else { + localImport = new Set([currentValue]); + } + imports.set(reexport.path, localImport); + }); + + localImportList.forEach(function (value, key) { + if (isNodeModule(key)) { + return; + } + var localImport = imports.get(key) || new Set(); + value.declarations.forEach(function (_ref6) {var importedSpecifiers = _ref6.importedSpecifiers; + importedSpecifiers.forEach(function (specifier) { + localImport.add(specifier); + }); + }); + imports.set(key, localImport); + }); + importList.set(file, imports); + + // build up export list only, if file is not ignored + if (ignoredFiles.has(file)) { + return; + } + namespace.forEach(function (value, key) { + if (key === DEFAULT) { + exports.set(IMPORT_DEFAULT_SPECIFIER, { whereUsed: new Set() }); + } else { + exports.set(key, { whereUsed: new Set() }); + } + }); + } + exports.set(EXPORT_ALL_DECLARATION, { whereUsed: new Set() }); + exports.set(IMPORT_NAMESPACE_SPECIFIER, { whereUsed: new Set() }); + exportList.set(file, exports); + }); + exportAll.forEach(function (value, key) { + value.forEach(function (val) { + var currentExports = exportList.get(val); + if (currentExports) { + var currentExport = currentExports.get(EXPORT_ALL_DECLARATION); + currentExport.whereUsed.add(key); + } + }); + }); +}; + +/** + * traverse through all imports and add the respective path to the whereUsed-list + * of the corresponding export + */ +var determineUsage = function determineUsage() { + importList.forEach(function (listValue, listKey) { + listValue.forEach(function (value, key) { + var exports = exportList.get(key); + if (typeof exports !== 'undefined') { + value.forEach(function (currentImport) { + var specifier = void 0; + if (currentImport === IMPORT_NAMESPACE_SPECIFIER) { + specifier = IMPORT_NAMESPACE_SPECIFIER; + } else if (currentImport === IMPORT_DEFAULT_SPECIFIER) { + specifier = IMPORT_DEFAULT_SPECIFIER; + } else { + specifier = currentImport; + } + if (typeof specifier !== 'undefined') { + var exportStatement = exports.get(specifier); + if (typeof exportStatement !== 'undefined') {var + whereUsed = exportStatement.whereUsed; + whereUsed.add(listKey); + exports.set(specifier, { whereUsed: whereUsed }); + } + } + }); + } + }); + }); +}; + +var getSrc = function getSrc(src) { + if (src) { + return src; + } + return [process.cwd()]; +}; + +/** + * prepare the lists of existing imports and exports - should only be executed once at + * the start of a new eslint run + */ +/** @type {Set} */ +var srcFiles = void 0; +var lastPrepareKey = void 0; +var doPreparation = function doPreparation(src, ignoreExports, context) { + var prepareKey = JSON.stringify({ + src: (src || []).sort(), + ignoreExports: (ignoreExports || []).sort(), + extensions: Array.from((0, _ignore.getFileExtensions)(context.settings)).sort() }); + + if (prepareKey === lastPrepareKey) { + return; + } + + importList.clear(); + exportList.clear(); + ignoredFiles.clear(); + filesOutsideSrc.clear(); + + srcFiles = resolveFiles(getSrc(src), ignoreExports, context); + prepareImportsAndExports(srcFiles, context); + determineUsage(); + lastPrepareKey = prepareKey; +}; + +var newNamespaceImportExists = function newNamespaceImportExists(specifiers) {return specifiers.some(function (_ref7) {var type = _ref7.type;return type === IMPORT_NAMESPACE_SPECIFIER;});}; + +var newDefaultImportExists = function newDefaultImportExists(specifiers) {return specifiers.some(function (_ref8) {var type = _ref8.type;return type === IMPORT_DEFAULT_SPECIFIER;});}; + +var fileIsInPkg = function fileIsInPkg(file) {var _readPkgUp = + (0, _readPkgUp3['default'])({ cwd: file }),path = _readPkgUp.path,pkg = _readPkgUp.pkg; + var basePath = (0, _path.dirname)(path); + + var checkPkgFieldString = function checkPkgFieldString(pkgField) { + if ((0, _path.join)(basePath, pkgField) === file) { + return true; + } + }; + + var checkPkgFieldObject = function checkPkgFieldObject(pkgField) { + var pkgFieldFiles = (0, _arrayPrototype2['default'])((0, _object2['default'])(pkgField), function (value) {return typeof value === 'boolean' ? [] : (0, _path.join)(basePath, value);}); + + if ((0, _arrayIncludes2['default'])(pkgFieldFiles, file)) { + return true; + } + }; + + var checkPkgField = function checkPkgField(pkgField) { + if (typeof pkgField === 'string') { + return checkPkgFieldString(pkgField); + } + + if ((typeof pkgField === 'undefined' ? 'undefined' : _typeof(pkgField)) === 'object') { + return checkPkgFieldObject(pkgField); + } + }; + + if (pkg['private'] === true) { + return false; + } + + if (pkg.bin) { + if (checkPkgField(pkg.bin)) { + return true; + } + } + + if (pkg.browser) { + if (checkPkgField(pkg.browser)) { + return true; + } + } + + if (pkg.main) { + if (checkPkgFieldString(pkg.main)) { + return true; + } + } + + return false; +}; + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Helpful warnings', + description: 'Forbid modules without exports, or exports without matching import in another module.', + url: (0, _docsUrl2['default'])('no-unused-modules') }, + + schema: [{ + properties: { + src: { + description: 'files/paths to be analyzed (only for unused exports)', + type: 'array', + uniqueItems: true, + items: { + type: 'string', + minLength: 1 } }, + + + ignoreExports: { + description: 'files/paths for which unused exports will not be reported (e.g module entry points)', + type: 'array', + uniqueItems: true, + items: { + type: 'string', + minLength: 1 } }, + + + missingExports: { + description: 'report modules without any exports', + type: 'boolean' }, + + unusedExports: { + description: 'report exports without any usage', + type: 'boolean' }, + + ignoreUnusedTypeExports: { + description: 'ignore type exports without any usage', + type: 'boolean' } }, + + + anyOf: [ + { + properties: { + unusedExports: { 'enum': [true] }, + src: { + minItems: 1 } }, + + + required: ['unusedExports'] }, + + { + properties: { + missingExports: { 'enum': [true] } }, + + required: ['missingExports'] }] }] }, + + + + + + create: function () {function create(context) {var _ref9 = + + + + + + + context.options[0] || {},src = _ref9.src,_ref9$ignoreExports = _ref9.ignoreExports,ignoreExports = _ref9$ignoreExports === undefined ? [] : _ref9$ignoreExports,missingExports = _ref9.missingExports,unusedExports = _ref9.unusedExports,ignoreUnusedTypeExports = _ref9.ignoreUnusedTypeExports; + + if (unusedExports) { + doPreparation(src, ignoreExports, context); + } + + var file = (0, _contextCompat.getPhysicalFilename)(context); + + var checkExportPresence = function () {function checkExportPresence(node) { + if (!missingExports) { + return; + } + + if (ignoredFiles.has(file)) { + return; + } + + var exportCount = exportList.get(file); + var exportAll = exportCount.get(EXPORT_ALL_DECLARATION); + var namespaceImports = exportCount.get(IMPORT_NAMESPACE_SPECIFIER); + + exportCount['delete'](EXPORT_ALL_DECLARATION); + exportCount['delete'](IMPORT_NAMESPACE_SPECIFIER); + if (exportCount.size < 1) { + // node.body[0] === 'undefined' only happens, if everything is commented out in the file + // being linted + context.report(node.body[0] ? node.body[0] : node, 'No exports found'); + } + exportCount.set(EXPORT_ALL_DECLARATION, exportAll); + exportCount.set(IMPORT_NAMESPACE_SPECIFIER, namespaceImports); + }return checkExportPresence;}(); + + var checkUsage = function () {function checkUsage(node, exportedValue, isTypeExport) { + if (!unusedExports) { + return; + } + + if (isTypeExport && ignoreUnusedTypeExports) { + return; + } + + if (ignoredFiles.has(file)) { + return; + } + + if (fileIsInPkg(file)) { + return; + } + + if (filesOutsideSrc.has(file)) { + return; + } + + // make sure file to be linted is included in source files + if (!srcFiles.has(file)) { + srcFiles = resolveFiles(getSrc(src), ignoreExports, context); + if (!srcFiles.has(file)) { + filesOutsideSrc.add(file); + return; + } + } + + exports = exportList.get(file); + + if (!exports) { + console.error('file `' + String(file) + '` has no exports. Please update to the latest, and if it still happens, report this on https://github.com/import-js/eslint-plugin-import/issues/2866!'); + } + + // special case: export * from + var exportAll = exports.get(EXPORT_ALL_DECLARATION); + if (typeof exportAll !== 'undefined' && exportedValue !== IMPORT_DEFAULT_SPECIFIER) { + if (exportAll.whereUsed.size > 0) { + return; + } + } + + // special case: namespace import + var namespaceImports = exports.get(IMPORT_NAMESPACE_SPECIFIER); + if (typeof namespaceImports !== 'undefined') { + if (namespaceImports.whereUsed.size > 0) { + return; + } + } + + // exportsList will always map any imported value of 'default' to 'ImportDefaultSpecifier' + var exportsKey = exportedValue === DEFAULT ? IMPORT_DEFAULT_SPECIFIER : exportedValue; + + var exportStatement = exports.get(exportsKey); + + var value = exportsKey === IMPORT_DEFAULT_SPECIFIER ? DEFAULT : exportsKey; + + if (typeof exportStatement !== 'undefined') { + if (exportStatement.whereUsed.size < 1) { + context.report( + node, 'exported declaration \'' + + value + '\' not used within other modules'); + + } + } else { + context.report( + node, 'exported declaration \'' + + value + '\' not used within other modules'); + + } + }return checkUsage;}(); + + /** + * only useful for tools like vscode-eslint + * + * update lists of existing exports during runtime + */ + var updateExportUsage = function () {function updateExportUsage(node) { + if (ignoredFiles.has(file)) { + return; + } + + var exports = exportList.get(file); + + // new module has been created during runtime + // include it in further processing + if (typeof exports === 'undefined') { + exports = new Map(); + } + + var newExports = new Map(); + var newExportIdentifiers = new Set(); + + node.body.forEach(function (_ref10) {var type = _ref10.type,declaration = _ref10.declaration,specifiers = _ref10.specifiers; + if (type === EXPORT_DEFAULT_DECLARATION) { + newExportIdentifiers.add(IMPORT_DEFAULT_SPECIFIER); + } + if (type === EXPORT_NAMED_DECLARATION) { + if (specifiers.length > 0) { + specifiers.forEach(function (specifier) { + if (specifier.exported) { + newExportIdentifiers.add(specifier.exported.name || specifier.exported.value); + } + }); + } + forEachDeclarationIdentifier(declaration, function (name) { + newExportIdentifiers.add(name); + }); + } + }); + + // old exports exist within list of new exports identifiers: add to map of new exports + exports.forEach(function (value, key) { + if (newExportIdentifiers.has(key)) { + newExports.set(key, value); + } + }); + + // new export identifiers added: add to map of new exports + newExportIdentifiers.forEach(function (key) { + if (!exports.has(key)) { + newExports.set(key, { whereUsed: new Set() }); + } + }); + + // preserve information about namespace imports + var exportAll = exports.get(EXPORT_ALL_DECLARATION); + var namespaceImports = exports.get(IMPORT_NAMESPACE_SPECIFIER); + + if (typeof namespaceImports === 'undefined') { + namespaceImports = { whereUsed: new Set() }; + } + + newExports.set(EXPORT_ALL_DECLARATION, exportAll); + newExports.set(IMPORT_NAMESPACE_SPECIFIER, namespaceImports); + exportList.set(file, newExports); + }return updateExportUsage;}(); + + /** + * only useful for tools like vscode-eslint + * + * update lists of existing imports during runtime + */ + var updateImportUsage = function () {function updateImportUsage(node) { + if (!unusedExports) { + return; + } + + var oldImportPaths = importList.get(file); + if (typeof oldImportPaths === 'undefined') { + oldImportPaths = new Map(); + } + + var oldNamespaceImports = new Set(); + var newNamespaceImports = new Set(); + + var oldExportAll = new Set(); + var newExportAll = new Set(); + + var oldDefaultImports = new Set(); + var newDefaultImports = new Set(); + + var oldImports = new Map(); + var newImports = new Map(); + oldImportPaths.forEach(function (value, key) { + if (value.has(EXPORT_ALL_DECLARATION)) { + oldExportAll.add(key); + } + if (value.has(IMPORT_NAMESPACE_SPECIFIER)) { + oldNamespaceImports.add(key); + } + if (value.has(IMPORT_DEFAULT_SPECIFIER)) { + oldDefaultImports.add(key); + } + value.forEach(function (val) { + if ( + val !== IMPORT_NAMESPACE_SPECIFIER && + val !== IMPORT_DEFAULT_SPECIFIER) + { + oldImports.set(val, key); + } + }); + }); + + function processDynamicImport(source) { + if (source.type !== 'Literal') { + return null; + } + var p = (0, _resolve2['default'])(source.value, context); + if (p == null) { + return null; + } + newNamespaceImports.add(p); + } + + (0, _visit2['default'])(node, visitorKeyMap.get(file), { + ImportExpression: function () {function ImportExpression(child) { + processDynamicImport(child.source); + }return ImportExpression;}(), + CallExpression: function () {function CallExpression(child) { + if (child.callee.type === 'Import') { + processDynamicImport(child.arguments[0]); + } + }return CallExpression;}() }); + + + node.body.forEach(function (astNode) { + var resolvedPath = void 0; + + // support for export { value } from 'module' + if (astNode.type === EXPORT_NAMED_DECLARATION) { + if (astNode.source) { + resolvedPath = (0, _resolve2['default'])(astNode.source.raw.replace(/('|")/g, ''), context); + astNode.specifiers.forEach(function (specifier) { + var name = specifier.local.name || specifier.local.value; + if (name === DEFAULT) { + newDefaultImports.add(resolvedPath); + } else { + newImports.set(name, resolvedPath); + } + }); + } + } + + if (astNode.type === EXPORT_ALL_DECLARATION) { + resolvedPath = (0, _resolve2['default'])(astNode.source.raw.replace(/('|")/g, ''), context); + newExportAll.add(resolvedPath); + } + + if (astNode.type === IMPORT_DECLARATION) { + resolvedPath = (0, _resolve2['default'])(astNode.source.raw.replace(/('|")/g, ''), context); + if (!resolvedPath) { + return; + } + + if (isNodeModule(resolvedPath)) { + return; + } + + if (newNamespaceImportExists(astNode.specifiers)) { + newNamespaceImports.add(resolvedPath); + } + + if (newDefaultImportExists(astNode.specifiers)) { + newDefaultImports.add(resolvedPath); + } + + astNode.specifiers. + filter(function (specifier) {return specifier.type !== IMPORT_DEFAULT_SPECIFIER && specifier.type !== IMPORT_NAMESPACE_SPECIFIER;}). + forEach(function (specifier) { + newImports.set(specifier.imported.name || specifier.imported.value, resolvedPath); + }); + } + }); + + newExportAll.forEach(function (value) { + if (!oldExportAll.has(value)) { + var imports = oldImportPaths.get(value); + if (typeof imports === 'undefined') { + imports = new Set(); + } + imports.add(EXPORT_ALL_DECLARATION); + oldImportPaths.set(value, imports); + + var _exports = exportList.get(value); + var currentExport = void 0; + if (typeof _exports !== 'undefined') { + currentExport = _exports.get(EXPORT_ALL_DECLARATION); + } else { + _exports = new Map(); + exportList.set(value, _exports); + } + + if (typeof currentExport !== 'undefined') { + currentExport.whereUsed.add(file); + } else { + var whereUsed = new Set(); + whereUsed.add(file); + _exports.set(EXPORT_ALL_DECLARATION, { whereUsed: whereUsed }); + } + } + }); + + oldExportAll.forEach(function (value) { + if (!newExportAll.has(value)) { + var imports = oldImportPaths.get(value); + imports['delete'](EXPORT_ALL_DECLARATION); + + var _exports2 = exportList.get(value); + if (typeof _exports2 !== 'undefined') { + var currentExport = _exports2.get(EXPORT_ALL_DECLARATION); + if (typeof currentExport !== 'undefined') { + currentExport.whereUsed['delete'](file); + } + } + } + }); + + newDefaultImports.forEach(function (value) { + if (!oldDefaultImports.has(value)) { + var imports = oldImportPaths.get(value); + if (typeof imports === 'undefined') { + imports = new Set(); + } + imports.add(IMPORT_DEFAULT_SPECIFIER); + oldImportPaths.set(value, imports); + + var _exports3 = exportList.get(value); + var currentExport = void 0; + if (typeof _exports3 !== 'undefined') { + currentExport = _exports3.get(IMPORT_DEFAULT_SPECIFIER); + } else { + _exports3 = new Map(); + exportList.set(value, _exports3); + } + + if (typeof currentExport !== 'undefined') { + currentExport.whereUsed.add(file); + } else { + var whereUsed = new Set(); + whereUsed.add(file); + _exports3.set(IMPORT_DEFAULT_SPECIFIER, { whereUsed: whereUsed }); + } + } + }); + + oldDefaultImports.forEach(function (value) { + if (!newDefaultImports.has(value)) { + var imports = oldImportPaths.get(value); + imports['delete'](IMPORT_DEFAULT_SPECIFIER); + + var _exports4 = exportList.get(value); + if (typeof _exports4 !== 'undefined') { + var currentExport = _exports4.get(IMPORT_DEFAULT_SPECIFIER); + if (typeof currentExport !== 'undefined') { + currentExport.whereUsed['delete'](file); + } + } + } + }); + + newNamespaceImports.forEach(function (value) { + if (!oldNamespaceImports.has(value)) { + var imports = oldImportPaths.get(value); + if (typeof imports === 'undefined') { + imports = new Set(); + } + imports.add(IMPORT_NAMESPACE_SPECIFIER); + oldImportPaths.set(value, imports); + + var _exports5 = exportList.get(value); + var currentExport = void 0; + if (typeof _exports5 !== 'undefined') { + currentExport = _exports5.get(IMPORT_NAMESPACE_SPECIFIER); + } else { + _exports5 = new Map(); + exportList.set(value, _exports5); + } + + if (typeof currentExport !== 'undefined') { + currentExport.whereUsed.add(file); + } else { + var whereUsed = new Set(); + whereUsed.add(file); + _exports5.set(IMPORT_NAMESPACE_SPECIFIER, { whereUsed: whereUsed }); + } + } + }); + + oldNamespaceImports.forEach(function (value) { + if (!newNamespaceImports.has(value)) { + var imports = oldImportPaths.get(value); + imports['delete'](IMPORT_NAMESPACE_SPECIFIER); + + var _exports6 = exportList.get(value); + if (typeof _exports6 !== 'undefined') { + var currentExport = _exports6.get(IMPORT_NAMESPACE_SPECIFIER); + if (typeof currentExport !== 'undefined') { + currentExport.whereUsed['delete'](file); + } + } + } + }); + + newImports.forEach(function (value, key) { + if (!oldImports.has(key)) { + var imports = oldImportPaths.get(value); + if (typeof imports === 'undefined') { + imports = new Set(); + } + imports.add(key); + oldImportPaths.set(value, imports); + + var _exports7 = exportList.get(value); + var currentExport = void 0; + if (typeof _exports7 !== 'undefined') { + currentExport = _exports7.get(key); + } else { + _exports7 = new Map(); + exportList.set(value, _exports7); + } + + if (typeof currentExport !== 'undefined') { + currentExport.whereUsed.add(file); + } else { + var whereUsed = new Set(); + whereUsed.add(file); + _exports7.set(key, { whereUsed: whereUsed }); + } + } + }); + + oldImports.forEach(function (value, key) { + if (!newImports.has(key)) { + var imports = oldImportPaths.get(value); + imports['delete'](key); + + var _exports8 = exportList.get(value); + if (typeof _exports8 !== 'undefined') { + var currentExport = _exports8.get(key); + if (typeof currentExport !== 'undefined') { + currentExport.whereUsed['delete'](file); + } + } + } + }); + }return updateImportUsage;}(); + + return { + 'Program:exit': function () {function ProgramExit(node) { + updateExportUsage(node); + updateImportUsage(node); + checkExportPresence(node); + }return ProgramExit;}(), + ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) { + checkUsage(node, IMPORT_DEFAULT_SPECIFIER, false); + }return ExportDefaultDeclaration;}(), + ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { + node.specifiers.forEach(function (specifier) { + checkUsage(specifier, specifier.exported.name || specifier.exported.value, false); + }); + forEachDeclarationIdentifier(node.declaration, function (name, isTypeExport) { + checkUsage(node, name, isTypeExport); + }); + }return ExportNamedDeclaration;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby11bnVzZWQtbW9kdWxlcy5qcyJdLCJuYW1lcyI6WyJyZXF1aXJlRmlsZUVudW1lcmF0b3IiLCJGaWxlRW51bWVyYXRvciIsInJlcXVpcmUiLCJlIiwiY29kZSIsImxpc3RGaWxlc1VzaW5nRmlsZUVudW1lcmF0b3IiLCJzcmMiLCJleHRlbnNpb25zIiwiRVNMSU5UX1VTRV9GTEFUX0NPTkZJRyIsInByb2Nlc3MiLCJlbnYiLCJpc1VzaW5nRmxhdENvbmZpZyIsInNob3VsZFVzZUZsYXRDb25maWciLCJfIiwiZW51bWVyYXRvciIsIkFycmF5IiwiZnJvbSIsIml0ZXJhdGVGaWxlcyIsImZpbGVQYXRoIiwiaWdub3JlZCIsImZpbGVuYW1lIiwibWVzc2FnZSIsImluY2x1ZGVzIiwiRXJyb3IiLCJsaXN0RmlsZXNXaXRoTGVnYWN5RnVuY3Rpb25zIiwib3JpZ2luYWxMaXN0RmlsZXNUb1Byb2Nlc3MiLCJsaXN0RmlsZXNUb1Byb2Nlc3MiLCJwYXR0ZXJucyIsImNvbmNhdCIsInBhdHRlcm4iLCJtYXAiLCJleHRlbnNpb24iLCJ0ZXN0IiwiRVhQT1JUX0RFRkFVTFRfREVDTEFSQVRJT04iLCJFWFBPUlRfTkFNRURfREVDTEFSQVRJT04iLCJFWFBPUlRfQUxMX0RFQ0xBUkFUSU9OIiwiSU1QT1JUX0RFQ0xBUkFUSU9OIiwiSU1QT1JUX05BTUVTUEFDRV9TUEVDSUZJRVIiLCJJTVBPUlRfRE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ZWRFeHBvcnRzOiB7XG4gICAgICAgICAgZGVzY3JpcHRpb246ICdyZXBvcnQgZXhwb3J0cyB3aXRob3V0IGFueSB1c2FnZScsXG4gICAgICAgICAgdHlwZTogJ2Jvb2xlYW4nLFxuICAgICAgICB9LFxuICAgICAgICBpZ25vcmVVbnVzZWRUeXBlRXhwb3J0czoge1xuICAgICAgICAgIGRlc2NyaXB0aW9uOiAnaWdub3JlIHR5cGUgZXhwb3J0cyB3aXRob3V0IGFueSB1c2FnZScsXG4gICAgICAgICAgdHlwZTogJ2Jvb2xlYW4nLFxuICAgICAgICB9LFxuICAgICAgfSxcbiAgICAgIGFueU9mOiBbXG4gICAgICAgIHtcbiAgICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgICB1bnVzZWRFeHBvcnRzOiB7IGVudW06IFt0cnVlXSB9LFxuICAgICAgICAgICAgc3JjOiB7XG4gICAgICAgICAgICAgIG1pbkl0ZW1zOiAxLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9LFxuICAgICAgICAgIHJlcXVpcmVkOiBbJ3VudXNlZEV4cG9ydHMnXSxcbiAgICAgICAgfSxcbiAgICAgICAge1xuICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgIG1pc3NpbmdFeHBvcnRzOiB7IGVudW06IFt0cnVlXSB9LFxuICAgICAgICAgIH0sXG4gICAgICAgICAgcmVxdWlyZWQ6IFsnbWlzc2luZ0V4cG9ydHMnXSxcbiAgICAgICAgfSxcbiAgICAgIF0sXG4gICAgfV0sXG4gIH0sXG5cbiAgY3JlYXRlKGNvbnRleHQpIHtcbiAgICBjb25zdCB7XG4gICAgICBzcmMsXG4gICAgICBpZ25vcmVFeHBvcnRzID0gW10sXG4gICAgICBtaXNzaW5nRXhwb3J0cyxcbiAgICAgIHVudXNlZEV4cG9ydHMsXG4gICAgICBpZ25vcmVVbnVzZWRUeXBlRXhwb3J0cyxcbiAgICB9ID0gY29udGV4dC5vcHRpb25zWzB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TVBPUlRfREVGQVVMVF9TUEVDSUZJRVJcbiAgICAgICAgICApIHtcbiAgICAgICAgICAgIG9sZEltcG9ydHMuc2V0KHZhbCwga2V5KTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgfSk7XG5cbiAgICAgIGZ1bmN0aW9uIHByb2Nlc3NEeW5hbWljSW1wb3J0KHNvdXJjZSkge1xuICAgICAgICBpZiAoc291cmNlLnR5cGUgIT09ICdMaXRlcmFsJykge1xuICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHAgPSByZXNvbHZlKHNvdXJjZS52YWx1ZSwgY29udGV4dCk7XG4gICAgICAgIGlmIChwID09IG51bGwpIHtcbiAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgICAgICBuZXdOYW1lc3BhY2VJbXBvcnRzLmFkZChwKTtcbiAgICAgIH1cblxuICAgICAgdmlzaXQobm9kZSwgdmlzaXRvcktleU1hcC5nZXQoZmlsZSksIHtcbiAgICAgICAgSW1wb3J0RXhwcmVzc2lvbihjaGlsZCkge1xuICAgICAgICAgIHByb2Nlc3NEeW5hbWljSW1wb3J0KGNoaWxkLnNvdXJjZSk7XG4gICAgICAgIH0sXG4gICAgICAgIENhbGxFeHByZXNzaW9uKGNoaWxkKSB7XG4gICAgICAgICAgaWYgKGNoaWxkLmNhbGxlZS50eXBlID09PSAnSW1wb3J0Jykge1xuICAgICAgICAgICAgcHJvY2Vzc0R5bmFtaWNJbXBvcnQoY2hpbGQuYXJndW1lbnRzWzBdKTtcbiAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICB9KTtcblxuICAgICAgbm9kZS5ib2R5LmZvckVhY2goKGFzdE5vZGUpID0+IHtcbiAgICAgICAgbGV0IHJlc29sdmVkUGF0aDtcblxuICAgICAgICAvLyBzdXBwb3J0IGZvciBleHBvcnQgeyB2YWx1ZSB9IGZyb20gJ21vZHVsZSdcbiAgICAgICAgaWYgKG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xuICAgICAgICB9XG4gICAgICB9KTtcblxuICAgICAgb2xkRXhwb3J0QWxsLmZvckVhY2goKHZhbHVlKSA9PiB7XG4gICAgICAgIGlmICghbmV3RXhwb3J0QWxsLmhhcyh2YWx1ZSkpIHtcbiAgICAgICAgICBjb25zdCBpbXBvcnRzID0gb2xkSW1wb3J0UGF0aHMuZ2V0KHZhbHVlKTtcbiAgICAgICAgICBpbXBvcnRzLmRlbGV0ZShFWFBPUlRfQUxMX0RFQ0xBUkFUSU9OKTtcblxuICAgICAgICAgIGNvbnN0IGV4cG9ydHMgPSBleHBvcnRMaXN0LmdldCh2YWx1ZSk7XG4gICAgICAgICAgaWYgKHR5cGVvZiBleHBvcnRzICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgY29uc3QgY3VycmVudEV4cG9ydCA9IGV4cG9ydHMuZ2V0KEVYUE9SVF9BTExfREVDTEFSQVRJT04pO1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBjdXJyZW50RXhwb3J0ICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICBjdXJyZW50RXhwb3J0LndoZXJlVXNlZC5kZWxldGUoZmlsZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9KTtcblxuICAgICAgbmV3RGVmYXVsdEltcG9ydHMuZm9yRWFjaCgodmFsdWUpID0+IHtcbiAgICAgICAgaWYgKCFvbGREZWZhdWx0SW1wb3J0cy5oYXModmFsdWUpKSB7XG4gICAgICAgICAgbGV0IGltcG9ydHMgPSBvbGRJbXBvcnRQYXRocy5nZXQodmFsdWUpO1xuICAgICAgICAgIGlmICh0eXBlb2YgaW1wb3J0cyA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgIGltcG9ydHMgPSBuZXcgU2V0KCk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGltcG9ydHMuYWRkKElNUE9SVF9ERUZBVUxUX1NQRUNJRklFUik7XG4gICAgICAgICAg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0VfU1BFQ0lGSUVSKTtcbiAgICAgICAgICAgIGlmICh0eXBlb2YgY3VycmVudEV4cG9ydCAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgY3VycmVudEV4cG9ydC53aGVyZVVzZWQuZGVsZXRlKGZpbGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfSk7XG5cbiAgICAgIG5ld0ltcG9ydHMuZm9yRWFjaCgodmFsdWUsIGtleSkgPT4ge1xuICAgICAgICBpZiAoIW9sZEltcG9ydHMuaGFzKGtleSkpIHtcbiAgICAgICAgICBsZXQgaW1wb3J0cyA9IG9sZEltcG9ydFBhdGhzLmdldCh2YWx1ZSk7XG4gICAgICAgICAgaWYgKHR5cGVvZiBpbXBvcnRzID09PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgaW1wb3J0cyA9IG5ldyBTZXQoKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaW1wb3J0cy5hZGQoa2V5KTtcbiAgICAgICAgICBvbGRJbXBvcnRQYXRocy5zZXQodmFsdWUsIGltcG9ydHMpO1xuXG4gICAgICAgICAgbGV0IGV4cG9ydHMgPSBleHBvcnRMaXN0LmdldCh2YWx1ZSk7XG4gICAgICAgICAgbGV0IGN1cnJlbnRFeHBvcnQ7XG4gICAgICAgICAgaWYgKHR5cGVvZiBleHBvcnRzICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgY3VycmVudEV4cG9ydCA9IGV4cG9ydHMuZ2V0KGtleSk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGV4cG9ydHMgPSBuZXcgTWFwKCk7XG4gICAgICAgICAgICBleHBvcnRMaXN0LnNldCh2YWx1ZSwgZXhwb3J0cyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHR5cGVvZiBjdXJyZW50RXhwb3J0ICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgY3VycmVud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obm9kZSk7XG4gICAgICB9LFxuICAgICAgRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uKG5vZGUpIHtcbiAgICAgICAgY2hlY2tVc2FnZShub2RlLCBJTVBPUlRfREVGQVVMVF9TUEVDSUZJRVIsIGZhbHNlKTtcbiAgICAgIH0sXG4gICAgICBFeHBvcnROYW1lZERlY2xhcmF0aW9uKG5vZGUpIHtcbiAgICAgICAgbm9kZS5zcGVjaWZpZXJzLmZvckVhY2goKHNwZWNpZmllcikgPT4ge1xuICAgICAgICAgIGNoZWNrVXNhZ2Uoc3BlY2lmaWVyLCBzcGVjaWZpZXIuZXhwb3J0ZWQubmFtZSB8fCBzcGVjaWZpZXIuZXhwb3J0ZWQudmFsdWUsIGZhbHNlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGZvckVhY2hEZWNsYXJhdGlvbklkZW50aWZpZXIobm9kZS5kZWNsYXJhdGlvbiwgKG5hbWUsIGlzVHlwZUV4cG9ydCkgPT4ge1xuICAgICAgICAgIGNoZWNrVXNhZ2Uobm9kZSwgbmFtZSwgaXNUeXBlRXhwb3J0KTtcbiAgICAgICAgfSk7XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-useless-path-segments.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-useless-path-segments.js new file mode 100644 index 0000000000000000000000000000000000000000..617dd0c6e853a7af150a9d89bdce8c1af17108dd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-useless-path-segments.js @@ -0,0 +1,148 @@ +'use strict'; + + + + +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _ignore = require('eslint-module-utils/ignore'); +var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _path = require('path');var _path2 = _interopRequireDefault(_path); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +/** + * convert a potentially relative path from node utils into a true + * relative path. + * + * ../ -> .. + * ./ -> . + * .foo/bar -> ./.foo/bar + * ..foo/bar -> ./..foo/bar + * foo/bar -> ./foo/bar + * + * @param relativePath {string} relative posix path potentially missing leading './' + * @returns {string} relative posix path that always starts with a ./ + **/ /** + * @fileOverview Ensures that there are no useless path segments + * @author Thomas Grainger + */function toRelativePath(relativePath) {var stripped = relativePath.replace(/\/$/g, ''); // Remove trailing / + return (/^((\.\.)|(\.))($|\/)/.test(stripped) ? stripped : './' + String(stripped)); +} + +function normalize(fn) { + return toRelativePath(_path2['default'].posix.normalize(fn)); +} + +function countRelativeParents(pathSegments) { + return pathSegments.filter(function (x) {return x === '..';}).length; +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Static analysis', + description: 'Forbid unnecessary path segments in import and require statements.', + url: (0, _docsUrl2['default'])('no-useless-path-segments') }, + + + fixable: 'code', + + schema: [ + { + type: 'object', + properties: { + commonjs: { type: 'boolean' }, + noUselessIndex: { type: 'boolean' } }, + + additionalProperties: false }] }, + + + + + create: function () {function create(context) { + var currentDir = _path2['default'].dirname((0, _contextCompat.getPhysicalFilename)(context)); + var options = context.options[0]; + + function checkSourceValue(source) {var + importPath = source.value; + + function reportWithProposedPath(proposedPath) { + context.report({ + node: source, + // Note: Using messageIds is not possible due to the support for ESLint 2 and 3 + message: 'Useless path segments for "' + String(importPath) + '", should be "' + String(proposedPath) + '"', + fix: function () {function fix(fixer) {return proposedPath && fixer.replaceText(source, JSON.stringify(proposedPath));}return fix;}() }); + + } + + // Only relative imports are relevant for this rule --> Skip checking + if (!importPath.startsWith('.')) { + return; + } + + // Report rule violation if path is not the shortest possible + var resolvedPath = (0, _resolve2['default'])(importPath, context); + var normedPath = normalize(importPath); + var resolvedNormedPath = (0, _resolve2['default'])(normedPath, context); + if (normedPath !== importPath && resolvedPath === resolvedNormedPath) { + return reportWithProposedPath(normedPath); + } + + var fileExtensions = (0, _ignore.getFileExtensions)(context.settings); + var regexUnnecessaryIndex = new RegExp('.*\\/index(\\' + String( + Array.from(fileExtensions).join('|\\')) + ')?$'); + + + // Check if path contains unnecessary index (including a configured extension) + if (options && options.noUselessIndex && regexUnnecessaryIndex.test(importPath)) { + var parentDirectory = _path2['default'].dirname(importPath); + + // Try to find ambiguous imports + if (parentDirectory !== '.' && parentDirectory !== '..') {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = fileExtensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var fileExtension = _step.value; + if ((0, _resolve2['default'])('' + String(parentDirectory) + String(fileExtension), context)) { + return reportWithProposedPath(String(parentDirectory) + '/'); + } + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + } + + return reportWithProposedPath(parentDirectory); + } + + // Path is shortest possible + starts from the current directory --> Return directly + if (importPath.startsWith('./')) { + return; + } + + // Path is not existing --> Return directly (following code requires path to be defined) + if (resolvedPath === undefined) { + return; + } + + var expected = _path2['default'].relative(currentDir, resolvedPath); // Expected import path + var expectedSplit = expected.split(_path2['default'].sep); // Split by / or \ (depending on OS) + var importPathSplit = importPath.replace(/^\.\//, '').split('/'); + var countImportPathRelativeParents = countRelativeParents(importPathSplit); + var countExpectedRelativeParents = countRelativeParents(expectedSplit); + var diff = countImportPathRelativeParents - countExpectedRelativeParents; + + // Same number of relative parents --> Paths are the same --> Return directly + if (diff <= 0) { + return; + } + + // Report and propose minimal number of required relative parents + return reportWithProposedPath( + toRelativePath( + importPathSplit. + slice(0, countExpectedRelativeParents). + concat(importPathSplit.slice(countImportPathRelativeParents + diff)). + join('/'))); + + + } + + return (0, _moduleVisitor2['default'])(checkSourceValue, options); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby11c2VsZXNzLXBhdGgtc2VnbWVudHMuanMiXSwibmFtZXMiOlsidG9SZWxhdGl2ZVBhdGgiLCJyZWxhdGl2ZVBhdGgiLCJzdHJpcHBlZCIsInJlcGxhY2UiLCJ0ZXN0Iiwibm9ybWFsaXplIiwiZm4iLCJwYXRoIiwicG9zaXgiLCJjb3VudFJlbGF0aXZlUGFyZW50cyIsInBhdGhTZWdtZW50cyIsImZpbHRlciIsIngiLCJsZW5ndGgiLCJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwiY2F0ZWdvcnkiLCJkZXNjcmlwdGlvbiIsInVybCIsImZpeGFibGUiLCJzY2hlbWEiLCJwcm9wZXJ0aWVzIiwiY29tbW9uanMiLCJub1VzZWxlc3NJbmRleCIsImFkZGl0aW9uYWxQcm9wZXJ0aWVzIiwiY3JlYXRlIiwiY29udGV4dCIsImN1cnJlbnREaXIiLCJkaXJuYW1lIiwib3B0aW9ucyIsImNoZWNrU291cmNlVmFsdWUiLCJzb3VyY2UiLCJpbXBvcnRQYXRoIiwidmFsdWUiLCJyZXBvcnRXaXRoUHJvcG9zZWRQYXRoIiwicHJvcG9zZWRQYXRoIiwicmVwb3J0Iiwibm9kZSIsIm1lc3NhZ2UiLCJmaXgiLCJmaXhlciIsInJlcGxhY2VUZXh0IiwiSlNPTiIsInN0cmluZ2lmeSIsInN0YXJ0c1dpdGgiLCJyZXNvbHZlZFBhdGgiLCJub3JtZWRQYXRoIiwicmVzb2x2ZWROb3JtZWRQYXRoIiwiZmlsZUV4dGVuc2lvbnMiLCJzZXR0aW5ncyIsInJlZ2V4VW5uZWNlc3NhcnlJbmRleCIsIlJ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AgICAgICAgICAgIC5jb25jYXQoaW1wb3J0UGF0aFNwbGl0LnNsaWNlKGNvdW50SW1wb3J0UGF0aFJlbGF0aXZlUGFyZW50cyArIGRpZmYpKVxuICAgICAgICAgICAgLmpvaW4oJy8nKSxcbiAgICAgICAgKSxcbiAgICAgICk7XG4gICAgfVxuXG4gICAgcmV0dXJuIG1vZHVsZVZpc2l0b3IoY2hlY2tTb3VyY2VWYWx1ZSwgb3B0aW9ucyk7XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..a0e1a1481d2160eceac58a0a541a4bbe8399a41e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js @@ -0,0 +1,26 @@ +'use strict';var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function reportIfNonStandard(context, node, name) { + if (name && name.indexOf('!') !== -1) { + context.report(node, 'Unexpected \'!\' in \'' + String(name) + '\'. Do not use import syntax to configure webpack loaders.'); + } +} + +module.exports = { + meta: { + type: 'problem', + docs: { + category: 'Static analysis', + description: 'Forbid webpack loader syntax in imports.', + url: (0, _docsUrl2['default'])('no-webpack-loader-syntax') }, + + schema: [] }, + + + create: function () {function create(context) { + return (0, _moduleVisitor2['default'])(function (source, node) { + reportIfNonStandard(context, node, source.value); + }, { commonjs: true }); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyY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c3ludGF4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IG1vZHVsZVZpc2l0b3IgZnJvbSAnZXNsaW50LW1vZHVsZS11dGlscy9tb2R1bGVWaXNpdG9yJztcbmltcG9ydCBkb2NzVXJsIGZyb20gJy4uL2RvY3NVcmwnO1xuXG5mdW5jdGlvbiByZXBvcnRJZk5vblN0YW5kYXJkKGNvbnRleHQsIG5vZGUsIG5hbWUpIHtcbiAgaWYgKG5hbWUgJiYgbmFtZS5pbmRleE9mKCchJykgIT09IC0xKSB7XG4gICAgY29udGV4dC5yZXBvcnQobm9kZSwgYFVuZXhwZWN0ZWQgJyEnIGluICcke25hbWV9Jy4gRG8gbm90IHVzZSBpbXBvcnQgc3ludGF4IHRvIGNvbmZpZ3VyZSB3ZWJwYWNrIGxvYWRlcnMuYCk7XG4gIH1cbn1cblxubW9kdWxlLmV4cG9ydHMgPSB7XG4gIG1ldGE6IHtcbiAgICB0eXBlOiAncHJvYmxlbScsXG4gICAgZG9jczoge1xuICAgICAgY2F0ZWdvcnk6ICdTdGF0aWMgYW5hbHlzaXMnLFxuICAgICAgZGVzY3JpcHRpb246ICdGb3JiaWQgd2VicGFjayBsb2FkZXIgc3ludGF4IGluIGltcG9ydHMuJyxcbiAgICAgIHVybDogZG9jc1VybCgnbm8td2VicGFjay1sb2FkZXItc3ludGF4JyksXG4gICAgfSxcbiAgICBzY2hlbWE6IFtdLFxuICB9LFxuXG4gIGNyZWF0ZShjb250ZXh0KSB7XG4gICAgcmV0dXJuIG1vZHVsZVZpc2l0b3IoKHNvdXJjZSwgbm9kZSkgPT4ge1xuICAgICAgcmVwb3J0SWZOb25TdGFuZGFyZChjb250ZXh0LCBub2RlLCBzb3VyY2UudmFsdWUpO1xuICAgIH0sIHsgY29tbW9uanM6IHRydWUgfSk7XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/order.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/order.js new file mode 100644 index 0000000000000000000000000000000000000000..578709bf0b90c1c794ed7f8c046d9b3edaf0ff0a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/order.js @@ -0,0 +1,1349 @@ +'use strict';var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}(); + +var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch); +var _arrayIncludes = require('array-includes');var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes); +var _object = require('object.groupby');var _object2 = _interopRequireDefault(_object); +var _contextCompat = require('eslint-module-utils/contextCompat'); +var _stringPrototype = require('string.prototype.trimend');var _stringPrototype2 = _interopRequireDefault(_stringPrototype); + +var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType); +var _staticRequire = require('../core/staticRequire');var _staticRequire2 = _interopRequireDefault(_staticRequire); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +var categories = { + named: 'named', + 'import': 'import', + exports: 'exports' }; + + +var defaultGroups = ['builtin', 'external', 'parent', 'sibling', 'index']; + +// REPORTING AND FIXING + +function reverse(array) { + return array.map(function (v) {return Object.assign({}, v, { rank: -v.rank });}).reverse(); +} + +function getTokensOrCommentsAfter(sourceCode, node, count) { + var currentNodeOrToken = node; + var result = []; + for (var i = 0; i < count; i++) { + currentNodeOrToken = sourceCode.getTokenOrCommentAfter(currentNodeOrToken); + if (currentNodeOrToken == null) { + break; + } + result.push(currentNodeOrToken); + } + return result; +} + +function getTokensOrCommentsBefore(sourceCode, node, count) { + var currentNodeOrToken = node; + var result = []; + for (var i = 0; i < count; i++) { + currentNodeOrToken = sourceCode.getTokenOrCommentBefore(currentNodeOrToken); + if (currentNodeOrToken == null) { + break; + } + result.push(currentNodeOrToken); + } + return result.reverse(); +} + +function takeTokensAfterWhile(sourceCode, node, condition) { + var tokens = getTokensOrCommentsAfter(sourceCode, node, 100); + var result = []; + for (var i = 0; i < tokens.length; i++) { + if (condition(tokens[i])) { + result.push(tokens[i]); + } else { + break; + } + } + return result; +} + +function takeTokensBeforeWhile(sourceCode, node, condition) { + var tokens = getTokensOrCommentsBefore(sourceCode, node, 100); + var result = []; + for (var i = tokens.length - 1; i >= 0; i--) { + if (condition(tokens[i])) { + result.push(tokens[i]); + } else { + break; + } + } + return result.reverse(); +} + +function findOutOfOrder(imported) { + if (imported.length === 0) { + return []; + } + var maxSeenRankNode = imported[0]; + return imported.filter(function (importedModule) { + var res = importedModule.rank < maxSeenRankNode.rank; + if (maxSeenRankNode.rank < importedModule.rank) { + maxSeenRankNode = importedModule; + } + return res; + }); +} + +function findRootNode(node) { + var parent = node; + while (parent.parent != null && parent.parent.body == null) { + parent = parent.parent; + } + return parent; +} + +function commentOnSameLineAs(node) { + return function (token) {return (token.type === 'Block' || token.type === 'Line') && + token.loc.start.line === token.loc.end.line && + token.loc.end.line === node.loc.end.line;}; +} + +function findEndOfLineWithComments(sourceCode, node) { + var tokensToEndOfLine = takeTokensAfterWhile(sourceCode, node, commentOnSameLineAs(node)); + var endOfTokens = tokensToEndOfLine.length > 0 ? + tokensToEndOfLine[tokensToEndOfLine.length - 1].range[1] : + node.range[1]; + var result = endOfTokens; + for (var i = endOfTokens; i < sourceCode.text.length; i++) { + if (sourceCode.text[i] === '\n') { + result = i + 1; + break; + } + if (sourceCode.text[i] !== ' ' && sourceCode.text[i] !== '\t' && sourceCode.text[i] !== '\r') { + break; + } + result = i + 1; + } + return result; +} + +function findStartOfLineWithComments(sourceCode, node) { + var tokensToEndOfLine = takeTokensBeforeWhile(sourceCode, node, commentOnSameLineAs(node)); + var startOfTokens = tokensToEndOfLine.length > 0 ? tokensToEndOfLine[0].range[0] : node.range[0]; + var result = startOfTokens; + for (var i = startOfTokens - 1; i > 0; i--) { + if (sourceCode.text[i] !== ' ' && sourceCode.text[i] !== '\t') { + break; + } + result = i; + } + return result; +} + +function findSpecifierStart(sourceCode, node) { + var token = void 0; + + do { + token = sourceCode.getTokenBefore(node); + } while (token.value !== ',' && token.value !== '{'); + + return token.range[1]; +} + +function findSpecifierEnd(sourceCode, node) { + var token = void 0; + + do { + token = sourceCode.getTokenAfter(node); + } while (token.value !== ',' && token.value !== '}'); + + return token.range[0]; +} + +function isRequireExpression(expr) { + return expr != null && + expr.type === 'CallExpression' && + expr.callee != null && + expr.callee.name === 'require' && + expr.arguments != null && + expr.arguments.length === 1 && + expr.arguments[0].type === 'Literal'; +} + +function isSupportedRequireModule(node) { + if (node.type !== 'VariableDeclaration') { + return false; + } + if (node.declarations.length !== 1) { + return false; + } + var decl = node.declarations[0]; + var isPlainRequire = decl.id && ( + decl.id.type === 'Identifier' || decl.id.type === 'ObjectPattern') && + isRequireExpression(decl.init); + var isRequireWithMemberExpression = decl.id && ( + decl.id.type === 'Identifier' || decl.id.type === 'ObjectPattern') && + decl.init != null && + decl.init.type === 'CallExpression' && + decl.init.callee != null && + decl.init.callee.type === 'MemberExpression' && + isRequireExpression(decl.init.callee.object); + return isPlainRequire || isRequireWithMemberExpression; +} + +function isPlainImportModule(node) { + return node.type === 'ImportDeclaration' && node.specifiers != null && node.specifiers.length > 0; +} + +function isPlainImportEquals(node) { + return node.type === 'TSImportEqualsDeclaration' && node.moduleReference.expression; +} + +function isCJSExports(context, node) { + if ( + node.type === 'MemberExpression' && + node.object.type === 'Identifier' && + node.property.type === 'Identifier' && + node.object.name === 'module' && + node.property.name === 'exports') + { + return (0, _contextCompat.getScope)(context, node).variables.findIndex(function (variable) {return variable.name === 'module';}) === -1; + } + if ( + node.type === 'Identifier' && + node.name === 'exports') + { + return (0, _contextCompat.getScope)(context, node).variables.findIndex(function (variable) {return variable.name === 'exports';}) === -1; + } +} + +function getNamedCJSExports(context, node) { + if (node.type !== 'MemberExpression') { + return; + } + var result = []; + var root = node; + var parent = null; + while (root.type === 'MemberExpression') { + if (root.property.type !== 'Identifier') { + return; + } + result.unshift(root.property.name); + parent = root; + root = root.object; + } + + if (isCJSExports(context, root)) { + return result; + } + + if (isCJSExports(context, parent)) { + return result.slice(1); + } +} + +function canCrossNodeWhileReorder(node) { + return isSupportedRequireModule(node) || isPlainImportModule(node) || isPlainImportEquals(node); +} + +function canReorderItems(firstNode, secondNode) { + var parent = firstNode.parent;var _sort = + [ + parent.body.indexOf(firstNode), + parent.body.indexOf(secondNode)]. + sort(),_sort2 = _slicedToArray(_sort, 2),firstIndex = _sort2[0],secondIndex = _sort2[1]; + var nodesBetween = parent.body.slice(firstIndex, secondIndex + 1);var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = nodesBetween[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var nodeBetween = _step.value; + if (!canCrossNodeWhileReorder(nodeBetween)) { + return false; + } + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + return true; +} + +function makeImportDescription(node) { + if (node.type === 'export') { + if (node.node.exportKind === 'type') { + return 'type export'; + } + return 'export'; + } + if (node.node.importKind === 'type') { + return 'type import'; + } + if (node.node.importKind === 'typeof') { + return 'typeof import'; + } + return 'import'; +} + +function fixOutOfOrder(context, firstNode, secondNode, order, category) { + var isNamed = category === categories.named; + var isExports = category === categories.exports; + var sourceCode = (0, _contextCompat.getSourceCode)(context);var _ref = + + + + + isNamed ? { + firstRoot: firstNode.node, + secondRoot: secondNode.node } : + { + firstRoot: findRootNode(firstNode.node), + secondRoot: findRootNode(secondNode.node) },firstRoot = _ref.firstRoot,secondRoot = _ref.secondRoot;var _ref2 = + + + + + + + + isNamed ? { + firstRootStart: findSpecifierStart(sourceCode, firstRoot), + firstRootEnd: findSpecifierEnd(sourceCode, firstRoot), + secondRootStart: findSpecifierStart(sourceCode, secondRoot), + secondRootEnd: findSpecifierEnd(sourceCode, secondRoot) } : + { + firstRootStart: findStartOfLineWithComments(sourceCode, firstRoot), + firstRootEnd: findEndOfLineWithComments(sourceCode, firstRoot), + secondRootStart: findStartOfLineWithComments(sourceCode, secondRoot), + secondRootEnd: findEndOfLineWithComments(sourceCode, secondRoot) },firstRootStart = _ref2.firstRootStart,firstRootEnd = _ref2.firstRootEnd,secondRootStart = _ref2.secondRootStart,secondRootEnd = _ref2.secondRootEnd; + + + if (firstNode.displayName === secondNode.displayName) { + if (firstNode.alias) { + firstNode.displayName = String(firstNode.displayName) + ' as ' + String(firstNode.alias); + } + if (secondNode.alias) { + secondNode.displayName = String(secondNode.displayName) + ' as ' + String(secondNode.alias); + } + } + + var firstImport = String(makeImportDescription(firstNode)) + ' of `' + String(firstNode.displayName) + '`'; + var secondImport = '`' + String(secondNode.displayName) + '` ' + String(makeImportDescription(secondNode)); + var message = secondImport + ' should occur ' + String(order) + ' ' + firstImport; + + if (isNamed) { + var firstCode = sourceCode.text.slice(firstRootStart, firstRoot.range[1]); + var firstTrivia = sourceCode.text.slice(firstRoot.range[1], firstRootEnd); + var secondCode = sourceCode.text.slice(secondRootStart, secondRoot.range[1]); + var secondTrivia = sourceCode.text.slice(secondRoot.range[1], secondRootEnd); + + if (order === 'before') { + var trimmedTrivia = (0, _stringPrototype2['default'])(secondTrivia); + var gapCode = sourceCode.text.slice(firstRootEnd, secondRootStart - 1); + var whitespaces = secondTrivia.slice(trimmedTrivia.length); + context.report({ + node: secondNode.node, + message: message, + fix: function () {function fix(fixer) {return fixer.replaceTextRange( + [firstRootStart, secondRootEnd], String( + secondCode) + ',' + String(trimmedTrivia) + String(firstCode) + String(firstTrivia) + String(gapCode) + String(whitespaces));}return fix;}() }); + + + } else if (order === 'after') { + var _trimmedTrivia = (0, _stringPrototype2['default'])(firstTrivia); + var _gapCode = sourceCode.text.slice(secondRootEnd + 1, firstRootStart); + var _whitespaces = firstTrivia.slice(_trimmedTrivia.length); + context.report({ + node: secondNode.node, + message: message, + fix: function () {function fix(fixes) {return fixes.replaceTextRange( + [secondRootStart, firstRootEnd], '' + String( + _gapCode) + String(firstCode) + ',' + String(_trimmedTrivia) + String(secondCode) + String(_whitespaces));}return fix;}() }); + + + } + } else { + var canFix = isExports || canReorderItems(firstRoot, secondRoot); + var newCode = sourceCode.text.substring(secondRootStart, secondRootEnd); + + if (newCode[newCode.length - 1] !== '\n') { + newCode = String(newCode) + '\n'; + } + + if (order === 'before') { + context.report({ + node: secondNode.node, + message: message, + fix: canFix && function (fixer) {return fixer.replaceTextRange( + [firstRootStart, secondRootEnd], + newCode + sourceCode.text.substring(firstRootStart, secondRootStart));} }); + + + } else if (order === 'after') { + context.report({ + node: secondNode.node, + message: message, + fix: canFix && function (fixer) {return fixer.replaceTextRange( + [secondRootStart, firstRootEnd], + sourceCode.text.substring(secondRootEnd, firstRootEnd) + newCode);} }); + + + } + } +} + +function reportOutOfOrder(context, imported, outOfOrder, order, category) { + outOfOrder.forEach(function (imp) { + var found = imported.find(function () {function hasHigherRank(importedItem) { + return importedItem.rank > imp.rank; + }return hasHigherRank;}()); + fixOutOfOrder(context, found, imp, order, category); + }); +} + +function makeOutOfOrderReport(context, imported, category) { + var outOfOrder = findOutOfOrder(imported); + if (!outOfOrder.length) { + return; + } + + // There are things to report. Try to minimize the number of reported errors. + var reversedImported = reverse(imported); + var reversedOrder = findOutOfOrder(reversedImported); + if (reversedOrder.length < outOfOrder.length) { + reportOutOfOrder(context, reversedImported, reversedOrder, 'after', category); + return; + } + reportOutOfOrder(context, imported, outOfOrder, 'before', category); +} + +var compareString = function compareString(a, b) { + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; +}; + +/** Some parsers (languages without types) don't provide ImportKind */ +var DEFAULT_IMPORT_KIND = 'value'; +var getNormalizedValue = function getNormalizedValue(node, toLowerCase) { + var value = node.value; + return toLowerCase ? String(value).toLowerCase() : value; +}; + +function getSorter(alphabetizeOptions) { + var multiplier = alphabetizeOptions.order === 'asc' ? 1 : -1; + var orderImportKind = alphabetizeOptions.orderImportKind; + var multiplierImportKind = orderImportKind !== 'ignore' && ( + alphabetizeOptions.orderImportKind === 'asc' ? 1 : -1); + + return function () {function importsSorter(nodeA, nodeB) { + var importA = getNormalizedValue(nodeA, alphabetizeOptions.caseInsensitive); + var importB = getNormalizedValue(nodeB, alphabetizeOptions.caseInsensitive); + var result = 0; + + if (!(0, _arrayIncludes2['default'])(importA, '/') && !(0, _arrayIncludes2['default'])(importB, '/')) { + result = compareString(importA, importB); + } else { + var A = importA.split('/'); + var B = importB.split('/'); + var a = A.length; + var b = B.length; + + for (var i = 0; i < Math.min(a, b); i++) { + // Skip comparing the first path segment, if they are relative segments for both imports + if (i === 0 && (A[i] === '.' || A[i] === '..') && (B[i] === '.' || B[i] === '..')) { + // If one is sibling and the other parent import, no need to compare at all, since the paths belong in different groups + if (A[i] !== B[i]) {break;} + continue; + } + result = compareString(A[i], B[i]); + if (result) {break;} + } + + if (!result && a !== b) { + result = a < b ? -1 : 1; + } + } + + result = result * multiplier; + + // In case the paths are equal (result === 0), sort them by importKind + if (!result && multiplierImportKind) { + result = multiplierImportKind * compareString( + nodeA.node.importKind || DEFAULT_IMPORT_KIND, + nodeB.node.importKind || DEFAULT_IMPORT_KIND); + + } + + return result; + }return importsSorter;}(); +} + +function mutateRanksToAlphabetize(imported, alphabetizeOptions) { + var groupedByRanks = (0, _object2['default'])(imported, function (item) {return item.rank;}); + + var sorterFn = getSorter(alphabetizeOptions); + + // sort group keys so that they can be iterated on in order + var groupRanks = Object.keys(groupedByRanks).sort(function (a, b) { + return a - b; + }); + + // sort imports locally within their group + groupRanks.forEach(function (groupRank) { + groupedByRanks[groupRank].sort(sorterFn); + }); + + // assign globally unique rank to each import + var newRank = 0; + var alphabetizedRanks = groupRanks.reduce(function (acc, groupRank) { + groupedByRanks[groupRank].forEach(function (importedItem) { + acc[String(importedItem.value) + '|' + String(importedItem.node.importKind)] = parseInt(groupRank, 10) + newRank; + newRank += 1; + }); + return acc; + }, {}); + + // mutate the original group-rank with alphabetized-rank + imported.forEach(function (importedItem) { + importedItem.rank = alphabetizedRanks[String(importedItem.value) + '|' + String(importedItem.node.importKind)]; + }); +} + +// DETECTING + +function computePathRank(ranks, pathGroups, path, maxPosition) { + for (var i = 0, l = pathGroups.length; i < l; i++) {var _pathGroups$i = + pathGroups[i],pattern = _pathGroups$i.pattern,patternOptions = _pathGroups$i.patternOptions,group = _pathGroups$i.group,_pathGroups$i$positio = _pathGroups$i.position,position = _pathGroups$i$positio === undefined ? 1 : _pathGroups$i$positio; + if ((0, _minimatch2['default'])(path, pattern, patternOptions || { nocomment: true })) { + return ranks[group] + position / maxPosition; + } + } +} + +function computeRank(context, ranks, importEntry, excludedImportTypes, isSortingTypesGroup) { + var impType = void 0; + var rank = void 0; + + var isTypeGroupInGroups = ranks.omittedTypes.indexOf('type') === -1; + var isTypeOnlyImport = importEntry.node.importKind === 'type'; + var isExcludedFromPathRank = isTypeOnlyImport && isTypeGroupInGroups && excludedImportTypes.has('type'); + + if (importEntry.type === 'import:object') { + impType = 'object'; + } else if (isTypeOnlyImport && isTypeGroupInGroups && !isSortingTypesGroup) { + impType = 'type'; + } else { + impType = (0, _importType2['default'])(importEntry.value, context); + } + + if (!excludedImportTypes.has(impType) && !isExcludedFromPathRank) { + rank = computePathRank(ranks.groups, ranks.pathGroups, importEntry.value, ranks.maxPosition); + } + + if (typeof rank === 'undefined') { + rank = ranks.groups[impType]; + + if (typeof rank === 'undefined') { + return -1; + } + } + + if (isTypeOnlyImport && isSortingTypesGroup) { + rank = ranks.groups.type + rank / 10; + } + + if (importEntry.type !== 'import' && !importEntry.type.startsWith('import:')) { + rank += 100; + } + + return rank; +} + +function registerNode(context, importEntry, ranks, imported, excludedImportTypes, isSortingTypesGroup) { + var rank = computeRank(context, ranks, importEntry, excludedImportTypes, isSortingTypesGroup); + if (rank !== -1) { + var importNode = importEntry.node; + + if (importEntry.type === 'require' && importNode.parent.parent.type === 'VariableDeclaration') { + importNode = importNode.parent.parent; + } + + imported.push(Object.assign({}, + importEntry, { + rank: rank, + isMultiline: importNode.loc.end.line !== importNode.loc.start.line })); + + } +} + +function getRequireBlock(node) { + var n = node; + // Handle cases like `const baz = require('foo').bar.baz` + // and `const foo = require('foo')()` + while ( + n.parent.type === 'MemberExpression' && n.parent.object === n || + n.parent.type === 'CallExpression' && n.parent.callee === n) + { + n = n.parent; + } + if ( + n.parent.type === 'VariableDeclarator' && + n.parent.parent.type === 'VariableDeclaration' && + n.parent.parent.parent.type === 'Program') + { + return n.parent.parent.parent; + } +} + +var types = ['builtin', 'external', 'internal', 'unknown', 'parent', 'sibling', 'index', 'object', 'type']; + +/** + * Creates an object with type-rank pairs. + * + * Example: { index: 0, sibling: 1, parent: 1, external: 1, builtin: 2, internal: 2 } + */ +function convertGroupsToRanks(groups) { + var rankObject = groups.reduce(function (res, group, index) { + [].concat(group).forEach(function (groupItem) { + res[groupItem] = index * 2; + }); + return res; + }, {}); + + var omittedTypes = types.filter(function (type) { + return typeof rankObject[type] === 'undefined'; + }); + + var ranks = omittedTypes.reduce(function (res, type) { + res[type] = groups.length * 2; + return res; + }, rankObject); + + return { groups: ranks, omittedTypes: omittedTypes }; +} + +function convertPathGroupsForRanks(pathGroups) { + var after = {}; + var before = {}; + + var transformed = pathGroups.map(function (pathGroup, index) {var + group = pathGroup.group,positionString = pathGroup.position; + var position = 0; + if (positionString === 'after') { + if (!after[group]) { + after[group] = 1; + } + position = after[group]++; + } else if (positionString === 'before') { + if (!before[group]) { + before[group] = []; + } + before[group].push(index); + } + + return Object.assign({}, pathGroup, { position: position }); + }); + + var maxPosition = 1; + + Object.keys(before).forEach(function (group) { + var groupLength = before[group].length; + before[group].forEach(function (groupIndex, index) { + transformed[groupIndex].position = -1 * (groupLength - index); + }); + maxPosition = Math.max(maxPosition, groupLength); + }); + + Object.keys(after).forEach(function (key) { + var groupNextPosition = after[key]; + maxPosition = Math.max(maxPosition, groupNextPosition - 1); + }); + + return { + pathGroups: transformed, + maxPosition: maxPosition > 10 ? Math.pow(10, Math.ceil(Math.log10(maxPosition))) : 10 }; + +} + +function fixNewLineAfterImport(context, previousImport) { + var prevRoot = findRootNode(previousImport.node); + var tokensToEndOfLine = takeTokensAfterWhile( + (0, _contextCompat.getSourceCode)(context), + prevRoot, + commentOnSameLineAs(prevRoot)); + + + var endOfLine = prevRoot.range[1]; + if (tokensToEndOfLine.length > 0) { + endOfLine = tokensToEndOfLine[tokensToEndOfLine.length - 1].range[1]; + } + return function (fixer) {return fixer.insertTextAfterRange([prevRoot.range[0], endOfLine], '\n');}; +} + +function removeNewLineAfterImport(context, currentImport, previousImport) { + var sourceCode = (0, _contextCompat.getSourceCode)(context); + var prevRoot = findRootNode(previousImport.node); + var currRoot = findRootNode(currentImport.node); + var rangeToRemove = [ + findEndOfLineWithComments(sourceCode, prevRoot), + findStartOfLineWithComments(sourceCode, currRoot)]; + + if (/^\s*$/.test(sourceCode.text.substring(rangeToRemove[0], rangeToRemove[1]))) { + return function (fixer) {return fixer.removeRange(rangeToRemove);}; + } + return undefined; +} + +function makeNewlinesBetweenReport(context, imported, newlinesBetweenImports_, newlinesBetweenTypeOnlyImports_, distinctGroup, isSortingTypesGroup, isConsolidatingSpaceBetweenImports) { + var getNumberOfEmptyLinesBetween = function getNumberOfEmptyLinesBetween(currentImport, previousImport) { + var linesBetweenImports = (0, _contextCompat.getSourceCode)(context).lines.slice( + previousImport.node.loc.end.line, + currentImport.node.loc.start.line - 1); + + + return linesBetweenImports.filter(function (line) {return !line.trim().length;}).length; + }; + var getIsStartOfDistinctGroup = function getIsStartOfDistinctGroup(currentImport, previousImport) {return currentImport.rank - 1 >= previousImport.rank;}; + var previousImport = imported[0]; + + imported.slice(1).forEach(function (currentImport) { + var emptyLinesBetween = getNumberOfEmptyLinesBetween( + currentImport, + previousImport); + + + var isStartOfDistinctGroup = getIsStartOfDistinctGroup( + currentImport, + previousImport); + + + var isTypeOnlyImport = currentImport.node.importKind === 'type'; + var isPreviousImportTypeOnlyImport = previousImport.node.importKind === 'type'; + + var isNormalImportNextToTypeOnlyImportAndRelevant = isTypeOnlyImport !== isPreviousImportTypeOnlyImport && isSortingTypesGroup; + + var isTypeOnlyImportAndRelevant = isTypeOnlyImport && isSortingTypesGroup; + + // In the special case where newlinesBetweenImports and consolidateIslands + // want the opposite thing, consolidateIslands wins + var newlinesBetweenImports = isSortingTypesGroup && + isConsolidatingSpaceBetweenImports && ( + previousImport.isMultiline || currentImport.isMultiline) && + newlinesBetweenImports_ === 'never' ? + 'always-and-inside-groups' : + newlinesBetweenImports_; + + // In the special case where newlinesBetweenTypeOnlyImports and + // consolidateIslands want the opposite thing, consolidateIslands wins + var newlinesBetweenTypeOnlyImports = isSortingTypesGroup && + isConsolidatingSpaceBetweenImports && ( + isNormalImportNextToTypeOnlyImportAndRelevant || + previousImport.isMultiline || + currentImport.isMultiline) && + newlinesBetweenTypeOnlyImports_ === 'never' ? + 'always-and-inside-groups' : + newlinesBetweenTypeOnlyImports_; + + var isNotIgnored = isTypeOnlyImportAndRelevant && + newlinesBetweenTypeOnlyImports !== 'ignore' || + !isTypeOnlyImportAndRelevant && newlinesBetweenImports !== 'ignore'; + + if (isNotIgnored) { + var shouldAssertNewlineBetweenGroups = (isTypeOnlyImportAndRelevant || isNormalImportNextToTypeOnlyImportAndRelevant) && ( + newlinesBetweenTypeOnlyImports === 'always' || + newlinesBetweenTypeOnlyImports === 'always-and-inside-groups') || + !isTypeOnlyImportAndRelevant && !isNormalImportNextToTypeOnlyImportAndRelevant && ( + newlinesBetweenImports === 'always' || + newlinesBetweenImports === 'always-and-inside-groups'); + + var shouldAssertNoNewlineWithinGroup = (isTypeOnlyImportAndRelevant || isNormalImportNextToTypeOnlyImportAndRelevant) && + newlinesBetweenTypeOnlyImports !== 'always-and-inside-groups' || + !isTypeOnlyImportAndRelevant && !isNormalImportNextToTypeOnlyImportAndRelevant && + newlinesBetweenImports !== 'always-and-inside-groups'; + + var shouldAssertNoNewlineBetweenGroup = !isSortingTypesGroup || + !isNormalImportNextToTypeOnlyImportAndRelevant || + newlinesBetweenTypeOnlyImports === 'never'; + + var isTheNewlineBetweenImportsInTheSameGroup = distinctGroup && currentImport.rank === previousImport.rank || + !distinctGroup && !isStartOfDistinctGroup; + + // Let's try to cut down on linting errors sent to the user + var alreadyReported = false; + + if (shouldAssertNewlineBetweenGroups) { + if (currentImport.rank !== previousImport.rank && emptyLinesBetween === 0) { + if (distinctGroup || isStartOfDistinctGroup) { + alreadyReported = true; + context.report({ + node: previousImport.node, + message: 'There should be at least one empty line between import groups', + fix: fixNewLineAfterImport(context, previousImport) }); + + } + } else if (emptyLinesBetween > 0 && shouldAssertNoNewlineWithinGroup) { + if (isTheNewlineBetweenImportsInTheSameGroup) { + alreadyReported = true; + context.report({ + node: previousImport.node, + message: 'There should be no empty line within import group', + fix: removeNewLineAfterImport(context, currentImport, previousImport) }); + + } + } + } else if (emptyLinesBetween > 0 && shouldAssertNoNewlineBetweenGroup) { + alreadyReported = true; + context.report({ + node: previousImport.node, + message: 'There should be no empty line between import groups', + fix: removeNewLineAfterImport(context, currentImport, previousImport) }); + + } + + if (!alreadyReported && isConsolidatingSpaceBetweenImports) { + if (emptyLinesBetween === 0 && currentImport.isMultiline) { + context.report({ + node: previousImport.node, + message: 'There should be at least one empty line between this import and the multi-line import that follows it', + fix: fixNewLineAfterImport(context, previousImport) }); + + } else if (emptyLinesBetween === 0 && previousImport.isMultiline) { + context.report({ + node: previousImport.node, + message: 'There should be at least one empty line between this multi-line import and the import that follows it', + fix: fixNewLineAfterImport(context, previousImport) }); + + } else if ( + emptyLinesBetween > 0 && + !previousImport.isMultiline && + !currentImport.isMultiline && + isTheNewlineBetweenImportsInTheSameGroup) + { + context.report({ + node: previousImport.node, + message: + 'There should be no empty lines between this single-line import and the single-line import that follows it', + fix: removeNewLineAfterImport(context, currentImport, previousImport) }); + + } + } + } + + previousImport = currentImport; + }); +} + +function getAlphabetizeConfig(options) { + var alphabetize = options.alphabetize || {}; + var order = alphabetize.order || 'ignore'; + var orderImportKind = alphabetize.orderImportKind || 'ignore'; + var caseInsensitive = alphabetize.caseInsensitive || false; + + return { order: order, orderImportKind: orderImportKind, caseInsensitive: caseInsensitive }; +} + +// TODO, semver-major: Change the default of "distinctGroup" from true to false +var defaultDistinctGroup = true; + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Enforce a convention in module import order.', + url: (0, _docsUrl2['default'])('order') }, + + + fixable: 'code', + schema: [ + { + type: 'object', + properties: { + groups: { + type: 'array', + uniqueItems: true, + items: { + oneOf: [ + { 'enum': types }, + { + type: 'array', + uniqueItems: true, + items: { 'enum': types } }] } }, + + + + + pathGroupsExcludedImportTypes: { + type: 'array' }, + + distinctGroup: { + type: 'boolean', + 'default': defaultDistinctGroup }, + + pathGroups: { + type: 'array', + items: { + type: 'object', + properties: { + pattern: { + type: 'string' }, + + patternOptions: { + type: 'object' }, + + group: { + type: 'string', + 'enum': types }, + + position: { + type: 'string', + 'enum': ['after', 'before'] } }, + + + additionalProperties: false, + required: ['pattern', 'group'] } }, + + + 'newlines-between': { + 'enum': [ + 'ignore', + 'always', + 'always-and-inside-groups', + 'never'] }, + + + 'newlines-between-types': { + 'enum': [ + 'ignore', + 'always', + 'always-and-inside-groups', + 'never'] }, + + + consolidateIslands: { + 'enum': [ + 'inside-groups', + 'never'] }, + + + sortTypesGroup: { + type: 'boolean', + 'default': false }, + + named: { + 'default': false, + oneOf: [{ + type: 'boolean' }, + { + type: 'object', + properties: { + enabled: { type: 'boolean' }, + 'import': { type: 'boolean' }, + 'export': { type: 'boolean' }, + require: { type: 'boolean' }, + cjsExports: { type: 'boolean' }, + types: { + type: 'string', + 'enum': [ + 'mixed', + 'types-first', + 'types-last'] } }, + + + + additionalProperties: false }] }, + + + alphabetize: { + type: 'object', + properties: { + caseInsensitive: { + type: 'boolean', + 'default': false }, + + order: { + 'enum': ['ignore', 'asc', 'desc'], + 'default': 'ignore' }, + + orderImportKind: { + 'enum': ['ignore', 'asc', 'desc'], + 'default': 'ignore' } }, + + + additionalProperties: false }, + + warnOnUnassignedImports: { + type: 'boolean', + 'default': false } }, + + + additionalProperties: false, + dependencies: { + sortTypesGroup: { + oneOf: [ + { + // When sortTypesGroup is true, groups must NOT be an array that does not contain 'type' + properties: { + sortTypesGroup: { 'enum': [true] }, + groups: { + not: { + type: 'array', + uniqueItems: true, + items: { + oneOf: [ + { 'enum': types.filter(function (t) {return t !== 'type';}) }, + { + type: 'array', + uniqueItems: true, + items: { 'enum': types.filter(function (t) {return t !== 'type';}) } }] } } } }, + + + + + + + required: ['groups'] }, + + { + properties: { + sortTypesGroup: { 'enum': [false] } } }] }, + + + + + 'newlines-between-types': { + properties: { + sortTypesGroup: { 'enum': [true] } }, + + required: ['sortTypesGroup'] }, + + consolidateIslands: { + oneOf: [ + { + properties: { + consolidateIslands: { 'enum': ['inside-groups'] } }, + + anyOf: [ + { + properties: { + 'newlines-between': { 'enum': ['always-and-inside-groups'] } }, + + required: ['newlines-between'] }, + + { + properties: { + 'newlines-between-types': { 'enum': ['always-and-inside-groups'] } }, + + required: ['newlines-between-types'] }] }, + + + + { + properties: { + consolidateIslands: { 'enum': ['never'] } } }] } } }] }, + + + + + + + + + + create: function () {function create(context) { + var options = context.options[0] || {}; + var newlinesBetweenImports = options['newlines-between'] || 'ignore'; + var newlinesBetweenTypeOnlyImports = options['newlines-between-types'] || newlinesBetweenImports; + var pathGroupsExcludedImportTypes = new Set(options.pathGroupsExcludedImportTypes || ['builtin', 'external', 'object']); + var sortTypesGroup = options.sortTypesGroup; + var consolidateIslands = options.consolidateIslands || 'never'; + + var named = Object.assign({ + types: 'mixed' }, + _typeof(options.named) === 'object' ? Object.assign({}, + options.named, { + 'import': 'import' in options.named ? options.named['import'] : options.named.enabled, + 'export': 'export' in options.named ? options.named['export'] : options.named.enabled, + require: 'require' in options.named ? options.named.require : options.named.enabled, + cjsExports: 'cjsExports' in options.named ? options.named.cjsExports : options.named.enabled }) : + { + 'import': options.named, + 'export': options.named, + require: options.named, + cjsExports: options.named }); + + + + var namedGroups = named.types === 'mixed' ? [] : named.types === 'types-last' ? ['value'] : ['type']; + var alphabetize = getAlphabetizeConfig(options); + var distinctGroup = options.distinctGroup == null ? defaultDistinctGroup : !!options.distinctGroup; + var ranks = void 0; + + try {var _convertPathGroupsFor = + convertPathGroupsForRanks(options.pathGroups || []),pathGroups = _convertPathGroupsFor.pathGroups,maxPosition = _convertPathGroupsFor.maxPosition;var _convertGroupsToRanks = + convertGroupsToRanks(options.groups || defaultGroups),groups = _convertGroupsToRanks.groups,omittedTypes = _convertGroupsToRanks.omittedTypes; + ranks = { + groups: groups, + omittedTypes: omittedTypes, + pathGroups: pathGroups, + maxPosition: maxPosition }; + + } catch (error) { + // Malformed configuration + return { + Program: function () {function Program(node) { + context.report(node, error.message); + }return Program;}() }; + + } + var importMap = new Map(); + var exportMap = new Map(); + + var isTypeGroupInGroups = ranks.omittedTypes.indexOf('type') === -1; + var isSortingTypesGroup = isTypeGroupInGroups && sortTypesGroup; + + function getBlockImports(node) { + if (!importMap.has(node)) { + importMap.set(node, []); + } + return importMap.get(node); + } + + function getBlockExports(node) { + if (!exportMap.has(node)) { + exportMap.set(node, []); + } + return exportMap.get(node); + } + + function makeNamedOrderReport(context, namedImports) { + if (namedImports.length > 1) { + var imports = namedImports.map( + function (namedImport) { + var kind = namedImport.kind || 'value'; + var rank = namedGroups.findIndex(function (entry) {return [].concat(entry).indexOf(kind) > -1;}); + + return Object.assign({ + displayName: namedImport.value, + rank: rank === -1 ? namedGroups.length : rank }, + namedImport, { + value: String(namedImport.value) + ':' + String(namedImport.alias || '') }); + + }); + + if (alphabetize.order !== 'ignore') { + mutateRanksToAlphabetize(imports, alphabetize); + } + + makeOutOfOrderReport(context, imports, categories.named); + } + } + + return Object.assign({ + ImportDeclaration: function () {function ImportDeclaration(node) { + // Ignoring unassigned imports unless warnOnUnassignedImports is set + if (node.specifiers.length || options.warnOnUnassignedImports) { + var name = node.source.value; + registerNode( + context, + { + node: node, + value: name, + displayName: name, + type: 'import' }, + + ranks, + getBlockImports(node.parent), + pathGroupsExcludedImportTypes, + isSortingTypesGroup); + + + if (named['import']) { + makeNamedOrderReport( + context, + node.specifiers.filter( + function (specifier) {return specifier.type === 'ImportSpecifier';}).map( + function (specifier) {return Object.assign({ + node: specifier, + value: specifier.imported.name, + type: 'import', + kind: specifier.importKind }, + specifier.local.range[0] !== specifier.imported.range[0] && { + alias: specifier.local.name });})); + + + + + } + } + }return ImportDeclaration;}(), + TSImportEqualsDeclaration: function () {function TSImportEqualsDeclaration(node) { + // skip "export import"s + if (node.isExport) { + return; + } + + var displayName = void 0; + var value = void 0; + var type = void 0; + if (node.moduleReference.type === 'TSExternalModuleReference') { + value = node.moduleReference.expression.value; + displayName = value; + type = 'import'; + } else { + value = ''; + displayName = (0, _contextCompat.getSourceCode)(context).getText(node.moduleReference); + type = 'import:object'; + } + + registerNode( + context, + { + node: node, + value: value, + displayName: displayName, + type: type }, + + ranks, + getBlockImports(node.parent), + pathGroupsExcludedImportTypes, + isSortingTypesGroup); + + }return TSImportEqualsDeclaration;}(), + CallExpression: function () {function CallExpression(node) { + if (!(0, _staticRequire2['default'])(node)) { + return; + } + var block = getRequireBlock(node); + if (!block) { + return; + } + var name = node.arguments[0].value; + registerNode( + context, + { + node: node, + value: name, + displayName: name, + type: 'require' }, + + ranks, + getBlockImports(block), + pathGroupsExcludedImportTypes, + isSortingTypesGroup); + + }return CallExpression;}() }, + named.require && { + VariableDeclarator: function () {function VariableDeclarator(node) { + if (node.id.type === 'ObjectPattern' && isRequireExpression(node.init)) { + for (var i = 0; i < node.id.properties.length; i++) { + if ( + node.id.properties[i].key.type !== 'Identifier' || + node.id.properties[i].value.type !== 'Identifier') + { + return; + } + } + makeNamedOrderReport( + context, + node.id.properties.map(function (prop) {return Object.assign({ + node: prop, + value: prop.key.name, + type: 'require' }, + prop.key.range[0] !== prop.value.range[0] && { + alias: prop.value.name });})); + + + + } + }return VariableDeclarator;}() }, + + named['export'] && { + ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { + makeNamedOrderReport( + context, + node.specifiers.map(function (specifier) {return Object.assign({ + node: specifier, + value: specifier.local.name, + type: 'export', + kind: specifier.exportKind }, + specifier.local.range[0] !== specifier.exported.range[0] && { + alias: specifier.exported.name });})); + + + + }return ExportNamedDeclaration;}() }, + + named.cjsExports && { + AssignmentExpression: function () {function AssignmentExpression(node) { + if (node.parent.type === 'ExpressionStatement') { + if (isCJSExports(context, node.left)) { + if (node.right.type === 'ObjectExpression') { + for (var i = 0; i < node.right.properties.length; i++) { + if ( + !node.right.properties[i].key || + node.right.properties[i].key.type !== 'Identifier' || + !node.right.properties[i].value || + node.right.properties[i].value.type !== 'Identifier') + { + return; + } + } + + makeNamedOrderReport( + context, + node.right.properties.map(function (prop) {return Object.assign({ + node: prop, + value: prop.key.name, + type: 'export' }, + prop.key.range[0] !== prop.value.range[0] && { + alias: prop.value.name });})); + + + + } + } else { + var nameParts = getNamedCJSExports(context, node.left); + if (nameParts && nameParts.length > 0) { + var name = nameParts.join('.'); + getBlockExports(node.parent.parent).push({ + node: node, + value: name, + displayName: name, + type: 'export', + rank: 0 }); + + } + } + } + }return AssignmentExpression;}() }, { + + 'Program:exit': function () {function ProgramExit() { + importMap.forEach(function (imported) { + if (newlinesBetweenImports !== 'ignore' || newlinesBetweenTypeOnlyImports !== 'ignore') { + makeNewlinesBetweenReport( + context, + imported, + newlinesBetweenImports, + newlinesBetweenTypeOnlyImports, + distinctGroup, + isSortingTypesGroup, + consolidateIslands === 'inside-groups' && ( + newlinesBetweenImports === 'always-and-inside-groups' || + newlinesBetweenTypeOnlyImports === 'always-and-inside-groups')); + + } + + if (alphabetize.order !== 'ignore') { + mutateRanksToAlphabetize(imported, alphabetize); + } + + makeOutOfOrderReport(context, imported, categories['import']); + }); + + exportMap.forEach(function (exported) { + if (alphabetize.order !== 'ignore') { + mutateRanksToAlphabetize(exported, alphabetize); + makeOutOfOrderReport(context, exported, categories.exports); + } + }); + + importMap.clear(); + exportMap.clear(); + }return ProgramExit;}() }); + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9vcmRlci5qcyJdLCJuYW1lcyI6WyJjYXRlZ29yaWVzIiwibmFtZWQiLCJleHBvcnRzIiwiZGVmYXVsdEdyb3VwcyIsInJldmVyc2UiLCJhcnJheSIsIm1hcCIsInYiLCJyYW5rIiwiZ2V0VG9rZW5zT3JDb21tZW50c0FmdGVyIiwic291cmNlQ29kZSIsIm5vZGUiLCJjb3VudCIsImN1cnJlbnROb2RlT3JUb2tlbiIsInJlc3VsdCIsImkiLCJnZXRUb2tlbk9yQ29tbWVudEFmdGVyIiwicHVzaCIsImdldFRva2Vuc09yQ29tbWVudHNCZWZvcmUiLCJnZXRUb2tlbk9yQ29tbWVudEJlZm9yZSIsInRha2VUb2tlbnNBZnRlcldoaWxlIiwiY29uZGl0aW9uIiwidG9rZW5zIiwibGVuZ3RoIiwidGFrZVRva2Vuc0JlZm9yZVdoaWxlIiwiZmluZE91dE9mT3JkZXIiLCJpbXBvcnRlZCIsIm1heFNlZW5SYW5rTm9kZSIs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5tb2R1bGUuZXhwb3J0cyA9IHtcbiAgbWV0YToge1xuICAgIHR5cGU6ICdzdWdnZXN0aW9uJyxcbiAgICBkb2NzOiB7XG4gICAgICBjYXRlZ29yeTogJ1N0eWxlIGd1aWRlJyxcbiAgICAgIGRlc2NyaXB0aW9uOiAnRW5mb3JjZSBhIGNvbnZlbnRpb24gaW4gbW9kdWxlIGltcG9ydCBvcmRlci4nLFxuICAgICAgdXJsOiBkb2NzVXJsKCdvcmRlcicpLFxuICAgIH0sXG5cbiAgICBmaXhhYmxlOiAnY29kZScsXG4gICAgc2NoZW1hOiBbXG4gICAgICB7XG4gICAgICAgIHR5cGU6ICdvYmplY3QnLFxuICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgZ3JvdXBzOiB7XG4gICAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgICAgdW5pcXVlSXRlbXM6IHRydWUsXG4gICAgICAgICAgICBpdGVtczoge1xuICAgICAgICAgICAgICBvbmVPZjogW1xuICAgICAgICAgICAgICAgIHsgZW51bTogdHlwZXMgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgICAgICAgICAgdW5pcXVlSXRlbXM6IHRydWUsXG4gICAgICAgICAgICAgICAgICBpdGVtczogeyBlbnVtOiB0eXBlcyB9LFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIF0sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0sXG4gICAgICAgICAgcGF0aEdyb3Vwc0V4Y2x1ZGVkSW1wb3J0VHlwZXM6IHtcbiAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgfSxcbiAgICAgICAgICBkaXN0aW5jdEdyb3VwOiB7XG4gICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsXG4gICAgICAgICAgICBkZWZhdWx0OiBkZWZhdWx0RGlzdGluY3RHcm91cCxcbiAgICAgICAgICB9LFxuICAgICAgICAgIHBhdGhHcm91cHM6IHtcbiAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgICBpdGVtczoge1xuICAgICAgICAgICAgICB0eXBlOiAnb2JqZWN0JyxcbiAgICAgICAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgICAgICAgIHBhdHRlcm46IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgcGF0dGVybk9wdGlvbnM6IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdvYmplY3QnLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgZ3JvdXA6IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICAgICAgICAgICAgZW51bTogdHlwZXMsXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBwb3NpdGlvbjoge1xuICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsXG4gICAgICAgICAgICAgICAgICBlbnVtOiBbJ2FmdGVyJywgJ2JlZm9yZSddLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIGFkZGl0aW9uYWxQcm9wZXJ0aWVzOiBmYWxzZSxcbiAgICAgICAgICAgICAgcmVxdWlyZWQ6IFsncGF0dGVybicsICdncm91cCddLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9LFxuICAgICAgICAgICduZXdsaW5lcy1iZXR3ZWVuJzoge1xuICAgICAgICAgICAgZW51bTogW1xuICAgICAgICAgICAgICAnaWdub3JlJyxcbiAgICAgICAgICAgICAgJ2Fsd2F5cycsXG4gICAgICAgICAgICAgICdhbHdheXMtYW5kLWluc2lkZS1ncm91cHMnLFxuICAgICAgICAgICAgICAnbmV2ZXInLFxuICAgICAgICAgICAgXSxcbiAgICAgICAgICB9LFxuICAgICAgICAgICduZXdsaW5lcy1iZXR3ZWVuLXR5cGVzJzoge1xuICAgICAgICAgICAgZW51bTogW1xuICAgICAgICAgICAgICAnaWdub3JlJyxcbiAgICAgICAgICAgICAgJ2Fsd2F5cycsXG4gICAgICAgICAgICAgICdhbHdheXMtYW5kLWluc2lkZS1ncm91cHMnLFxuICAgICAgICAgICAgICAnbmV2ZXInLFxuICAgICAgICAgICAgXSxcbiAgICAgICAgICB9LFxuICAgICAgICAgIGNvbnNvbGlkYXRlSXNsYW5kczoge1xuICAgICAgICAgICAgZW51bTogW1xuICAgICAgICAgICAgICAnaW5zaWRlLWdyb3VwcycsXG4gICAgICAgICAgICAgICduZXZlcicsXG4gICAgICAgICAgICBdLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgc29ydFR5cGVzR3JvdXA6IHtcbiAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICAgICAgICAgIGRlZmF1bHQ6IGZhbHNlLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgbmFtZWQ6IHtcbiAgICAgICAgICAgIGRlZmF1bHQ6IGZhbHNlLFxuICAgICAgICAgICAgb25lT2Y6IFt7XG4gICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICAgICAgICAgIH0sIHtcbiAgICAgICAgICAgICAgdHlwZTogJ29iamVjdCcsXG4gICAgICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgICAgICBlbmFibGVkOiB7IHR5cGU6ICdib29sZWFuJyB9LFxuICAgICAgICAgICAgICAgIGltcG9ydDogeyB0eXBlOiAnYm9vbGVhbicgfSxcbiAgICAgICAgICAgICAgICBleHBvcnQ6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sXG4gICAgICAgICAgICAgICAgcmVxdWlyZTogeyB0eXBlOiAnYm9vbGVhbicgfSxcbiAgICAgICAgICAgICAgICBjanNFeHBvcnRzOiB7IHR5cGU6ICdib29sZWFuJyB9LFxuICAgICAgICAgICAgICAgIHR5cGVzOiB7XG4gICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgICAgICAgIGVudW06IFtcbiAgICAgICAgICAgICAgICAgICAgJ21peGVkJyxcbiAgICAgICAgICAgICAgICAgICAgJ3R5cGVzLWZpcnN0JyxcbiAgICAgICAgICAgICAgICAgICAgJ3R5cGVzLWxhc3QnLFxuICAgICAgICAgICAgICAgICAgXSxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBhZGRpdGlvbmFsUHJvcGVydGllczogZmFsc2UsXG4gICAgICAgICAgICB9XSxcbiAgICAgICAgICB9LFxuICAgICAgICAgIGFscGhhYmV0aXplOiB7XG4gICAgICAgICAgICB0eXBlOiAnb2JqZWN0JyxcbiAgICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiB7XG4gICAgICAgICAgICAgICAgdHlwZTogJ2Jvb2xlYW4nLFxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6IGZhbHNlLFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBvcmRlcjoge1xuICAgICAgICAgICAgICAgIGVudW06IFsnaWdub3JlJywgJ2FzYycsICdkZXNjJ10sXG4gICAgICAgICAgICAgICAgZGVmYXVsdDogJ2lnbm9yZScsXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIG9yZGVySW1wb3J0S2luZDoge1xuICAgICAgICAgICAgICAgIGVudW06IFsnaWdub3JlJywgJ2FzYycsICdkZXNjJ10sXG4gICAgICAgICAgICAgICAgZGVmYXVsdDogJ2lnbm9yZScsXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYWRkaXRpb25hbFByb3BlcnRpZXM6IGZhbHNlLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgd2Fybk9uVW5hc3NpZ25lZEltcG9ydHM6IHtcbiAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICAgICAgICAgIGRlZmF1bHQ6IGZhbHNlLFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICAgIGFkZGl0aW9uYWxQcm9wZXJ0aWVzOiBmYWxzZSxcbiAgICAgICAgZGVwZW5kZW5jaWVzOiB7XG4gICAgICAgICAgc29ydFR5cGVzR3JvdXA6IHtcbiAgICAgICAgICAgIG9uZU9mOiBbXG4gICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAvLyBXaGVuIHNvcnRUeXBlc0dyb3VwIGlzIHRydWUsIGdyb3VwcyBtdXN0IE5PVCBiZSBhbiBhcnJheSB0aGF0IGRvZXMgbm90IGNvbnRhaW4gJ3R5cGUnXG4gICAgICAgICAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgICAgICAgICAgc29ydFR5cGVzR3JvdXA6IHsgZW51bTogW3RydWVdIH0sXG4gICAgICAgICAgICAgICAgICBncm91cHM6IHtcbiAgICAgICAgICAgICAgICAgICAgbm90OiB7XG4gICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JyxcbiAgICAgICAgICAgICAgICAgICAgICB1bmlxdWVJdGVtczogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICBpdGVtczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgb25lT2Y6IFtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgeyBlbnVtOiB0eXBlcy5maWx0ZXIoKHQpID0+IHQgIT09ICd0eXBlJykgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5pcXVlSXRlbXM6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRlbXM6IHsgZW51bTogdHlwZXMuZmlsdGVyKCh0KSA9PiB0ICE9PSAndHlwZScpIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgcmVxdWlyZWQ6IFsnZ3JvdXBzJ10sXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgICAgICAgICBzb3J0VHlwZXNHcm91cDogeyBlbnVtOiBbZmFsc2VdIH0sXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgfSxcbiAgICAgICAgICAnbmV3bGluZXMtYmV0d2Vlbi10eXBlcyc6IHtcbiAgICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgICAgc29ydFR5cGVzR3JvdXA6IHsgZW51bTogW3RydWVdIH0sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcmVxdWlyZWQ6IFsnc29ydFR5cGVzR3JvdXAnXSxcbiAgICAgICAgICB9LFxuICAgICAgICAgIGNvbnNvbGlkYXRlSXNsYW5kczoge1xuICAgICAgICAgICAgb25lT2Y6IFtcbiAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgICAgICAgIGNvbnNvbGlkYXRlSXNsYW5kczogeyBlbnVtOiBbJ2luc2lkZS1ncm91cHMnXSB9LFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgYW55T2Y6IFtcbiAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgICAgICAgICAgICAgICduZXdsaW5lcy1iZXR3ZWVuJzogeyBlbnVtOiBbJ2Fsd2F5cy1hbmQtaW5zaWRlLWdyb3VwcyddIH0sXG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmVkOiBbJ25ld2xpbmVzLWJldHdlZW4nXSxcbiAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgICAgICAgICAgICAnbmV3bGluZXMtYmV0d2Vlbi10eXBlcyc6IHsgZW51bTogWydhbHdheXMtYW5kLWluc2lkZS1ncm91cHMnXSB9LFxuICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICByZXF1aXJlZDogWyduZXdsaW5lcy1iZXR3ZWVuLXR5cGVzJ10sXG4gICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIF0sXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgICAgICAgICBjb25zb2xpZGF0ZUlzbGFuZHM6IHsgZW51bTogWyduZXZlciddIH0sXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgXSxcbiAgfSxcblxuICBjcmVhdGUoY29udGV4dCkge1xuICAgIGNvbnN0IG9wdGlvbnMgPSBjb250ZXh0Lm9wdGlvbnNbMF0gfHwge307XG4gICAgY29uc3QgbmV3bGluZXNCZXR3ZWVuSW1wb3J0cyA9IG9wdGlvbnNbJ25ld2xpbmVzLWJldHdlZW4nXSB8fCAnaWdub3JlJztcbiAgICBjb25zdCBuZXdsaW5lc0JldHdlZW5UeXBlT25seUltcG9ydHMgPSBvcHRpb25zWyduZXdsaW5lcy1iZXR3ZWVuLXR5cGVzJ10gfHwgbmV3bGluZXNCZXR3ZWVuSW1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ICAgICByZWdpc3Rlck5vZGUoXG4gICAgICAgICAgICBjb250ZXh0LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICB2YWx1ZTogbmFtZSxcbiAgICAgICAgICAgICAgZGlzcGxheU5hbWU6IG5hbWUsXG4gICAgICAgICAgICAgIHR5cGU6ICdpbXBvcnQnLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHJhbmtzLFxuICAgICAgICAgICAgZ2V0QmxvY2tJbXBvcnRzKG5vZGUucGFyZW50KSxcbiAgICAgICAgICAgIHBhdGhHcm91cHNFeGNsdWRlZEltcG9ydFR5cGVzLFxuICAgICAgICAgICAgaXNTb3J0aW5nVHlwZXNHcm91cCxcbiAgICAgICAgICApO1xuXG4gICAgICAgICAgaWYgKG5hbWVkLmltcG9ydCkge1xuICAgICAgICAgICAgbWFrZU5hbWVkT3JkZXJSZXBvcnQoXG4gICAgICAgICAgICAgIGNvbnRleHQsXG4gICAgICAgICAgICAgIG5vZGUuc3BlY2lmaWVycy5maWx0ZXIoXG4gICAgICAgICAgICAgICAgKHNwZWNpZmllcikgPT4gc3BlY2lmaWVyLnR5cGUgPT09ICdJbXBvcnRTcGVjaWZpZXInKS5tYXAoXG4gICAgICAgICAgICAgICAgKHNwZWNpZmllcikgPT4gKHtcbiAgICAgICAgICAgICAgICAgIG5vZGU6IHNwZWNpZmllcixcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiBzcGVjaWZpZXIuaW1wb3J0ZWQubmFtZSxcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdpbXBvcnQnLFxuICAgICAgICAgICAgICAgICAga2luZDogc3BlY2lmaWVyLmltcG9ydEtpbmQsXG4gICAgICAgICAgICAgICAgICAuLi5zcGVjaWZpZXIubG9jYWwucmFuZ2VbMF0gIT09IHNwZWNpZmllci5pbXBvcnRlZC5yYW5nZVswXSAmJiB7XG4gICAgICAgICAgICAgICAgICAgIGFsaWFzOiBzcGVjaWZpZXIubG9jYWwubmFtZSxcbiAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgICksXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFRTSW1wb3J0RXF1YWxzRGVjbGFyYXRpb24obm9kZSkge1xuICAgICAgICAvLyBza2lwIFwiZXhwb3J0IGltcG9ydFwic1xuICAgICAgICBpZiAobm9kZS5pc0V4cG9ydCkge1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGxldCBkaXNwbGF5TmFtZTtcbiAgICAgICAgbGV0IHZhbHVlO1xuICAgICAgICBsZXQgdHlwZTtcbiAgICAgICAgaWYgKG5vZGUubW9kdWxlUmVmZXJlbmNlLnR5cGUgPT09ICdUU0V4dGVybmFsTW9kdWxlUmVmZXJlbmNlJykge1xuICAgICAgICAgIHZhbHVlID0gbm9kZS5tb2R1bGVSZWZlcmVuY2UuZXhwcmVzc2lvbi52YWx1ZTtcbiAgICAgICAgICBkaXNwbGF5TmFtZSA9IHZhbHVlO1xuICAgICAgICAgIHR5cGUgPSAnaW1wb3J0JztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB2YWx1ZSA9ICcnO1xuICAgICAgICAgIGRpc3BsYXlOYW1lID0gZ2V0U291cmNlQ29kZShjb250ZXh0KS5nZXRUZXh0KG5vZGUubW9kdWxlUmVmZXJlbmNlKTtcbiAgICAgICAgICB0eXBlID0gJ2ltcG9ydDpvYmplY3QnO1xuICAgICAgICB9XG5cbiAgICAgICAgcmVnaXN0ZXJOb2RlKFxuICAgICAgICAgIGNvbnRleHQsXG4gICAgICAgICAge1xuICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgIHZhbHVlLFxuICAgICAgICAgICAgZGlzcGxheU5hbWUsXG4gICAgICAgICAgICB0eXBlLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgcmFua3MsXG4gICAgICAgICAgZ2V0QmxvY2tJbXBvcnRzKG5vZGUucGFyZW50KSxcbiAgICAgICAgICBwYXRoR3JvdXBzRXhjbHVkZWRJbXBvcnRUeXBlcyxcbiAgICAgICAgICBpc1NvcnRpbmdUeXBlc0dyb3VwLFxuICAgICAgICApO1xuICAgICAgfSxcbiAgICAgIENhbGxFeHByZXNzaW9uKG5vZGUpIHtcbiAgICAgICAgaWYgKCFpc1N0YXRpY1JlcXVpcmUobm9kZSkpIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgYmxvY2sgPSBnZXRSZXF1aXJlQmxvY2sobm9kZSk7XG4gICAgICAgIGlmICghYmxvY2spIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgbmFtZSA9IG5vZGUuYXJndW1lbnRzWzBdLnZhbHVlO1xuICAgICAgICByZWdpc3Rlck5vZGUoXG4gICAgICAgICAgY29udGV4dCxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgdmFsdWU6IG5hbWUsXG4gICAgICAgICAgICBkaXNwbGF5TmFtZTogbmFtZSxcbiAgICAgICAgICAgIHR5cGU6ICdyZXF1aXJlJyxcbiAgICAgICAgICB9LFxuICAgICAgICAgIHJhbmtzLFxuICAgICAgICAgIGdldEJsb2NrSW1wb3J0cyhibG9jayksXG4gICAgICAgICAgcGF0aEdyb3Vwc0V4Y2x1ZGVkSW1wb3J0VHlwZXMsXG4gICAgICAgICAgaXNTb3J0aW5nVHlwZXNHcm91cCxcbiAgICAgICAgKTtcbiAgICAgIH0sXG4gICAgICAuLi5uYW1lZC5yZXF1aXJlICYmIHtcbiAgICAgICAgVmFyaWFibGVEZWNsYXJhdG9yKG5vZGUpIHtcbiAgICAgICAgICBpZiAobm9kZS5pZC50eXBlID09PSAnT2JqZWN0UGF0dGVybicgJiYgaXNSZXF1aXJlRXhwcmVzc2lvbihub2RlLmluaXQpKSB7XG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG5vZGUuaWQucHJvcGVydGllcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAgICAgbm9kZS5pZC5wcm9wZXJ0aWVzW2ldLmtleS50eXBlICE9PSAnSWRlbnRpZmllcidcbiAgICAgICAgICAgICAgICB8fCBub2RlLmlkLnByb3BlcnRpZXNbaV0udmFsdWUudHlwZSAhPT0gJ0lkZW50aWZpZXInXG4gICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbWFrZU5hbWVkT3JkZXJSZXBvcnQoXG4gICAgICAgICAgICAgIGNvbnRleHQsXG4gICAgICAgICAgICAgIG5vZGUuaWQucHJvcGVydGllcy5tYXAoKHByb3ApID0+ICh7XG4gICAgICAgICAgICAgICAgbm9kZTogcHJvcCxcbiAgICAgICAgICAgICAgICB2YWx1ZTogcHJvcC5rZXkubmFtZSxcbiAgICAgICAgICAgICAgICB0eXBlOiAncmVxdWlyZScsXG4gICAgICAgICAgICAgICAgLi4ucHJvcC5rZXkucmFuZ2VbMF0gIT09IHByb3AudmFsdWUucmFuZ2VbMF0gJiYge1xuICAgICAgICAgICAgICAgICAgYWxpYXM6IHByb3AudmFsdWUubmFtZSxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICB9KSksXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgICAuLi5uYW1lZC5leHBvcnQgJiYge1xuICAgICAgICBFeHBvcnROYW1lZERlY2xhcmF0aW9uKG5vZGUpIHtcbiAgICAgICAgICBtYWtlTmFtZWRPcmRlclJlcG9ydChcbiAgICAgICAgICAgIGNvbnRleHQsXG4gICAgICAgICAgICBub2RlLnNwZWNpZmllcnMubWFwKChzcGVjaWZpZXIpID0+ICh7XG4gICAgICAgICAgICAgIG5vZGU6IHNwZWNpZmllcixcbiAgICAgICAgICAgICAgdmFsdWU6IHNwZWNpZmllci5sb2NhbC5uYW1lLFxuICAgICAgICAgICAgICB0eXBlOiAnZXhwb3J0JyxcbiAgICAgICAgICAgICAga2luZDogc3BlY2lmaWVyLmV4cG9ydEtpbmQsXG4gICAgICAgICAgICAgIC4uLnNwZWNpZmllci5sb2NhbC5yYW5nZVswXSAhPT0gc3BlY2lmaWVyLmV4cG9ydGVkLnJhbmdlWzBdICYmIHtcbiAgICAgICAgICAgICAgICBhbGlhczogc3BlY2lmaWVyLmV4cG9ydGVkLm5hbWUsXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9KSksXG4gICAgICAgICAgKTtcbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgICAuLi5uYW1lZC5janNFeHBvcnRzICYmIHtcbiAgICAgICAgQXNzaWdubWVudEV4cHJlc3Npb24obm9kZSkge1xuICAgICAgICAgIGlmIChub2RlLnBhcmVudC50eXBlID09PSAnRXhwcmVzc2lvblN0YXRlbWVudCcpIHtcbiAgICAgICAgICAgIGlmIChpc0NKU0V4cG9ydHMoY29udGV4dCwgbm9kZS5sZWZ0KSkge1xuICAgICAgICAgICAgICBpZiAobm9kZS5yaWdodC50eXBlID09PSAnT2JqZWN0RXhwcmVzc2lvbicpIHtcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG5vZGUucmlnaHQucHJvcGVydGllcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgICAgICAhbm9kZS5yaWdodC5wcm9wZXJ0aWVzW2ldLmtleVxuICAgICAgICAgICAgICAgICAgICB8fCBub2RlLnJpZ2h0LnByb3BlcnRpZXNbaV0ua2V5LnR5cGUgIT09ICdJZGVudGlmaWVyJ1xuICAgICAgICAgICAgICAgICAgICB8fCAhbm9kZS5yaWdodC5wcm9wZXJ0aWVzW2ldLnZhbHVlXG4gICAgICAgICAgICAgICAgICAgIHx8IG5vZGUucmlnaHQucHJvcGVydGllc1tpXS52YWx1ZS50eXBlICE9PSAnSWRlbnRpZmllcidcbiAgICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgbWFrZU5hbWVkT3JkZXJSZXBvcnQoXG4gICAgICAgICAgICAgICAgICBjb250ZXh0LFxuICAgICAgICAgICAgICAgICAgbm9kZS5yaWdodC5wcm9wZXJ0aWVzLm1hcCgocHJvcCkgPT4gKHtcbiAgICAgICAgICAgICAgICAgICAgbm9kZTogcHJvcCxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHByb3Aua2V5Lm5hbWUsXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6ICdleHBvcnQnLFxuICAgICAgICAgICAgICAgICAgICAuLi5wcm9wLmtleS5yYW5nZVswXSAhPT0gcHJvcC52YWx1ZS5yYW5nZVswXSAmJiB7XG4gICAgICAgICAgICAgICAgICAgICAgYWxpYXM6IHByb3AudmFsdWUubmFtZSxcbiAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgIH0pKSxcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBjb25zdCBuYW1lUGFydHMgPSBnZXROYW1lZENKU0V4cG9ydHMoY29udGV4dCwgbm9kZS5sZWZ0KTtcbiAgICAgICAgICAgICAgaWYgKG5hbWVQYXJ0cyAmJiBuYW1lUGFydHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIGNvbnN0IG5hbWUgPSBuYW1lUGFydHMuam9pbignLicpO1xuICAgICAgICAgICAgICAgIGdldEJsb2NrRXhwb3J0cyhub2RlLnBhcmVudC5wYXJlbnQpLnB1c2goe1xuICAgICAgICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiBuYW1lLFxuICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6IG5hbWUsXG4gICAgICAgICAgICAgICAgICB0eXBlOiAnZXhwb3J0JyxcbiAgICAgICAgICAgICAgICAgIHJhbms6IDAsXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICB9LFxuICAgICAgJ1Byb2dyYW06ZXhpdCcoKSB7XG4gICAgICAgIGltcG9ydE1hcC5mb3JFYWNoKChpbXBvcnRlZCkgPT4ge1xuICAgICAgICAgIGlmIChuZXdsaW5lc0JldHdlZW5JbXBvcnRzICE9PSAnaWdub3JlJyB8fCBuZXdsaW5lc0JldHdlZW5UeXBlT25seUltcG9ydHMgIT09ICdpZ25vcmUnKSB7XG4gICAgICAgICAgICBtYWtlTmV3bGluZXNCZXR3ZWVuUmVwb3J0KFxuICAgICAgICAgICAgICBjb250ZXh0LFxuICAgICAgICAgICAgICBpbXBvcnRlZCxcbiAgICAgICAgICAgICAgbmV3bGluZXNCZXR3ZWVuSW1wb3J0cyxcbiAgICAgICAgICAgICAgbmV3bGluZXNCZXR3ZWVuVHlwZU9ubHlJbXBvcnRzLFxuICAgICAgICAgICAgICBkaXN0aW5jdEdyb3VwLFxuICAgICAgICAgICAgICBpc1NvcnRpbmdUeXBlc0dyb3VwLFxuICAgICAgICAgICAgICBjb25zb2xpZGF0ZUlzbGFuZHMgPT09ICdpbnNpZGUtZ3JvdXBzJ1xuICAgICAgICAgICAgICAgICYmIChuZXdsaW5lc0JldHdlZW5JbXBvcnRzID09PSAnYWx3YXlzLWFuZC1pbnNpZGUtZ3JvdXBzJ1xuICAgICAgICAgICAgICAgICAgfHwgbmV3bGluZXNCZXR3ZWVuVHlwZU9ubHlJbXBvcnRzID09PSAnYWx3YXlzLWFuZC1pbnNpZGUtZ3JvdXBzJyksXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChhbHBoYWJldGl6ZS5vcmRlciAhPT0gJ2lnbm9yZScpIHtcbiAgICAgICAgICAgIG11dGF0ZVJhbmtzVG9BbHBoYWJldGl6ZShpbXBvcnRlZCwgYWxwaGFiZXRpemUpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIG1ha2VPdXRPZk9yZGVyUmVwb3J0KGNvbnRleHQsIGltcG9ydGVkLCBjYXRlZ29yaWVzLmltcG9ydCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGV4cG9ydE1hcC5mb3JFYWNoKChleHBvcnRlZCkgPT4ge1xuICAgICAgICAgIGlmIChhbHBoYWJldGl6ZS5vcmRlciAhPT0gJ2lnbm9yZScpIHtcbiAgICAgICAgICAgIG11dGF0ZVJhbmtzVG9BbHBoYWJldGl6ZShleHBvcnRlZCwgYWxwaGFiZXRpemUpO1xuICAgICAgICAgICAgbWFrZU91dE9mT3JkZXJSZXBvcnQoY29udGV4dCwgZXhwb3J0ZWQsIGNhdGVnb3JpZXMuZXhwb3J0cyk7XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBpbXBvcnRNYXAuY2xlYXIoKTtcbiAgICAgICAgZXhwb3J0TWFwLmNsZWFyKCk7XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js new file mode 100644 index 0000000000000000000000000000000000000000..a4d827977a55893bda8c501c1e5cd3925f05986a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js @@ -0,0 +1,116 @@ +'use strict'; + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +var SINGLE_EXPORT_ERROR_MESSAGE = 'Prefer default export on a file with single export.'; +var ANY_EXPORT_ERROR_MESSAGE = 'Prefer default export to be present on every file that has export.'; + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Style guide', + description: 'Prefer a default export if module exports a single name or multiple names.', + url: (0, _docsUrl2['default'])('prefer-default-export') }, + + schema: [{ + type: 'object', + properties: { + target: { + type: 'string', + 'enum': ['single', 'any'], + 'default': 'single' } }, + + + additionalProperties: false }] }, + + + + create: function () {function create(context) { + var specifierExportCount = 0; + var hasDefaultExport = false; + var hasStarExport = false; + var hasTypeExport = false; + var namedExportNode = null; + // get options. by default we look into files with single export + var _ref = context.options[0] || {},_ref$target = _ref.target,target = _ref$target === undefined ? 'single' : _ref$target; + function captureDeclaration(identifierOrPattern) { + if (identifierOrPattern && identifierOrPattern.type === 'ObjectPattern') { + // recursively capture + identifierOrPattern.properties. + forEach(function (property) { + captureDeclaration(property.value); + }); + } else if (identifierOrPattern && identifierOrPattern.type === 'ArrayPattern') { + identifierOrPattern.elements. + forEach(captureDeclaration); + } else { + // assume it's a single standard identifier + specifierExportCount++; + } + } + + return { + ExportDefaultSpecifier: function () {function ExportDefaultSpecifier() { + hasDefaultExport = true; + }return ExportDefaultSpecifier;}(), + + ExportSpecifier: function () {function ExportSpecifier(node) { + if ((node.exported.name || node.exported.value) === 'default') { + hasDefaultExport = true; + } else { + specifierExportCount++; + namedExportNode = node; + } + }return ExportSpecifier;}(), + + ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { + // if there are specifiers, node.declaration should be null + if (!node.declaration) {return;}var + + type = node.declaration.type; + + if ( + type === 'TSTypeAliasDeclaration' || + type === 'TypeAlias' || + type === 'TSInterfaceDeclaration' || + type === 'InterfaceDeclaration') + { + specifierExportCount++; + hasTypeExport = true; + return; + } + + if (node.declaration.declarations) { + node.declaration.declarations.forEach(function (declaration) { + captureDeclaration(declaration.id); + }); + } else { + // captures 'export function foo() {}' syntax + specifierExportCount++; + } + + namedExportNode = node; + }return ExportNamedDeclaration;}(), + + ExportDefaultDeclaration: function () {function ExportDefaultDeclaration() { + hasDefaultExport = true; + }return ExportDefaultDeclaration;}(), + + ExportAllDeclaration: function () {function ExportAllDeclaration() { + hasStarExport = true; + }return ExportAllDeclaration;}(), + + 'Program:exit': function () {function ProgramExit() { + if (hasDefaultExport || hasStarExport || hasTypeExport) { + return; + } + if (target === 'single' && specifierExportCount === 1) { + context.report(namedExportNode, SINGLE_EXPORT_ERROR_MESSAGE); + } else if (target === 'any' && specifierExportCount > 0) { + context.report(namedExportNode, ANY_EXPORT_ERROR_MESSAGE); + } + }return ProgramExit;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9wcmVmZXItZGVmYXVsdC1leHBvcnQuanMiXSwibmFtZXMiOlsiU0lOR0xFX0VYUE9SVF9FUlJPUl9NRVNTQUdFIiwiQU5ZX0VYUE9SVF9FUlJPUl9NRVNTQUdFIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJzY2hlbWEiLCJwcm9wZXJ0aWVzIiwidGFyZ2V0IiwiYWRkaXRpb25hbFByb3BlcnRpZXMiLCJjcmVhdGUiLCJjb250ZXh0Iiwic3BlY2lmaWVyRXhwb3J0Q291bnQiLCJoYXNEZWZhdWx0RXhwb3J0IiwiaGFzU3RhckV4cG9ydCIsImhhc1R5cGVFeHBvcnQiLCJuYW1lZEV4cG9ydE5vZGUiLCJvcHRpb25zIiwiY2FwdHVyZURlY2xhcmF0aW9uIiwiaWRlbnRpZmllck9yUGF0dGVybiIsImZvckVhY2giLCJwcm9wZXJ0eSIsInZhbHVlIiwiZWxlbWVudHMiLCJFeHBvcnREZWZhdWx0U3B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tcbiAgICAgICAgICBjb250ZXh0LnJlcG9ydChuYW1lZEV4cG9ydE5vZGUsIEFOWV9FWFBPUlRfRVJST1JfTUVTU0FHRSk7XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/unambiguous.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/unambiguous.js new file mode 100644 index 0000000000000000000000000000000000000000..314a2e57069d4c2b3cdc240b036d20aadaa3032f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/rules/unambiguous.js @@ -0,0 +1,42 @@ +'use strict'; + + + + +var _unambiguous = require('eslint-module-utils/unambiguous'); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl); +var _sourceType = require('../core/sourceType');var _sourceType2 = _interopRequireDefault(_sourceType);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + category: 'Module systems', + description: 'Forbid potentially ambiguous parse goal (`script` vs. `module`).', + url: (0, _docsUrl2['default'])('unambiguous') }, + + schema: [] }, + + + create: function () {function create(context) { + // ignore non-modules + if ((0, _sourceType2['default'])(context) !== 'module') { + return {}; + } + + return { + Program: function () {function Program(ast) { + if (!(0, _unambiguous.isModule)(ast)) { + context.report({ + node: ast, + message: 'This module could be parsed as a valid script.' }); + + } + }return Program;}() }; + + + }return create;}() }; /** + * @fileOverview Report modules that could parse incorrectly as scripts. + * @author Ben Mosher + */ +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy91bmFtYmlndW91cy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwiY2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bmltcG9ydCBkb2NzVXJsIGZyb20gJy4uL2RvY3NVcmwnO1xuaW1wb3J0IHNvdXJjZVR5cGUgZnJvbSAnLi4vY29yZS9zb3VyY2VUeXBlJztcblxubW9kdWxlLmV4cG9ydHMgPSB7XG4gIG1ldGE6IHtcbiAgICB0eXBlOiAnc3VnZ2VzdGlvbicsXG4gICAgZG9jczoge1xuICAgICAgY2F0ZWdvcnk6ICdNb2R1bGUgc3lzdGVtcycsXG4gICAgICBkZXNjcmlwdGlvbjogJ0ZvcmJpZCBwb3RlbnRpYWxseSBhbWJpZ3VvdXMgcGFyc2UgZ29hbCAoYHNjcmlwdGAgdnMuIGBtb2R1bGVgKS4nLFxuICAgICAgdXJsOiBkb2NzVXJsKCd1bmFtYmlndW91cycpLFxuICAgIH0sXG4gICAgc2NoZW1hOiBbXSxcbiAgfSxcblxuICBjcmVhdGUoY29udGV4dCkge1xuICAgIC8vIGlnbm9yZSBub24tbW9kdWxlc1xuICAgIGlmIChzb3VyY2VUeXBlKGNvbnRleHQpICE9PSAnbW9kdWxlJykge1xuICAgICAgcmV0dXJuIHt9O1xuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBQcm9ncmFtKGFzdCkge1xuICAgICAgICBpZiAoIWlzTW9kdWxlKGFzdCkpIHtcbiAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgICBub2RlOiBhc3QsXG4gICAgICAgICAgICBtZXNzYWdlOiAnVGhpcyBtb2R1bGUgY291bGQgYmUgcGFyc2VkIGFzIGEgdmFsaWQgc2NyaXB0LicsXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfTtcblxuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/scc.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/scc.js new file mode 100644 index 0000000000000000000000000000000000000000..3451d1bd3c288e261ba3c6c1e531648967d1e916 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/lib/scc.js @@ -0,0 +1,92 @@ +'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();var _scc = require('@rtsao/scc');var _scc2 = _interopRequireDefault(_scc); +var _hash = require('eslint-module-utils/hash'); +var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve); +var _builder = require('./exportMap/builder');var _builder2 = _interopRequireDefault(_builder); +var _childContext = require('./exportMap/childContext');var _childContext2 = _interopRequireDefault(_childContext);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _toConsumableArray(arr) {if (Array.isArray(arr)) {for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {arr2[i] = arr[i];}return arr2;} else {return Array.from(arr);}}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} + +var cache = new Map();var + +StronglyConnectedComponentsBuilder = function () {function StronglyConnectedComponentsBuilder() {_classCallCheck(this, StronglyConnectedComponentsBuilder);}_createClass(StronglyConnectedComponentsBuilder, null, [{ key: 'clearCache', value: function () {function clearCache() + { + cache = new Map(); + }return clearCache;}() }, { key: 'get', value: function () {function get( + + source, context) { + var path = (0, _resolve2['default'])(source, context); + if (path == null) {return null;} + return StronglyConnectedComponentsBuilder['for']((0, _childContext2['default'])(path, context)); + }return get;}() }, { key: 'for', value: function () {function _for( + + context) { + var settingsHash = (0, _hash.hashObject)({ + settings: context.settings, + parserOptions: context.parserOptions, + parserPath: context.parserPath }). + digest('hex'); + var cacheKey = context.path + settingsHash; + if (cache.has(cacheKey)) { + return cache.get(cacheKey); + } + var scc = StronglyConnectedComponentsBuilder.calculate(context); + var visitedFiles = Object.keys(scc); + visitedFiles.forEach(function (filePath) {return cache.set(filePath + settingsHash, scc);}); + return scc; + }return _for;}() }, { key: 'calculate', value: function () {function calculate( + + context) { + var exportMap = _builder2['default']['for'](context); + var adjacencyList = this.exportMapToAdjacencyList(exportMap); + var calculatedScc = (0, _scc2['default'])(adjacencyList); + return StronglyConnectedComponentsBuilder.calculatedSccToPlainObject(calculatedScc); + }return calculate;}() + + /** @returns {Map>} for each dep, what are its direct deps */ }, { key: 'exportMapToAdjacencyList', value: function () {function exportMapToAdjacencyList( + initialExportMap) { + var adjacencyList = new Map(); + // BFS + function visitNode(exportMap) { + if (!exportMap) { + return; + } + exportMap.imports.forEach(function (v, importedPath) { + var from = exportMap.path; + var to = importedPath; + + // Ignore type-only imports, because we care only about SCCs of value imports + var toTraverse = [].concat(_toConsumableArray(v.declarations)).filter(function (_ref) {var isOnlyImportingTypes = _ref.isOnlyImportingTypes;return !isOnlyImportingTypes;}); + if (toTraverse.length === 0) {return;} + + if (!adjacencyList.has(from)) { + adjacencyList.set(from, new Set()); + } + + if (adjacencyList.get(from).has(to)) { + return; // prevent endless loop + } + adjacencyList.get(from).add(to); + visitNode(v.getter()); + }); + } + visitNode(initialExportMap); + // Fill gaps + adjacencyList.forEach(function (values) { + values.forEach(function (value) { + if (!adjacencyList.has(value)) { + adjacencyList.set(value, new Set()); + } + }); + }); + return adjacencyList; + }return exportMapToAdjacencyList;}() + + /** @returns {Record} for each key, its SCC's index */ }, { key: 'calculatedSccToPlainObject', value: function () {function calculatedSccToPlainObject( + sccs) { + var obj = {}; + sccs.forEach(function (scc, index) { + scc.forEach(function (node) { + obj[node] = index; + }); + }); + return obj; + }return calculatedSccToPlainObject;}() }]);return StronglyConnectedComponentsBuilder;}();exports['default'] = StronglyConnectedComponentsBuilder; +//# sourceMappingURL=data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G4gIH1cblxuICAvKiogQHJldHVybnMge1JlY29yZDxzdHJpbmcsIG51bWJlcj59IGZvciBlYWNoIGtleSwgaXRzIFNDQydzIGluZGV4ICovXG4gIHN0YXRpYyBjYWxjdWxhdGVkU2NjVG9QbGFpbk9iamVjdChzY2NzKSB7XG4gICAgY29uc3Qgb2JqID0ge307XG4gICAgc2Njcy5mb3JFYWNoKChzY2MsIGluZGV4KSA9PiB7XG4gICAgICBzY2MuZm9yRWFjaCgobm9kZSkgPT4ge1xuICAgICAgICBvYmpbbm9kZV0gPSBpbmRleDtcbiAgICAgIH0pO1xuICAgIH0pO1xuICAgIHJldHVybiBvYmo7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/memo-parser/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/memo-parser/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..c6ade2a433a2d64efb01cb1289b895357dd03cf9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/memo-parser/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Ben Mosher + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/memo-parser/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/memo-parser/README.md new file mode 100644 index 0000000000000000000000000000000000000000..741e0ed4d0a9c39d3842f82c42e4a7bc71402354 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/memo-parser/README.md @@ -0,0 +1,21 @@ +# eslint-plugin-import/memo-parser + +## NOTE + +This used to improve performance, but as of ESLint 5 and v2 of this plugin, it seems to just consume a bunch of memory and slightly increase lint times. + +**Not recommended for use at this time!** + +This parser is just a memoizing wrapper around some actual parser. + +To configure, just add your _actual_ parser to the `parserOptions`, like so: + +```yaml +parser: eslint-plugin-import/memo-parser +# parser: babel-eslint + +parserOptions: + parser: babel-eslint + sourceType: module + ecmaVersion: 6 +``` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/memo-parser/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/memo-parser/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7868b7e9530bd42662e2722695e78aed674830b9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/memo-parser/index.js @@ -0,0 +1,41 @@ +'use strict'; + +const crypto = require('crypto'); +const moduleRequire = require('eslint-module-utils/module-require').default; +const hashObject = require('eslint-module-utils/hash').hashObject; + +const cache = new Map(); + +// must match ESLint default options or we'll miss the cache every time +const parserOptions = { + loc: true, + range: true, + raw: true, + tokens: true, + comment: true, + attachComment: true, +}; + +exports.parse = function parse(content, options) { + options = { ...options, ...parserOptions }; + + if (!options.filePath) { + throw new Error('no file path provided!'); + } + + const keyHash = crypto.createHash('sha256'); + keyHash.update(content); + hashObject(options, keyHash); + + const key = keyHash.digest('hex'); + + let ast = cache.get(key); + if (ast != null) { return ast; } + + const realParser = moduleRequire(options.parser); + + ast = realParser.parse(content, options); + cache.set(key, ast); + + return ast; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/.bin/semver b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/.bin/semver new file mode 100644 index 0000000000000000000000000000000000000000..16e6872b5778b5c43af2cefec45471c090be89b9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/.bin/semver @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3ed56435cbd4b3f07a80c4a343edd86d787f89bf2cee0105bdf68cb653ba2a0 +size 4717 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/CHANGELOG.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..820d21e3322b9d2778786ea743dd5e818991d595 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..658c933d28255e8c716899789e8c0f846e5dc125 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0ee7634ddd0a4a6337fe7677e99ba78cd626fa07 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/README.md @@ -0,0 +1,437 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/node.js new file mode 100644 index 0000000000000000000000000000000000000000..7fc36fe6dbecbfd41530c5a490cc738ec2968653 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/package.json new file mode 100644 index 0000000000000000000000000000000000000000..191c8154787cb9f8662967d4c4f8f9f3467a2bbf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/package.json @@ -0,0 +1,51 @@ +{ + "name": "debug", + "version": "3.2.7", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "node.js", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "author": "TJ Holowaychuk ", + "contributors": [ + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + }, + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "unpkg": "./dist/debug.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/browser.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/browser.js new file mode 100644 index 0000000000000000000000000000000000000000..c924b0ac4d4882e4a72a116436ed17a487c2fc05 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/browser.js @@ -0,0 +1,180 @@ +"use strict"; + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +/** + * Colors. + */ + +exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ +// eslint-disable-next-line complexity + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); +} +/** + * Colorize log arguments if enabled. + * + * @api public + */ + + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); +} +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + +function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); +} +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } +} +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + +function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); +var formatters = module.exports.formatters; +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/common.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/common.js new file mode 100644 index 0000000000000000000000000000000000000000..e0de3fb530f1c2ea33c4c65bcfd39b98a53600d7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/common.js @@ -0,0 +1,249 @@ +"use strict"; + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + // Disabled? + if (!debug.enabled) { + return; + } + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @api public + */ + + + function disable() { + createDebug.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; +} + +module.exports = setup; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..021731593ac517b224bddda8c450bac52889843a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/index.js @@ -0,0 +1,12 @@ +"use strict"; + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/node.js new file mode 100644 index 0000000000000000000000000000000000000000..1e6a5f16aecdd38a2bfb607f3d82e299f7624f9a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/debug/src/node.js @@ -0,0 +1,177 @@ +"use strict"; + +/** + * Module dependencies. + */ +var tty = require('tty'); + +var util = require('util'); +/** + * This is the Node.js implementation of `debug()`. + */ + + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + var supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221]; + } +} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be. + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // Camel-case + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) { + return k.toUpperCase(); + }); // Coerce string value into JS value + + var val = process.env[key]; + + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); +} +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + + +function formatArgs(args) { + var name = this.namespace, + useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c); + var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m"); + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m"); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + + return new Date().toISOString() + ' '; +} +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + + +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + +function load() { + return process.env.DEBUG; +} +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + + +function init(debug) { + debug.inspectOpts = {}; + var keys = Object.keys(exports.inspectOpts); + + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); +var formatters = module.exports.formatters; +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(function (str) { return str.trim(); }) + .join(' '); +}; +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..57140d0fbda7d4eba4e217cf56ea46b495796524 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md @@ -0,0 +1,94 @@ +v2.1.0 - January 6, 2018 + +* 827f314 Update: support node ranges (fixes #89) (#190) (Teddy Katz) + +v2.0.2 - November 25, 2017 + +* 5049ee3 Fix: Remove redundant LICENSE/README names from files (#203) (Kevin Partington) + +v2.0.1 - November 10, 2017 + +* 009f33d Fix: Making sure union type stringification respects compact flag (#199) (Mitermayer Reis) +* 19da935 Use native String.prototype.trim instead of a custom implementation. (#201) (Rouven Weßling) +* e3a011b chore: add mocha.opts to restore custom mocha config (Jason Kurian) +* d888200 chore: adds nyc and a newer version of mocha to accurately report coverage (Jason Kurian) +* 6b210a8 fix: support type expression for @this tag (fixes #181) (#182) (Frédéric Junod) +* 1c4a4c7 fix: Allow array indexes in names (#193) (Tom MacWright) +* 9aed54d Fix incorrect behavior when arrow functions are used as default values (#189) (Gaurab Paul) +* 9efb6ca Upgrade: Use Array.isArray instead of isarray package (#195) (medanat) + +v2.0.0 - November 15, 2016 + +* 7d7c5f1 Breaking: Re-license to Apache 2 (fixes #176) (#178) (Nicholas C. Zakas) +* 5496132 Docs: Update license copyright (Nicholas C. Zakas) + +v1.5.0 - October 13, 2016 + +* e33c6bb Update: Add support for BooleanLiteralType (#173) (Erik Arvidsson) + +v1.4.0 - September 13, 2016 + +* d7426e5 Update: add ability to parse optional properties in typedefs (refs #5) (#174) (ikokostya) + +v1.3.0 - August 22, 2016 + +* 12c7ad9 Update: Add support for numeric and string literal types (fixes #156) (#172) (Andrew Walter) + +v1.2.3 - August 16, 2016 + +* b96a884 Build: Add CI release script (Nicholas C. Zakas) +* 8d9b3c7 Upgrade: Upgrade esutils to v2.0.2 (fixes #170) (#171) (Emeegeemee) + +v1.2.2 - May 19, 2016 + +* ebe0b08 Fix: Support case insensitive tags (fixes #163) (#164) (alberto) +* 8e6d81e Chore: Remove copyright and license from headers (Nicholas C. Zakas) +* 79035c6 Chore: Include jQuery Foundation copyright (Nicholas C. Zakas) +* 06910a7 Fix: Preserve whitespace in default param string values (fixes #157) (Kai Cataldo) + +v1.2.1 - March 29, 2016 + +* 1f54014 Fix: allow hyphens in names (fixes #116) (Kai Cataldo) +* bbee469 Docs: Add issue template (Nicholas C. Zakas) + +v1.2.0 - February 19, 2016 + +* 18136c5 Build: Cleanup build system (Nicholas C. Zakas) +* b082f85 Update: Add support for slash in namepaths (fixes #100) (Ryan Duffy) +* def53a2 Docs: Fix typo in option lineNumbers (Daniel Tschinder) +* e2cbbc5 Update: Bump isarray to v1.0.0 (Shinnosuke Watanabe) +* ae07aa8 Fix: Allow whitespace in optional param with default value (fixes #141) (chris) + +v1.1.0 - January 6, 2016 + +* Build: Switch to Makefile.js (Nicholas C. Zakas) +* New: support name expression for @this tag (fixes #143) (Tim Schaub) +* Build: Update ESLint settings (Nicholas C. Zakas) + +v1.0.0 - December 21, 2015 + +* New: parse caption tags in examples into separate property. (fixes #131) (Tom MacWright) + +v0.7.2 - November 27, 2015 + +* Fix: Line numbers for some tags (fixes #138) Fixing issue where input was not consumed via advance() but was skipped when parsing tags resulting in sometimes incorrect reported lineNumber. (TEHEK) +* Build: Add missing linefix package (Nicholas C. Zakas) + +v0.7.1 - November 13, 2015 + +* Update: Begin switch to Makefile.js (Nicholas C. Zakas) +* Fix: permit return tag without type (fixes #136) (Tom MacWright) +* Fix: package.json homepage field (Bogdan Chadkin) +* Fix: Parse array default syntax. Fixes #133 (Tom MacWright) +* Fix: Last tag always has \n in the description (fixes #87) (Burak Yigit Kaya) +* Docs: Add changelog (Nicholas C. Zakas) + +v0.7.0 - September 21, 2015 + +* Docs: Update README with new info (fixes #127) (Nicholas C. Zakas) +* Fix: Parsing fix for param with arrays and properties (fixes #111) (Gyandeep Singh) +* Build: Add travis build (fixes #123) (Gyandeep Singh) +* Fix: Parsing of parameter name without a type (fixes #120) (Gyandeep Singh) +* New: added preserveWhitespace option (Aleks Totic) +* New: Add "files" entry to only deploy select files (Rob Loach) +* New: Add support and tests for typedefs. Refs #5 (Tom MacWright) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..3e8ba72f69be5744b50a6347ec62253112c066b8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima new file mode 100644 index 0000000000000000000000000000000000000000..3e580c355a96e5ab8c4fb2ea4ada2d62287de41f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/README.md new file mode 100644 index 0000000000000000000000000000000000000000..26fad18b90d5c8b39864af4e7fd7e54958cd51fe --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/README.md @@ -0,0 +1,165 @@ +[![NPM version][npm-image]][npm-url] +[![build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![Downloads][downloads-image]][downloads-url] +[![Join the chat at https://gitter.im/eslint/doctrine](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/doctrine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +# Doctrine + +Doctrine is a [JSDoc](http://usejsdoc.org) parser that parses documentation comments from JavaScript (you need to pass in the comment, not a whole JavaScript file). + +## Installation + +You can install Doctrine using [npm](https://npmjs.com): + +``` +$ npm install doctrine --save-dev +``` + +Doctrine can also be used in web browsers using [Browserify](http://browserify.org). + +## Usage + +Require doctrine inside of your JavaScript: + +```js +var doctrine = require("doctrine"); +``` + +### parse() + +The primary method is `parse()`, which accepts two arguments: the JSDoc comment to parse and an optional options object. The available options are: + +* `unwrap` - set to `true` to delete the leading `/**`, any `*` that begins a line, and the trailing `*/` from the source text. Default: `false`. +* `tags` - an array of tags to return. When specified, Doctrine returns only tags in this array. For example, if `tags` is `["param"]`, then only `@param` tags will be returned. Default: `null`. +* `recoverable` - set to `true` to keep parsing even when syntax errors occur. Default: `false`. +* `sloppy` - set to `true` to allow optional parameters to be specified in brackets (`@param {string} [foo]`). Default: `false`. +* `lineNumbers` - set to `true` to add `lineNumber` to each node, specifying the line on which the node is found in the source. Default: `false`. +* `range` - set to `true` to add `range` to each node, specifying the start and end index of the node in the original comment. Default: `false`. + +Here's a simple example: + +```js +var ast = doctrine.parse( + [ + "/**", + " * This function comment is parsed by doctrine", + " * @param {{ok:String}} userName", + "*/" + ].join('\n'), { unwrap: true }); +``` + +This example returns the following AST: + + { + "description": "This function comment is parsed by doctrine", + "tags": [ + { + "title": "param", + "description": null, + "type": { + "type": "RecordType", + "fields": [ + { + "type": "FieldType", + "key": "ok", + "value": { + "type": "NameExpression", + "name": "String" + } + } + ] + }, + "name": "userName" + } + ] + } + +See the [demo page](http://eslint.org/doctrine/demo/) more detail. + +## Team + +These folks keep the project moving and are resources for help: + +* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead +* Yusuke Suzuki ([@constellation](https://github.com/constellation)) - reviewer + +## Contributing + +Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/doctrine/issues). + +## Frequently Asked Questions + +### Can I pass a whole JavaScript file to Doctrine? + +No. Doctrine can only parse JSDoc comments, so you'll need to pass just the JSDoc comment to Doctrine in order to work. + + +### License + +#### doctrine + +Copyright JS Foundation and other contributors, https://js.foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +#### esprima + +some of functions is derived from esprima + +Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about) + (twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#### closure-compiler + +some of extensions is derived from closure-compiler + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + + +### Where to ask for help? + +Join our [Chatroom](https://gitter.im/eslint/doctrine) + +[npm-image]: https://img.shields.io/npm/v/doctrine.svg?style=flat-square +[npm-url]: https://www.npmjs.com/package/doctrine +[travis-image]: https://img.shields.io/travis/eslint/doctrine/master.svg?style=flat-square +[travis-url]: https://travis-ci.org/eslint/doctrine +[coveralls-image]: https://img.shields.io/coveralls/eslint/doctrine/master.svg?style=flat-square +[coveralls-url]: https://coveralls.io/r/eslint/doctrine?branch=master +[downloads-image]: http://img.shields.io/npm/dm/doctrine.svg?style=flat-square +[downloads-url]: https://www.npmjs.com/package/doctrine diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js new file mode 100644 index 0000000000000000000000000000000000000000..1665afe9ef3ec1704a2cc6d63a27869116f4992c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js @@ -0,0 +1,899 @@ +/* + * @fileoverview Main Doctrine object + * @author Yusuke Suzuki + * @author Dan Tao + * @author Andrew Eisenberg + */ + +(function () { + 'use strict'; + + var typed, + utility, + jsdoc, + esutils, + hasOwnProperty; + + esutils = require('esutils'); + typed = require('./typed'); + utility = require('./utility'); + + function sliceSource(source, index, last) { + return source.slice(index, last); + } + + hasOwnProperty = (function () { + var func = Object.prototype.hasOwnProperty; + return function hasOwnProperty(obj, name) { + return func.call(obj, name); + }; + }()); + + function shallowCopy(obj) { + var ret = {}, key; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + + function isASCIIAlphanumeric(ch) { + return (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) || + (ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) || + (ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */); + } + + function isParamTitle(title) { + return title === 'param' || title === 'argument' || title === 'arg'; + } + + function isReturnTitle(title) { + return title === 'return' || title === 'returns'; + } + + function isProperty(title) { + return title === 'property' || title === 'prop'; + } + + function isNameParameterRequired(title) { + return isParamTitle(title) || isProperty(title) || + title === 'alias' || title === 'this' || title === 'mixes' || title === 'requires'; + } + + function isAllowedName(title) { + return isNameParameterRequired(title) || title === 'const' || title === 'constant'; + } + + function isAllowedNested(title) { + return isProperty(title) || isParamTitle(title); + } + + function isAllowedOptional(title) { + return isProperty(title) || isParamTitle(title); + } + + function isTypeParameterRequired(title) { + return isParamTitle(title) || isReturnTitle(title) || + title === 'define' || title === 'enum' || + title === 'implements' || title === 'this' || + title === 'type' || title === 'typedef' || isProperty(title); + } + + // Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required + // This would require changes to 'parseType' + function isAllowedType(title) { + return isTypeParameterRequired(title) || title === 'throws' || title === 'const' || title === 'constant' || + title === 'namespace' || title === 'member' || title === 'var' || title === 'module' || + title === 'constructor' || title === 'class' || title === 'extends' || title === 'augments' || + title === 'public' || title === 'private' || title === 'protected'; + } + + // A regex character class that contains all whitespace except linebreak characters (\r, \n, \u2028, \u2029) + var WHITESPACE = '[ \\f\\t\\v\\u00a0\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]'; + + var STAR_MATCHER = '(' + WHITESPACE + '*(?:\\*' + WHITESPACE + '?)?)(.+|[\r\n\u2028\u2029])'; + + function unwrapComment(doc) { + // JSDoc comment is following form + // /** + // * ....... + // */ + + return doc. + // remove /** + replace(/^\/\*\*?/, ''). + // remove */ + replace(/\*\/$/, ''). + // remove ' * ' at the beginning of a line + replace(new RegExp(STAR_MATCHER, 'g'), '$2'). + // remove trailing whitespace + replace(/\s*$/, ''); + } + + /** + * Converts an index in an "unwrapped" JSDoc comment to the corresponding index in the original "wrapped" version + * @param {string} originalSource The original wrapped comment + * @param {number} unwrappedIndex The index of a character in the unwrapped string + * @returns {number} The index of the corresponding character in the original wrapped string + */ + function convertUnwrappedCommentIndex(originalSource, unwrappedIndex) { + var replacedSource = originalSource.replace(/^\/\*\*?/, ''); + var numSkippedChars = 0; + var matcher = new RegExp(STAR_MATCHER, 'g'); + var match; + + while ((match = matcher.exec(replacedSource))) { + numSkippedChars += match[1].length; + + if (match.index + match[0].length > unwrappedIndex + numSkippedChars) { + return unwrappedIndex + numSkippedChars + originalSource.length - replacedSource.length; + } + } + + return originalSource.replace(/\*\/$/, '').replace(/\s*$/, '').length; + } + + // JSDoc Tag Parser + + (function (exports) { + var Rules, + index, + lineNumber, + length, + source, + originalSource, + recoverable, + sloppy, + strict; + + function advance() { + var ch = source.charCodeAt(index); + index += 1; + if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(index) === 0x0A /* '\n' */)) { + lineNumber += 1; + } + return String.fromCharCode(ch); + } + + function scanTitle() { + var title = ''; + // waste '@' + advance(); + + while (index < length && isASCIIAlphanumeric(source.charCodeAt(index))) { + title += advance(); + } + + return title; + } + + function seekContent() { + var ch, waiting, last = index; + + waiting = false; + while (last < length) { + ch = source.charCodeAt(last); + if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(last + 1) === 0x0A /* '\n' */)) { + waiting = true; + } else if (waiting) { + if (ch === 0x40 /* '@' */) { + break; + } + if (!esutils.code.isWhiteSpace(ch)) { + waiting = false; + } + } + last += 1; + } + return last; + } + + // type expression may have nest brace, such as, + // { { ok: string } } + // + // therefore, scanning type expression with balancing braces. + function parseType(title, last, addRange) { + var ch, brace, type, startIndex, direct = false; + + + // search '{' + while (index < last) { + ch = source.charCodeAt(index); + if (esutils.code.isWhiteSpace(ch)) { + advance(); + } else if (ch === 0x7B /* '{' */) { + advance(); + break; + } else { + // this is direct pattern + direct = true; + break; + } + } + + + if (direct) { + return null; + } + + // type expression { is found + brace = 1; + type = ''; + while (index < last) { + ch = source.charCodeAt(index); + if (esutils.code.isLineTerminator(ch)) { + advance(); + } else { + if (ch === 0x7D /* '}' */) { + brace -= 1; + if (brace === 0) { + advance(); + break; + } + } else if (ch === 0x7B /* '{' */) { + brace += 1; + } + if (type === '') { + startIndex = index; + } + type += advance(); + } + } + + if (brace !== 0) { + // braces is not balanced + return utility.throwError('Braces are not balanced'); + } + + if (isAllowedOptional(title)) { + return typed.parseParamType(type, {startIndex: convertIndex(startIndex), range: addRange}); + } + + return typed.parseType(type, {startIndex: convertIndex(startIndex), range: addRange}); + } + + function scanIdentifier(last) { + var identifier; + if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index)) && !source[index].match(/[0-9]/)) { + return null; + } + identifier = advance(); + while (index < last && esutils.code.isIdentifierPartES5(source.charCodeAt(index))) { + identifier += advance(); + } + return identifier; + } + + function skipWhiteSpace(last) { + while (index < last && (esutils.code.isWhiteSpace(source.charCodeAt(index)) || esutils.code.isLineTerminator(source.charCodeAt(index)))) { + advance(); + } + } + + function parseName(last, allowBrackets, allowNestedParams) { + var name = '', + useBrackets, + insideString; + + + skipWhiteSpace(last); + + if (index >= last) { + return null; + } + + if (source.charCodeAt(index) === 0x5B /* '[' */) { + if (allowBrackets) { + useBrackets = true; + name = advance(); + } else { + return null; + } + } + + name += scanIdentifier(last); + + if (allowNestedParams) { + if (source.charCodeAt(index) === 0x3A /* ':' */ && ( + name === 'module' || + name === 'external' || + name === 'event')) { + name += advance(); + name += scanIdentifier(last); + + } + if(source.charCodeAt(index) === 0x5B /* '[' */ && source.charCodeAt(index + 1) === 0x5D /* ']' */){ + name += advance(); + name += advance(); + } + while (source.charCodeAt(index) === 0x2E /* '.' */ || + source.charCodeAt(index) === 0x2F /* '/' */ || + source.charCodeAt(index) === 0x23 /* '#' */ || + source.charCodeAt(index) === 0x2D /* '-' */ || + source.charCodeAt(index) === 0x7E /* '~' */) { + name += advance(); + name += scanIdentifier(last); + } + } + + if (useBrackets) { + skipWhiteSpace(last); + // do we have a default value for this? + if (source.charCodeAt(index) === 0x3D /* '=' */) { + // consume the '='' symbol + name += advance(); + skipWhiteSpace(last); + + var ch; + var bracketDepth = 1; + + // scan in the default value + while (index < last) { + ch = source.charCodeAt(index); + + if (esutils.code.isWhiteSpace(ch)) { + if (!insideString) { + skipWhiteSpace(last); + ch = source.charCodeAt(index); + } + } + + if (ch === 0x27 /* ''' */) { + if (!insideString) { + insideString = '\''; + } else { + if (insideString === '\'') { + insideString = ''; + } + } + } + + if (ch === 0x22 /* '"' */) { + if (!insideString) { + insideString = '"'; + } else { + if (insideString === '"') { + insideString = ''; + } + } + } + + if (ch === 0x5B /* '[' */) { + bracketDepth++; + } else if (ch === 0x5D /* ']' */ && + --bracketDepth === 0) { + break; + } + + name += advance(); + } + } + + skipWhiteSpace(last); + + if (index >= last || source.charCodeAt(index) !== 0x5D /* ']' */) { + // we never found a closing ']' + return null; + } + + // collect the last ']' + name += advance(); + } + + return name; + } + + function skipToTag() { + while (index < length && source.charCodeAt(index) !== 0x40 /* '@' */) { + advance(); + } + if (index >= length) { + return false; + } + utility.assert(source.charCodeAt(index) === 0x40 /* '@' */); + return true; + } + + function convertIndex(rangeIndex) { + if (source === originalSource) { + return rangeIndex; + } + return convertUnwrappedCommentIndex(originalSource, rangeIndex); + } + + function TagParser(options, title) { + this._options = options; + this._title = title.toLowerCase(); + this._tag = { + title: title, + description: null + }; + if (this._options.lineNumbers) { + this._tag.lineNumber = lineNumber; + } + this._first = index - title.length - 1; + this._last = 0; + // space to save special information for title parsers. + this._extra = { }; + } + + // addError(err, ...) + TagParser.prototype.addError = function addError(errorText) { + var args = Array.prototype.slice.call(arguments, 1), + msg = errorText.replace( + /%(\d)/g, + function (whole, index) { + utility.assert(index < args.length, 'Message reference must be in range'); + return args[index]; + } + ); + + if (!this._tag.errors) { + this._tag.errors = []; + } + if (strict) { + utility.throwError(msg); + } + this._tag.errors.push(msg); + return recoverable; + }; + + TagParser.prototype.parseType = function () { + // type required titles + if (isTypeParameterRequired(this._title)) { + try { + this._tag.type = parseType(this._title, this._last, this._options.range); + if (!this._tag.type) { + if (!isParamTitle(this._title) && !isReturnTitle(this._title)) { + if (!this.addError('Missing or invalid tag type')) { + return false; + } + } + } + } catch (error) { + this._tag.type = null; + if (!this.addError(error.message)) { + return false; + } + } + } else if (isAllowedType(this._title)) { + // optional types + try { + this._tag.type = parseType(this._title, this._last, this._options.range); + } catch (e) { + //For optional types, lets drop the thrown error when we hit the end of the file + } + } + return true; + }; + + TagParser.prototype._parseNamePath = function (optional) { + var name; + name = parseName(this._last, sloppy && isAllowedOptional(this._title), true); + if (!name) { + if (!optional) { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } + this._tag.name = name; + return true; + }; + + TagParser.prototype.parseNamePath = function () { + return this._parseNamePath(false); + }; + + TagParser.prototype.parseNamePathOptional = function () { + return this._parseNamePath(true); + }; + + + TagParser.prototype.parseName = function () { + var assign, name; + + // param, property requires name + if (isAllowedName(this._title)) { + this._tag.name = parseName(this._last, sloppy && isAllowedOptional(this._title), isAllowedNested(this._title)); + if (!this._tag.name) { + if (!isNameParameterRequired(this._title)) { + return true; + } + + // it's possible the name has already been parsed but interpreted as a type + // it's also possible this is a sloppy declaration, in which case it will be + // fixed at the end + if (isParamTitle(this._title) && this._tag.type && this._tag.type.name) { + this._extra.name = this._tag.type; + this._tag.name = this._tag.type.name; + this._tag.type = null; + } else { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } else { + name = this._tag.name; + if (name.charAt(0) === '[' && name.charAt(name.length - 1) === ']') { + // extract the default value if there is one + // example: @param {string} [somebody=John Doe] description + assign = name.substring(1, name.length - 1).split('='); + if (assign.length > 1) { + this._tag['default'] = assign.slice(1).join('='); + } + this._tag.name = assign[0]; + + // convert to an optional type + if (this._tag.type && this._tag.type.type !== 'OptionalType') { + this._tag.type = { + type: 'OptionalType', + expression: this._tag.type + }; + } + } + } + } + + + return true; + }; + + TagParser.prototype.parseDescription = function parseDescription() { + var description = sliceSource(source, index, this._last).trim(); + if (description) { + if ((/^-\s+/).test(description)) { + description = description.substring(2); + } + this._tag.description = description; + } + return true; + }; + + TagParser.prototype.parseCaption = function parseDescription() { + var description = sliceSource(source, index, this._last).trim(); + var captionStartTag = ''; + var captionEndTag = ''; + var captionStart = description.indexOf(captionStartTag); + var captionEnd = description.indexOf(captionEndTag); + if (captionStart >= 0 && captionEnd >= 0) { + this._tag.caption = description.substring( + captionStart + captionStartTag.length, captionEnd).trim(); + this._tag.description = description.substring(captionEnd + captionEndTag.length).trim(); + } else { + this._tag.description = description; + } + return true; + }; + + TagParser.prototype.parseKind = function parseKind() { + var kind, kinds; + kinds = { + 'class': true, + 'constant': true, + 'event': true, + 'external': true, + 'file': true, + 'function': true, + 'member': true, + 'mixin': true, + 'module': true, + 'namespace': true, + 'typedef': true + }; + kind = sliceSource(source, index, this._last).trim(); + this._tag.kind = kind; + if (!hasOwnProperty(kinds, kind)) { + if (!this.addError('Invalid kind name \'%0\'', kind)) { + return false; + } + } + return true; + }; + + TagParser.prototype.parseAccess = function parseAccess() { + var access; + access = sliceSource(source, index, this._last).trim(); + this._tag.access = access; + if (access !== 'private' && access !== 'protected' && access !== 'public') { + if (!this.addError('Invalid access name \'%0\'', access)) { + return false; + } + } + return true; + }; + + TagParser.prototype.parseThis = function parseThis() { + // this name may be a name expression (e.g. {foo.bar}), + // an union (e.g. {foo.bar|foo.baz}) or a name path (e.g. foo.bar) + var value = sliceSource(source, index, this._last).trim(); + if (value && value.charAt(0) === '{') { + var gotType = this.parseType(); + if (gotType && this._tag.type.type === 'NameExpression' || this._tag.type.type === 'UnionType') { + this._tag.name = this._tag.type.name; + return true; + } else { + return this.addError('Invalid name for this'); + } + } else { + return this.parseNamePath(); + } + }; + + TagParser.prototype.parseVariation = function parseVariation() { + var variation, text; + text = sliceSource(source, index, this._last).trim(); + variation = parseFloat(text, 10); + this._tag.variation = variation; + if (isNaN(variation)) { + if (!this.addError('Invalid variation \'%0\'', text)) { + return false; + } + } + return true; + }; + + TagParser.prototype.ensureEnd = function () { + var shouldBeEmpty = sliceSource(source, index, this._last).trim(); + if (shouldBeEmpty) { + if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) { + return false; + } + } + return true; + }; + + TagParser.prototype.epilogue = function epilogue() { + var description; + + description = this._tag.description; + // un-fix potentially sloppy declaration + if (isAllowedOptional(this._title) && !this._tag.type && description && description.charAt(0) === '[') { + this._tag.type = this._extra.name; + if (!this._tag.name) { + this._tag.name = undefined; + } + + if (!sloppy) { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } + + return true; + }; + + Rules = { + // http://usejsdoc.org/tags-access.html + 'access': ['parseAccess'], + // http://usejsdoc.org/tags-alias.html + 'alias': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-augments.html + 'augments': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-constructor.html + 'constructor': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-constructor.html + 'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-extends.html + 'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-example.html + 'example': ['parseCaption'], + // http://usejsdoc.org/tags-deprecated.html + 'deprecated': ['parseDescription'], + // http://usejsdoc.org/tags-global.html + 'global': ['ensureEnd'], + // http://usejsdoc.org/tags-inner.html + 'inner': ['ensureEnd'], + // http://usejsdoc.org/tags-instance.html + 'instance': ['ensureEnd'], + // http://usejsdoc.org/tags-kind.html + 'kind': ['parseKind'], + // http://usejsdoc.org/tags-mixes.html + 'mixes': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-mixin.html + 'mixin': ['parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-member.html + 'member': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-method.html + 'method': ['parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-module.html + 'module': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-method.html + 'func': ['parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-method.html + 'function': ['parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-member.html + 'var': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-name.html + 'name': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-namespace.html + 'namespace': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-private.html + 'private': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-protected.html + 'protected': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-public.html + 'public': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-readonly.html + 'readonly': ['ensureEnd'], + // http://usejsdoc.org/tags-requires.html + 'requires': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-since.html + 'since': ['parseDescription'], + // http://usejsdoc.org/tags-static.html + 'static': ['ensureEnd'], + // http://usejsdoc.org/tags-summary.html + 'summary': ['parseDescription'], + // http://usejsdoc.org/tags-this.html + 'this': ['parseThis', 'ensureEnd'], + // http://usejsdoc.org/tags-todo.html + 'todo': ['parseDescription'], + // http://usejsdoc.org/tags-typedef.html + 'typedef': ['parseType', 'parseNamePathOptional'], + // http://usejsdoc.org/tags-variation.html + 'variation': ['parseVariation'], + // http://usejsdoc.org/tags-version.html + 'version': ['parseDescription'] + }; + + TagParser.prototype.parse = function parse() { + var i, iz, sequences, method; + + + // empty title + if (!this._title) { + if (!this.addError('Missing or invalid title')) { + return null; + } + } + + // Seek to content last index. + this._last = seekContent(this._title); + + if (this._options.range) { + this._tag.range = [this._first, source.slice(0, this._last).replace(/\s*$/, '').length].map(convertIndex); + } + + if (hasOwnProperty(Rules, this._title)) { + sequences = Rules[this._title]; + } else { + // default sequences + sequences = ['parseType', 'parseName', 'parseDescription', 'epilogue']; + } + + for (i = 0, iz = sequences.length; i < iz; ++i) { + method = sequences[i]; + if (!this[method]()) { + return null; + } + } + + return this._tag; + }; + + function parseTag(options) { + var title, parser, tag; + + // skip to tag + if (!skipToTag()) { + return null; + } + + // scan title + title = scanTitle(); + + // construct tag parser + parser = new TagParser(options, title); + tag = parser.parse(); + + // Seek global index to end of this tag. + while (index < parser._last) { + advance(); + } + + return tag; + } + + // + // Parse JSDoc + // + + function scanJSDocDescription(preserveWhitespace) { + var description = '', ch, atAllowed; + + atAllowed = true; + while (index < length) { + ch = source.charCodeAt(index); + + if (atAllowed && ch === 0x40 /* '@' */) { + break; + } + + if (esutils.code.isLineTerminator(ch)) { + atAllowed = true; + } else if (atAllowed && !esutils.code.isWhiteSpace(ch)) { + atAllowed = false; + } + + description += advance(); + } + + return preserveWhitespace ? description : description.trim(); + } + + function parse(comment, options) { + var tags = [], tag, description, interestingTags, i, iz; + + if (options === undefined) { + options = {}; + } + + if (typeof options.unwrap === 'boolean' && options.unwrap) { + source = unwrapComment(comment); + } else { + source = comment; + } + + originalSource = comment; + + // array of relevant tags + if (options.tags) { + if (Array.isArray(options.tags)) { + interestingTags = { }; + for (i = 0, iz = options.tags.length; i < iz; i++) { + if (typeof options.tags[i] === 'string') { + interestingTags[options.tags[i]] = true; + } else { + utility.throwError('Invalid "tags" parameter: ' + options.tags); + } + } + } else { + utility.throwError('Invalid "tags" parameter: ' + options.tags); + } + } + + length = source.length; + index = 0; + lineNumber = 0; + recoverable = options.recoverable; + sloppy = options.sloppy; + strict = options.strict; + + description = scanJSDocDescription(options.preserveWhitespace); + + while (true) { + tag = parseTag(options); + if (!tag) { + break; + } + if (!interestingTags || interestingTags.hasOwnProperty(tag.title)) { + tags.push(tag); + } + } + + return { + description: description, + tags: tags + }; + } + exports.parse = parse; + }(jsdoc = {})); + + exports.version = utility.VERSION; + exports.parse = jsdoc.parse; + exports.parseType = typed.parseType; + exports.parseParamType = typed.parseParamType; + exports.unwrapComment = unwrapComment; + exports.Syntax = shallowCopy(typed.Syntax); + exports.Error = utility.DoctrineError; + exports.type = { + Syntax: exports.Syntax, + parseType: typed.parseType, + parseParamType: typed.parseParamType, + stringify: typed.stringify + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js new file mode 100644 index 0000000000000000000000000000000000000000..bdd3c394fc7d1fb57c3beb38f9655fe327c4db0f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js @@ -0,0 +1,1305 @@ +/* + * @fileoverview Type expression parser. + * @author Yusuke Suzuki + * @author Dan Tao + * @author Andrew Eisenberg + */ + +// "typed", the Type Expression Parser for doctrine. + +(function () { + 'use strict'; + + var Syntax, + Token, + source, + length, + index, + previous, + token, + value, + esutils, + utility, + rangeOffset, + addRange; + + esutils = require('esutils'); + utility = require('./utility'); + + Syntax = { + NullableLiteral: 'NullableLiteral', + AllLiteral: 'AllLiteral', + NullLiteral: 'NullLiteral', + UndefinedLiteral: 'UndefinedLiteral', + VoidLiteral: 'VoidLiteral', + UnionType: 'UnionType', + ArrayType: 'ArrayType', + RecordType: 'RecordType', + FieldType: 'FieldType', + FunctionType: 'FunctionType', + ParameterType: 'ParameterType', + RestType: 'RestType', + NonNullableType: 'NonNullableType', + OptionalType: 'OptionalType', + NullableType: 'NullableType', + NameExpression: 'NameExpression', + TypeApplication: 'TypeApplication', + StringLiteralType: 'StringLiteralType', + NumericLiteralType: 'NumericLiteralType', + BooleanLiteralType: 'BooleanLiteralType' + }; + + Token = { + ILLEGAL: 0, // ILLEGAL + DOT_LT: 1, // .< + REST: 2, // ... + LT: 3, // < + GT: 4, // > + LPAREN: 5, // ( + RPAREN: 6, // ) + LBRACE: 7, // { + RBRACE: 8, // } + LBRACK: 9, // [ + RBRACK: 10, // ] + COMMA: 11, // , + COLON: 12, // : + STAR: 13, // * + PIPE: 14, // | + QUESTION: 15, // ? + BANG: 16, // ! + EQUAL: 17, // = + NAME: 18, // name token + STRING: 19, // string + NUMBER: 20, // number + EOF: 21 + }; + + function isTypeName(ch) { + return '><(){}[],:*|?!='.indexOf(String.fromCharCode(ch)) === -1 && !esutils.code.isWhiteSpace(ch) && !esutils.code.isLineTerminator(ch); + } + + function Context(previous, index, token, value) { + this._previous = previous; + this._index = index; + this._token = token; + this._value = value; + } + + Context.prototype.restore = function () { + previous = this._previous; + index = this._index; + token = this._token; + value = this._value; + }; + + Context.save = function () { + return new Context(previous, index, token, value); + }; + + function maybeAddRange(node, range) { + if (addRange) { + node.range = [range[0] + rangeOffset, range[1] + rangeOffset]; + } + return node; + } + + function advance() { + var ch = source.charAt(index); + index += 1; + return ch; + } + + function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && esutils.code.isHexDigit(source.charCodeAt(index))) { + ch = advance(); + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } + + function scanString() { + var str = '', quote, ch, code, unescaped, restore; //TODO review removal octal = false + quote = source.charAt(index); + ++index; + + while (index < length) { + ch = advance(); + + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = advance(); + if (!esutils.code.isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'u': + case 'x': + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + str += unescaped; + } else { + index = restore; + str += ch; + } + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\v'; + break; + + default: + if (esutils.code.isOctalDigit(ch.charCodeAt(0))) { + code = '01234567'.indexOf(ch); + + // \0 is not octal escape sequence + // Deprecating unused code. TODO review removal + //if (code !== 0) { + // octal = true; + //} + + if (index < length && esutils.code.isOctalDigit(source.charCodeAt(index))) { + //TODO Review Removal octal = true; + code = code * 8 + '01234567'.indexOf(advance()); + + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + esutils.code.isOctalDigit(source.charCodeAt(index))) { + code = code * 8 + '01234567'.indexOf(advance()); + } + } + str += String.fromCharCode(code); + } else { + str += ch; + } + break; + } + } else { + if (ch === '\r' && source.charCodeAt(index) === 0x0A /* '\n' */) { + ++index; + } + } + } else if (esutils.code.isLineTerminator(ch.charCodeAt(0))) { + break; + } else { + str += ch; + } + } + + if (quote !== '') { + utility.throwError('unexpected quote'); + } + + value = str; + return Token.STRING; + } + + function scanNumber() { + var number, ch; + + number = ''; + ch = source.charCodeAt(index); + + if (ch !== 0x2E /* '.' */) { + number = advance(); + ch = source.charCodeAt(index); + + if (number === '0') { + if (ch === 0x78 /* 'x' */ || ch === 0x58 /* 'X' */) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isHexDigit(ch)) { + break; + } + number += advance(); + } + + if (number.length <= 2) { + // only 0x + utility.throwError('unexpected token'); + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStartES5(ch)) { + utility.throwError('unexpected token'); + } + } + value = parseInt(number, 16); + return Token.NUMBER; + } + + if (esutils.code.isOctalDigit(ch)) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isOctalDigit(ch)) { + break; + } + number += advance(); + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStartES5(ch) || esutils.code.isDecimalDigit(ch)) { + utility.throwError('unexpected token'); + } + } + value = parseInt(number, 8); + return Token.NUMBER; + } + + if (esutils.code.isDecimalDigit(ch)) { + utility.throwError('unexpected token'); + } + } + + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } + + if (ch === 0x2E /* '.' */) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } + + if (ch === 0x65 /* 'e' */ || ch === 0x45 /* 'E' */) { + number += advance(); + + ch = source.charCodeAt(index); + if (ch === 0x2B /* '+' */ || ch === 0x2D /* '-' */) { + number += advance(); + } + + ch = source.charCodeAt(index); + if (esutils.code.isDecimalDigit(ch)) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } else { + utility.throwError('unexpected token'); + } + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStartES5(ch)) { + utility.throwError('unexpected token'); + } + } + + value = parseFloat(number); + return Token.NUMBER; + } + + + function scanTypeName() { + var ch, ch2; + + value = advance(); + while (index < length && isTypeName(source.charCodeAt(index))) { + ch = source.charCodeAt(index); + if (ch === 0x2E /* '.' */) { + if ((index + 1) >= length) { + return Token.ILLEGAL; + } + ch2 = source.charCodeAt(index + 1); + if (ch2 === 0x3C /* '<' */) { + break; + } + } + value += advance(); + } + return Token.NAME; + } + + function next() { + var ch; + + previous = index; + + while (index < length && esutils.code.isWhiteSpace(source.charCodeAt(index))) { + advance(); + } + if (index >= length) { + token = Token.EOF; + return token; + } + + ch = source.charCodeAt(index); + switch (ch) { + case 0x27: /* ''' */ + case 0x22: /* '"' */ + token = scanString(); + return token; + + case 0x3A: /* ':' */ + advance(); + token = Token.COLON; + return token; + + case 0x2C: /* ',' */ + advance(); + token = Token.COMMA; + return token; + + case 0x28: /* '(' */ + advance(); + token = Token.LPAREN; + return token; + + case 0x29: /* ')' */ + advance(); + token = Token.RPAREN; + return token; + + case 0x5B: /* '[' */ + advance(); + token = Token.LBRACK; + return token; + + case 0x5D: /* ']' */ + advance(); + token = Token.RBRACK; + return token; + + case 0x7B: /* '{' */ + advance(); + token = Token.LBRACE; + return token; + + case 0x7D: /* '}' */ + advance(); + token = Token.RBRACE; + return token; + + case 0x2E: /* '.' */ + if (index + 1 < length) { + ch = source.charCodeAt(index + 1); + if (ch === 0x3C /* '<' */) { + advance(); // '.' + advance(); // '<' + token = Token.DOT_LT; + return token; + } + + if (ch === 0x2E /* '.' */ && index + 2 < length && source.charCodeAt(index + 2) === 0x2E /* '.' */) { + advance(); // '.' + advance(); // '.' + advance(); // '.' + token = Token.REST; + return token; + } + + if (esutils.code.isDecimalDigit(ch)) { + token = scanNumber(); + return token; + } + } + token = Token.ILLEGAL; + return token; + + case 0x3C: /* '<' */ + advance(); + token = Token.LT; + return token; + + case 0x3E: /* '>' */ + advance(); + token = Token.GT; + return token; + + case 0x2A: /* '*' */ + advance(); + token = Token.STAR; + return token; + + case 0x7C: /* '|' */ + advance(); + token = Token.PIPE; + return token; + + case 0x3F: /* '?' */ + advance(); + token = Token.QUESTION; + return token; + + case 0x21: /* '!' */ + advance(); + token = Token.BANG; + return token; + + case 0x3D: /* '=' */ + advance(); + token = Token.EQUAL; + return token; + + case 0x2D: /* '-' */ + token = scanNumber(); + return token; + + default: + if (esutils.code.isDecimalDigit(ch)) { + token = scanNumber(); + return token; + } + + // type string permits following case, + // + // namespace.module.MyClass + // + // this reduced 1 token TK_NAME + utility.assert(isTypeName(ch)); + token = scanTypeName(); + return token; + } + } + + function consume(target, text) { + utility.assert(token === target, text || 'consumed token not matched'); + next(); + } + + function expect(target, message) { + if (token !== target) { + utility.throwError(message || 'unexpected token'); + } + next(); + } + + // UnionType := '(' TypeUnionList ')' + // + // TypeUnionList := + // <> + // | NonemptyTypeUnionList + // + // NonemptyTypeUnionList := + // TypeExpression + // | TypeExpression '|' NonemptyTypeUnionList + function parseUnionType() { + var elements, startIndex = index - 1; + consume(Token.LPAREN, 'UnionType should start with ('); + elements = []; + if (token !== Token.RPAREN) { + while (true) { + elements.push(parseTypeExpression()); + if (token === Token.RPAREN) { + break; + } + expect(Token.PIPE); + } + } + consume(Token.RPAREN, 'UnionType should end with )'); + return maybeAddRange({ + type: Syntax.UnionType, + elements: elements + }, [startIndex, previous]); + } + + // ArrayType := '[' ElementTypeList ']' + // + // ElementTypeList := + // <> + // | TypeExpression + // | '...' TypeExpression + // | TypeExpression ',' ElementTypeList + function parseArrayType() { + var elements, startIndex = index - 1, restStartIndex; + consume(Token.LBRACK, 'ArrayType should start with ['); + elements = []; + while (token !== Token.RBRACK) { + if (token === Token.REST) { + restStartIndex = index - 3; + consume(Token.REST); + elements.push(maybeAddRange({ + type: Syntax.RestType, + expression: parseTypeExpression() + }, [restStartIndex, previous])); + break; + } else { + elements.push(parseTypeExpression()); + } + if (token !== Token.RBRACK) { + expect(Token.COMMA); + } + } + expect(Token.RBRACK); + return maybeAddRange({ + type: Syntax.ArrayType, + elements: elements + }, [startIndex, previous]); + } + + function parseFieldName() { + var v = value; + if (token === Token.NAME || token === Token.STRING) { + next(); + return v; + } + + if (token === Token.NUMBER) { + consume(Token.NUMBER); + return String(v); + } + + utility.throwError('unexpected token'); + } + + // FieldType := + // FieldName + // | FieldName ':' TypeExpression + // + // FieldName := + // NameExpression + // | StringLiteral + // | NumberLiteral + // | ReservedIdentifier + function parseFieldType() { + var key, rangeStart = previous; + + key = parseFieldName(); + if (token === Token.COLON) { + consume(Token.COLON); + return maybeAddRange({ + type: Syntax.FieldType, + key: key, + value: parseTypeExpression() + }, [rangeStart, previous]); + } + return maybeAddRange({ + type: Syntax.FieldType, + key: key, + value: null + }, [rangeStart, previous]); + } + + // RecordType := '{' FieldTypeList '}' + // + // FieldTypeList := + // <> + // | FieldType + // | FieldType ',' FieldTypeList + function parseRecordType() { + var fields, rangeStart = index - 1, rangeEnd; + + consume(Token.LBRACE, 'RecordType should start with {'); + fields = []; + if (token === Token.COMMA) { + consume(Token.COMMA); + } else { + while (token !== Token.RBRACE) { + fields.push(parseFieldType()); + if (token !== Token.RBRACE) { + expect(Token.COMMA); + } + } + } + rangeEnd = index; + expect(Token.RBRACE); + return maybeAddRange({ + type: Syntax.RecordType, + fields: fields + }, [rangeStart, rangeEnd]); + } + + // NameExpression := + // Identifier + // | TagIdentifier ':' Identifier + // + // Tag identifier is one of "module", "external" or "event" + // Identifier is the same as Token.NAME, including any dots, something like + // namespace.module.MyClass + function parseNameExpression() { + var name = value, rangeStart = index - name.length; + expect(Token.NAME); + + if (token === Token.COLON && ( + name === 'module' || + name === 'external' || + name === 'event')) { + consume(Token.COLON); + name += ':' + value; + expect(Token.NAME); + } + + return maybeAddRange({ + type: Syntax.NameExpression, + name: name + }, [rangeStart, previous]); + } + + // TypeExpressionList := + // TopLevelTypeExpression + // | TopLevelTypeExpression ',' TypeExpressionList + function parseTypeExpressionList() { + var elements = []; + + elements.push(parseTop()); + while (token === Token.COMMA) { + consume(Token.COMMA); + elements.push(parseTop()); + } + return elements; + } + + // TypeName := + // NameExpression + // | NameExpression TypeApplication + // + // TypeApplication := + // '.<' TypeExpressionList '>' + // | '<' TypeExpressionList '>' // this is extension of doctrine + function parseTypeName() { + var expr, applications, startIndex = index - value.length; + + expr = parseNameExpression(); + if (token === Token.DOT_LT || token === Token.LT) { + next(); + applications = parseTypeExpressionList(); + expect(Token.GT); + return maybeAddRange({ + type: Syntax.TypeApplication, + expression: expr, + applications: applications + }, [startIndex, previous]); + } + return expr; + } + + // ResultType := + // <> + // | ':' void + // | ':' TypeExpression + // + // BNF is above + // but, we remove <> pattern, so token is always TypeToken::COLON + function parseResultType() { + consume(Token.COLON, 'ResultType should start with :'); + if (token === Token.NAME && value === 'void') { + consume(Token.NAME); + return { + type: Syntax.VoidLiteral + }; + } + return parseTypeExpression(); + } + + // ParametersType := + // RestParameterType + // | NonRestParametersType + // | NonRestParametersType ',' RestParameterType + // + // RestParameterType := + // '...' + // '...' Identifier + // + // NonRestParametersType := + // ParameterType ',' NonRestParametersType + // | ParameterType + // | OptionalParametersType + // + // OptionalParametersType := + // OptionalParameterType + // | OptionalParameterType, OptionalParametersType + // + // OptionalParameterType := ParameterType= + // + // ParameterType := TypeExpression | Identifier ':' TypeExpression + // + // Identifier is "new" or "this" + function parseParametersType() { + var params = [], optionalSequence = false, expr, rest = false, startIndex, restStartIndex = index - 3, nameStartIndex; + + while (token !== Token.RPAREN) { + if (token === Token.REST) { + // RestParameterType + consume(Token.REST); + rest = true; + } + + startIndex = previous; + + expr = parseTypeExpression(); + if (expr.type === Syntax.NameExpression && token === Token.COLON) { + nameStartIndex = previous - expr.name.length; + // Identifier ':' TypeExpression + consume(Token.COLON); + expr = maybeAddRange({ + type: Syntax.ParameterType, + name: expr.name, + expression: parseTypeExpression() + }, [nameStartIndex, previous]); + } + if (token === Token.EQUAL) { + consume(Token.EQUAL); + expr = maybeAddRange({ + type: Syntax.OptionalType, + expression: expr + }, [startIndex, previous]); + optionalSequence = true; + } else { + if (optionalSequence) { + utility.throwError('unexpected token'); + } + } + if (rest) { + expr = maybeAddRange({ + type: Syntax.RestType, + expression: expr + }, [restStartIndex, previous]); + } + params.push(expr); + if (token !== Token.RPAREN) { + expect(Token.COMMA); + } + } + return params; + } + + // FunctionType := 'function' FunctionSignatureType + // + // FunctionSignatureType := + // | TypeParameters '(' ')' ResultType + // | TypeParameters '(' ParametersType ')' ResultType + // | TypeParameters '(' 'this' ':' TypeName ')' ResultType + // | TypeParameters '(' 'this' ':' TypeName ',' ParametersType ')' ResultType + function parseFunctionType() { + var isNew, thisBinding, params, result, fnType, startIndex = index - value.length; + utility.assert(token === Token.NAME && value === 'function', 'FunctionType should start with \'function\''); + consume(Token.NAME); + + // Google Closure Compiler is not implementing TypeParameters. + // So we do not. if we don't get '(', we see it as error. + expect(Token.LPAREN); + + isNew = false; + params = []; + thisBinding = null; + if (token !== Token.RPAREN) { + // ParametersType or 'this' + if (token === Token.NAME && + (value === 'this' || value === 'new')) { + // 'this' or 'new' + // 'new' is Closure Compiler extension + isNew = value === 'new'; + consume(Token.NAME); + expect(Token.COLON); + thisBinding = parseTypeName(); + if (token === Token.COMMA) { + consume(Token.COMMA); + params = parseParametersType(); + } + } else { + params = parseParametersType(); + } + } + + expect(Token.RPAREN); + + result = null; + if (token === Token.COLON) { + result = parseResultType(); + } + + fnType = maybeAddRange({ + type: Syntax.FunctionType, + params: params, + result: result + }, [startIndex, previous]); + if (thisBinding) { + // avoid adding null 'new' and 'this' properties + fnType['this'] = thisBinding; + if (isNew) { + fnType['new'] = true; + } + } + return fnType; + } + + // BasicTypeExpression := + // '*' + // | 'null' + // | 'undefined' + // | TypeName + // | FunctionType + // | UnionType + // | RecordType + // | ArrayType + function parseBasicTypeExpression() { + var context, startIndex; + switch (token) { + case Token.STAR: + consume(Token.STAR); + return maybeAddRange({ + type: Syntax.AllLiteral + }, [previous - 1, previous]); + + case Token.LPAREN: + return parseUnionType(); + + case Token.LBRACK: + return parseArrayType(); + + case Token.LBRACE: + return parseRecordType(); + + case Token.NAME: + startIndex = index - value.length; + + if (value === 'null') { + consume(Token.NAME); + return maybeAddRange({ + type: Syntax.NullLiteral + }, [startIndex, previous]); + } + + if (value === 'undefined') { + consume(Token.NAME); + return maybeAddRange({ + type: Syntax.UndefinedLiteral + }, [startIndex, previous]); + } + + if (value === 'true' || value === 'false') { + consume(Token.NAME); + return maybeAddRange({ + type: Syntax.BooleanLiteralType, + value: value === 'true' + }, [startIndex, previous]); + } + + context = Context.save(); + if (value === 'function') { + try { + return parseFunctionType(); + } catch (e) { + context.restore(); + } + } + + return parseTypeName(); + + case Token.STRING: + next(); + return maybeAddRange({ + type: Syntax.StringLiteralType, + value: value + }, [previous - value.length - 2, previous]); + + case Token.NUMBER: + next(); + return maybeAddRange({ + type: Syntax.NumericLiteralType, + value: value + }, [previous - String(value).length, previous]); + + default: + utility.throwError('unexpected token'); + } + } + + // TypeExpression := + // BasicTypeExpression + // | '?' BasicTypeExpression + // | '!' BasicTypeExpression + // | BasicTypeExpression '?' + // | BasicTypeExpression '!' + // | '?' + // | BasicTypeExpression '[]' + function parseTypeExpression() { + var expr, rangeStart; + + if (token === Token.QUESTION) { + rangeStart = index - 1; + consume(Token.QUESTION); + if (token === Token.COMMA || token === Token.EQUAL || token === Token.RBRACE || + token === Token.RPAREN || token === Token.PIPE || token === Token.EOF || + token === Token.RBRACK || token === Token.GT) { + return maybeAddRange({ + type: Syntax.NullableLiteral + }, [rangeStart, previous]); + } + return maybeAddRange({ + type: Syntax.NullableType, + expression: parseBasicTypeExpression(), + prefix: true + }, [rangeStart, previous]); + } else if (token === Token.BANG) { + rangeStart = index - 1; + consume(Token.BANG); + return maybeAddRange({ + type: Syntax.NonNullableType, + expression: parseBasicTypeExpression(), + prefix: true + }, [rangeStart, previous]); + } else { + rangeStart = previous; + } + + expr = parseBasicTypeExpression(); + if (token === Token.BANG) { + consume(Token.BANG); + return maybeAddRange({ + type: Syntax.NonNullableType, + expression: expr, + prefix: false + }, [rangeStart, previous]); + } + + if (token === Token.QUESTION) { + consume(Token.QUESTION); + return maybeAddRange({ + type: Syntax.NullableType, + expression: expr, + prefix: false + }, [rangeStart, previous]); + } + + if (token === Token.LBRACK) { + consume(Token.LBRACK); + expect(Token.RBRACK, 'expected an array-style type declaration (' + value + '[])'); + return maybeAddRange({ + type: Syntax.TypeApplication, + expression: maybeAddRange({ + type: Syntax.NameExpression, + name: 'Array' + }, [rangeStart, previous]), + applications: [expr] + }, [rangeStart, previous]); + } + + return expr; + } + + // TopLevelTypeExpression := + // TypeExpression + // | TypeUnionList + // + // This rule is Google Closure Compiler extension, not ES4 + // like, + // { number | string } + // If strict to ES4, we should write it as + // { (number|string) } + function parseTop() { + var expr, elements; + + expr = parseTypeExpression(); + if (token !== Token.PIPE) { + return expr; + } + + elements = [expr]; + consume(Token.PIPE); + while (true) { + elements.push(parseTypeExpression()); + if (token !== Token.PIPE) { + break; + } + consume(Token.PIPE); + } + + return maybeAddRange({ + type: Syntax.UnionType, + elements: elements + }, [0, index]); + } + + function parseTopParamType() { + var expr; + + if (token === Token.REST) { + consume(Token.REST); + return maybeAddRange({ + type: Syntax.RestType, + expression: parseTop() + }, [0, index]); + } + + expr = parseTop(); + if (token === Token.EQUAL) { + consume(Token.EQUAL); + return maybeAddRange({ + type: Syntax.OptionalType, + expression: expr + }, [0, index]); + } + + return expr; + } + + function parseType(src, opt) { + var expr; + + source = src; + length = source.length; + index = 0; + previous = 0; + addRange = opt && opt.range; + rangeOffset = opt && opt.startIndex || 0; + + next(); + expr = parseTop(); + + if (opt && opt.midstream) { + return { + expression: expr, + index: previous + }; + } + + if (token !== Token.EOF) { + utility.throwError('not reach to EOF'); + } + + return expr; + } + + function parseParamType(src, opt) { + var expr; + + source = src; + length = source.length; + index = 0; + previous = 0; + addRange = opt && opt.range; + rangeOffset = opt && opt.startIndex || 0; + + next(); + expr = parseTopParamType(); + + if (opt && opt.midstream) { + return { + expression: expr, + index: previous + }; + } + + if (token !== Token.EOF) { + utility.throwError('not reach to EOF'); + } + + return expr; + } + + function stringifyImpl(node, compact, topLevel) { + var result, i, iz; + + switch (node.type) { + case Syntax.NullableLiteral: + result = '?'; + break; + + case Syntax.AllLiteral: + result = '*'; + break; + + case Syntax.NullLiteral: + result = 'null'; + break; + + case Syntax.UndefinedLiteral: + result = 'undefined'; + break; + + case Syntax.VoidLiteral: + result = 'void'; + break; + + case Syntax.UnionType: + if (!topLevel) { + result = '('; + } else { + result = ''; + } + + for (i = 0, iz = node.elements.length; i < iz; ++i) { + result += stringifyImpl(node.elements[i], compact); + if ((i + 1) !== iz) { + result += compact ? '|' : ' | '; + } + } + + if (!topLevel) { + result += ')'; + } + break; + + case Syntax.ArrayType: + result = '['; + for (i = 0, iz = node.elements.length; i < iz; ++i) { + result += stringifyImpl(node.elements[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += ']'; + break; + + case Syntax.RecordType: + result = '{'; + for (i = 0, iz = node.fields.length; i < iz; ++i) { + result += stringifyImpl(node.fields[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += '}'; + break; + + case Syntax.FieldType: + if (node.value) { + result = node.key + (compact ? ':' : ': ') + stringifyImpl(node.value, compact); + } else { + result = node.key; + } + break; + + case Syntax.FunctionType: + result = compact ? 'function(' : 'function ('; + + if (node['this']) { + if (node['new']) { + result += (compact ? 'new:' : 'new: '); + } else { + result += (compact ? 'this:' : 'this: '); + } + + result += stringifyImpl(node['this'], compact); + + if (node.params.length !== 0) { + result += compact ? ',' : ', '; + } + } + + for (i = 0, iz = node.params.length; i < iz; ++i) { + result += stringifyImpl(node.params[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + + result += ')'; + + if (node.result) { + result += (compact ? ':' : ': ') + stringifyImpl(node.result, compact); + } + break; + + case Syntax.ParameterType: + result = node.name + (compact ? ':' : ': ') + stringifyImpl(node.expression, compact); + break; + + case Syntax.RestType: + result = '...'; + if (node.expression) { + result += stringifyImpl(node.expression, compact); + } + break; + + case Syntax.NonNullableType: + if (node.prefix) { + result = '!' + stringifyImpl(node.expression, compact); + } else { + result = stringifyImpl(node.expression, compact) + '!'; + } + break; + + case Syntax.OptionalType: + result = stringifyImpl(node.expression, compact) + '='; + break; + + case Syntax.NullableType: + if (node.prefix) { + result = '?' + stringifyImpl(node.expression, compact); + } else { + result = stringifyImpl(node.expression, compact) + '?'; + } + break; + + case Syntax.NameExpression: + result = node.name; + break; + + case Syntax.TypeApplication: + result = stringifyImpl(node.expression, compact) + '.<'; + for (i = 0, iz = node.applications.length; i < iz; ++i) { + result += stringifyImpl(node.applications[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += '>'; + break; + + case Syntax.StringLiteralType: + result = '"' + node.value + '"'; + break; + + case Syntax.NumericLiteralType: + result = String(node.value); + break; + + case Syntax.BooleanLiteralType: + result = String(node.value); + break; + + default: + utility.throwError('Unknown type ' + node.type); + } + + return result; + } + + function stringify(node, options) { + if (options == null) { + options = {}; + } + return stringifyImpl(node, options.compact, options.topLevel); + } + + exports.parseType = parseType; + exports.parseParamType = parseParamType; + exports.stringify = stringify; + exports.Syntax = Syntax; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js new file mode 100644 index 0000000000000000000000000000000000000000..381580ebe2534af83524e88d64e1536fddfd38df --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js @@ -0,0 +1,35 @@ +/* + * @fileoverview Utilities for Doctrine + * @author Yusuke Suzuki + */ + + +(function () { + 'use strict'; + + var VERSION; + + VERSION = require('../package.json').version; + exports.VERSION = VERSION; + + function DoctrineError(message) { + this.name = 'DoctrineError'; + this.message = message; + } + DoctrineError.prototype = (function () { + var Middle = function () { }; + Middle.prototype = Error.prototype; + return new Middle(); + }()); + DoctrineError.prototype.constructor = DoctrineError; + exports.DoctrineError = DoctrineError; + + function throwError(message) { + throw new DoctrineError(message); + } + exports.throwError = throwError; + + exports.assert = require('assert'); +}()); + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/package.json new file mode 100644 index 0000000000000000000000000000000000000000..92667d34373924099ac58e2ab5ee9390471ee6eb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/doctrine/package.json @@ -0,0 +1,57 @@ +{ + "name": "doctrine", + "description": "JSDoc parser", + "homepage": "https://github.com/eslint/doctrine", + "main": "lib/doctrine.js", + "version": "2.1.0", + "engines": { + "node": ">=0.10.0" + }, + "directories": { + "lib": "./lib" + }, + "files": [ + "lib" + ], + "maintainers": [ + { + "name": "Nicholas C. Zakas", + "email": "nicholas+npm@nczconsulting.com", + "web": "https://www.nczonline.net" + }, + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "https://github.com/Constellation" + } + ], + "repository": "eslint/doctrine", + "devDependencies": { + "coveralls": "^2.11.2", + "dateformat": "^1.0.11", + "eslint": "^1.10.3", + "eslint-release": "^0.10.0", + "linefix": "^0.1.1", + "mocha": "^3.4.2", + "npm-license": "^0.3.1", + "nyc": "^10.3.2", + "semver": "^5.0.3", + "shelljs": "^0.5.3", + "shelljs-nodecli": "^0.1.1", + "should": "^5.0.1" + }, + "license": "Apache-2.0", + "scripts": { + "pretest": "npm run lint", + "test": "nyc mocha", + "coveralls": "nyc report --reporter=text-lcov | coveralls", + "lint": "eslint lib/", + "release": "eslint-release", + "ci-release": "eslint-ci-release", + "alpharelease": "eslint-prerelease alpha", + "betarelease": "eslint-prerelease beta" + }, + "dependencies": { + "esutils": "^2.0.2" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..19129e315fe593965a2fdd50ec0d1253bcbd2ece --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2293a14fdc3579558dbe9fbc50aa549657948c3e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/README.md @@ -0,0 +1,443 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero element in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions + are equal. Sorts in ascending order if passed to `Array.sort()`. + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version, options)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). + +If the `options.rtl` flag is set, then `coerce` will return the right-most +coercible tuple that does not share an ending index with a longer coercible +tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not +`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of +any other overlapping SemVer tuple. + +### Clean + +* `clean(version)`: Clean a string to be a valid semver if possible + +This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. + +ex. +* `s.clean(' = v 2.1.5foo')`: `null` +* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean(' = v 2.1.5-foo')`: `null` +* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean('=v2.1.5')`: `'2.1.5'` +* `s.clean(' =v2.1.5')`: `2.1.5` +* `s.clean(' 2.1.5 ')`: `'2.1.5'` +* `s.clean('~1.0.0')`: `null` diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/bin/semver.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/bin/semver.js new file mode 100644 index 0000000000000000000000000000000000000000..666034a75d8442be9bb2d9c55c3909b55a093cb5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/bin/semver.js @@ -0,0 +1,174 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var rtl = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '--rtl': + rtl = true + break + case '--ltr': + rtl = false + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + '--rtl', + ' Coerce version strings right to left', + '', + '--ltr', + ' Coerce version strings left to right (default)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6b970a629ffe81d300d6b0469fa9b1992ca24c8e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/package.json @@ -0,0 +1,38 @@ +{ + "name": "semver", + "version": "6.3.1", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap test/ --100 --timeout=30", + "lint": "echo linting disabled", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap test/ --100 --timeout=30", + "posttest": "npm run lint" + }, + "devDependencies": { + "@npmcli/template-oss": "4.17.0", + "tap": "^12.7.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "./bin/semver.js" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "content": "./scripts/template-oss", + "version": "4.17.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/range.bnf b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/range.bnf new file mode 100644 index 0000000000000000000000000000000000000000..d4c6ae0d76c9ac0c10c93062e5ff9cec277b07cd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/semver.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/semver.js new file mode 100644 index 0000000000000000000000000000000000000000..39319c13cac27d65d88d34dac95470a6494a0dae --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-import/node_modules/semver/semver.js @@ -0,0 +1,1643 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +// The actual regexps go on exports.re +var re = exports.re = [] +var safeRe = exports.safeRe = [] +var src = exports.src = [] +var t = exports.tokens = {} +var R = 0 + +function tok (n) { + t[n] = R++ +} + +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +tok('NUMERICIDENTIFIER') +src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' +tok('NUMERICIDENTIFIERLOOSE') +src[t.NUMERICIDENTIFIERLOOSE] = '\\d+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +tok('NONNUMERICIDENTIFIER') +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +tok('MAINVERSION') +src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')' + +tok('MAINVERSIONLOOSE') +src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +tok('PRERELEASEIDENTIFIER') +src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +tok('PRERELEASEIDENTIFIERLOOSE') +src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +tok('PRERELEASE') +src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))' + +tok('PRERELEASELOOSE') +src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +tok('BUILDIDENTIFIER') +src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +tok('BUILD') +src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +tok('FULL') +tok('FULLPLAIN') +src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + + src[t.PRERELEASE] + '?' + + src[t.BUILD] + '?' + +src[t.FULL] = '^' + src[t.FULLPLAIN] + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +tok('LOOSEPLAIN') +src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + + src[t.PRERELEASELOOSE] + '?' + + src[t.BUILD] + '?' + +tok('LOOSE') +src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$' + +tok('GTLT') +src[t.GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +tok('XRANGEIDENTIFIERLOOSE') +src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +tok('XRANGEIDENTIFIER') +src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*' + +tok('XRANGEPLAIN') +src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:' + src[t.PRERELEASE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGEPLAINLOOSE') +src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[t.PRERELEASELOOSE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGE') +src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$' +tok('XRANGELOOSE') +src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +tok('COERCE') +src[t.COERCE] = '(^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' +tok('COERCERTL') +re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') +safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g') + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +tok('LONETILDE') +src[t.LONETILDE] = '(?:~>?)' + +tok('TILDETRIM') +src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' +re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g') +var tildeTrimReplace = '$1~' + +tok('TILDE') +src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$' +tok('TILDELOOSE') +src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +tok('LONECARET') +src[t.LONECARET] = '(?:\\^)' + +tok('CARETTRIM') +src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' +re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g') +var caretTrimReplace = '$1^' + +tok('CARET') +src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$' +tok('CARETLOOSE') +src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +tok('COMPARATORLOOSE') +src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$' +tok('COMPARATOR') +src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +tok('COMPARATORTRIM') +src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +tok('HYPHENRANGE') +src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAIN] + ')' + + '\\s*$' + +tok('HYPHENRANGELOOSE') +src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +tok('STAR') +src[t.STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +SemVer.prototype.compareBuild = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + var i = 0 + do { + var a = this.build[i] + var b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.compareBuild = compareBuild +function compareBuild (a, b, loose) { + var versionA = new SemVer(a, loose) + var versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(b, a, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + if (this.value === '') { + return true + } + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + this.raw) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[t.COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return ( + isSatisfiable(thisComparators, options) && + range.set.some(function (rangeComparators) { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every(function (thisComparator) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) +} + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +function isSatisfiable (comparators, options) { + var result = true + var remainingComparators = comparators.slice() + var testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every(function (otherComparator) { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + pr + } else if (xm) { + ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr + } else if (xp) { + ret = '>=' + M + '.' + m + '.0' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + pr + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(safeRe[t.STAR], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version, options) { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + var match = null + if (!options.rtl) { + match = version.match(safeRe[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + var next + while ((next = safeRe[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + safeRe[t.COERCERTL].lastIndex = -1 + } + + if (match === null) { + return null + } + + return parse(match[2] + + '.' + (match[3] || '0') + + '.' + (match[4] || '0'), options) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/configs/flat-config-base.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/configs/flat-config-base.js new file mode 100644 index 0000000000000000000000000000000000000000..98575f4ecc14be6a14016b9e0a78734af44066b9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/configs/flat-config-base.js @@ -0,0 +1,8 @@ +'use strict'; +const globals = require('globals'); + +module.exports = { + languageOptions: { + globals: globals.builtin, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/configs/legacy-config-base.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/configs/legacy-config-base.js new file mode 100644 index 0000000000000000000000000000000000000000..6a828fcb01ee99a407f0089df3cfc303b996bc21 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/configs/legacy-config-base.js @@ -0,0 +1,10 @@ +'use strict'; +module.exports = { + env: { + es2024: true, + }, + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/.bin/resolve b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/.bin/resolve new file mode 100644 index 0000000000000000000000000000000000000000..b7064585ef01f96f92f752c6c304399d1a67dad7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/.bin/resolve @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38bfe8e320fb462083ff58d54aee6fc4cc2db9baef9ce9f88830652d55863e8b +size 1535 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/CHANGELOG.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..deaaa8e693d3e0d21eb56ad1895d1520b2313400 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/CHANGELOG.md @@ -0,0 +1,206 @@ +# Changelog + +## v4.3.0 + +- support Cloudflare workers [e438266](https://github.com/watson/ci-info/commit/e438266) + +## v4.2.0 + +- support Cloudflare Pages [75c9de8](https://github.com/watson/ci-info/commit/75c9de8) + +### v4.1.0 + +- support Appcircle PR [1d42c26](https://github.com/watson/ci-info/commit/1d42c26) +- support AWS CodeBuild PR [e6fcdd2](https://github.com/watson/ci-info/commit/e6fcdd2) +- add `ci.id` to return vendor constant [81fd993](https://github.com/watson/ci-info/commit/81fd993) + +## v4.0.0 + +- support Earthly CI [fb8bd85](https://github.com/watson/ci-info/commit/fb8bd85) +- support Prow CI [8e6a591](https://github.com/watson/ci-info/commit/8e6a591) +- support Vela CI [bb13901](https://github.com/watson/ci-info/commit/bb13901) +- support Agola CI [ec4e149](https://github.com/watson/ci-info/commit/ec4e149) +- support Gitea Actions [f6f173f](https://github.com/watson/ci-info/commit/f6f173f) +- run tests on nodejs v20 [bff314d](https://github.com/watson/ci-info/commit/bff314d) + +#### Breaking Changes + +- remove Shippable CI [2c5571a](https://github.com/watson/ci-info/commit/2c5571a) +- remove Solano CI [d6315fc](https://github.com/watson/ci-info/commit/d6315fc) + +## v3.9.0 + +- better support for Azure Pipelines ([#116](https://github.com/watson/ci-info/pull/116)), [5ea8d85](https://github.com/watson/ci-info/commit/5ea8d85) +- detect PullRequest in Azure Pipelines [5ea8d85](https://github.com/watson/ci-info/commit/5ea8d85) + +## v3.8.0 + +- support Harness CI [76a2867](https://github.com/watson/ci-info/commit/76a2867) + +## v3.7.1 + +- ignore ci detection when CI is set to `'false'` [24cc450](https://github.com/watson/ci-info/commit/24cc450) + +## v3.7.0 + +- support Sourcehut CI [85b96ea](https://github.com/watson/ci-info/commit/85b96ea) +- support ReleaseHub CI [409d886](https://github.com/watson/ci-info/commit/409d886) + +## v3.6.2 + +- fix VERCEL environment detection ([#98](https://github.com/watson/ci-info/pull/98)) + +## v3.6.1 + +- fix error in typings [357b454](https://github.com/watson/ci-info/commit/357b454) + +## v3.6.0 + +This release attempts to bring parity with [@npmcli/ci-detect](https://github.com/npm/ci-detect). See [#95](https://github.com/watson/ci-info/pull/95) for more details. + +- support gerrit ([#95](https://github.com/watson/ci-info/pull/95)) +- support google cloud build ([#95](https://github.com/watson/ci-info/pull/95)) +- support heroku ([#95](https://github.com/watson/ci-info/pull/95)) +- support anonymous CI's that exposes BUILD_ID and CI_NAME env vars ([#95](https://github.com/watson/ci-info/pull/95)) +- support more vercel environments ([#95](https://github.com/watson/ci-info/pull/95)) + +## v3.5.0 + +- support Woodpecker CI ([#90](https://github.com/watson/ci-info/pull/90)) + +## v3.4.0 + +- partial support Appflow CI (only CI detection) ([#84](https://github.com/watson/ci-info/pull/84)) +- support Codemagic CI ([#85](https://github.com/watson/ci-info/pull/85)) +- support Xcode Server CI ([#86](https://github.com/watson/ci-info/pull/86)) +- support Xcode Cloud CI ([#86](https://github.com/watson/ci-info/pull/86)) + +## v3.3.2 + +- fix: export correct typings for `EAS` + +## v3.3.1 + +- fix: export `EAS_BUILD` constant in typings +- Add support for nodejs v18 + +## v3.3.0 + +- support Expo Application Services ([#70](https://github.com/watson/ci-info/pull/70)) + +## v3.2.0 + +- support LayerCI ([#68](https://github.com/watson/ci-info/pull/68)) +- support Appcircle ([#69](https://github.com/watson/ci-info/pull/69)) +- support Codefresh CI ([#65](https://github.com/watson/ci-info/pull/65)) +- add support for nodejs v16 + +## v3.1.1 + +Bug Fixes: + +- remove duplicate declaration in typings + +## v3.1.0 + +Features: + +- add typings + +## v3.0.0 + +Features: + +- Add support nodejs versions: 14, 15 +- support Nevercode ([#30](https://github.com/watson/ci-info/pull/30)) +- support Render CI ([#36](https://github.com/watson/ci-info/pull/36)) +- support Now CI ([#37](https://github.com/watson/ci-info/pull/37)) +- support GitLab PR ([#59](https://github.com/watson/ci-info/pull/59)) +- support Screwdriver CD ([#60](https://github.com/watson/ci-info/pull/60)) +- support Visual Studio App Center ([#61](https://github.com/watson/ci-info/pull/61)) + +Bug Fixes: + +- update Netlify env constant ([#47](https://github.com/watson/ci-info/pull/47)) + +Breaking changes: + +- Drop support for Node.js end-of-life versions: 6, 13 +- replace `Zeit Now` with `Vercel` ([#55](https://github.com/watson/ci-info/pull/55)) + +## v2.0.0 + +Breaking changes: + +- Drop support for Node.js end-of-life versions: 0.10, 0.12, 4, 5, 7, and 9 +- Team Foundation Server will now be detected as Azure Pipelines. The constant `ci.TFS` no longer exists - use + `ci.AZURE_PIPELINES` instead +- Remove deprecated `ci.TDDIUM` constant - use `ci.SOLANDO` instead + +New features: + +- feat: support Azure Pipelines ([#23](https://github.com/watson/ci-info/pull/23)) +- feat: support Netlify CI ([#26](https://github.com/watson/ci-info/pull/26)) +- feat: support Bitbucket pipelines PR detection ([#27](https://github.com/watson/ci-info/pull/27)) + +## v1.6.0 + +- feat: add Sail CI support +- feat: add Buddy support +- feat: add Bitrise support +- feat: detect Jenkins PRs +- feat: detect Drone PRs + +## v1.5.1 + +- fix: use full path to vendors.json + +## v1.5.0 + +- feat: add dsari detection ([#15](https://github.com/watson/ci-info/pull/15)) +- feat: add ci.isPR ([#16](https://github.com/watson/ci-info/pull/16)) + +## v1.4.0 + +- feat: add Cirrus CI detection ([#13](https://github.com/watson/ci-info/pull/13)) +- feat: add Shippable CI detection ([#14](https://github.com/watson/ci-info/pull/14)) + +## v1.3.1 + +- chore: reduce npm package size by not including `.github` folder content + ([#11](https://github.com/watson/ci-info/pull/11)) + +## v1.3.0 + +- feat: add support for Strider CD +- chore: deprecate vendor constant `TDDIUM` in favor of `SOLANO` +- docs: add missing vendor constant to docs + +## v1.2.0 + +- feat: detect solano-ci ([#9](https://github.com/watson/ci-info/pull/9)) + +## v1.1.3 + +- fix: fix spelling of Hunson in `ci.name` + +## v1.1.2 + +- fix: no more false positive matches for Jenkins + +## v1.1.1 + +- docs: sort lists of CI servers in README.md +- docs: add missing AWS CodeBuild to the docs + +## v1.1.0 + +- feat: add AWS CodeBuild to CI detection ([#2](https://github.com/watson/ci-info/pull/2)) + +## v1.0.1 + +- chore: reduce npm package size by using an `.npmignore` file ([#3](https://github.com/watson/ci-info/pull/3)) + +## v1.0.0 + +- Initial release diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..95f61daaaf485f6311e2d5396f360e27dce55002 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Thomas Watson Steen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8d36300cabf9b372fd824ffe25c1ffb75f085bf1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/README.md @@ -0,0 +1,135 @@ +# ci-info + +Get details about the current Continuous Integration environment. + +Please [open an +issue](https://github.com/watson/ci-info/issues/new?template=ci-server-not-detected.md) +if your CI server isn't properly detected :) + +[![npm](https://img.shields.io/npm/v/ci-info.svg)](https://www.npmjs.com/package/ci-info) +[![Tests](https://github.com/watson/ci-info/workflows/Tests/badge.svg)](https://github.com/watson/ci-info/actions) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) + +## Installation + +```bash +npm install ci-info --save +``` + +## Usage + +```js +var ci = require('ci-info') + +if (ci.isCI) { + console.log('The name of the CI server is:', ci.name) +} else { + console.log('This program is not running on a CI server') +} +``` + +## Supported CI tools + +Officially supported CI servers: + +| Name | Constant | isPR | +| ------------------------------------------------------------------------------- | ----------------------- | ---- | +| [Agola CI](https://agola.io/) | `ci.AGOLA` | ✅ | +| [Appcircle](https://appcircle.io/) | `ci.APPCIRCLE` | ✅ | +| [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | ✅ | +| [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | ✅ | +| [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) | `ci.AZURE_PIPELINES` | ✅ | +| [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | 🚫 | +| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | ✅ | +| [Bitrise](https://www.bitrise.io/) | `ci.BITRISE` | ✅ | +| [Buddy](https://buddy.works/) | `ci.BUDDY` | ✅ | +| [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | ✅ | +| [CircleCI](http://circleci.com) | `ci.CIRCLE` | ✅ | +| [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | ✅ | +| [Cloudflare Pages](https://pages.cloudflare.com/) | `ci.CLOUDFLARE_PAGES` | 🚫 | +| [Cloudflare Workers](https://pages.cloudflare.com/) | `ci.CLOUDFLARE_WORKERS` | 🚫 | +| [Codefresh](https://codefresh.io/) | `ci.CODEFRESH` | ✅ | +| [Codeship](https://codeship.com) | `ci.CODESHIP` | 🚫 | +| [Drone](https://drone.io) | `ci.DRONE` | ✅ | +| [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | 🚫 | +| [Earthly CI](https://earthly.dev/) | `ci.EARTHLY` | 🚫 | +| [Expo Application Services](https://expo.dev/eas) | `ci.EAS` | 🚫 | +| [Gerrit CI](https://www.gerritcodereview.com) | `ci.GERRIT` | 🚫 | +| [GitHub Actions](https://github.com/features/actions/) | `ci.GITHUB_ACTIONS` | ✅ | +| [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | ✅ | +| [Gitea Actions](https://about.gitea.com/) | `ci.GITEA_ACTIONS` | 🚫 | +| [GoCD](https://www.go.cd/) | `ci.GOCD` | 🚫 | +| [Google Cloud Build](https://cloud.google.com/build) | `ci.GOOGLE_CLOUD_BUILD` | 🚫 | +| [Harness CI](https://www.harness.io/products/continuous-integration) | `ci.HARNESS` | 🚫 | +| [Heroku](https://www.heroku.com) | `ci.HEROKU` | 🚫 | +| [Hudson](http://hudson-ci.org) | `ci.HUDSON` | 🚫 | +| [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | ✅ | +| [LayerCI](https://layerci.com/) | `ci.LAYERCI` | ✅ | +| [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | 🚫 | +| [Netlify CI](https://www.netlify.com/) | `ci.NETLIFY` | ✅ | +| [Nevercode](http://nevercode.io/) | `ci.NEVERCODE` | ✅ | +| [Prow](https://docs.prow.k8s.io/) | `ci.PROW` | 🚫 | +| [ReleaseHub](https://releasehub.com/) | `ci.RELEASEHUB` | 🚫 | +| [Render](https://render.com/) | `ci.RENDER` | ✅ | +| [Sail CI](https://sail.ci/) | `ci.SAIL` | ✅ | +| [Screwdriver](https://screwdriver.cd/) | `ci.SCREWDRIVER` | ✅ | +| [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | ✅ | +| [Sourcehut](https://sourcehut.org/) | `ci.SOURCEHUT` | 🚫 | +| [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | 🚫 | +| [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | 🚫 | +| [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | 🚫 | +| [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | ✅ | +| [Vela](https://go-vela.github.io/docs/) | `ci.VELA` | ✅ | +| [Vercel](https://vercel.com/) | `ci.VERCEL` | ✅ | +| [Visual Studio App Center](https://appcenter.ms/) | `ci.APPCENTER` | 🚫 | +| [Woodpecker](https://woodpecker-ci.org/) | `ci.WOODPECKER` | ✅ | + +## API + +### `ci.name` + +Returns a string containing name of the CI server the code is running on. +If CI server is not detected, it returns `null`. + +Don't depend on the value of this string not to change for a specific +vendor. If you find your self writing `ci.name === 'Travis CI'`, you +most likely want to use `ci.TRAVIS` instead. + +### `ci.isCI` + +Returns a boolean. Will be `true` if the code is running on a CI server, +otherwise `false`. + +Some CI servers not listed here might still trigger the `ci.isCI` +boolean to be set to `true` if they use certain vendor neutral +environment variables. In those cases `ci.name` will be `null` and no +vendor specific boolean will be set to `true`. + +### `ci.isPR` + +Returns a boolean if PR detection is supported for the current CI server. Will +be `true` if a PR is being tested, otherwise `false`. If PR detection is +not supported for the current CI server, the value will be `null`. + +### `ci.` + +A vendor specific boolean constant is exposed for each support CI +vendor. A constant will be `true` if the code is determined to run on +the given CI server, otherwise `false`. + +Examples of vendor constants are `ci.TRAVIS` or `ci.APPVEYOR`. For a +complete list, see the support table above. + +## Ports + +ci-info has been ported to the following languages + +| Language | Repository | +|----------|------------| +| Go | https://github.com/hofstadter-io/cinful | +| Rust | https://github.com/sagiegurari/ci_info | +| Kotlin | https://github.com/cloudflightio/ci-info | + +## License + +[MIT](LICENSE) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf277d841add59e9d27a11ec4eb2cc1c866abfd0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/index.d.ts @@ -0,0 +1,86 @@ +// This file is generated at pre-commit by running `node create-typings.js`. + +/** + * Returns a boolean. Will be `true` if the code is running on a CI server, + * otherwise `false`. + * + * Some CI servers not listed here might still trigger the `ci.isCI` + * boolean to be set to `true` if they use certain vendor neutral environment + * variables. In those cases `ci.name` will be `null` and no vendor specific + * boolean will be set to `true`. + */ +export const isCI: boolean; +/** + * Returns a boolean if PR detection is supported for the current CI server. + * Will be `true` if a PR is being tested, otherwise `false`. If PR detection is + * not supported for the current CI server, the value will be `null`. + */ +export const isPR: boolean | null; +/** + * Returns a string containing name of the CI server the code is running on. If + * CI server is not detected, it returns `null`. + * + * Don't depend on the value of this string not to change for a specific vendor. + * If you find your self writing `ci.name === 'Travis CI'`, you most likely want + * to use `ci.TRAVIS` instead. + */ +export const name: string | null; +/** + * Returns a string containing the identifier of the CI server the code is running on. If + * CI server is not detected, it returns `null`. + */ +export const id: string | null; + +/* Vendor constants */ +export const AGOLA: boolean; +export const APPCIRCLE: boolean; +export const APPVEYOR: boolean; +export const CODEBUILD: boolean; +export const AZURE_PIPELINES: boolean; +export const BAMBOO: boolean; +export const BITBUCKET: boolean; +export const BITRISE: boolean; +export const BUDDY: boolean; +export const BUILDKITE: boolean; +export const CIRCLE: boolean; +export const CIRRUS: boolean; +export const CLOUDFLARE_PAGES: boolean; +export const CLOUDFLARE_WORKERS: boolean; +export const CODEFRESH: boolean; +export const CODEMAGIC: boolean; +export const CODESHIP: boolean; +export const DRONE: boolean; +export const DSARI: boolean; +export const EARTHLY: boolean; +export const EAS: boolean; +export const GERRIT: boolean; +export const GITEA_ACTIONS: boolean; +export const GITHUB_ACTIONS: boolean; +export const GITLAB: boolean; +export const GOCD: boolean; +export const GOOGLE_CLOUD_BUILD: boolean; +export const HARNESS: boolean; +export const HEROKU: boolean; +export const HUDSON: boolean; +export const JENKINS: boolean; +export const LAYERCI: boolean; +export const MAGNUM: boolean; +export const NETLIFY: boolean; +export const NEVERCODE: boolean; +export const PROW: boolean; +export const RELEASEHUB: boolean; +export const RENDER: boolean; +export const SAIL: boolean; +export const SCREWDRIVER: boolean; +export const SEMAPHORE: boolean; +export const SOURCEHUT: boolean; +export const STRIDER: boolean; +export const TASKCLUSTER: boolean; +export const TEAMCITY: boolean; +export const TRAVIS: boolean; +export const VELA: boolean; +export const VERCEL: boolean; +export const APPCENTER: boolean; +export const WOODPECKER: boolean; +export const XCODE_CLOUD: boolean; +export const XCODE_SERVER: boolean; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/index.js new file mode 100644 index 0000000000000000000000000000000000000000..75695253adb4771ac8dbfa1d6606a2c5c3cf9422 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/index.js @@ -0,0 +1,102 @@ +'use strict' + +const vendors = require('./vendors.json') + +const env = process.env + +// Used for testing only +Object.defineProperty(exports, '_vendors', { + value: vendors.map(function (v) { + return v.constant + }) +}) + +exports.name = null +exports.isPR = null +exports.id = null + +vendors.forEach(function (vendor) { + const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env] + const isCI = envs.every(function (obj) { + return checkEnv(obj) + }) + + exports[vendor.constant] = isCI + + if (!isCI) { + return + } + + exports.name = vendor.name + exports.isPR = checkPR(vendor) + exports.id = vendor.constant +}) + +exports.isCI = !!( + env.CI !== 'false' && // Bypass all checks if CI env is explicitly set to 'false' + (env.BUILD_ID || // Jenkins, Cloudbees + env.BUILD_NUMBER || // Jenkins, TeamCity + env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers + env.CI_APP_ID || // Appflow + env.CI_BUILD_ID || // Appflow + env.CI_BUILD_NUMBER || // Appflow + env.CI_NAME || // Codeship and others + env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI + env.RUN_ID || // TaskCluster, dsari + exports.name || + false) +) + +function checkEnv (obj) { + // "env": "CIRRUS" + if (typeof obj === 'string') return !!env[obj] + + // "env": { "env": "NODE", "includes": "/app/.heroku/node/bin/node" } + if ('env' in obj) { + // Currently there are no other types, uncomment when there are + // if ('includes' in obj) { + return env[obj.env] && env[obj.env].includes(obj.includes) + // } + } + + if ('any' in obj) { + return obj.any.some(function (k) { + return !!env[k] + }) + } + + return Object.keys(obj).every(function (k) { + return env[k] === obj[k] + }) +} + +function checkPR (vendor) { + switch (typeof vendor.pr) { + case 'string': + // "pr": "CIRRUS_PR" + return !!env[vendor.pr] + case 'object': + if ('env' in vendor.pr) { + if ('any' in vendor.pr) { + // "pr": { "env": "CODEBUILD_WEBHOOK_EVENT", "any": ["PULL_REQUEST_CREATED", "PULL_REQUEST_UPDATED"] } + return vendor.pr.any.some(function (key) { + return env[vendor.pr.env] === key + }) + } else { + // "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" } + return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne + } + } else if ('any' in vendor.pr) { + // "pr": { "any": ["ghprbPullId", "CHANGE_ID"] } + return vendor.pr.any.some(function (key) { + return !!env[key] + }) + } else { + // "pr": { "DRONE_BUILD_EVENT": "pull_request" } + return checkEnv(vendor.pr) + } + default: + // PR detection not supported for this vendor + return null + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8ce80ae1ee847313833a95c1fd2ffcdbf945d6a2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/package.json @@ -0,0 +1,54 @@ +{ + "name": "ci-info", + "version": "4.3.0", + "description": "Get details about the current Continuous Integration environment", + "main": "index.js", + "typings": "index.d.ts", + "type": "commonjs", + "author": "Thomas Watson Steen (https://twitter.com/wa7son)", + "license": "MIT", + "repository": "github:watson/ci-info", + "bugs": "https://github.com/watson/ci-info/issues", + "homepage": "https://github.com/watson/ci-info", + "contributors": [ + { + "name": "Sibiraj", + "url": "https://github.com/sibiraj-s" + } + ], + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "keywords": [ + "ci", + "continuous", + "integration", + "test", + "detect" + ], + "files": [ + "vendors.json", + "index.js", + "index.d.ts", + "CHANGELOG.md" + ], + "scripts": { + "build": "node sort-vendors.js && node create-typings.js", + "lint:fix": "standard --fix", + "test": "standard && node test.js", + "prepare": "husky install || true" + }, + "devDependencies": { + "clear-module": "^4.1.2", + "husky": "^9.1.7", + "publint": "^0.3.12", + "standard": "^17.1.2", + "tape": "^5.9.0" + }, + "engines": { + "node": ">=8" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/vendors.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/vendors.json new file mode 100644 index 0000000000000000000000000000000000000000..3505e1b533d3ff8d738c1f19e1f3f6cb416f8f27 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/ci-info/vendors.json @@ -0,0 +1,358 @@ +[ + { + "name": "Agola CI", + "constant": "AGOLA", + "env": "AGOLA_GIT_REF", + "pr": "AGOLA_PULL_REQUEST_ID" + }, + { + "name": "Appcircle", + "constant": "APPCIRCLE", + "env": "AC_APPCIRCLE", + "pr": { + "env": "AC_GIT_PR", + "ne": "false" + } + }, + { + "name": "AppVeyor", + "constant": "APPVEYOR", + "env": "APPVEYOR", + "pr": "APPVEYOR_PULL_REQUEST_NUMBER" + }, + { + "name": "AWS CodeBuild", + "constant": "CODEBUILD", + "env": "CODEBUILD_BUILD_ARN", + "pr": { + "env": "CODEBUILD_WEBHOOK_EVENT", + "any": [ + "PULL_REQUEST_CREATED", + "PULL_REQUEST_UPDATED", + "PULL_REQUEST_REOPENED" + ] + } + }, + { + "name": "Azure Pipelines", + "constant": "AZURE_PIPELINES", + "env": "TF_BUILD", + "pr": { + "BUILD_REASON": "PullRequest" + } + }, + { + "name": "Bamboo", + "constant": "BAMBOO", + "env": "bamboo_planKey" + }, + { + "name": "Bitbucket Pipelines", + "constant": "BITBUCKET", + "env": "BITBUCKET_COMMIT", + "pr": "BITBUCKET_PR_ID" + }, + { + "name": "Bitrise", + "constant": "BITRISE", + "env": "BITRISE_IO", + "pr": "BITRISE_PULL_REQUEST" + }, + { + "name": "Buddy", + "constant": "BUDDY", + "env": "BUDDY_WORKSPACE_ID", + "pr": "BUDDY_EXECUTION_PULL_REQUEST_ID" + }, + { + "name": "Buildkite", + "constant": "BUILDKITE", + "env": "BUILDKITE", + "pr": { + "env": "BUILDKITE_PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "CircleCI", + "constant": "CIRCLE", + "env": "CIRCLECI", + "pr": "CIRCLE_PULL_REQUEST" + }, + { + "name": "Cirrus CI", + "constant": "CIRRUS", + "env": "CIRRUS_CI", + "pr": "CIRRUS_PR" + }, + { + "name": "Cloudflare Pages", + "constant": "CLOUDFLARE_PAGES", + "env": "CF_PAGES" + }, + { + "name": "Cloudflare Workers", + "constant": "CLOUDFLARE_WORKERS", + "env": "WORKERS_CI" + }, + { + "name": "Codefresh", + "constant": "CODEFRESH", + "env": "CF_BUILD_ID", + "pr": { + "any": [ + "CF_PULL_REQUEST_NUMBER", + "CF_PULL_REQUEST_ID" + ] + } + }, + { + "name": "Codemagic", + "constant": "CODEMAGIC", + "env": "CM_BUILD_ID", + "pr": "CM_PULL_REQUEST" + }, + { + "name": "Codeship", + "constant": "CODESHIP", + "env": { + "CI_NAME": "codeship" + } + }, + { + "name": "Drone", + "constant": "DRONE", + "env": "DRONE", + "pr": { + "DRONE_BUILD_EVENT": "pull_request" + } + }, + { + "name": "dsari", + "constant": "DSARI", + "env": "DSARI" + }, + { + "name": "Earthly", + "constant": "EARTHLY", + "env": "EARTHLY_CI" + }, + { + "name": "Expo Application Services", + "constant": "EAS", + "env": "EAS_BUILD" + }, + { + "name": "Gerrit", + "constant": "GERRIT", + "env": "GERRIT_PROJECT" + }, + { + "name": "Gitea Actions", + "constant": "GITEA_ACTIONS", + "env": "GITEA_ACTIONS" + }, + { + "name": "GitHub Actions", + "constant": "GITHUB_ACTIONS", + "env": "GITHUB_ACTIONS", + "pr": { + "GITHUB_EVENT_NAME": "pull_request" + } + }, + { + "name": "GitLab CI", + "constant": "GITLAB", + "env": "GITLAB_CI", + "pr": "CI_MERGE_REQUEST_ID" + }, + { + "name": "GoCD", + "constant": "GOCD", + "env": "GO_PIPELINE_LABEL" + }, + { + "name": "Google Cloud Build", + "constant": "GOOGLE_CLOUD_BUILD", + "env": "BUILDER_OUTPUT" + }, + { + "name": "Harness CI", + "constant": "HARNESS", + "env": "HARNESS_BUILD_ID" + }, + { + "name": "Heroku", + "constant": "HEROKU", + "env": { + "env": "NODE", + "includes": "/app/.heroku/node/bin/node" + } + }, + { + "name": "Hudson", + "constant": "HUDSON", + "env": "HUDSON_URL" + }, + { + "name": "Jenkins", + "constant": "JENKINS", + "env": [ + "JENKINS_URL", + "BUILD_ID" + ], + "pr": { + "any": [ + "ghprbPullId", + "CHANGE_ID" + ] + } + }, + { + "name": "LayerCI", + "constant": "LAYERCI", + "env": "LAYERCI", + "pr": "LAYERCI_PULL_REQUEST" + }, + { + "name": "Magnum CI", + "constant": "MAGNUM", + "env": "MAGNUM" + }, + { + "name": "Netlify CI", + "constant": "NETLIFY", + "env": "NETLIFY", + "pr": { + "env": "PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "Nevercode", + "constant": "NEVERCODE", + "env": "NEVERCODE", + "pr": { + "env": "NEVERCODE_PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "Prow", + "constant": "PROW", + "env": "PROW_JOB_ID" + }, + { + "name": "ReleaseHub", + "constant": "RELEASEHUB", + "env": "RELEASE_BUILD_ID" + }, + { + "name": "Render", + "constant": "RENDER", + "env": "RENDER", + "pr": { + "IS_PULL_REQUEST": "true" + } + }, + { + "name": "Sail CI", + "constant": "SAIL", + "env": "SAILCI", + "pr": "SAIL_PULL_REQUEST_NUMBER" + }, + { + "name": "Screwdriver", + "constant": "SCREWDRIVER", + "env": "SCREWDRIVER", + "pr": { + "env": "SD_PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "Semaphore", + "constant": "SEMAPHORE", + "env": "SEMAPHORE", + "pr": "PULL_REQUEST_NUMBER" + }, + { + "name": "Sourcehut", + "constant": "SOURCEHUT", + "env": { + "CI_NAME": "sourcehut" + } + }, + { + "name": "Strider CD", + "constant": "STRIDER", + "env": "STRIDER" + }, + { + "name": "TaskCluster", + "constant": "TASKCLUSTER", + "env": [ + "TASK_ID", + "RUN_ID" + ] + }, + { + "name": "TeamCity", + "constant": "TEAMCITY", + "env": "TEAMCITY_VERSION" + }, + { + "name": "Travis CI", + "constant": "TRAVIS", + "env": "TRAVIS", + "pr": { + "env": "TRAVIS_PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "Vela", + "constant": "VELA", + "env": "VELA", + "pr": { + "VELA_PULL_REQUEST": "1" + } + }, + { + "name": "Vercel", + "constant": "VERCEL", + "env": { + "any": [ + "NOW_BUILDER", + "VERCEL" + ] + }, + "pr": "VERCEL_GIT_PULL_REQUEST_ID" + }, + { + "name": "Visual Studio App Center", + "constant": "APPCENTER", + "env": "APPCENTER_BUILD_ID" + }, + { + "name": "Woodpecker", + "constant": "WOODPECKER", + "env": { + "CI": "woodpecker" + }, + "pr": { + "CI_BUILD_EVENT": "pull_request" + } + }, + { + "name": "Xcode Cloud", + "constant": "XCODE_CLOUD", + "env": "CI_XCODE_PROJECT", + "pr": "CI_PULL_REQUEST_NUMBER" + }, + { + "name": "Xcode Server", + "constant": "XCODE_SERVER", + "env": "XCS" + } +] diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..41e3192ae9f3a71609a22ef89c011b70e1d8cbb9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/index.d.ts @@ -0,0 +1,137 @@ +import {Options as LocatePathOptions} from 'locate-path'; + +declare const stop: unique symbol; + +declare namespace findUp { + interface Options extends LocatePathOptions {} + + type StopSymbol = typeof stop; + + type Match = string | StopSymbol | undefined; +} + +declare const findUp: { + /** + Find a file or directory by walking up parent directories. + + @param name - Name of the file or directory to find. Can be multiple. + @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. + + @example + ``` + // / + // └── Users + // └── sindresorhus + // ├── unicorn.png + // └── foo + // └── bar + // ├── baz + // └── example.js + + // example.js + import findUp = require('find-up'); + + (async () => { + console.log(await findUp('unicorn.png')); + //=> '/Users/sindresorhus/unicorn.png' + + console.log(await findUp(['rainbow.png', 'unicorn.png'])); + //=> '/Users/sindresorhus/unicorn.png' + })(); + ``` + */ + (name: string | string[], options?: findUp.Options): Promise; + + /** + Find a file or directory by walking up parent directories. + + @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search. + @returns The first path found or `undefined` if none could be found. + + @example + ``` + import path = require('path'); + import findUp = require('find-up'); + + (async () => { + console.log(await findUp(async directory => { + const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; + }, {type: 'directory'})); + //=> '/Users/sindresorhus' + })(); + ``` + */ + (matcher: (directory: string) => (findUp.Match | Promise), options?: findUp.Options): Promise; + + sync: { + /** + Synchronously find a file or directory by walking up parent directories. + + @param name - Name of the file or directory to find. Can be multiple. + @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. + */ + (name: string | string[], options?: findUp.Options): string | undefined; + + /** + Synchronously find a file or directory by walking up parent directories. + + @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search. + @returns The first path found or `undefined` if none could be found. + + @example + ``` + import path = require('path'); + import findUp = require('find-up'); + + console.log(findUp.sync(directory => { + const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; + }, {type: 'directory'})); + //=> '/Users/sindresorhus' + ``` + */ + (matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined; + + /** + Synchronously check if a path exists. + + @param path - Path to the file or directory. + @returns Whether the path exists. + + @example + ``` + import findUp = require('find-up'); + + console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png')); + //=> true + ``` + */ + exists(path: string): boolean; + } + + /** + Check if a path exists. + + @param path - Path to a file or directory. + @returns Whether the path exists. + + @example + ``` + import findUp = require('find-up'); + + (async () => { + console.log(await findUp.exists('/Users/sindresorhus/unicorn.png')); + //=> true + })(); + ``` + */ + exists(path: string): Promise; + + /** + Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`. + */ + readonly stop: findUp.StopSymbol; +}; + +export = findUp; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ce564e5d322847ed088eba6d0973c19da3b4426d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/index.js @@ -0,0 +1,89 @@ +'use strict'; +const path = require('path'); +const locatePath = require('locate-path'); +const pathExists = require('path-exists'); + +const stop = Symbol('findUp.stop'); + +module.exports = async (name, options = {}) => { + let directory = path.resolve(options.cwd || ''); + const {root} = path.parse(directory); + const paths = [].concat(name); + + const runMatcher = async locateOptions => { + if (typeof name !== 'function') { + return locatePath(paths, locateOptions); + } + + const foundPath = await name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePath([foundPath], locateOptions); + } + + return foundPath; + }; + + // eslint-disable-next-line no-constant-condition + while (true) { + // eslint-disable-next-line no-await-in-loop + const foundPath = await runMatcher({...options, cwd: directory}); + + if (foundPath === stop) { + return; + } + + if (foundPath) { + return path.resolve(directory, foundPath); + } + + if (directory === root) { + return; + } + + directory = path.dirname(directory); + } +}; + +module.exports.sync = (name, options = {}) => { + let directory = path.resolve(options.cwd || ''); + const {root} = path.parse(directory); + const paths = [].concat(name); + + const runMatcher = locateOptions => { + if (typeof name !== 'function') { + return locatePath.sync(paths, locateOptions); + } + + const foundPath = name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePath.sync([foundPath], locateOptions); + } + + return foundPath; + }; + + // eslint-disable-next-line no-constant-condition + while (true) { + const foundPath = runMatcher({...options, cwd: directory}); + + if (foundPath === stop) { + return; + } + + if (foundPath) { + return path.resolve(directory, foundPath); + } + + if (directory === root) { + return; + } + + directory = path.dirname(directory); + } +}; + +module.exports.exists = pathExists; + +module.exports.sync.exists = pathExists.sync; + +module.exports.stop = stop; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/package.json new file mode 100644 index 0000000000000000000000000000000000000000..cd50281eb29a9b2d69d7917e4be8fe9995ac250d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/package.json @@ -0,0 +1,53 @@ +{ + "name": "find-up", + "version": "4.1.0", + "description": "Find a file or directory by walking up parent directories", + "license": "MIT", + "repository": "sindresorhus/find-up", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "package", + "resolve", + "parent", + "parents", + "folder", + "directory", + "walk", + "walking", + "path" + ], + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "devDependencies": { + "ava": "^2.1.0", + "is-path-inside": "^2.1.0", + "tempy": "^0.3.0", + "tsd": "^0.7.3", + "xo": "^0.24.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..d6a21e525988e8ac8e95a1add7a45bf4e2bc6aff --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/find-up/readme.md @@ -0,0 +1,156 @@ +# find-up [![Build Status](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) + +> Find a file or directory by walking up parent directories + + +## Install + +``` +$ npm install find-up +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + ├── unicorn.png + └── foo + └── bar + ├── baz + └── example.js +``` + +`example.js` + +```js +const path = require('path'); +const findUp = require('find-up'); + +(async () => { + console.log(await findUp('unicorn.png')); + //=> '/Users/sindresorhus/unicorn.png' + + console.log(await findUp(['rainbow.png', 'unicorn.png'])); + //=> '/Users/sindresorhus/unicorn.png' + + console.log(await findUp(async directory => { + const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; + }, {type: 'directory'})); + //=> '/Users/sindresorhus' +})(); +``` + + +## API + +### findUp(name, options?) +### findUp(matcher, options?) + +Returns a `Promise` for either the path or `undefined` if it couldn't be found. + +### findUp([...name], options?) + +Returns a `Promise` for either the first path found (by respecting the order of the array) or `undefined` if none could be found. + +### findUp.sync(name, options?) +### findUp.sync(matcher, options?) + +Returns a path or `undefined` if it couldn't be found. + +### findUp.sync([...name], options?) + +Returns the first path found (by respecting the order of the array) or `undefined` if none could be found. + +#### name + +Type: `string` + +Name of the file or directory to find. + +#### matcher + +Type: `Function` + +A function that will be called with each directory until it returns a `string` with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use-cases. + +When using async mode, the `matcher` may optionally be an async or promise-returning function that returns the path. + +#### options + +Type: `object` + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Directory to start from. + +##### type + +Type: `string`
+Default: `'file'`
+Values: `'file'` `'directory'` + +The type of paths that can match. + +##### allowSymlinks + +Type: `boolean`
+Default: `true` + +Allow symbolic links to match if they point to the chosen path type. + +### findUp.exists(path) + +Returns a `Promise` of whether the path exists. + +### findUp.sync.exists(path) + +Returns a `boolean` of whether the path exists. + +#### path + +Type: `string` + +Path to a file or directory. + +### findUp.stop + +A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem. + +```js +const path = require('path'); +const findUp = require('find-up'); + +(async () => { + await findUp(directory => { + return path.basename(directory) === 'work' ? findUp.stop : 'logo.png'; + }); +})(); +``` + + +## Related + +- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package +- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path + + +--- + +
+ + Get professional support for 'find-up' with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/globals.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/globals.json new file mode 100644 index 0000000000000000000000000000000000000000..11e5c0a637860423f8afefa97b3e1bb9ffd45f9c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/globals.json @@ -0,0 +1,2999 @@ +{ + "amd": { + "define": false, + "require": false + }, + "applescript": { + "$": false, + "Application": false, + "Automation": false, + "console": false, + "delay": false, + "Library": false, + "ObjC": false, + "ObjectSpecifier": false, + "Path": false, + "Progress": false, + "Ref": false + }, + "atomtest": { + "advanceClock": false, + "atom": false, + "fakeClearInterval": false, + "fakeClearTimeout": false, + "fakeSetInterval": false, + "fakeSetTimeout": false, + "resetTimeouts": false, + "waitsForPromise": false + }, + "browser": { + "AbortController": false, + "AbortSignal": false, + "AbsoluteOrientationSensor": false, + "AbstractRange": false, + "Accelerometer": false, + "addEventListener": false, + "ai": false, + "AI": false, + "AITextSession": false, + "alert": false, + "AnalyserNode": false, + "Animation": false, + "AnimationEffect": false, + "AnimationEvent": false, + "AnimationPlaybackEvent": false, + "AnimationTimeline": false, + "atob": false, + "Attr": false, + "Audio": false, + "AudioBuffer": false, + "AudioBufferSourceNode": false, + "AudioContext": false, + "AudioData": false, + "AudioDecoder": false, + "AudioDestinationNode": false, + "AudioEncoder": false, + "AudioListener": false, + "AudioNode": false, + "AudioParam": false, + "AudioParamMap": false, + "AudioProcessingEvent": false, + "AudioScheduledSourceNode": false, + "AudioSinkInfo": false, + "AudioWorklet": false, + "AudioWorkletGlobalScope": false, + "AudioWorkletNode": false, + "AudioWorkletProcessor": false, + "AuthenticatorAssertionResponse": false, + "AuthenticatorAttestationResponse": false, + "AuthenticatorResponse": false, + "BackgroundFetchManager": false, + "BackgroundFetchRecord": false, + "BackgroundFetchRegistration": false, + "BarcodeDetector": false, + "BarProp": false, + "BaseAudioContext": false, + "BatteryManager": false, + "BeforeUnloadEvent": false, + "BiquadFilterNode": false, + "Blob": false, + "BlobEvent": false, + "Bluetooth": false, + "BluetoothCharacteristicProperties": false, + "BluetoothDevice": false, + "BluetoothRemoteGATTCharacteristic": false, + "BluetoothRemoteGATTDescriptor": false, + "BluetoothRemoteGATTServer": false, + "BluetoothRemoteGATTService": false, + "BluetoothUUID": false, + "blur": false, + "BroadcastChannel": false, + "BrowserCaptureMediaStreamTrack": false, + "btoa": false, + "ByteLengthQueuingStrategy": false, + "Cache": false, + "caches": false, + "CacheStorage": false, + "cancelAnimationFrame": false, + "cancelIdleCallback": false, + "CanvasCaptureMediaStream": false, + "CanvasCaptureMediaStreamTrack": false, + "CanvasGradient": false, + "CanvasPattern": false, + "CanvasRenderingContext2D": false, + "CaptureController": false, + "CaretPosition": false, + "CDATASection": false, + "ChannelMergerNode": false, + "ChannelSplitterNode": false, + "ChapterInformation": false, + "CharacterBoundsUpdateEvent": false, + "CharacterData": false, + "clearInterval": false, + "clearTimeout": false, + "clientInformation": false, + "Clipboard": false, + "ClipboardEvent": false, + "ClipboardItem": false, + "close": false, + "closed": false, + "CloseEvent": false, + "CloseWatcher": false, + "Comment": false, + "CompositionEvent": false, + "CompressionStream": false, + "confirm": false, + "console": false, + "ConstantSourceNode": false, + "ContentVisibilityAutoStateChangeEvent": false, + "ConvolverNode": false, + "CookieChangeEvent": false, + "CookieDeprecationLabel": false, + "cookieStore": false, + "CookieStore": false, + "CookieStoreManager": false, + "CountQueuingStrategy": false, + "createImageBitmap": false, + "Credential": false, + "credentialless": false, + "CredentialsContainer": false, + "CropTarget": false, + "crossOriginIsolated": false, + "crypto": false, + "Crypto": false, + "CryptoKey": false, + "CSS": false, + "CSSAnimation": false, + "CSSConditionRule": false, + "CSSContainerRule": false, + "CSSCounterStyleRule": false, + "CSSFontFaceRule": false, + "CSSFontFeatureValuesRule": false, + "CSSFontPaletteValuesRule": false, + "CSSGroupingRule": false, + "CSSImageValue": false, + "CSSImportRule": false, + "CSSKeyframeRule": false, + "CSSKeyframesRule": false, + "CSSKeywordValue": false, + "CSSLayerBlockRule": false, + "CSSLayerStatementRule": false, + "CSSMarginRule": false, + "CSSMathClamp": false, + "CSSMathInvert": false, + "CSSMathMax": false, + "CSSMathMin": false, + "CSSMathNegate": false, + "CSSMathProduct": false, + "CSSMathSum": false, + "CSSMathValue": false, + "CSSMatrixComponent": false, + "CSSMediaRule": false, + "CSSNamespaceRule": false, + "CSSNestedDeclarations": false, + "CSSNumericArray": false, + "CSSNumericValue": false, + "CSSPageDescriptors": false, + "CSSPageRule": false, + "CSSPerspective": false, + "CSSPositionTryDescriptors": false, + "CSSPositionTryRule": false, + "CSSPositionValue": false, + "CSSPropertyRule": false, + "CSSRotate": false, + "CSSRule": false, + "CSSRuleList": false, + "CSSScale": false, + "CSSScopeRule": false, + "CSSSkew": false, + "CSSSkewX": false, + "CSSSkewY": false, + "CSSStartingStyleRule": false, + "CSSStyleDeclaration": false, + "CSSStyleRule": false, + "CSSStyleSheet": false, + "CSSStyleValue": false, + "CSSSupportsRule": false, + "CSSTransformComponent": false, + "CSSTransformValue": false, + "CSSTransition": false, + "CSSTranslate": false, + "CSSUnitValue": false, + "CSSUnparsedValue": false, + "CSSVariableReferenceValue": false, + "CSSViewTransitionRule": false, + "currentFrame": false, + "currentTime": false, + "CustomElementRegistry": false, + "customElements": false, + "CustomEvent": false, + "CustomStateSet": false, + "DataTransfer": false, + "DataTransferItem": false, + "DataTransferItemList": false, + "DecompressionStream": false, + "DelayNode": false, + "DelegatedInkTrailPresenter": false, + "DeviceMotionEvent": false, + "DeviceMotionEventAcceleration": false, + "DeviceMotionEventRotationRate": false, + "DeviceOrientationEvent": false, + "devicePixelRatio": false, + "dispatchEvent": false, + "document": false, + "Document": false, + "DocumentFragment": false, + "documentPictureInPicture": false, + "DocumentPictureInPicture": false, + "DocumentPictureInPictureEvent": false, + "DocumentTimeline": false, + "DocumentType": false, + "DOMError": false, + "DOMException": false, + "DOMImplementation": false, + "DOMMatrix": false, + "DOMMatrixReadOnly": false, + "DOMParser": false, + "DOMPoint": false, + "DOMPointReadOnly": false, + "DOMQuad": false, + "DOMRect": false, + "DOMRectList": false, + "DOMRectReadOnly": false, + "DOMStringList": false, + "DOMStringMap": false, + "DOMTokenList": false, + "DragEvent": false, + "DynamicsCompressorNode": false, + "EditContext": false, + "Element": false, + "ElementInternals": false, + "EncodedAudioChunk": false, + "EncodedVideoChunk": false, + "ErrorEvent": false, + "event": false, + "Event": false, + "EventCounts": false, + "EventSource": false, + "EventTarget": false, + "external": false, + "External": false, + "EyeDropper": false, + "FeaturePolicy": false, + "FederatedCredential": false, + "fence": false, + "Fence": false, + "FencedFrameConfig": false, + "fetch": false, + "fetchLater": false, + "FetchLaterResult": false, + "File": false, + "FileList": false, + "FileReader": false, + "FileSystem": false, + "FileSystemDirectoryEntry": false, + "FileSystemDirectoryHandle": false, + "FileSystemDirectoryReader": false, + "FileSystemEntry": false, + "FileSystemFileEntry": false, + "FileSystemFileHandle": false, + "FileSystemHandle": false, + "FileSystemWritableFileStream": false, + "find": false, + "Float16Array": false, + "focus": false, + "FocusEvent": false, + "FontData": false, + "FontFace": false, + "FontFaceSet": false, + "FontFaceSetLoadEvent": false, + "FormData": false, + "FormDataEvent": false, + "FragmentDirective": false, + "frameElement": false, + "frames": false, + "GainNode": false, + "Gamepad": false, + "GamepadAxisMoveEvent": false, + "GamepadButton": false, + "GamepadButtonEvent": false, + "GamepadEvent": false, + "GamepadHapticActuator": false, + "GamepadPose": false, + "Geolocation": false, + "GeolocationCoordinates": false, + "GeolocationPosition": false, + "GeolocationPositionError": false, + "getComputedStyle": false, + "getScreenDetails": false, + "getSelection": false, + "GPU": false, + "GPUAdapter": false, + "GPUAdapterInfo": false, + "GPUBindGroup": false, + "GPUBindGroupLayout": false, + "GPUBuffer": false, + "GPUBufferUsage": false, + "GPUCanvasContext": false, + "GPUColorWrite": false, + "GPUCommandBuffer": false, + "GPUCommandEncoder": false, + "GPUCompilationInfo": false, + "GPUCompilationMessage": false, + "GPUComputePassEncoder": false, + "GPUComputePipeline": false, + "GPUDevice": false, + "GPUDeviceLostInfo": false, + "GPUError": false, + "GPUExternalTexture": false, + "GPUInternalError": false, + "GPUMapMode": false, + "GPUOutOfMemoryError": false, + "GPUPipelineError": false, + "GPUPipelineLayout": false, + "GPUQuerySet": false, + "GPUQueue": false, + "GPURenderBundle": false, + "GPURenderBundleEncoder": false, + "GPURenderPassEncoder": false, + "GPURenderPipeline": false, + "GPUSampler": false, + "GPUShaderModule": false, + "GPUShaderStage": false, + "GPUSupportedFeatures": false, + "GPUSupportedLimits": false, + "GPUTexture": false, + "GPUTextureUsage": false, + "GPUTextureView": false, + "GPUUncapturedErrorEvent": false, + "GPUValidationError": false, + "GravitySensor": false, + "Gyroscope": false, + "HashChangeEvent": false, + "Headers": false, + "HID": false, + "HIDConnectionEvent": false, + "HIDDevice": false, + "HIDInputReportEvent": false, + "Highlight": false, + "HighlightRegistry": false, + "history": false, + "History": false, + "HTMLAllCollection": false, + "HTMLAnchorElement": false, + "HTMLAreaElement": false, + "HTMLAudioElement": false, + "HTMLBaseElement": false, + "HTMLBodyElement": false, + "HTMLBRElement": false, + "HTMLButtonElement": false, + "HTMLCanvasElement": false, + "HTMLCollection": false, + "HTMLDataElement": false, + "HTMLDataListElement": false, + "HTMLDetailsElement": false, + "HTMLDialogElement": false, + "HTMLDirectoryElement": false, + "HTMLDivElement": false, + "HTMLDListElement": false, + "HTMLDocument": false, + "HTMLElement": false, + "HTMLEmbedElement": false, + "HTMLFencedFrameElement": false, + "HTMLFieldSetElement": false, + "HTMLFontElement": false, + "HTMLFormControlsCollection": false, + "HTMLFormElement": false, + "HTMLFrameElement": false, + "HTMLFrameSetElement": false, + "HTMLHeadElement": false, + "HTMLHeadingElement": false, + "HTMLHRElement": false, + "HTMLHtmlElement": false, + "HTMLIFrameElement": false, + "HTMLImageElement": false, + "HTMLInputElement": false, + "HTMLLabelElement": false, + "HTMLLegendElement": false, + "HTMLLIElement": false, + "HTMLLinkElement": false, + "HTMLMapElement": false, + "HTMLMarqueeElement": false, + "HTMLMediaElement": false, + "HTMLMenuElement": false, + "HTMLMetaElement": false, + "HTMLMeterElement": false, + "HTMLModElement": false, + "HTMLObjectElement": false, + "HTMLOListElement": false, + "HTMLOptGroupElement": false, + "HTMLOptionElement": false, + "HTMLOptionsCollection": false, + "HTMLOutputElement": false, + "HTMLParagraphElement": false, + "HTMLParamElement": false, + "HTMLPictureElement": false, + "HTMLPreElement": false, + "HTMLProgressElement": false, + "HTMLQuoteElement": false, + "HTMLScriptElement": false, + "HTMLSelectElement": false, + "HTMLSlotElement": false, + "HTMLSourceElement": false, + "HTMLSpanElement": false, + "HTMLStyleElement": false, + "HTMLTableCaptionElement": false, + "HTMLTableCellElement": false, + "HTMLTableColElement": false, + "HTMLTableElement": false, + "HTMLTableRowElement": false, + "HTMLTableSectionElement": false, + "HTMLTemplateElement": false, + "HTMLTextAreaElement": false, + "HTMLTimeElement": false, + "HTMLTitleElement": false, + "HTMLTrackElement": false, + "HTMLUListElement": false, + "HTMLUnknownElement": false, + "HTMLVideoElement": false, + "IDBCursor": false, + "IDBCursorWithValue": false, + "IDBDatabase": false, + "IDBFactory": false, + "IDBIndex": false, + "IDBKeyRange": false, + "IDBObjectStore": false, + "IDBOpenDBRequest": false, + "IDBRequest": false, + "IDBTransaction": false, + "IDBVersionChangeEvent": false, + "IdentityCredential": false, + "IdentityCredentialError": false, + "IdentityProvider": false, + "IdleDeadline": false, + "IdleDetector": false, + "IIRFilterNode": false, + "Image": false, + "ImageBitmap": false, + "ImageBitmapRenderingContext": false, + "ImageCapture": false, + "ImageData": false, + "ImageDecoder": false, + "ImageTrack": false, + "ImageTrackList": false, + "indexedDB": false, + "Ink": false, + "innerHeight": false, + "innerWidth": false, + "InputDeviceCapabilities": false, + "InputDeviceInfo": false, + "InputEvent": false, + "IntersectionObserver": false, + "IntersectionObserverEntry": false, + "isSecureContext": false, + "Keyboard": false, + "KeyboardEvent": false, + "KeyboardLayoutMap": false, + "KeyframeEffect": false, + "LargestContentfulPaint": false, + "LaunchParams": false, + "launchQueue": false, + "LaunchQueue": false, + "LayoutShift": false, + "LayoutShiftAttribution": false, + "length": false, + "LinearAccelerationSensor": false, + "localStorage": false, + "location": true, + "Location": false, + "locationbar": false, + "Lock": false, + "LockManager": false, + "matchMedia": false, + "MathMLElement": false, + "MediaCapabilities": false, + "MediaCapabilitiesInfo": false, + "MediaDeviceInfo": false, + "MediaDevices": false, + "MediaElementAudioSourceNode": false, + "MediaEncryptedEvent": false, + "MediaError": false, + "MediaKeyError": false, + "MediaKeyMessageEvent": false, + "MediaKeys": false, + "MediaKeySession": false, + "MediaKeyStatusMap": false, + "MediaKeySystemAccess": false, + "MediaList": false, + "MediaMetadata": false, + "MediaQueryList": false, + "MediaQueryListEvent": false, + "MediaRecorder": false, + "MediaRecorderErrorEvent": false, + "MediaSession": false, + "MediaSource": false, + "MediaSourceHandle": false, + "MediaStream": false, + "MediaStreamAudioDestinationNode": false, + "MediaStreamAudioSourceNode": false, + "MediaStreamEvent": false, + "MediaStreamTrack": false, + "MediaStreamTrackAudioSourceNode": false, + "MediaStreamTrackAudioStats": false, + "MediaStreamTrackEvent": false, + "MediaStreamTrackGenerator": false, + "MediaStreamTrackProcessor": false, + "MediaStreamTrackVideoStats": false, + "menubar": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "MIDIAccess": false, + "MIDIConnectionEvent": false, + "MIDIInput": false, + "MIDIInputMap": false, + "MIDIMessageEvent": false, + "MIDIOutput": false, + "MIDIOutputMap": false, + "MIDIPort": false, + "MimeType": false, + "MimeTypeArray": false, + "model": false, + "ModelGenericSession": false, + "ModelManager": false, + "MouseEvent": false, + "moveBy": false, + "moveTo": false, + "MutationEvent": false, + "MutationObserver": false, + "MutationRecord": false, + "name": false, + "NamedNodeMap": false, + "NavigateEvent": false, + "navigation": false, + "Navigation": false, + "NavigationActivation": false, + "NavigationCurrentEntryChangeEvent": false, + "NavigationDestination": false, + "NavigationHistoryEntry": false, + "NavigationPreloadManager": false, + "NavigationTransition": false, + "navigator": false, + "Navigator": false, + "NavigatorLogin": false, + "NavigatorManagedData": false, + "NavigatorUAData": false, + "NetworkInformation": false, + "Node": false, + "NodeFilter": false, + "NodeIterator": false, + "NodeList": false, + "Notification": false, + "NotifyPaintEvent": false, + "NotRestoredReasonDetails": false, + "NotRestoredReasons": false, + "OfflineAudioCompletionEvent": false, + "OfflineAudioContext": false, + "offscreenBuffering": false, + "OffscreenCanvas": false, + "OffscreenCanvasRenderingContext2D": false, + "onabort": true, + "onafterprint": true, + "onanimationcancel": true, + "onanimationend": true, + "onanimationiteration": true, + "onanimationstart": true, + "onappinstalled": true, + "onauxclick": true, + "onbeforeinput": true, + "onbeforeinstallprompt": true, + "onbeforematch": true, + "onbeforeprint": true, + "onbeforetoggle": true, + "onbeforeunload": true, + "onbeforexrselect": true, + "onblur": true, + "oncancel": true, + "oncanplay": true, + "oncanplaythrough": true, + "onchange": true, + "onclick": true, + "onclose": true, + "oncontentvisibilityautostatechange": true, + "oncontextlost": true, + "oncontextmenu": true, + "oncontextrestored": true, + "oncopy": true, + "oncuechange": true, + "oncut": true, + "ondblclick": true, + "ondevicemotion": true, + "ondeviceorientation": true, + "ondeviceorientationabsolute": true, + "ondrag": true, + "ondragend": true, + "ondragenter": true, + "ondragleave": true, + "ondragover": true, + "ondragstart": true, + "ondrop": true, + "ondurationchange": true, + "onemptied": true, + "onended": true, + "onerror": true, + "onfocus": true, + "onformdata": true, + "ongamepadconnected": true, + "ongamepaddisconnected": true, + "ongotpointercapture": true, + "onhashchange": true, + "oninput": true, + "oninvalid": true, + "onkeydown": true, + "onkeypress": true, + "onkeyup": true, + "onlanguagechange": true, + "onload": true, + "onloadeddata": true, + "onloadedmetadata": true, + "onloadstart": true, + "onlostpointercapture": true, + "onmessage": true, + "onmessageerror": true, + "onmousedown": true, + "onmouseenter": true, + "onmouseleave": true, + "onmousemove": true, + "onmouseout": true, + "onmouseover": true, + "onmouseup": true, + "onmousewheel": true, + "onoffline": true, + "ononline": true, + "onpagehide": true, + "onpagereveal": true, + "onpageshow": true, + "onpageswap": true, + "onpaste": true, + "onpause": true, + "onplay": true, + "onplaying": true, + "onpointercancel": true, + "onpointerdown": true, + "onpointerenter": true, + "onpointerleave": true, + "onpointermove": true, + "onpointerout": true, + "onpointerover": true, + "onpointerrawupdate": true, + "onpointerup": true, + "onpopstate": true, + "onprogress": true, + "onratechange": true, + "onrejectionhandled": true, + "onreset": true, + "onresize": true, + "onscroll": true, + "onscrollend": true, + "onscrollsnapchange": true, + "onscrollsnapchanging": true, + "onsearch": true, + "onsecuritypolicyviolation": true, + "onseeked": true, + "onseeking": true, + "onselect": true, + "onselectionchange": true, + "onselectstart": true, + "onslotchange": true, + "onstalled": true, + "onstorage": true, + "onsubmit": true, + "onsuspend": true, + "ontimeupdate": true, + "ontoggle": true, + "ontransitioncancel": true, + "ontransitionend": true, + "ontransitionrun": true, + "ontransitionstart": true, + "onunhandledrejection": true, + "onunload": true, + "onvolumechange": true, + "onwaiting": true, + "onwheel": true, + "open": false, + "opener": false, + "Option": false, + "OrientationSensor": false, + "origin": false, + "originAgentCluster": false, + "OscillatorNode": false, + "OTPCredential": false, + "outerHeight": false, + "outerWidth": false, + "OverconstrainedError": false, + "PageRevealEvent": false, + "PageSwapEvent": false, + "PageTransitionEvent": false, + "pageXOffset": false, + "pageYOffset": false, + "PannerNode": false, + "parent": false, + "PasswordCredential": false, + "Path2D": false, + "PaymentAddress": false, + "PaymentManager": false, + "PaymentMethodChangeEvent": false, + "PaymentRequest": false, + "PaymentRequestUpdateEvent": false, + "PaymentResponse": false, + "performance": false, + "Performance": false, + "PerformanceElementTiming": false, + "PerformanceEntry": false, + "PerformanceEventTiming": false, + "PerformanceLongAnimationFrameTiming": false, + "PerformanceLongTaskTiming": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceNavigation": false, + "PerformanceNavigationTiming": false, + "PerformanceObserver": false, + "PerformanceObserverEntryList": false, + "PerformancePaintTiming": false, + "PerformanceResourceTiming": false, + "PerformanceScriptTiming": false, + "PerformanceServerTiming": false, + "PerformanceTiming": false, + "PeriodicSyncManager": false, + "PeriodicWave": false, + "Permissions": false, + "PermissionStatus": false, + "PERSISTENT": false, + "personalbar": false, + "PictureInPictureEvent": false, + "PictureInPictureWindow": false, + "Plugin": false, + "PluginArray": false, + "PointerEvent": false, + "PopStateEvent": false, + "postMessage": false, + "Presentation": false, + "PresentationAvailability": false, + "PresentationConnection": false, + "PresentationConnectionAvailableEvent": false, + "PresentationConnectionCloseEvent": false, + "PresentationConnectionList": false, + "PresentationReceiver": false, + "PresentationRequest": false, + "PressureObserver": false, + "PressureRecord": false, + "print": false, + "ProcessingInstruction": false, + "Profiler": false, + "ProgressEvent": false, + "PromiseRejectionEvent": false, + "prompt": false, + "ProtectedAudience": false, + "PublicKeyCredential": false, + "PushManager": false, + "PushSubscription": false, + "PushSubscriptionOptions": false, + "queryLocalFonts": false, + "queueMicrotask": false, + "RadioNodeList": false, + "Range": false, + "ReadableByteStreamController": false, + "ReadableStream": false, + "ReadableStreamBYOBReader": false, + "ReadableStreamBYOBRequest": false, + "ReadableStreamDefaultController": false, + "ReadableStreamDefaultReader": false, + "registerProcessor": false, + "RelativeOrientationSensor": false, + "RemotePlayback": false, + "removeEventListener": false, + "reportError": false, + "ReportingObserver": false, + "Request": false, + "requestAnimationFrame": false, + "requestIdleCallback": false, + "resizeBy": false, + "ResizeObserver": false, + "ResizeObserverEntry": false, + "ResizeObserverSize": false, + "resizeTo": false, + "Response": false, + "RTCCertificate": false, + "RTCDataChannel": false, + "RTCDataChannelEvent": false, + "RTCDtlsTransport": false, + "RTCDTMFSender": false, + "RTCDTMFToneChangeEvent": false, + "RTCEncodedAudioFrame": false, + "RTCEncodedVideoFrame": false, + "RTCError": false, + "RTCErrorEvent": false, + "RTCIceCandidate": false, + "RTCIceTransport": false, + "RTCPeerConnection": false, + "RTCPeerConnectionIceErrorEvent": false, + "RTCPeerConnectionIceEvent": false, + "RTCRtpReceiver": false, + "RTCRtpScriptTransform": false, + "RTCRtpSender": false, + "RTCRtpTransceiver": false, + "RTCSctpTransport": false, + "RTCSessionDescription": false, + "RTCStatsReport": false, + "RTCTrackEvent": false, + "sampleRate": false, + "scheduler": false, + "Scheduler": false, + "Scheduling": false, + "screen": false, + "Screen": false, + "ScreenDetailed": false, + "ScreenDetails": false, + "screenLeft": false, + "ScreenOrientation": false, + "screenTop": false, + "screenX": false, + "screenY": false, + "ScriptProcessorNode": false, + "scroll": false, + "scrollbars": false, + "scrollBy": false, + "ScrollTimeline": false, + "scrollTo": false, + "scrollX": false, + "scrollY": false, + "SecurityPolicyViolationEvent": false, + "Selection": false, + "self": false, + "Sensor": false, + "SensorErrorEvent": false, + "Serial": false, + "SerialPort": false, + "ServiceWorker": false, + "ServiceWorkerContainer": false, + "ServiceWorkerRegistration": false, + "sessionStorage": false, + "setInterval": false, + "setTimeout": false, + "ShadowRoot": false, + "sharedStorage": false, + "SharedStorage": false, + "SharedStorageWorklet": false, + "SharedWorker": false, + "showDirectoryPicker": false, + "showOpenFilePicker": false, + "showSaveFilePicker": false, + "SnapEvent": false, + "SourceBuffer": false, + "SourceBufferList": false, + "speechSynthesis": false, + "SpeechSynthesis": false, + "SpeechSynthesisErrorEvent": false, + "SpeechSynthesisEvent": false, + "SpeechSynthesisUtterance": false, + "SpeechSynthesisVoice": false, + "StaticRange": false, + "status": false, + "statusbar": false, + "StereoPannerNode": false, + "stop": false, + "Storage": false, + "StorageBucket": false, + "StorageBucketManager": false, + "StorageEvent": false, + "StorageManager": false, + "structuredClone": false, + "styleMedia": false, + "StylePropertyMap": false, + "StylePropertyMapReadOnly": false, + "StyleSheet": false, + "StyleSheetList": false, + "SubmitEvent": false, + "SubtleCrypto": false, + "SVGAElement": false, + "SVGAngle": false, + "SVGAnimatedAngle": false, + "SVGAnimatedBoolean": false, + "SVGAnimatedEnumeration": false, + "SVGAnimatedInteger": false, + "SVGAnimatedLength": false, + "SVGAnimatedLengthList": false, + "SVGAnimatedNumber": false, + "SVGAnimatedNumberList": false, + "SVGAnimatedPreserveAspectRatio": false, + "SVGAnimatedRect": false, + "SVGAnimatedString": false, + "SVGAnimatedTransformList": false, + "SVGAnimateElement": false, + "SVGAnimateMotionElement": false, + "SVGAnimateTransformElement": false, + "SVGAnimationElement": false, + "SVGCircleElement": false, + "SVGClipPathElement": false, + "SVGComponentTransferFunctionElement": false, + "SVGDefsElement": false, + "SVGDescElement": false, + "SVGElement": false, + "SVGEllipseElement": false, + "SVGFEBlendElement": false, + "SVGFEColorMatrixElement": false, + "SVGFEComponentTransferElement": false, + "SVGFECompositeElement": false, + "SVGFEConvolveMatrixElement": false, + "SVGFEDiffuseLightingElement": false, + "SVGFEDisplacementMapElement": false, + "SVGFEDistantLightElement": false, + "SVGFEDropShadowElement": false, + "SVGFEFloodElement": false, + "SVGFEFuncAElement": false, + "SVGFEFuncBElement": false, + "SVGFEFuncGElement": false, + "SVGFEFuncRElement": false, + "SVGFEGaussianBlurElement": false, + "SVGFEImageElement": false, + "SVGFEMergeElement": false, + "SVGFEMergeNodeElement": false, + "SVGFEMorphologyElement": false, + "SVGFEOffsetElement": false, + "SVGFEPointLightElement": false, + "SVGFESpecularLightingElement": false, + "SVGFESpotLightElement": false, + "SVGFETileElement": false, + "SVGFETurbulenceElement": false, + "SVGFilterElement": false, + "SVGForeignObjectElement": false, + "SVGGElement": false, + "SVGGeometryElement": false, + "SVGGradientElement": false, + "SVGGraphicsElement": false, + "SVGImageElement": false, + "SVGLength": false, + "SVGLengthList": false, + "SVGLinearGradientElement": false, + "SVGLineElement": false, + "SVGMarkerElement": false, + "SVGMaskElement": false, + "SVGMatrix": false, + "SVGMetadataElement": false, + "SVGMPathElement": false, + "SVGNumber": false, + "SVGNumberList": false, + "SVGPathElement": false, + "SVGPatternElement": false, + "SVGPoint": false, + "SVGPointList": false, + "SVGPolygonElement": false, + "SVGPolylineElement": false, + "SVGPreserveAspectRatio": false, + "SVGRadialGradientElement": false, + "SVGRect": false, + "SVGRectElement": false, + "SVGScriptElement": false, + "SVGSetElement": false, + "SVGStopElement": false, + "SVGStringList": false, + "SVGStyleElement": false, + "SVGSVGElement": false, + "SVGSwitchElement": false, + "SVGSymbolElement": false, + "SVGTextContentElement": false, + "SVGTextElement": false, + "SVGTextPathElement": false, + "SVGTextPositioningElement": false, + "SVGTitleElement": false, + "SVGTransform": false, + "SVGTransformList": false, + "SVGTSpanElement": false, + "SVGUnitTypes": false, + "SVGUseElement": false, + "SVGViewElement": false, + "SyncManager": false, + "TaskAttributionTiming": false, + "TaskController": false, + "TaskPriorityChangeEvent": false, + "TaskSignal": false, + "TEMPORARY": false, + "Text": false, + "TextDecoder": false, + "TextDecoderStream": false, + "TextEncoder": false, + "TextEncoderStream": false, + "TextEvent": false, + "TextFormat": false, + "TextFormatUpdateEvent": false, + "TextMetrics": false, + "TextTrack": false, + "TextTrackCue": false, + "TextTrackCueList": false, + "TextTrackList": false, + "TextUpdateEvent": false, + "TimeEvent": false, + "TimeRanges": false, + "ToggleEvent": false, + "toolbar": false, + "top": false, + "Touch": false, + "TouchEvent": false, + "TouchList": false, + "TrackEvent": false, + "TransformStream": false, + "TransformStreamDefaultController": false, + "TransitionEvent": false, + "TreeWalker": false, + "TrustedHTML": false, + "TrustedScript": false, + "TrustedScriptURL": false, + "TrustedTypePolicy": false, + "TrustedTypePolicyFactory": false, + "trustedTypes": false, + "UIEvent": false, + "URL": false, + "URLPattern": false, + "URLSearchParams": false, + "USB": false, + "USBAlternateInterface": false, + "USBConfiguration": false, + "USBConnectionEvent": false, + "USBDevice": false, + "USBEndpoint": false, + "USBInterface": false, + "USBInTransferResult": false, + "USBIsochronousInTransferPacket": false, + "USBIsochronousInTransferResult": false, + "USBIsochronousOutTransferPacket": false, + "USBIsochronousOutTransferResult": false, + "USBOutTransferResult": false, + "UserActivation": false, + "ValidityState": false, + "VideoColorSpace": false, + "VideoDecoder": false, + "VideoEncoder": false, + "VideoFrame": false, + "VideoPlaybackQuality": false, + "ViewTimeline": false, + "ViewTransition": false, + "ViewTransitionTypeSet": false, + "VirtualKeyboard": false, + "VirtualKeyboardGeometryChangeEvent": false, + "VisibilityStateEntry": false, + "visualViewport": false, + "VisualViewport": false, + "VTTCue": false, + "VTTRegion": false, + "WakeLock": false, + "WakeLockSentinel": false, + "WaveShaperNode": false, + "WebAssembly": false, + "WebGL2RenderingContext": false, + "WebGLActiveInfo": false, + "WebGLBuffer": false, + "WebGLContextEvent": false, + "WebGLFramebuffer": false, + "WebGLObject": false, + "WebGLProgram": false, + "WebGLQuery": false, + "WebGLRenderbuffer": false, + "WebGLRenderingContext": false, + "WebGLSampler": false, + "WebGLShader": false, + "WebGLShaderPrecisionFormat": false, + "WebGLSync": false, + "WebGLTexture": false, + "WebGLTransformFeedback": false, + "WebGLUniformLocation": false, + "WebGLVertexArrayObject": false, + "WebSocket": false, + "WebSocketError": false, + "WebSocketStream": false, + "WebTransport": false, + "WebTransportBidirectionalStream": false, + "WebTransportDatagramDuplexStream": false, + "WebTransportError": false, + "WebTransportReceiveStream": false, + "WebTransportSendStream": false, + "WGSLLanguageFeatures": false, + "WheelEvent": false, + "window": false, + "Window": false, + "WindowControlsOverlay": false, + "WindowControlsOverlayGeometryChangeEvent": false, + "Worker": false, + "Worklet": false, + "WorkletGlobalScope": false, + "WritableStream": false, + "WritableStreamDefaultController": false, + "WritableStreamDefaultWriter": false, + "XMLDocument": false, + "XMLHttpRequest": false, + "XMLHttpRequestEventTarget": false, + "XMLHttpRequestUpload": false, + "XMLSerializer": false, + "XPathEvaluator": false, + "XPathExpression": false, + "XPathResult": false, + "XRAnchor": false, + "XRAnchorSet": false, + "XRBoundedReferenceSpace": false, + "XRCamera": false, + "XRCPUDepthInformation": false, + "XRDepthInformation": false, + "XRDOMOverlayState": false, + "XRFrame": false, + "XRHand": false, + "XRHitTestResult": false, + "XRHitTestSource": false, + "XRInputSource": false, + "XRInputSourceArray": false, + "XRInputSourceEvent": false, + "XRInputSourcesChangeEvent": false, + "XRJointPose": false, + "XRJointSpace": false, + "XRLayer": false, + "XRLightEstimate": false, + "XRLightProbe": false, + "XRPose": false, + "XRRay": false, + "XRReferenceSpace": false, + "XRReferenceSpaceEvent": false, + "XRRenderState": false, + "XRRigidTransform": false, + "XRSession": false, + "XRSessionEvent": false, + "XRSpace": false, + "XRSystem": false, + "XRTransientInputHitTestResult": false, + "XRTransientInputHitTestSource": false, + "XRView": false, + "XRViewerPose": false, + "XRViewport": false, + "XRWebGLBinding": false, + "XRWebGLDepthInformation": false, + "XRWebGLLayer": false, + "XSLTProcessor": false + }, + "builtin": { + "AggregateError": false, + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "FinalizationRegistry": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "Iterator": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakRef": false, + "WeakSet": false + }, + "chai": { + "assert": true, + "expect": true, + "should": true + }, + "commonjs": { + "exports": true, + "global": false, + "module": false, + "require": false + }, + "couch": { + "emit": false, + "exports": false, + "getRow": false, + "log": false, + "module": false, + "provides": false, + "require": false, + "respond": false, + "send": false, + "start": false, + "sum": false + }, + "devtools": { + "$": false, + "$_": false, + "$$": false, + "$0": false, + "$1": false, + "$2": false, + "$3": false, + "$4": false, + "$x": false, + "chrome": false, + "clear": false, + "copy": false, + "debug": false, + "dir": false, + "dirxml": false, + "getEventListeners": false, + "inspect": false, + "keys": false, + "monitor": false, + "monitorEvents": false, + "profile": false, + "profileEnd": false, + "queryObjects": false, + "table": false, + "undebug": false, + "unmonitor": false, + "unmonitorEvents": false, + "values": false + }, + "embertest": { + "andThen": false, + "click": false, + "currentPath": false, + "currentRouteName": false, + "currentURL": false, + "fillIn": false, + "find": false, + "findAll": false, + "findWithAssert": false, + "keyEvent": false, + "pauseTest": false, + "resumeTest": false, + "triggerEvent": false, + "visit": false, + "wait": false + }, + "es2015": { + "Array": false, + "ArrayBuffer": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakSet": false + }, + "es2016": { + "Array": false, + "ArrayBuffer": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakSet": false + }, + "es2017": { + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakSet": false + }, + "es2018": { + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakSet": false + }, + "es2019": { + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakSet": false + }, + "es2020": { + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakSet": false + }, + "es2021": { + "AggregateError": false, + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "FinalizationRegistry": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakRef": false, + "WeakSet": false + }, + "es2022": { + "AggregateError": false, + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "FinalizationRegistry": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakRef": false, + "WeakSet": false + }, + "es2023": { + "AggregateError": false, + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "FinalizationRegistry": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakRef": false, + "WeakSet": false + }, + "es2024": { + "AggregateError": false, + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "FinalizationRegistry": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakRef": false, + "WeakSet": false + }, + "es2025": { + "AggregateError": false, + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "FinalizationRegistry": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Intl": false, + "isFinite": false, + "isNaN": false, + "Iterator": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "WeakMap": false, + "WeakRef": false, + "WeakSet": false + }, + "es3": { + "Array": false, + "Boolean": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Function": false, + "Infinity": false, + "isFinite": false, + "isNaN": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "RangeError": false, + "ReferenceError": false, + "RegExp": false, + "String": false, + "SyntaxError": false, + "TypeError": false, + "undefined": false, + "unescape": false, + "URIError": false + }, + "es5": { + "Array": false, + "Boolean": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Function": false, + "Infinity": false, + "isFinite": false, + "isNaN": false, + "JSON": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "RangeError": false, + "ReferenceError": false, + "RegExp": false, + "String": false, + "SyntaxError": false, + "TypeError": false, + "undefined": false, + "unescape": false, + "URIError": false + }, + "greasemonkey": { + "cloneInto": false, + "createObjectIn": false, + "exportFunction": false, + "GM": false, + "GM_addElement": false, + "GM_addStyle": false, + "GM_addValueChangeListener": false, + "GM_deleteValue": false, + "GM_download": false, + "GM_getResourceText": false, + "GM_getResourceURL": false, + "GM_getTab": false, + "GM_getTabs": false, + "GM_getValue": false, + "GM_info": false, + "GM_listValues": false, + "GM_log": false, + "GM_notification": false, + "GM_openInTab": false, + "GM_registerMenuCommand": false, + "GM_removeValueChangeListener": false, + "GM_saveTab": false, + "GM_setClipboard": false, + "GM_setValue": false, + "GM_unregisterMenuCommand": false, + "GM_xmlhttpRequest": false, + "unsafeWindow": false + }, + "jasmine": { + "afterAll": false, + "afterEach": false, + "beforeAll": false, + "beforeEach": false, + "describe": false, + "expect": false, + "expectAsync": false, + "fail": false, + "fdescribe": false, + "fit": false, + "it": false, + "jasmine": false, + "pending": false, + "runs": false, + "spyOn": false, + "spyOnAllFunctions": false, + "spyOnProperty": false, + "waits": false, + "waitsFor": false, + "xdescribe": false, + "xit": false + }, + "jest": { + "afterAll": false, + "afterEach": false, + "beforeAll": false, + "beforeEach": false, + "describe": false, + "expect": false, + "fit": false, + "it": false, + "jest": false, + "test": false, + "xdescribe": false, + "xit": false, + "xtest": false + }, + "jquery": { + "$": false, + "jQuery": false + }, + "meteor": { + "$": false, + "Accounts": false, + "AccountsClient": false, + "AccountsCommon": false, + "AccountsServer": false, + "App": false, + "Assets": false, + "Blaze": false, + "check": false, + "Cordova": false, + "DDP": false, + "DDPRateLimiter": false, + "DDPServer": false, + "Deps": false, + "EJSON": false, + "Email": false, + "HTTP": false, + "Log": false, + "Match": false, + "Meteor": false, + "Mongo": false, + "MongoInternals": false, + "Npm": false, + "Package": false, + "Plugin": false, + "process": false, + "Random": false, + "ReactiveDict": false, + "ReactiveVar": false, + "Router": false, + "ServiceConfiguration": false, + "Session": false, + "share": false, + "Spacebars": false, + "Template": false, + "Tinytest": false, + "Tracker": false, + "UI": false, + "Utils": false, + "WebApp": false, + "WebAppInternals": false + }, + "mocha": { + "after": false, + "afterEach": false, + "before": false, + "beforeEach": false, + "context": false, + "describe": false, + "it": false, + "mocha": false, + "run": false, + "setup": false, + "specify": false, + "suite": false, + "suiteSetup": false, + "suiteTeardown": false, + "teardown": false, + "test": false, + "xcontext": false, + "xdescribe": false, + "xit": false, + "xspecify": false + }, + "mongo": { + "_isWindows": false, + "_rand": false, + "BulkWriteResult": false, + "cat": false, + "cd": false, + "connect": false, + "db": false, + "getHostName": false, + "getMemInfo": false, + "hostname": false, + "ISODate": false, + "listFiles": false, + "load": false, + "ls": false, + "md5sumFile": false, + "mkdir": false, + "Mongo": false, + "NumberInt": false, + "NumberLong": false, + "ObjectId": false, + "PlanCache": false, + "print": false, + "printjson": false, + "pwd": false, + "quit": false, + "removeFile": false, + "rs": false, + "sh": false, + "UUID": false, + "version": false, + "WriteResult": false + }, + "nashorn": { + "__DIR__": false, + "__FILE__": false, + "__LINE__": false, + "com": false, + "edu": false, + "exit": false, + "java": false, + "Java": false, + "javafx": false, + "JavaImporter": false, + "javax": false, + "JSAdapter": false, + "load": false, + "loadWithNewGlobal": false, + "org": false, + "Packages": false, + "print": false, + "quit": false + }, + "node": { + "__dirname": false, + "__filename": false, + "AbortController": false, + "AbortSignal": false, + "atob": false, + "Blob": false, + "BroadcastChannel": false, + "btoa": false, + "Buffer": false, + "ByteLengthQueuingStrategy": false, + "clearImmediate": false, + "clearInterval": false, + "clearTimeout": false, + "CloseEvent": false, + "CompressionStream": false, + "console": false, + "CountQueuingStrategy": false, + "crypto": false, + "Crypto": false, + "CryptoKey": false, + "CustomEvent": false, + "DecompressionStream": false, + "DOMException": false, + "Event": false, + "EventTarget": false, + "exports": true, + "fetch": false, + "File": false, + "FormData": false, + "global": false, + "Headers": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "module": false, + "navigator": false, + "Navigator": false, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceObserver": false, + "PerformanceObserverEntryList": false, + "PerformanceResourceTiming": false, + "process": false, + "queueMicrotask": false, + "ReadableByteStreamController": false, + "ReadableStream": false, + "ReadableStreamBYOBReader": false, + "ReadableStreamBYOBRequest": false, + "ReadableStreamDefaultController": false, + "ReadableStreamDefaultReader": false, + "Request": false, + "require": false, + "Response": false, + "setImmediate": false, + "setInterval": false, + "setTimeout": false, + "structuredClone": false, + "SubtleCrypto": false, + "TextDecoder": false, + "TextDecoderStream": false, + "TextEncoder": false, + "TextEncoderStream": false, + "TransformStream": false, + "TransformStreamDefaultController": false, + "URL": false, + "URLSearchParams": false, + "WebAssembly": false, + "WebSocket": false, + "WritableStream": false, + "WritableStreamDefaultController": false, + "WritableStreamDefaultWriter": false + }, + "nodeBuiltin": { + "AbortController": false, + "AbortSignal": false, + "atob": false, + "Blob": false, + "BroadcastChannel": false, + "btoa": false, + "Buffer": false, + "ByteLengthQueuingStrategy": false, + "clearImmediate": false, + "clearInterval": false, + "clearTimeout": false, + "CloseEvent": false, + "CompressionStream": false, + "console": false, + "CountQueuingStrategy": false, + "crypto": false, + "Crypto": false, + "CryptoKey": false, + "CustomEvent": false, + "DecompressionStream": false, + "DOMException": false, + "Event": false, + "EventTarget": false, + "fetch": false, + "File": false, + "FormData": false, + "global": false, + "Headers": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "navigator": false, + "Navigator": false, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceObserver": false, + "PerformanceObserverEntryList": false, + "PerformanceResourceTiming": false, + "process": false, + "queueMicrotask": false, + "ReadableByteStreamController": false, + "ReadableStream": false, + "ReadableStreamBYOBReader": false, + "ReadableStreamBYOBRequest": false, + "ReadableStreamDefaultController": false, + "ReadableStreamDefaultReader": false, + "Request": false, + "Response": false, + "setImmediate": false, + "setInterval": false, + "setTimeout": false, + "structuredClone": false, + "SubtleCrypto": false, + "TextDecoder": false, + "TextDecoderStream": false, + "TextEncoder": false, + "TextEncoderStream": false, + "TransformStream": false, + "TransformStreamDefaultController": false, + "URL": false, + "URLSearchParams": false, + "WebAssembly": false, + "WebSocket": false, + "WritableStream": false, + "WritableStreamDefaultController": false, + "WritableStreamDefaultWriter": false + }, + "phantomjs": { + "console": true, + "exports": true, + "phantom": true, + "require": true, + "WebPage": true + }, + "prototypejs": { + "$": false, + "$$": false, + "$A": false, + "$break": false, + "$continue": false, + "$F": false, + "$H": false, + "$R": false, + "$w": false, + "Abstract": false, + "Ajax": false, + "Autocompleter": false, + "Builder": false, + "Class": false, + "Control": false, + "Draggable": false, + "Draggables": false, + "Droppables": false, + "Effect": false, + "Element": false, + "Enumerable": false, + "Event": false, + "Field": false, + "Form": false, + "Hash": false, + "Insertion": false, + "ObjectRange": false, + "PeriodicalExecuter": false, + "Position": false, + "Prototype": false, + "Scriptaculous": false, + "Selector": false, + "Sortable": false, + "SortableObserver": false, + "Sound": false, + "Template": false, + "Toggle": false, + "Try": false + }, + "protractor": { + "$": false, + "$$": false, + "browser": false, + "by": false, + "By": false, + "DartObject": false, + "element": false, + "protractor": false + }, + "qunit": { + "asyncTest": false, + "deepEqual": false, + "equal": false, + "expect": false, + "module": false, + "notDeepEqual": false, + "notEqual": false, + "notOk": false, + "notPropEqual": false, + "notStrictEqual": false, + "ok": false, + "propEqual": false, + "QUnit": false, + "raises": false, + "start": false, + "stop": false, + "strictEqual": false, + "test": false, + "throws": false + }, + "rhino": { + "defineClass": false, + "deserialize": false, + "gc": false, + "help": false, + "importClass": false, + "importPackage": false, + "java": false, + "load": false, + "loadClass": false, + "Packages": false, + "print": false, + "quit": false, + "readFile": false, + "readUrl": false, + "runCommand": false, + "seal": false, + "serialize": false, + "spawn": false, + "sync": false, + "toint32": false, + "version": false + }, + "serviceworker": { + "addEventListener": false, + "applicationCache": false, + "atob": false, + "Blob": false, + "BroadcastChannel": false, + "btoa": false, + "ByteLengthQueuingStrategy": false, + "Cache": false, + "caches": false, + "CacheStorage": false, + "clearInterval": false, + "clearTimeout": false, + "Client": false, + "clients": false, + "Clients": false, + "close": true, + "CompressionStream": false, + "console": false, + "CountQueuingStrategy": false, + "crypto": false, + "Crypto": false, + "CryptoKey": false, + "CustomEvent": false, + "DecompressionStream": false, + "ErrorEvent": false, + "Event": false, + "ExtendableEvent": false, + "ExtendableMessageEvent": false, + "fetch": false, + "FetchEvent": false, + "File": false, + "FileReaderSync": false, + "FormData": false, + "Headers": false, + "IDBCursor": false, + "IDBCursorWithValue": false, + "IDBDatabase": false, + "IDBFactory": false, + "IDBIndex": false, + "IDBKeyRange": false, + "IDBObjectStore": false, + "IDBOpenDBRequest": false, + "IDBRequest": false, + "IDBTransaction": false, + "IDBVersionChangeEvent": false, + "ImageData": false, + "importScripts": false, + "indexedDB": false, + "location": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "name": false, + "navigator": false, + "Notification": false, + "onclose": true, + "onconnect": true, + "onerror": true, + "onfetch": true, + "oninstall": true, + "onlanguagechange": true, + "onmessage": true, + "onmessageerror": true, + "onnotificationclick": true, + "onnotificationclose": true, + "onoffline": true, + "ononline": true, + "onpush": true, + "onpushsubscriptionchange": true, + "onrejectionhandled": true, + "onsync": true, + "onunhandledrejection": true, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceNavigation": false, + "PerformanceObserver": false, + "PerformanceObserverEntryList": false, + "PerformanceResourceTiming": false, + "PerformanceTiming": false, + "postMessage": true, + "queueMicrotask": false, + "ReadableByteStreamController": false, + "ReadableStream": false, + "ReadableStreamBYOBReader": false, + "ReadableStreamBYOBRequest": false, + "ReadableStreamDefaultController": false, + "ReadableStreamDefaultReader": false, + "registration": false, + "removeEventListener": false, + "Request": false, + "Response": false, + "self": false, + "ServiceWorker": false, + "ServiceWorkerContainer": false, + "ServiceWorkerGlobalScope": false, + "ServiceWorkerMessageEvent": false, + "ServiceWorkerRegistration": false, + "setInterval": false, + "setTimeout": false, + "skipWaiting": false, + "SubtleCrypto": false, + "TextDecoder": false, + "TextDecoderStream": false, + "TextEncoder": false, + "TextEncoderStream": false, + "TransformStream": false, + "TransformStreamDefaultController": false, + "URL": false, + "URLSearchParams": false, + "WebAssembly": false, + "WebSocket": false, + "WindowClient": false, + "Worker": false, + "WorkerGlobalScope": false, + "WritableStream": false, + "WritableStreamDefaultController": false, + "WritableStreamDefaultWriter": false, + "XMLHttpRequest": false + }, + "shared-node-browser": { + "AbortController": false, + "AbortSignal": false, + "atob": false, + "Blob": false, + "BroadcastChannel": false, + "btoa": false, + "ByteLengthQueuingStrategy": false, + "clearInterval": false, + "clearTimeout": false, + "CloseEvent": false, + "CompressionStream": false, + "console": false, + "CountQueuingStrategy": false, + "crypto": false, + "Crypto": false, + "CryptoKey": false, + "CustomEvent": false, + "DecompressionStream": false, + "DOMException": false, + "Event": false, + "EventTarget": false, + "fetch": false, + "File": false, + "FormData": false, + "Headers": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "navigator": false, + "Navigator": false, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceObserver": false, + "PerformanceObserverEntryList": false, + "PerformanceResourceTiming": false, + "queueMicrotask": false, + "ReadableByteStreamController": false, + "ReadableStream": false, + "ReadableStreamBYOBReader": false, + "ReadableStreamBYOBRequest": false, + "ReadableStreamDefaultController": false, + "ReadableStreamDefaultReader": false, + "Request": false, + "Response": false, + "setInterval": false, + "setTimeout": false, + "structuredClone": false, + "SubtleCrypto": false, + "TextDecoder": false, + "TextDecoderStream": false, + "TextEncoder": false, + "TextEncoderStream": false, + "TransformStream": false, + "TransformStreamDefaultController": false, + "URL": false, + "URLSearchParams": false, + "WebAssembly": false, + "WebSocket": false, + "WritableStream": false, + "WritableStreamDefaultController": false, + "WritableStreamDefaultWriter": false + }, + "shelljs": { + "cat": false, + "cd": false, + "chmod": false, + "config": false, + "cp": false, + "dirs": false, + "echo": false, + "env": false, + "error": false, + "exec": false, + "exit": false, + "find": false, + "grep": false, + "head": false, + "ln": false, + "ls": false, + "mkdir": false, + "mv": false, + "popd": false, + "pushd": false, + "pwd": false, + "rm": false, + "sed": false, + "set": false, + "ShellString": false, + "sort": false, + "tail": false, + "tempdir": false, + "test": false, + "touch": false, + "uniq": false, + "which": false + }, + "vitest": { + "afterAll": false, + "afterEach": false, + "assert": false, + "assertType": false, + "beforeAll": false, + "beforeEach": false, + "chai": false, + "describe": false, + "expect": false, + "expectTypeOf": false, + "it": false, + "onTestFailed": false, + "onTestFinished": false, + "suite": false, + "test": false, + "vi": false, + "vitest": false + }, + "webextensions": { + "browser": false, + "chrome": false, + "opr": false + }, + "worker": { + "AbortController": false, + "AbortSignal": false, + "addEventListener": false, + "ai": false, + "atob": false, + "AudioData": false, + "AudioDecoder": false, + "AudioEncoder": false, + "BackgroundFetchManager": false, + "BackgroundFetchRecord": false, + "BackgroundFetchRegistration": false, + "BarcodeDetector": false, + "Blob": false, + "BroadcastChannel": false, + "btoa": false, + "ByteLengthQueuingStrategy": false, + "Cache": false, + "caches": false, + "CacheStorage": false, + "cancelAnimationFrame": false, + "CanvasGradient": false, + "CanvasPattern": false, + "clearInterval": false, + "clearTimeout": false, + "close": false, + "CloseEvent": false, + "CompressionStream": false, + "console": false, + "CountQueuingStrategy": false, + "createImageBitmap": false, + "CropTarget": false, + "crossOriginIsolated": false, + "crypto": false, + "Crypto": false, + "CryptoKey": false, + "CSSSkewX": false, + "CSSSkewY": false, + "CustomEvent": false, + "DecompressionStream": false, + "DedicatedWorkerGlobalScope": false, + "dispatchEvent": false, + "DOMException": false, + "DOMMatrix": false, + "DOMMatrixReadOnly": false, + "DOMPoint": false, + "DOMPointReadOnly": false, + "DOMQuad": false, + "DOMRect": false, + "DOMRectReadOnly": false, + "DOMStringList": false, + "EncodedAudioChunk": false, + "EncodedVideoChunk": false, + "ErrorEvent": false, + "Event": false, + "EventSource": false, + "EventTarget": false, + "fetch": false, + "File": false, + "FileList": false, + "FileReader": false, + "FileReaderSync": false, + "FileSystemDirectoryHandle": false, + "FileSystemFileHandle": false, + "FileSystemHandle": false, + "FileSystemSyncAccessHandle": false, + "FileSystemWritableFileStream": false, + "FontFace": false, + "fonts": false, + "FormData": false, + "GPU": false, + "GPUAdapter": false, + "GPUAdapterInfo": false, + "GPUBindGroup": false, + "GPUBindGroupLayout": false, + "GPUBuffer": false, + "GPUBufferUsage": false, + "GPUCanvasContext": false, + "GPUColorWrite": false, + "GPUCommandBuffer": false, + "GPUCommandEncoder": false, + "GPUCompilationInfo": false, + "GPUCompilationMessage": false, + "GPUComputePassEncoder": false, + "GPUComputePipeline": false, + "GPUDevice": false, + "GPUDeviceLostInfo": false, + "GPUError": false, + "GPUExternalTexture": false, + "GPUInternalError": false, + "GPUMapMode": false, + "GPUOutOfMemoryError": false, + "GPUPipelineError": false, + "GPUPipelineLayout": false, + "GPUQuerySet": false, + "GPUQueue": false, + "GPURenderBundle": false, + "GPURenderBundleEncoder": false, + "GPURenderPassEncoder": false, + "GPURenderPipeline": false, + "GPUSampler": false, + "GPUShaderModule": false, + "GPUShaderStage": false, + "GPUSupportedFeatures": false, + "GPUSupportedLimits": false, + "GPUTexture": false, + "GPUTextureUsage": false, + "GPUTextureView": false, + "GPUUncapturedErrorEvent": false, + "GPUValidationError": false, + "Headers": false, + "HID": false, + "HIDConnectionEvent": false, + "HIDDevice": false, + "HIDInputReportEvent": false, + "IDBCursor": false, + "IDBCursorWithValue": false, + "IDBDatabase": false, + "IDBFactory": false, + "IDBIndex": false, + "IDBKeyRange": false, + "IDBObjectStore": false, + "IDBOpenDBRequest": false, + "IDBRequest": false, + "IDBTransaction": false, + "IDBVersionChangeEvent": false, + "IdleDetector": false, + "ImageBitmap": false, + "ImageBitmapRenderingContext": false, + "ImageData": false, + "ImageDecoder": false, + "ImageTrack": false, + "ImageTrackList": false, + "importScripts": false, + "indexedDB": false, + "isSecureContext": false, + "location": false, + "Lock": false, + "LockManager": false, + "MediaCapabilities": false, + "MediaSource": false, + "MediaSourceHandle": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "name": false, + "NavigationPreloadManager": false, + "navigator": false, + "NavigatorUAData": false, + "NetworkInformation": false, + "Notification": false, + "OffscreenCanvas": false, + "OffscreenCanvasRenderingContext2D": false, + "onerror": true, + "onlanguagechange": true, + "onmessage": true, + "onmessageerror": true, + "onrejectionhandled": true, + "onunhandledrejection": true, + "origin": false, + "Path2D": false, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceObserver": false, + "PerformanceObserverEntryList": false, + "PerformanceResourceTiming": false, + "PerformanceServerTiming": false, + "PeriodicSyncManager": false, + "Permissions": false, + "PermissionStatus": false, + "PERSISTENT": false, + "postMessage": false, + "PressureObserver": false, + "PressureRecord": false, + "ProgressEvent": false, + "PromiseRejectionEvent": false, + "PushManager": false, + "PushSubscription": false, + "PushSubscriptionOptions": false, + "queueMicrotask": false, + "ReadableByteStreamController": false, + "ReadableStream": false, + "ReadableStreamBYOBReader": false, + "ReadableStreamBYOBRequest": false, + "ReadableStreamDefaultController": false, + "ReadableStreamDefaultReader": false, + "removeEventListener": false, + "reportError": false, + "ReportingObserver": false, + "Request": false, + "requestAnimationFrame": false, + "Response": false, + "RTCDataChannel": false, + "RTCEncodedAudioFrame": false, + "RTCEncodedVideoFrame": false, + "scheduler": false, + "Scheduler": false, + "SecurityPolicyViolationEvent": false, + "self": false, + "Serial": false, + "SerialPort": false, + "ServiceWorkerRegistration": false, + "setInterval": false, + "setTimeout": false, + "SourceBuffer": false, + "SourceBufferList": false, + "StorageBucket": false, + "StorageBucketManager": false, + "StorageManager": false, + "structuredClone": false, + "SubtleCrypto": false, + "SyncManager": false, + "TaskController": false, + "TaskPriorityChangeEvent": false, + "TaskSignal": false, + "TEMPORARY": false, + "TextDecoder": false, + "TextDecoderStream": false, + "TextEncoder": false, + "TextEncoderStream": false, + "TextMetrics": false, + "TransformStream": false, + "TransformStreamDefaultController": false, + "TrustedHTML": false, + "TrustedScript": false, + "TrustedScriptURL": false, + "TrustedTypePolicy": false, + "TrustedTypePolicyFactory": false, + "trustedTypes": false, + "URL": false, + "URLPattern": false, + "URLSearchParams": false, + "USB": false, + "USBAlternateInterface": false, + "USBConfiguration": false, + "USBConnectionEvent": false, + "USBDevice": false, + "USBEndpoint": false, + "USBInterface": false, + "USBInTransferResult": false, + "USBIsochronousInTransferPacket": false, + "USBIsochronousInTransferResult": false, + "USBIsochronousOutTransferPacket": false, + "USBIsochronousOutTransferResult": false, + "USBOutTransferResult": false, + "UserActivation": false, + "VideoColorSpace": false, + "VideoDecoder": false, + "VideoEncoder": false, + "VideoFrame": false, + "WebAssembly": false, + "WebGL2RenderingContext": false, + "WebGLActiveInfo": false, + "WebGLBuffer": false, + "WebGLContextEvent": false, + "WebGLFramebuffer": false, + "WebGLObject": false, + "WebGLProgram": false, + "WebGLQuery": false, + "WebGLRenderbuffer": false, + "WebGLRenderingContext": false, + "WebGLSampler": false, + "WebGLShader": false, + "WebGLShaderPrecisionFormat": false, + "WebGLSync": false, + "WebGLTexture": false, + "WebGLTransformFeedback": false, + "WebGLUniformLocation": false, + "WebGLVertexArrayObject": false, + "webkitRequestFileSystem": false, + "webkitRequestFileSystemSync": false, + "webkitResolveLocalFileSystemSyncURL": false, + "webkitResolveLocalFileSystemURL": false, + "WebSocket": false, + "WebSocketError": false, + "WebSocketStream": false, + "WebTransport": false, + "WebTransportBidirectionalStream": false, + "WebTransportDatagramDuplexStream": false, + "WebTransportError": false, + "WGSLLanguageFeatures": false, + "Worker": false, + "WorkerGlobalScope": false, + "WorkerLocation": false, + "WorkerNavigator": false, + "WritableStream": false, + "WritableStreamDefaultController": false, + "WritableStreamDefaultWriter": false, + "XMLHttpRequest": false, + "XMLHttpRequestEventTarget": false, + "XMLHttpRequestUpload": false + }, + "wsh": { + "ActiveXObject": false, + "CollectGarbage": false, + "Debug": false, + "Enumerator": false, + "GetObject": false, + "RuntimeObject": false, + "ScriptEngine": false, + "ScriptEngineBuildVersion": false, + "ScriptEngineMajorVersion": false, + "ScriptEngineMinorVersion": false, + "VBArray": false, + "WScript": false, + "WSH": false + }, + "yui": { + "YAHOO": false, + "YAHOO_config": false, + "YUI": false, + "YUI_config": false + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d84ad268efda4dc8605dd40dc6a1fa126d6398e9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/index.d.ts @@ -0,0 +1,3098 @@ +// This file is autogenerated by scripts/generate-types.mjs +// Do NOT modify this file manually + +type GlobalsAmd = { + readonly 'define': false; + readonly 'require': false; +} + +type GlobalsApplescript = { + readonly '$': false; + readonly 'Application': false; + readonly 'Automation': false; + readonly 'console': false; + readonly 'delay': false; + readonly 'Library': false; + readonly 'ObjC': false; + readonly 'ObjectSpecifier': false; + readonly 'Path': false; + readonly 'Progress': false; + readonly 'Ref': false; +} + +type GlobalsAtomtest = { + readonly 'advanceClock': false; + readonly 'atom': false; + readonly 'fakeClearInterval': false; + readonly 'fakeClearTimeout': false; + readonly 'fakeSetInterval': false; + readonly 'fakeSetTimeout': false; + readonly 'resetTimeouts': false; + readonly 'waitsForPromise': false; +} + +type GlobalsBrowser = { + readonly 'AbortController': false; + readonly 'AbortSignal': false; + readonly 'AbsoluteOrientationSensor': false; + readonly 'AbstractRange': false; + readonly 'Accelerometer': false; + readonly 'addEventListener': false; + readonly 'ai': false; + readonly 'AI': false; + readonly 'AITextSession': false; + readonly 'alert': false; + readonly 'AnalyserNode': false; + readonly 'Animation': false; + readonly 'AnimationEffect': false; + readonly 'AnimationEvent': false; + readonly 'AnimationPlaybackEvent': false; + readonly 'AnimationTimeline': false; + readonly 'atob': false; + readonly 'Attr': false; + readonly 'Audio': false; + readonly 'AudioBuffer': false; + readonly 'AudioBufferSourceNode': false; + readonly 'AudioContext': false; + readonly 'AudioData': false; + readonly 'AudioDecoder': false; + readonly 'AudioDestinationNode': false; + readonly 'AudioEncoder': false; + readonly 'AudioListener': false; + readonly 'AudioNode': false; + readonly 'AudioParam': false; + readonly 'AudioParamMap': false; + readonly 'AudioProcessingEvent': false; + readonly 'AudioScheduledSourceNode': false; + readonly 'AudioSinkInfo': false; + readonly 'AudioWorklet': false; + readonly 'AudioWorkletGlobalScope': false; + readonly 'AudioWorkletNode': false; + readonly 'AudioWorkletProcessor': false; + readonly 'AuthenticatorAssertionResponse': false; + readonly 'AuthenticatorAttestationResponse': false; + readonly 'AuthenticatorResponse': false; + readonly 'BackgroundFetchManager': false; + readonly 'BackgroundFetchRecord': false; + readonly 'BackgroundFetchRegistration': false; + readonly 'BarcodeDetector': false; + readonly 'BarProp': false; + readonly 'BaseAudioContext': false; + readonly 'BatteryManager': false; + readonly 'BeforeUnloadEvent': false; + readonly 'BiquadFilterNode': false; + readonly 'Blob': false; + readonly 'BlobEvent': false; + readonly 'Bluetooth': false; + readonly 'BluetoothCharacteristicProperties': false; + readonly 'BluetoothDevice': false; + readonly 'BluetoothRemoteGATTCharacteristic': false; + readonly 'BluetoothRemoteGATTDescriptor': false; + readonly 'BluetoothRemoteGATTServer': false; + readonly 'BluetoothRemoteGATTService': false; + readonly 'BluetoothUUID': false; + readonly 'blur': false; + readonly 'BroadcastChannel': false; + readonly 'BrowserCaptureMediaStreamTrack': false; + readonly 'btoa': false; + readonly 'ByteLengthQueuingStrategy': false; + readonly 'Cache': false; + readonly 'caches': false; + readonly 'CacheStorage': false; + readonly 'cancelAnimationFrame': false; + readonly 'cancelIdleCallback': false; + readonly 'CanvasCaptureMediaStream': false; + readonly 'CanvasCaptureMediaStreamTrack': false; + readonly 'CanvasGradient': false; + readonly 'CanvasPattern': false; + readonly 'CanvasRenderingContext2D': false; + readonly 'CaptureController': false; + readonly 'CaretPosition': false; + readonly 'CDATASection': false; + readonly 'ChannelMergerNode': false; + readonly 'ChannelSplitterNode': false; + readonly 'ChapterInformation': false; + readonly 'CharacterBoundsUpdateEvent': false; + readonly 'CharacterData': false; + readonly 'clearInterval': false; + readonly 'clearTimeout': false; + readonly 'clientInformation': false; + readonly 'Clipboard': false; + readonly 'ClipboardEvent': false; + readonly 'ClipboardItem': false; + readonly 'close': false; + readonly 'closed': false; + readonly 'CloseEvent': false; + readonly 'CloseWatcher': false; + readonly 'Comment': false; + readonly 'CompositionEvent': false; + readonly 'CompressionStream': false; + readonly 'confirm': false; + readonly 'console': false; + readonly 'ConstantSourceNode': false; + readonly 'ContentVisibilityAutoStateChangeEvent': false; + readonly 'ConvolverNode': false; + readonly 'CookieChangeEvent': false; + readonly 'CookieDeprecationLabel': false; + readonly 'cookieStore': false; + readonly 'CookieStore': false; + readonly 'CookieStoreManager': false; + readonly 'CountQueuingStrategy': false; + readonly 'createImageBitmap': false; + readonly 'Credential': false; + readonly 'credentialless': false; + readonly 'CredentialsContainer': false; + readonly 'CropTarget': false; + readonly 'crossOriginIsolated': false; + readonly 'crypto': false; + readonly 'Crypto': false; + readonly 'CryptoKey': false; + readonly 'CSS': false; + readonly 'CSSAnimation': false; + readonly 'CSSConditionRule': false; + readonly 'CSSContainerRule': false; + readonly 'CSSCounterStyleRule': false; + readonly 'CSSFontFaceRule': false; + readonly 'CSSFontFeatureValuesRule': false; + readonly 'CSSFontPaletteValuesRule': false; + readonly 'CSSGroupingRule': false; + readonly 'CSSImageValue': false; + readonly 'CSSImportRule': false; + readonly 'CSSKeyframeRule': false; + readonly 'CSSKeyframesRule': false; + readonly 'CSSKeywordValue': false; + readonly 'CSSLayerBlockRule': false; + readonly 'CSSLayerStatementRule': false; + readonly 'CSSMarginRule': false; + readonly 'CSSMathClamp': false; + readonly 'CSSMathInvert': false; + readonly 'CSSMathMax': false; + readonly 'CSSMathMin': false; + readonly 'CSSMathNegate': false; + readonly 'CSSMathProduct': false; + readonly 'CSSMathSum': false; + readonly 'CSSMathValue': false; + readonly 'CSSMatrixComponent': false; + readonly 'CSSMediaRule': false; + readonly 'CSSNamespaceRule': false; + readonly 'CSSNestedDeclarations': false; + readonly 'CSSNumericArray': false; + readonly 'CSSNumericValue': false; + readonly 'CSSPageDescriptors': false; + readonly 'CSSPageRule': false; + readonly 'CSSPerspective': false; + readonly 'CSSPositionTryDescriptors': false; + readonly 'CSSPositionTryRule': false; + readonly 'CSSPositionValue': false; + readonly 'CSSPropertyRule': false; + readonly 'CSSRotate': false; + readonly 'CSSRule': false; + readonly 'CSSRuleList': false; + readonly 'CSSScale': false; + readonly 'CSSScopeRule': false; + readonly 'CSSSkew': false; + readonly 'CSSSkewX': false; + readonly 'CSSSkewY': false; + readonly 'CSSStartingStyleRule': false; + readonly 'CSSStyleDeclaration': false; + readonly 'CSSStyleRule': false; + readonly 'CSSStyleSheet': false; + readonly 'CSSStyleValue': false; + readonly 'CSSSupportsRule': false; + readonly 'CSSTransformComponent': false; + readonly 'CSSTransformValue': false; + readonly 'CSSTransition': false; + readonly 'CSSTranslate': false; + readonly 'CSSUnitValue': false; + readonly 'CSSUnparsedValue': false; + readonly 'CSSVariableReferenceValue': false; + readonly 'CSSViewTransitionRule': false; + readonly 'currentFrame': false; + readonly 'currentTime': false; + readonly 'CustomElementRegistry': false; + readonly 'customElements': false; + readonly 'CustomEvent': false; + readonly 'CustomStateSet': false; + readonly 'DataTransfer': false; + readonly 'DataTransferItem': false; + readonly 'DataTransferItemList': false; + readonly 'DecompressionStream': false; + readonly 'DelayNode': false; + readonly 'DelegatedInkTrailPresenter': false; + readonly 'DeviceMotionEvent': false; + readonly 'DeviceMotionEventAcceleration': false; + readonly 'DeviceMotionEventRotationRate': false; + readonly 'DeviceOrientationEvent': false; + readonly 'devicePixelRatio': false; + readonly 'dispatchEvent': false; + readonly 'document': false; + readonly 'Document': false; + readonly 'DocumentFragment': false; + readonly 'documentPictureInPicture': false; + readonly 'DocumentPictureInPicture': false; + readonly 'DocumentPictureInPictureEvent': false; + readonly 'DocumentTimeline': false; + readonly 'DocumentType': false; + readonly 'DOMError': false; + readonly 'DOMException': false; + readonly 'DOMImplementation': false; + readonly 'DOMMatrix': false; + readonly 'DOMMatrixReadOnly': false; + readonly 'DOMParser': false; + readonly 'DOMPoint': false; + readonly 'DOMPointReadOnly': false; + readonly 'DOMQuad': false; + readonly 'DOMRect': false; + readonly 'DOMRectList': false; + readonly 'DOMRectReadOnly': false; + readonly 'DOMStringList': false; + readonly 'DOMStringMap': false; + readonly 'DOMTokenList': false; + readonly 'DragEvent': false; + readonly 'DynamicsCompressorNode': false; + readonly 'EditContext': false; + readonly 'Element': false; + readonly 'ElementInternals': false; + readonly 'EncodedAudioChunk': false; + readonly 'EncodedVideoChunk': false; + readonly 'ErrorEvent': false; + readonly 'event': false; + readonly 'Event': false; + readonly 'EventCounts': false; + readonly 'EventSource': false; + readonly 'EventTarget': false; + readonly 'external': false; + readonly 'External': false; + readonly 'EyeDropper': false; + readonly 'FeaturePolicy': false; + readonly 'FederatedCredential': false; + readonly 'fence': false; + readonly 'Fence': false; + readonly 'FencedFrameConfig': false; + readonly 'fetch': false; + readonly 'fetchLater': false; + readonly 'FetchLaterResult': false; + readonly 'File': false; + readonly 'FileList': false; + readonly 'FileReader': false; + readonly 'FileSystem': false; + readonly 'FileSystemDirectoryEntry': false; + readonly 'FileSystemDirectoryHandle': false; + readonly 'FileSystemDirectoryReader': false; + readonly 'FileSystemEntry': false; + readonly 'FileSystemFileEntry': false; + readonly 'FileSystemFileHandle': false; + readonly 'FileSystemHandle': false; + readonly 'FileSystemWritableFileStream': false; + readonly 'find': false; + readonly 'Float16Array': false; + readonly 'focus': false; + readonly 'FocusEvent': false; + readonly 'FontData': false; + readonly 'FontFace': false; + readonly 'FontFaceSet': false; + readonly 'FontFaceSetLoadEvent': false; + readonly 'FormData': false; + readonly 'FormDataEvent': false; + readonly 'FragmentDirective': false; + readonly 'frameElement': false; + readonly 'frames': false; + readonly 'GainNode': false; + readonly 'Gamepad': false; + readonly 'GamepadAxisMoveEvent': false; + readonly 'GamepadButton': false; + readonly 'GamepadButtonEvent': false; + readonly 'GamepadEvent': false; + readonly 'GamepadHapticActuator': false; + readonly 'GamepadPose': false; + readonly 'Geolocation': false; + readonly 'GeolocationCoordinates': false; + readonly 'GeolocationPosition': false; + readonly 'GeolocationPositionError': false; + readonly 'getComputedStyle': false; + readonly 'getScreenDetails': false; + readonly 'getSelection': false; + readonly 'GPU': false; + readonly 'GPUAdapter': false; + readonly 'GPUAdapterInfo': false; + readonly 'GPUBindGroup': false; + readonly 'GPUBindGroupLayout': false; + readonly 'GPUBuffer': false; + readonly 'GPUBufferUsage': false; + readonly 'GPUCanvasContext': false; + readonly 'GPUColorWrite': false; + readonly 'GPUCommandBuffer': false; + readonly 'GPUCommandEncoder': false; + readonly 'GPUCompilationInfo': false; + readonly 'GPUCompilationMessage': false; + readonly 'GPUComputePassEncoder': false; + readonly 'GPUComputePipeline': false; + readonly 'GPUDevice': false; + readonly 'GPUDeviceLostInfo': false; + readonly 'GPUError': false; + readonly 'GPUExternalTexture': false; + readonly 'GPUInternalError': false; + readonly 'GPUMapMode': false; + readonly 'GPUOutOfMemoryError': false; + readonly 'GPUPipelineError': false; + readonly 'GPUPipelineLayout': false; + readonly 'GPUQuerySet': false; + readonly 'GPUQueue': false; + readonly 'GPURenderBundle': false; + readonly 'GPURenderBundleEncoder': false; + readonly 'GPURenderPassEncoder': false; + readonly 'GPURenderPipeline': false; + readonly 'GPUSampler': false; + readonly 'GPUShaderModule': false; + readonly 'GPUShaderStage': false; + readonly 'GPUSupportedFeatures': false; + readonly 'GPUSupportedLimits': false; + readonly 'GPUTexture': false; + readonly 'GPUTextureUsage': false; + readonly 'GPUTextureView': false; + readonly 'GPUUncapturedErrorEvent': false; + readonly 'GPUValidationError': false; + readonly 'GravitySensor': false; + readonly 'Gyroscope': false; + readonly 'HashChangeEvent': false; + readonly 'Headers': false; + readonly 'HID': false; + readonly 'HIDConnectionEvent': false; + readonly 'HIDDevice': false; + readonly 'HIDInputReportEvent': false; + readonly 'Highlight': false; + readonly 'HighlightRegistry': false; + readonly 'history': false; + readonly 'History': false; + readonly 'HTMLAllCollection': false; + readonly 'HTMLAnchorElement': false; + readonly 'HTMLAreaElement': false; + readonly 'HTMLAudioElement': false; + readonly 'HTMLBaseElement': false; + readonly 'HTMLBodyElement': false; + readonly 'HTMLBRElement': false; + readonly 'HTMLButtonElement': false; + readonly 'HTMLCanvasElement': false; + readonly 'HTMLCollection': false; + readonly 'HTMLDataElement': false; + readonly 'HTMLDataListElement': false; + readonly 'HTMLDetailsElement': false; + readonly 'HTMLDialogElement': false; + readonly 'HTMLDirectoryElement': false; + readonly 'HTMLDivElement': false; + readonly 'HTMLDListElement': false; + readonly 'HTMLDocument': false; + readonly 'HTMLElement': false; + readonly 'HTMLEmbedElement': false; + readonly 'HTMLFencedFrameElement': false; + readonly 'HTMLFieldSetElement': false; + readonly 'HTMLFontElement': false; + readonly 'HTMLFormControlsCollection': false; + readonly 'HTMLFormElement': false; + readonly 'HTMLFrameElement': false; + readonly 'HTMLFrameSetElement': false; + readonly 'HTMLHeadElement': false; + readonly 'HTMLHeadingElement': false; + readonly 'HTMLHRElement': false; + readonly 'HTMLHtmlElement': false; + readonly 'HTMLIFrameElement': false; + readonly 'HTMLImageElement': false; + readonly 'HTMLInputElement': false; + readonly 'HTMLLabelElement': false; + readonly 'HTMLLegendElement': false; + readonly 'HTMLLIElement': false; + readonly 'HTMLLinkElement': false; + readonly 'HTMLMapElement': false; + readonly 'HTMLMarqueeElement': false; + readonly 'HTMLMediaElement': false; + readonly 'HTMLMenuElement': false; + readonly 'HTMLMetaElement': false; + readonly 'HTMLMeterElement': false; + readonly 'HTMLModElement': false; + readonly 'HTMLObjectElement': false; + readonly 'HTMLOListElement': false; + readonly 'HTMLOptGroupElement': false; + readonly 'HTMLOptionElement': false; + readonly 'HTMLOptionsCollection': false; + readonly 'HTMLOutputElement': false; + readonly 'HTMLParagraphElement': false; + readonly 'HTMLParamElement': false; + readonly 'HTMLPictureElement': false; + readonly 'HTMLPreElement': false; + readonly 'HTMLProgressElement': false; + readonly 'HTMLQuoteElement': false; + readonly 'HTMLScriptElement': false; + readonly 'HTMLSelectElement': false; + readonly 'HTMLSlotElement': false; + readonly 'HTMLSourceElement': false; + readonly 'HTMLSpanElement': false; + readonly 'HTMLStyleElement': false; + readonly 'HTMLTableCaptionElement': false; + readonly 'HTMLTableCellElement': false; + readonly 'HTMLTableColElement': false; + readonly 'HTMLTableElement': false; + readonly 'HTMLTableRowElement': false; + readonly 'HTMLTableSectionElement': false; + readonly 'HTMLTemplateElement': false; + readonly 'HTMLTextAreaElement': false; + readonly 'HTMLTimeElement': false; + readonly 'HTMLTitleElement': false; + readonly 'HTMLTrackElement': false; + readonly 'HTMLUListElement': false; + readonly 'HTMLUnknownElement': false; + readonly 'HTMLVideoElement': false; + readonly 'IDBCursor': false; + readonly 'IDBCursorWithValue': false; + readonly 'IDBDatabase': false; + readonly 'IDBFactory': false; + readonly 'IDBIndex': false; + readonly 'IDBKeyRange': false; + readonly 'IDBObjectStore': false; + readonly 'IDBOpenDBRequest': false; + readonly 'IDBRequest': false; + readonly 'IDBTransaction': false; + readonly 'IDBVersionChangeEvent': false; + readonly 'IdentityCredential': false; + readonly 'IdentityCredentialError': false; + readonly 'IdentityProvider': false; + readonly 'IdleDeadline': false; + readonly 'IdleDetector': false; + readonly 'IIRFilterNode': false; + readonly 'Image': false; + readonly 'ImageBitmap': false; + readonly 'ImageBitmapRenderingContext': false; + readonly 'ImageCapture': false; + readonly 'ImageData': false; + readonly 'ImageDecoder': false; + readonly 'ImageTrack': false; + readonly 'ImageTrackList': false; + readonly 'indexedDB': false; + readonly 'Ink': false; + readonly 'innerHeight': false; + readonly 'innerWidth': false; + readonly 'InputDeviceCapabilities': false; + readonly 'InputDeviceInfo': false; + readonly 'InputEvent': false; + readonly 'IntersectionObserver': false; + readonly 'IntersectionObserverEntry': false; + readonly 'isSecureContext': false; + readonly 'Keyboard': false; + readonly 'KeyboardEvent': false; + readonly 'KeyboardLayoutMap': false; + readonly 'KeyframeEffect': false; + readonly 'LargestContentfulPaint': false; + readonly 'LaunchParams': false; + readonly 'launchQueue': false; + readonly 'LaunchQueue': false; + readonly 'LayoutShift': false; + readonly 'LayoutShiftAttribution': false; + readonly 'length': false; + readonly 'LinearAccelerationSensor': false; + readonly 'localStorage': false; + readonly 'location': true; + readonly 'Location': false; + readonly 'locationbar': false; + readonly 'Lock': false; + readonly 'LockManager': false; + readonly 'matchMedia': false; + readonly 'MathMLElement': false; + readonly 'MediaCapabilities': false; + readonly 'MediaCapabilitiesInfo': false; + readonly 'MediaDeviceInfo': false; + readonly 'MediaDevices': false; + readonly 'MediaElementAudioSourceNode': false; + readonly 'MediaEncryptedEvent': false; + readonly 'MediaError': false; + readonly 'MediaKeyError': false; + readonly 'MediaKeyMessageEvent': false; + readonly 'MediaKeys': false; + readonly 'MediaKeySession': false; + readonly 'MediaKeyStatusMap': false; + readonly 'MediaKeySystemAccess': false; + readonly 'MediaList': false; + readonly 'MediaMetadata': false; + readonly 'MediaQueryList': false; + readonly 'MediaQueryListEvent': false; + readonly 'MediaRecorder': false; + readonly 'MediaRecorderErrorEvent': false; + readonly 'MediaSession': false; + readonly 'MediaSource': false; + readonly 'MediaSourceHandle': false; + readonly 'MediaStream': false; + readonly 'MediaStreamAudioDestinationNode': false; + readonly 'MediaStreamAudioSourceNode': false; + readonly 'MediaStreamEvent': false; + readonly 'MediaStreamTrack': false; + readonly 'MediaStreamTrackAudioSourceNode': false; + readonly 'MediaStreamTrackAudioStats': false; + readonly 'MediaStreamTrackEvent': false; + readonly 'MediaStreamTrackGenerator': false; + readonly 'MediaStreamTrackProcessor': false; + readonly 'MediaStreamTrackVideoStats': false; + readonly 'menubar': false; + readonly 'MessageChannel': false; + readonly 'MessageEvent': false; + readonly 'MessagePort': false; + readonly 'MIDIAccess': false; + readonly 'MIDIConnectionEvent': false; + readonly 'MIDIInput': false; + readonly 'MIDIInputMap': false; + readonly 'MIDIMessageEvent': false; + readonly 'MIDIOutput': false; + readonly 'MIDIOutputMap': false; + readonly 'MIDIPort': false; + readonly 'MimeType': false; + readonly 'MimeTypeArray': false; + readonly 'model': false; + readonly 'ModelGenericSession': false; + readonly 'ModelManager': false; + readonly 'MouseEvent': false; + readonly 'moveBy': false; + readonly 'moveTo': false; + readonly 'MutationEvent': false; + readonly 'MutationObserver': false; + readonly 'MutationRecord': false; + readonly 'name': false; + readonly 'NamedNodeMap': false; + readonly 'NavigateEvent': false; + readonly 'navigation': false; + readonly 'Navigation': false; + readonly 'NavigationActivation': false; + readonly 'NavigationCurrentEntryChangeEvent': false; + readonly 'NavigationDestination': false; + readonly 'NavigationHistoryEntry': false; + readonly 'NavigationPreloadManager': false; + readonly 'NavigationTransition': false; + readonly 'navigator': false; + readonly 'Navigator': false; + readonly 'NavigatorLogin': false; + readonly 'NavigatorManagedData': false; + readonly 'NavigatorUAData': false; + readonly 'NetworkInformation': false; + readonly 'Node': false; + readonly 'NodeFilter': false; + readonly 'NodeIterator': false; + readonly 'NodeList': false; + readonly 'Notification': false; + readonly 'NotifyPaintEvent': false; + readonly 'NotRestoredReasonDetails': false; + readonly 'NotRestoredReasons': false; + readonly 'OfflineAudioCompletionEvent': false; + readonly 'OfflineAudioContext': false; + readonly 'offscreenBuffering': false; + readonly 'OffscreenCanvas': false; + readonly 'OffscreenCanvasRenderingContext2D': false; + readonly 'onabort': true; + readonly 'onafterprint': true; + readonly 'onanimationcancel': true; + readonly 'onanimationend': true; + readonly 'onanimationiteration': true; + readonly 'onanimationstart': true; + readonly 'onappinstalled': true; + readonly 'onauxclick': true; + readonly 'onbeforeinput': true; + readonly 'onbeforeinstallprompt': true; + readonly 'onbeforematch': true; + readonly 'onbeforeprint': true; + readonly 'onbeforetoggle': true; + readonly 'onbeforeunload': true; + readonly 'onbeforexrselect': true; + readonly 'onblur': true; + readonly 'oncancel': true; + readonly 'oncanplay': true; + readonly 'oncanplaythrough': true; + readonly 'onchange': true; + readonly 'onclick': true; + readonly 'onclose': true; + readonly 'oncontentvisibilityautostatechange': true; + readonly 'oncontextlost': true; + readonly 'oncontextmenu': true; + readonly 'oncontextrestored': true; + readonly 'oncopy': true; + readonly 'oncuechange': true; + readonly 'oncut': true; + readonly 'ondblclick': true; + readonly 'ondevicemotion': true; + readonly 'ondeviceorientation': true; + readonly 'ondeviceorientationabsolute': true; + readonly 'ondrag': true; + readonly 'ondragend': true; + readonly 'ondragenter': true; + readonly 'ondragleave': true; + readonly 'ondragover': true; + readonly 'ondragstart': true; + readonly 'ondrop': true; + readonly 'ondurationchange': true; + readonly 'onemptied': true; + readonly 'onended': true; + readonly 'onerror': true; + readonly 'onfocus': true; + readonly 'onformdata': true; + readonly 'ongamepadconnected': true; + readonly 'ongamepaddisconnected': true; + readonly 'ongotpointercapture': true; + readonly 'onhashchange': true; + readonly 'oninput': true; + readonly 'oninvalid': true; + readonly 'onkeydown': true; + readonly 'onkeypress': true; + readonly 'onkeyup': true; + readonly 'onlanguagechange': true; + readonly 'onload': true; + readonly 'onloadeddata': true; + readonly 'onloadedmetadata': true; + readonly 'onloadstart': true; + readonly 'onlostpointercapture': true; + readonly 'onmessage': true; + readonly 'onmessageerror': true; + readonly 'onmousedown': true; + readonly 'onmouseenter': true; + readonly 'onmouseleave': true; + readonly 'onmousemove': true; + readonly 'onmouseout': true; + readonly 'onmouseover': true; + readonly 'onmouseup': true; + readonly 'onmousewheel': true; + readonly 'onoffline': true; + readonly 'ononline': true; + readonly 'onpagehide': true; + readonly 'onpagereveal': true; + readonly 'onpageshow': true; + readonly 'onpageswap': true; + readonly 'onpaste': true; + readonly 'onpause': true; + readonly 'onplay': true; + readonly 'onplaying': true; + readonly 'onpointercancel': true; + readonly 'onpointerdown': true; + readonly 'onpointerenter': true; + readonly 'onpointerleave': true; + readonly 'onpointermove': true; + readonly 'onpointerout': true; + readonly 'onpointerover': true; + readonly 'onpointerrawupdate': true; + readonly 'onpointerup': true; + readonly 'onpopstate': true; + readonly 'onprogress': true; + readonly 'onratechange': true; + readonly 'onrejectionhandled': true; + readonly 'onreset': true; + readonly 'onresize': true; + readonly 'onscroll': true; + readonly 'onscrollend': true; + readonly 'onscrollsnapchange': true; + readonly 'onscrollsnapchanging': true; + readonly 'onsearch': true; + readonly 'onsecuritypolicyviolation': true; + readonly 'onseeked': true; + readonly 'onseeking': true; + readonly 'onselect': true; + readonly 'onselectionchange': true; + readonly 'onselectstart': true; + readonly 'onslotchange': true; + readonly 'onstalled': true; + readonly 'onstorage': true; + readonly 'onsubmit': true; + readonly 'onsuspend': true; + readonly 'ontimeupdate': true; + readonly 'ontoggle': true; + readonly 'ontransitioncancel': true; + readonly 'ontransitionend': true; + readonly 'ontransitionrun': true; + readonly 'ontransitionstart': true; + readonly 'onunhandledrejection': true; + readonly 'onunload': true; + readonly 'onvolumechange': true; + readonly 'onwaiting': true; + readonly 'onwheel': true; + readonly 'open': false; + readonly 'opener': false; + readonly 'Option': false; + readonly 'OrientationSensor': false; + readonly 'origin': false; + readonly 'originAgentCluster': false; + readonly 'OscillatorNode': false; + readonly 'OTPCredential': false; + readonly 'outerHeight': false; + readonly 'outerWidth': false; + readonly 'OverconstrainedError': false; + readonly 'PageRevealEvent': false; + readonly 'PageSwapEvent': false; + readonly 'PageTransitionEvent': false; + readonly 'pageXOffset': false; + readonly 'pageYOffset': false; + readonly 'PannerNode': false; + readonly 'parent': false; + readonly 'PasswordCredential': false; + readonly 'Path2D': false; + readonly 'PaymentAddress': false; + readonly 'PaymentManager': false; + readonly 'PaymentMethodChangeEvent': false; + readonly 'PaymentRequest': false; + readonly 'PaymentRequestUpdateEvent': false; + readonly 'PaymentResponse': false; + readonly 'performance': false; + readonly 'Performance': false; + readonly 'PerformanceElementTiming': false; + readonly 'PerformanceEntry': false; + readonly 'PerformanceEventTiming': false; + readonly 'PerformanceLongAnimationFrameTiming': false; + readonly 'PerformanceLongTaskTiming': false; + readonly 'PerformanceMark': false; + readonly 'PerformanceMeasure': false; + readonly 'PerformanceNavigation': false; + readonly 'PerformanceNavigationTiming': false; + readonly 'PerformanceObserver': false; + readonly 'PerformanceObserverEntryList': false; + readonly 'PerformancePaintTiming': false; + readonly 'PerformanceResourceTiming': false; + readonly 'PerformanceScriptTiming': false; + readonly 'PerformanceServerTiming': false; + readonly 'PerformanceTiming': false; + readonly 'PeriodicSyncManager': false; + readonly 'PeriodicWave': false; + readonly 'Permissions': false; + readonly 'PermissionStatus': false; + readonly 'PERSISTENT': false; + readonly 'personalbar': false; + readonly 'PictureInPictureEvent': false; + readonly 'PictureInPictureWindow': false; + readonly 'Plugin': false; + readonly 'PluginArray': false; + readonly 'PointerEvent': false; + readonly 'PopStateEvent': false; + readonly 'postMessage': false; + readonly 'Presentation': false; + readonly 'PresentationAvailability': false; + readonly 'PresentationConnection': false; + readonly 'PresentationConnectionAvailableEvent': false; + readonly 'PresentationConnectionCloseEvent': false; + readonly 'PresentationConnectionList': false; + readonly 'PresentationReceiver': false; + readonly 'PresentationRequest': false; + readonly 'PressureObserver': false; + readonly 'PressureRecord': false; + readonly 'print': false; + readonly 'ProcessingInstruction': false; + readonly 'Profiler': false; + readonly 'ProgressEvent': false; + readonly 'PromiseRejectionEvent': false; + readonly 'prompt': false; + readonly 'ProtectedAudience': false; + readonly 'PublicKeyCredential': false; + readonly 'PushManager': false; + readonly 'PushSubscription': false; + readonly 'PushSubscriptionOptions': false; + readonly 'queryLocalFonts': false; + readonly 'queueMicrotask': false; + readonly 'RadioNodeList': false; + readonly 'Range': false; + readonly 'ReadableByteStreamController': false; + readonly 'ReadableStream': false; + readonly 'ReadableStreamBYOBReader': false; + readonly 'ReadableStreamBYOBRequest': false; + readonly 'ReadableStreamDefaultController': false; + readonly 'ReadableStreamDefaultReader': false; + readonly 'registerProcessor': false; + readonly 'RelativeOrientationSensor': false; + readonly 'RemotePlayback': false; + readonly 'removeEventListener': false; + readonly 'reportError': false; + readonly 'ReportingObserver': false; + readonly 'Request': false; + readonly 'requestAnimationFrame': false; + readonly 'requestIdleCallback': false; + readonly 'resizeBy': false; + readonly 'ResizeObserver': false; + readonly 'ResizeObserverEntry': false; + readonly 'ResizeObserverSize': false; + readonly 'resizeTo': false; + readonly 'Response': false; + readonly 'RTCCertificate': false; + readonly 'RTCDataChannel': false; + readonly 'RTCDataChannelEvent': false; + readonly 'RTCDtlsTransport': false; + readonly 'RTCDTMFSender': false; + readonly 'RTCDTMFToneChangeEvent': false; + readonly 'RTCEncodedAudioFrame': false; + readonly 'RTCEncodedVideoFrame': false; + readonly 'RTCError': false; + readonly 'RTCErrorEvent': false; + readonly 'RTCIceCandidate': false; + readonly 'RTCIceTransport': false; + readonly 'RTCPeerConnection': false; + readonly 'RTCPeerConnectionIceErrorEvent': false; + readonly 'RTCPeerConnectionIceEvent': false; + readonly 'RTCRtpReceiver': false; + readonly 'RTCRtpScriptTransform': false; + readonly 'RTCRtpSender': false; + readonly 'RTCRtpTransceiver': false; + readonly 'RTCSctpTransport': false; + readonly 'RTCSessionDescription': false; + readonly 'RTCStatsReport': false; + readonly 'RTCTrackEvent': false; + readonly 'sampleRate': false; + readonly 'scheduler': false; + readonly 'Scheduler': false; + readonly 'Scheduling': false; + readonly 'screen': false; + readonly 'Screen': false; + readonly 'ScreenDetailed': false; + readonly 'ScreenDetails': false; + readonly 'screenLeft': false; + readonly 'ScreenOrientation': false; + readonly 'screenTop': false; + readonly 'screenX': false; + readonly 'screenY': false; + readonly 'ScriptProcessorNode': false; + readonly 'scroll': false; + readonly 'scrollbars': false; + readonly 'scrollBy': false; + readonly 'ScrollTimeline': false; + readonly 'scrollTo': false; + readonly 'scrollX': false; + readonly 'scrollY': false; + readonly 'SecurityPolicyViolationEvent': false; + readonly 'Selection': false; + readonly 'self': false; + readonly 'Sensor': false; + readonly 'SensorErrorEvent': false; + readonly 'Serial': false; + readonly 'SerialPort': false; + readonly 'ServiceWorker': false; + readonly 'ServiceWorkerContainer': false; + readonly 'ServiceWorkerRegistration': false; + readonly 'sessionStorage': false; + readonly 'setInterval': false; + readonly 'setTimeout': false; + readonly 'ShadowRoot': false; + readonly 'sharedStorage': false; + readonly 'SharedStorage': false; + readonly 'SharedStorageWorklet': false; + readonly 'SharedWorker': false; + readonly 'showDirectoryPicker': false; + readonly 'showOpenFilePicker': false; + readonly 'showSaveFilePicker': false; + readonly 'SnapEvent': false; + readonly 'SourceBuffer': false; + readonly 'SourceBufferList': false; + readonly 'speechSynthesis': false; + readonly 'SpeechSynthesis': false; + readonly 'SpeechSynthesisErrorEvent': false; + readonly 'SpeechSynthesisEvent': false; + readonly 'SpeechSynthesisUtterance': false; + readonly 'SpeechSynthesisVoice': false; + readonly 'StaticRange': false; + readonly 'status': false; + readonly 'statusbar': false; + readonly 'StereoPannerNode': false; + readonly 'stop': false; + readonly 'Storage': false; + readonly 'StorageBucket': false; + readonly 'StorageBucketManager': false; + readonly 'StorageEvent': false; + readonly 'StorageManager': false; + readonly 'structuredClone': false; + readonly 'styleMedia': false; + readonly 'StylePropertyMap': false; + readonly 'StylePropertyMapReadOnly': false; + readonly 'StyleSheet': false; + readonly 'StyleSheetList': false; + readonly 'SubmitEvent': false; + readonly 'SubtleCrypto': false; + readonly 'SVGAElement': false; + readonly 'SVGAngle': false; + readonly 'SVGAnimatedAngle': false; + readonly 'SVGAnimatedBoolean': false; + readonly 'SVGAnimatedEnumeration': false; + readonly 'SVGAnimatedInteger': false; + readonly 'SVGAnimatedLength': false; + readonly 'SVGAnimatedLengthList': false; + readonly 'SVGAnimatedNumber': false; + readonly 'SVGAnimatedNumberList': false; + readonly 'SVGAnimatedPreserveAspectRatio': false; + readonly 'SVGAnimatedRect': false; + readonly 'SVGAnimatedString': false; + readonly 'SVGAnimatedTransformList': false; + readonly 'SVGAnimateElement': false; + readonly 'SVGAnimateMotionElement': false; + readonly 'SVGAnimateTransformElement': false; + readonly 'SVGAnimationElement': false; + readonly 'SVGCircleElement': false; + readonly 'SVGClipPathElement': false; + readonly 'SVGComponentTransferFunctionElement': false; + readonly 'SVGDefsElement': false; + readonly 'SVGDescElement': false; + readonly 'SVGElement': false; + readonly 'SVGEllipseElement': false; + readonly 'SVGFEBlendElement': false; + readonly 'SVGFEColorMatrixElement': false; + readonly 'SVGFEComponentTransferElement': false; + readonly 'SVGFECompositeElement': false; + readonly 'SVGFEConvolveMatrixElement': false; + readonly 'SVGFEDiffuseLightingElement': false; + readonly 'SVGFEDisplacementMapElement': false; + readonly 'SVGFEDistantLightElement': false; + readonly 'SVGFEDropShadowElement': false; + readonly 'SVGFEFloodElement': false; + readonly 'SVGFEFuncAElement': false; + readonly 'SVGFEFuncBElement': false; + readonly 'SVGFEFuncGElement': false; + readonly 'SVGFEFuncRElement': false; + readonly 'SVGFEGaussianBlurElement': false; + readonly 'SVGFEImageElement': false; + readonly 'SVGFEMergeElement': false; + readonly 'SVGFEMergeNodeElement': false; + readonly 'SVGFEMorphologyElement': false; + readonly 'SVGFEOffsetElement': false; + readonly 'SVGFEPointLightElement': false; + readonly 'SVGFESpecularLightingElement': false; + readonly 'SVGFESpotLightElement': false; + readonly 'SVGFETileElement': false; + readonly 'SVGFETurbulenceElement': false; + readonly 'SVGFilterElement': false; + readonly 'SVGForeignObjectElement': false; + readonly 'SVGGElement': false; + readonly 'SVGGeometryElement': false; + readonly 'SVGGradientElement': false; + readonly 'SVGGraphicsElement': false; + readonly 'SVGImageElement': false; + readonly 'SVGLength': false; + readonly 'SVGLengthList': false; + readonly 'SVGLinearGradientElement': false; + readonly 'SVGLineElement': false; + readonly 'SVGMarkerElement': false; + readonly 'SVGMaskElement': false; + readonly 'SVGMatrix': false; + readonly 'SVGMetadataElement': false; + readonly 'SVGMPathElement': false; + readonly 'SVGNumber': false; + readonly 'SVGNumberList': false; + readonly 'SVGPathElement': false; + readonly 'SVGPatternElement': false; + readonly 'SVGPoint': false; + readonly 'SVGPointList': false; + readonly 'SVGPolygonElement': false; + readonly 'SVGPolylineElement': false; + readonly 'SVGPreserveAspectRatio': false; + readonly 'SVGRadialGradientElement': false; + readonly 'SVGRect': false; + readonly 'SVGRectElement': false; + readonly 'SVGScriptElement': false; + readonly 'SVGSetElement': false; + readonly 'SVGStopElement': false; + readonly 'SVGStringList': false; + readonly 'SVGStyleElement': false; + readonly 'SVGSVGElement': false; + readonly 'SVGSwitchElement': false; + readonly 'SVGSymbolElement': false; + readonly 'SVGTextContentElement': false; + readonly 'SVGTextElement': false; + readonly 'SVGTextPathElement': false; + readonly 'SVGTextPositioningElement': false; + readonly 'SVGTitleElement': false; + readonly 'SVGTransform': false; + readonly 'SVGTransformList': false; + readonly 'SVGTSpanElement': false; + readonly 'SVGUnitTypes': false; + readonly 'SVGUseElement': false; + readonly 'SVGViewElement': false; + readonly 'SyncManager': false; + readonly 'TaskAttributionTiming': false; + readonly 'TaskController': false; + readonly 'TaskPriorityChangeEvent': false; + readonly 'TaskSignal': false; + readonly 'TEMPORARY': false; + readonly 'Text': false; + readonly 'TextDecoder': false; + readonly 'TextDecoderStream': false; + readonly 'TextEncoder': false; + readonly 'TextEncoderStream': false; + readonly 'TextEvent': false; + readonly 'TextFormat': false; + readonly 'TextFormatUpdateEvent': false; + readonly 'TextMetrics': false; + readonly 'TextTrack': false; + readonly 'TextTrackCue': false; + readonly 'TextTrackCueList': false; + readonly 'TextTrackList': false; + readonly 'TextUpdateEvent': false; + readonly 'TimeEvent': false; + readonly 'TimeRanges': false; + readonly 'ToggleEvent': false; + readonly 'toolbar': false; + readonly 'top': false; + readonly 'Touch': false; + readonly 'TouchEvent': false; + readonly 'TouchList': false; + readonly 'TrackEvent': false; + readonly 'TransformStream': false; + readonly 'TransformStreamDefaultController': false; + readonly 'TransitionEvent': false; + readonly 'TreeWalker': false; + readonly 'TrustedHTML': false; + readonly 'TrustedScript': false; + readonly 'TrustedScriptURL': false; + readonly 'TrustedTypePolicy': false; + readonly 'TrustedTypePolicyFactory': false; + readonly 'trustedTypes': false; + readonly 'UIEvent': false; + readonly 'URL': false; + readonly 'URLPattern': false; + readonly 'URLSearchParams': false; + readonly 'USB': false; + readonly 'USBAlternateInterface': false; + readonly 'USBConfiguration': false; + readonly 'USBConnectionEvent': false; + readonly 'USBDevice': false; + readonly 'USBEndpoint': false; + readonly 'USBInterface': false; + readonly 'USBInTransferResult': false; + readonly 'USBIsochronousInTransferPacket': false; + readonly 'USBIsochronousInTransferResult': false; + readonly 'USBIsochronousOutTransferPacket': false; + readonly 'USBIsochronousOutTransferResult': false; + readonly 'USBOutTransferResult': false; + readonly 'UserActivation': false; + readonly 'ValidityState': false; + readonly 'VideoColorSpace': false; + readonly 'VideoDecoder': false; + readonly 'VideoEncoder': false; + readonly 'VideoFrame': false; + readonly 'VideoPlaybackQuality': false; + readonly 'ViewTimeline': false; + readonly 'ViewTransition': false; + readonly 'ViewTransitionTypeSet': false; + readonly 'VirtualKeyboard': false; + readonly 'VirtualKeyboardGeometryChangeEvent': false; + readonly 'VisibilityStateEntry': false; + readonly 'visualViewport': false; + readonly 'VisualViewport': false; + readonly 'VTTCue': false; + readonly 'VTTRegion': false; + readonly 'WakeLock': false; + readonly 'WakeLockSentinel': false; + readonly 'WaveShaperNode': false; + readonly 'WebAssembly': false; + readonly 'WebGL2RenderingContext': false; + readonly 'WebGLActiveInfo': false; + readonly 'WebGLBuffer': false; + readonly 'WebGLContextEvent': false; + readonly 'WebGLFramebuffer': false; + readonly 'WebGLObject': false; + readonly 'WebGLProgram': false; + readonly 'WebGLQuery': false; + readonly 'WebGLRenderbuffer': false; + readonly 'WebGLRenderingContext': false; + readonly 'WebGLSampler': false; + readonly 'WebGLShader': false; + readonly 'WebGLShaderPrecisionFormat': false; + readonly 'WebGLSync': false; + readonly 'WebGLTexture': false; + readonly 'WebGLTransformFeedback': false; + readonly 'WebGLUniformLocation': false; + readonly 'WebGLVertexArrayObject': false; + readonly 'WebSocket': false; + readonly 'WebSocketError': false; + readonly 'WebSocketStream': false; + readonly 'WebTransport': false; + readonly 'WebTransportBidirectionalStream': false; + readonly 'WebTransportDatagramDuplexStream': false; + readonly 'WebTransportError': false; + readonly 'WebTransportReceiveStream': false; + readonly 'WebTransportSendStream': false; + readonly 'WGSLLanguageFeatures': false; + readonly 'WheelEvent': false; + readonly 'window': false; + readonly 'Window': false; + readonly 'WindowControlsOverlay': false; + readonly 'WindowControlsOverlayGeometryChangeEvent': false; + readonly 'Worker': false; + readonly 'Worklet': false; + readonly 'WorkletGlobalScope': false; + readonly 'WritableStream': false; + readonly 'WritableStreamDefaultController': false; + readonly 'WritableStreamDefaultWriter': false; + readonly 'XMLDocument': false; + readonly 'XMLHttpRequest': false; + readonly 'XMLHttpRequestEventTarget': false; + readonly 'XMLHttpRequestUpload': false; + readonly 'XMLSerializer': false; + readonly 'XPathEvaluator': false; + readonly 'XPathExpression': false; + readonly 'XPathResult': false; + readonly 'XRAnchor': false; + readonly 'XRAnchorSet': false; + readonly 'XRBoundedReferenceSpace': false; + readonly 'XRCamera': false; + readonly 'XRCPUDepthInformation': false; + readonly 'XRDepthInformation': false; + readonly 'XRDOMOverlayState': false; + readonly 'XRFrame': false; + readonly 'XRHand': false; + readonly 'XRHitTestResult': false; + readonly 'XRHitTestSource': false; + readonly 'XRInputSource': false; + readonly 'XRInputSourceArray': false; + readonly 'XRInputSourceEvent': false; + readonly 'XRInputSourcesChangeEvent': false; + readonly 'XRJointPose': false; + readonly 'XRJointSpace': false; + readonly 'XRLayer': false; + readonly 'XRLightEstimate': false; + readonly 'XRLightProbe': false; + readonly 'XRPose': false; + readonly 'XRRay': false; + readonly 'XRReferenceSpace': false; + readonly 'XRReferenceSpaceEvent': false; + readonly 'XRRenderState': false; + readonly 'XRRigidTransform': false; + readonly 'XRSession': false; + readonly 'XRSessionEvent': false; + readonly 'XRSpace': false; + readonly 'XRSystem': false; + readonly 'XRTransientInputHitTestResult': false; + readonly 'XRTransientInputHitTestSource': false; + readonly 'XRView': false; + readonly 'XRViewerPose': false; + readonly 'XRViewport': false; + readonly 'XRWebGLBinding': false; + readonly 'XRWebGLDepthInformation': false; + readonly 'XRWebGLLayer': false; + readonly 'XSLTProcessor': false; +} + +type GlobalsBuiltin = { + readonly 'AggregateError': false; + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'BigInt': false; + readonly 'BigInt64Array': false; + readonly 'BigUint64Array': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'FinalizationRegistry': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'globalThis': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'Iterator': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakRef': false; + readonly 'WeakSet': false; +} + +type GlobalsChai = { + readonly 'assert': true; + readonly 'expect': true; + readonly 'should': true; +} + +type GlobalsCommonjs = { + readonly 'exports': true; + readonly 'global': false; + readonly 'module': false; + readonly 'require': false; +} + +type GlobalsCouch = { + readonly 'emit': false; + readonly 'exports': false; + readonly 'getRow': false; + readonly 'log': false; + readonly 'module': false; + readonly 'provides': false; + readonly 'require': false; + readonly 'respond': false; + readonly 'send': false; + readonly 'start': false; + readonly 'sum': false; +} + +type GlobalsDevtools = { + readonly '$': false; + readonly '$_': false; + readonly '$$': false; + readonly '$0': false; + readonly '$1': false; + readonly '$2': false; + readonly '$3': false; + readonly '$4': false; + readonly '$x': false; + readonly 'chrome': false; + readonly 'clear': false; + readonly 'copy': false; + readonly 'debug': false; + readonly 'dir': false; + readonly 'dirxml': false; + readonly 'getEventListeners': false; + readonly 'inspect': false; + readonly 'keys': false; + readonly 'monitor': false; + readonly 'monitorEvents': false; + readonly 'profile': false; + readonly 'profileEnd': false; + readonly 'queryObjects': false; + readonly 'table': false; + readonly 'undebug': false; + readonly 'unmonitor': false; + readonly 'unmonitorEvents': false; + readonly 'values': false; +} + +type GlobalsEmbertest = { + readonly 'andThen': false; + readonly 'click': false; + readonly 'currentPath': false; + readonly 'currentRouteName': false; + readonly 'currentURL': false; + readonly 'fillIn': false; + readonly 'find': false; + readonly 'findAll': false; + readonly 'findWithAssert': false; + readonly 'keyEvent': false; + readonly 'pauseTest': false; + readonly 'resumeTest': false; + readonly 'triggerEvent': false; + readonly 'visit': false; + readonly 'wait': false; +} + +type GlobalsEs2015 = { + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2016 = { + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2017 = { + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2018 = { + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2019 = { + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2020 = { + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'BigInt': false; + readonly 'BigInt64Array': false; + readonly 'BigUint64Array': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'globalThis': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2021 = { + readonly 'AggregateError': false; + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'BigInt': false; + readonly 'BigInt64Array': false; + readonly 'BigUint64Array': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'FinalizationRegistry': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'globalThis': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakRef': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2022 = { + readonly 'AggregateError': false; + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'BigInt': false; + readonly 'BigInt64Array': false; + readonly 'BigUint64Array': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'FinalizationRegistry': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'globalThis': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakRef': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2023 = { + readonly 'AggregateError': false; + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'BigInt': false; + readonly 'BigInt64Array': false; + readonly 'BigUint64Array': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'FinalizationRegistry': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'globalThis': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakRef': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2024 = { + readonly 'AggregateError': false; + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'BigInt': false; + readonly 'BigInt64Array': false; + readonly 'BigUint64Array': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'FinalizationRegistry': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'globalThis': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakRef': false; + readonly 'WeakSet': false; +} + +type GlobalsEs2025 = { + readonly 'AggregateError': false; + readonly 'Array': false; + readonly 'ArrayBuffer': false; + readonly 'Atomics': false; + readonly 'BigInt': false; + readonly 'BigInt64Array': false; + readonly 'BigUint64Array': false; + readonly 'Boolean': false; + readonly 'DataView': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'FinalizationRegistry': false; + readonly 'Float32Array': false; + readonly 'Float64Array': false; + readonly 'Function': false; + readonly 'globalThis': false; + readonly 'Infinity': false; + readonly 'Int16Array': false; + readonly 'Int32Array': false; + readonly 'Int8Array': false; + readonly 'Intl': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'Iterator': false; + readonly 'JSON': false; + readonly 'Map': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'Promise': false; + readonly 'Proxy': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'Reflect': false; + readonly 'RegExp': false; + readonly 'Set': false; + readonly 'SharedArrayBuffer': false; + readonly 'String': false; + readonly 'Symbol': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'Uint16Array': false; + readonly 'Uint32Array': false; + readonly 'Uint8Array': false; + readonly 'Uint8ClampedArray': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; + readonly 'WeakMap': false; + readonly 'WeakRef': false; + readonly 'WeakSet': false; +} + +type GlobalsEs3 = { + readonly 'Array': false; + readonly 'Boolean': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'Function': false; + readonly 'Infinity': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'RegExp': false; + readonly 'String': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; +} + +type GlobalsEs5 = { + readonly 'Array': false; + readonly 'Boolean': false; + readonly 'Date': false; + readonly 'decodeURI': false; + readonly 'decodeURIComponent': false; + readonly 'encodeURI': false; + readonly 'encodeURIComponent': false; + readonly 'Error': false; + readonly 'escape': false; + readonly 'eval': false; + readonly 'EvalError': false; + readonly 'Function': false; + readonly 'Infinity': false; + readonly 'isFinite': false; + readonly 'isNaN': false; + readonly 'JSON': false; + readonly 'Math': false; + readonly 'NaN': false; + readonly 'Number': false; + readonly 'Object': false; + readonly 'parseFloat': false; + readonly 'parseInt': false; + readonly 'RangeError': false; + readonly 'ReferenceError': false; + readonly 'RegExp': false; + readonly 'String': false; + readonly 'SyntaxError': false; + readonly 'TypeError': false; + readonly 'undefined': false; + readonly 'unescape': false; + readonly 'URIError': false; +} + +type GlobalsGreasemonkey = { + readonly 'cloneInto': false; + readonly 'createObjectIn': false; + readonly 'exportFunction': false; + readonly 'GM': false; + readonly 'GM_addElement': false; + readonly 'GM_addStyle': false; + readonly 'GM_addValueChangeListener': false; + readonly 'GM_deleteValue': false; + readonly 'GM_download': false; + readonly 'GM_getResourceText': false; + readonly 'GM_getResourceURL': false; + readonly 'GM_getTab': false; + readonly 'GM_getTabs': false; + readonly 'GM_getValue': false; + readonly 'GM_info': false; + readonly 'GM_listValues': false; + readonly 'GM_log': false; + readonly 'GM_notification': false; + readonly 'GM_openInTab': false; + readonly 'GM_registerMenuCommand': false; + readonly 'GM_removeValueChangeListener': false; + readonly 'GM_saveTab': false; + readonly 'GM_setClipboard': false; + readonly 'GM_setValue': false; + readonly 'GM_unregisterMenuCommand': false; + readonly 'GM_xmlhttpRequest': false; + readonly 'unsafeWindow': false; +} + +type GlobalsJasmine = { + readonly 'afterAll': false; + readonly 'afterEach': false; + readonly 'beforeAll': false; + readonly 'beforeEach': false; + readonly 'describe': false; + readonly 'expect': false; + readonly 'expectAsync': false; + readonly 'fail': false; + readonly 'fdescribe': false; + readonly 'fit': false; + readonly 'it': false; + readonly 'jasmine': false; + readonly 'pending': false; + readonly 'runs': false; + readonly 'spyOn': false; + readonly 'spyOnAllFunctions': false; + readonly 'spyOnProperty': false; + readonly 'waits': false; + readonly 'waitsFor': false; + readonly 'xdescribe': false; + readonly 'xit': false; +} + +type GlobalsJest = { + readonly 'afterAll': false; + readonly 'afterEach': false; + readonly 'beforeAll': false; + readonly 'beforeEach': false; + readonly 'describe': false; + readonly 'expect': false; + readonly 'fit': false; + readonly 'it': false; + readonly 'jest': false; + readonly 'test': false; + readonly 'xdescribe': false; + readonly 'xit': false; + readonly 'xtest': false; +} + +type GlobalsJquery = { + readonly '$': false; + readonly 'jQuery': false; +} + +type GlobalsMeteor = { + readonly '$': false; + readonly 'Accounts': false; + readonly 'AccountsClient': false; + readonly 'AccountsCommon': false; + readonly 'AccountsServer': false; + readonly 'App': false; + readonly 'Assets': false; + readonly 'Blaze': false; + readonly 'check': false; + readonly 'Cordova': false; + readonly 'DDP': false; + readonly 'DDPRateLimiter': false; + readonly 'DDPServer': false; + readonly 'Deps': false; + readonly 'EJSON': false; + readonly 'Email': false; + readonly 'HTTP': false; + readonly 'Log': false; + readonly 'Match': false; + readonly 'Meteor': false; + readonly 'Mongo': false; + readonly 'MongoInternals': false; + readonly 'Npm': false; + readonly 'Package': false; + readonly 'Plugin': false; + readonly 'process': false; + readonly 'Random': false; + readonly 'ReactiveDict': false; + readonly 'ReactiveVar': false; + readonly 'Router': false; + readonly 'ServiceConfiguration': false; + readonly 'Session': false; + readonly 'share': false; + readonly 'Spacebars': false; + readonly 'Template': false; + readonly 'Tinytest': false; + readonly 'Tracker': false; + readonly 'UI': false; + readonly 'Utils': false; + readonly 'WebApp': false; + readonly 'WebAppInternals': false; +} + +type GlobalsMocha = { + readonly 'after': false; + readonly 'afterEach': false; + readonly 'before': false; + readonly 'beforeEach': false; + readonly 'context': false; + readonly 'describe': false; + readonly 'it': false; + readonly 'mocha': false; + readonly 'run': false; + readonly 'setup': false; + readonly 'specify': false; + readonly 'suite': false; + readonly 'suiteSetup': false; + readonly 'suiteTeardown': false; + readonly 'teardown': false; + readonly 'test': false; + readonly 'xcontext': false; + readonly 'xdescribe': false; + readonly 'xit': false; + readonly 'xspecify': false; +} + +type GlobalsMongo = { + readonly '_isWindows': false; + readonly '_rand': false; + readonly 'BulkWriteResult': false; + readonly 'cat': false; + readonly 'cd': false; + readonly 'connect': false; + readonly 'db': false; + readonly 'getHostName': false; + readonly 'getMemInfo': false; + readonly 'hostname': false; + readonly 'ISODate': false; + readonly 'listFiles': false; + readonly 'load': false; + readonly 'ls': false; + readonly 'md5sumFile': false; + readonly 'mkdir': false; + readonly 'Mongo': false; + readonly 'NumberInt': false; + readonly 'NumberLong': false; + readonly 'ObjectId': false; + readonly 'PlanCache': false; + readonly 'print': false; + readonly 'printjson': false; + readonly 'pwd': false; + readonly 'quit': false; + readonly 'removeFile': false; + readonly 'rs': false; + readonly 'sh': false; + readonly 'UUID': false; + readonly 'version': false; + readonly 'WriteResult': false; +} + +type GlobalsNashorn = { + readonly '__DIR__': false; + readonly '__FILE__': false; + readonly '__LINE__': false; + readonly 'com': false; + readonly 'edu': false; + readonly 'exit': false; + readonly 'java': false; + readonly 'Java': false; + readonly 'javafx': false; + readonly 'JavaImporter': false; + readonly 'javax': false; + readonly 'JSAdapter': false; + readonly 'load': false; + readonly 'loadWithNewGlobal': false; + readonly 'org': false; + readonly 'Packages': false; + readonly 'print': false; + readonly 'quit': false; +} + +type GlobalsNode = { + readonly '__dirname': false; + readonly '__filename': false; + readonly 'AbortController': false; + readonly 'AbortSignal': false; + readonly 'atob': false; + readonly 'Blob': false; + readonly 'BroadcastChannel': false; + readonly 'btoa': false; + readonly 'Buffer': false; + readonly 'ByteLengthQueuingStrategy': false; + readonly 'clearImmediate': false; + readonly 'clearInterval': false; + readonly 'clearTimeout': false; + readonly 'CloseEvent': false; + readonly 'CompressionStream': false; + readonly 'console': false; + readonly 'CountQueuingStrategy': false; + readonly 'crypto': false; + readonly 'Crypto': false; + readonly 'CryptoKey': false; + readonly 'CustomEvent': false; + readonly 'DecompressionStream': false; + readonly 'DOMException': false; + readonly 'Event': false; + readonly 'EventTarget': false; + readonly 'exports': true; + readonly 'fetch': false; + readonly 'File': false; + readonly 'FormData': false; + readonly 'global': false; + readonly 'Headers': false; + readonly 'MessageChannel': false; + readonly 'MessageEvent': false; + readonly 'MessagePort': false; + readonly 'module': false; + readonly 'navigator': false; + readonly 'Navigator': false; + readonly 'performance': false; + readonly 'Performance': false; + readonly 'PerformanceEntry': false; + readonly 'PerformanceMark': false; + readonly 'PerformanceMeasure': false; + readonly 'PerformanceObserver': false; + readonly 'PerformanceObserverEntryList': false; + readonly 'PerformanceResourceTiming': false; + readonly 'process': false; + readonly 'queueMicrotask': false; + readonly 'ReadableByteStreamController': false; + readonly 'ReadableStream': false; + readonly 'ReadableStreamBYOBReader': false; + readonly 'ReadableStreamBYOBRequest': false; + readonly 'ReadableStreamDefaultController': false; + readonly 'ReadableStreamDefaultReader': false; + readonly 'Request': false; + readonly 'require': false; + readonly 'Response': false; + readonly 'setImmediate': false; + readonly 'setInterval': false; + readonly 'setTimeout': false; + readonly 'structuredClone': false; + readonly 'SubtleCrypto': false; + readonly 'TextDecoder': false; + readonly 'TextDecoderStream': false; + readonly 'TextEncoder': false; + readonly 'TextEncoderStream': false; + readonly 'TransformStream': false; + readonly 'TransformStreamDefaultController': false; + readonly 'URL': false; + readonly 'URLSearchParams': false; + readonly 'WebAssembly': false; + readonly 'WebSocket': false; + readonly 'WritableStream': false; + readonly 'WritableStreamDefaultController': false; + readonly 'WritableStreamDefaultWriter': false; +} + +type GlobalsNodeBuiltin = { + readonly 'AbortController': false; + readonly 'AbortSignal': false; + readonly 'atob': false; + readonly 'Blob': false; + readonly 'BroadcastChannel': false; + readonly 'btoa': false; + readonly 'Buffer': false; + readonly 'ByteLengthQueuingStrategy': false; + readonly 'clearImmediate': false; + readonly 'clearInterval': false; + readonly 'clearTimeout': false; + readonly 'CloseEvent': false; + readonly 'CompressionStream': false; + readonly 'console': false; + readonly 'CountQueuingStrategy': false; + readonly 'crypto': false; + readonly 'Crypto': false; + readonly 'CryptoKey': false; + readonly 'CustomEvent': false; + readonly 'DecompressionStream': false; + readonly 'DOMException': false; + readonly 'Event': false; + readonly 'EventTarget': false; + readonly 'fetch': false; + readonly 'File': false; + readonly 'FormData': false; + readonly 'global': false; + readonly 'Headers': false; + readonly 'MessageChannel': false; + readonly 'MessageEvent': false; + readonly 'MessagePort': false; + readonly 'navigator': false; + readonly 'Navigator': false; + readonly 'performance': false; + readonly 'Performance': false; + readonly 'PerformanceEntry': false; + readonly 'PerformanceMark': false; + readonly 'PerformanceMeasure': false; + readonly 'PerformanceObserver': false; + readonly 'PerformanceObserverEntryList': false; + readonly 'PerformanceResourceTiming': false; + readonly 'process': false; + readonly 'queueMicrotask': false; + readonly 'ReadableByteStreamController': false; + readonly 'ReadableStream': false; + readonly 'ReadableStreamBYOBReader': false; + readonly 'ReadableStreamBYOBRequest': false; + readonly 'ReadableStreamDefaultController': false; + readonly 'ReadableStreamDefaultReader': false; + readonly 'Request': false; + readonly 'Response': false; + readonly 'setImmediate': false; + readonly 'setInterval': false; + readonly 'setTimeout': false; + readonly 'structuredClone': false; + readonly 'SubtleCrypto': false; + readonly 'TextDecoder': false; + readonly 'TextDecoderStream': false; + readonly 'TextEncoder': false; + readonly 'TextEncoderStream': false; + readonly 'TransformStream': false; + readonly 'TransformStreamDefaultController': false; + readonly 'URL': false; + readonly 'URLSearchParams': false; + readonly 'WebAssembly': false; + readonly 'WebSocket': false; + readonly 'WritableStream': false; + readonly 'WritableStreamDefaultController': false; + readonly 'WritableStreamDefaultWriter': false; +} + +type GlobalsPhantomjs = { + readonly 'console': true; + readonly 'exports': true; + readonly 'phantom': true; + readonly 'require': true; + readonly 'WebPage': true; +} + +type GlobalsPrototypejs = { + readonly '$': false; + readonly '$$': false; + readonly '$A': false; + readonly '$break': false; + readonly '$continue': false; + readonly '$F': false; + readonly '$H': false; + readonly '$R': false; + readonly '$w': false; + readonly 'Abstract': false; + readonly 'Ajax': false; + readonly 'Autocompleter': false; + readonly 'Builder': false; + readonly 'Class': false; + readonly 'Control': false; + readonly 'Draggable': false; + readonly 'Draggables': false; + readonly 'Droppables': false; + readonly 'Effect': false; + readonly 'Element': false; + readonly 'Enumerable': false; + readonly 'Event': false; + readonly 'Field': false; + readonly 'Form': false; + readonly 'Hash': false; + readonly 'Insertion': false; + readonly 'ObjectRange': false; + readonly 'PeriodicalExecuter': false; + readonly 'Position': false; + readonly 'Prototype': false; + readonly 'Scriptaculous': false; + readonly 'Selector': false; + readonly 'Sortable': false; + readonly 'SortableObserver': false; + readonly 'Sound': false; + readonly 'Template': false; + readonly 'Toggle': false; + readonly 'Try': false; +} + +type GlobalsProtractor = { + readonly '$': false; + readonly '$$': false; + readonly 'browser': false; + readonly 'by': false; + readonly 'By': false; + readonly 'DartObject': false; + readonly 'element': false; + readonly 'protractor': false; +} + +type GlobalsQunit = { + readonly 'asyncTest': false; + readonly 'deepEqual': false; + readonly 'equal': false; + readonly 'expect': false; + readonly 'module': false; + readonly 'notDeepEqual': false; + readonly 'notEqual': false; + readonly 'notOk': false; + readonly 'notPropEqual': false; + readonly 'notStrictEqual': false; + readonly 'ok': false; + readonly 'propEqual': false; + readonly 'QUnit': false; + readonly 'raises': false; + readonly 'start': false; + readonly 'stop': false; + readonly 'strictEqual': false; + readonly 'test': false; + readonly 'throws': false; +} + +type GlobalsRhino = { + readonly 'defineClass': false; + readonly 'deserialize': false; + readonly 'gc': false; + readonly 'help': false; + readonly 'importClass': false; + readonly 'importPackage': false; + readonly 'java': false; + readonly 'load': false; + readonly 'loadClass': false; + readonly 'Packages': false; + readonly 'print': false; + readonly 'quit': false; + readonly 'readFile': false; + readonly 'readUrl': false; + readonly 'runCommand': false; + readonly 'seal': false; + readonly 'serialize': false; + readonly 'spawn': false; + readonly 'sync': false; + readonly 'toint32': false; + readonly 'version': false; +} + +type GlobalsServiceworker = { + readonly 'addEventListener': false; + readonly 'applicationCache': false; + readonly 'atob': false; + readonly 'Blob': false; + readonly 'BroadcastChannel': false; + readonly 'btoa': false; + readonly 'ByteLengthQueuingStrategy': false; + readonly 'Cache': false; + readonly 'caches': false; + readonly 'CacheStorage': false; + readonly 'clearInterval': false; + readonly 'clearTimeout': false; + readonly 'Client': false; + readonly 'clients': false; + readonly 'Clients': false; + readonly 'close': true; + readonly 'CompressionStream': false; + readonly 'console': false; + readonly 'CountQueuingStrategy': false; + readonly 'crypto': false; + readonly 'Crypto': false; + readonly 'CryptoKey': false; + readonly 'CustomEvent': false; + readonly 'DecompressionStream': false; + readonly 'ErrorEvent': false; + readonly 'Event': false; + readonly 'ExtendableEvent': false; + readonly 'ExtendableMessageEvent': false; + readonly 'fetch': false; + readonly 'FetchEvent': false; + readonly 'File': false; + readonly 'FileReaderSync': false; + readonly 'FormData': false; + readonly 'Headers': false; + readonly 'IDBCursor': false; + readonly 'IDBCursorWithValue': false; + readonly 'IDBDatabase': false; + readonly 'IDBFactory': false; + readonly 'IDBIndex': false; + readonly 'IDBKeyRange': false; + readonly 'IDBObjectStore': false; + readonly 'IDBOpenDBRequest': false; + readonly 'IDBRequest': false; + readonly 'IDBTransaction': false; + readonly 'IDBVersionChangeEvent': false; + readonly 'ImageData': false; + readonly 'importScripts': false; + readonly 'indexedDB': false; + readonly 'location': false; + readonly 'MessageChannel': false; + readonly 'MessageEvent': false; + readonly 'MessagePort': false; + readonly 'name': false; + readonly 'navigator': false; + readonly 'Notification': false; + readonly 'onclose': true; + readonly 'onconnect': true; + readonly 'onerror': true; + readonly 'onfetch': true; + readonly 'oninstall': true; + readonly 'onlanguagechange': true; + readonly 'onmessage': true; + readonly 'onmessageerror': true; + readonly 'onnotificationclick': true; + readonly 'onnotificationclose': true; + readonly 'onoffline': true; + readonly 'ononline': true; + readonly 'onpush': true; + readonly 'onpushsubscriptionchange': true; + readonly 'onrejectionhandled': true; + readonly 'onsync': true; + readonly 'onunhandledrejection': true; + readonly 'performance': false; + readonly 'Performance': false; + readonly 'PerformanceEntry': false; + readonly 'PerformanceMark': false; + readonly 'PerformanceMeasure': false; + readonly 'PerformanceNavigation': false; + readonly 'PerformanceObserver': false; + readonly 'PerformanceObserverEntryList': false; + readonly 'PerformanceResourceTiming': false; + readonly 'PerformanceTiming': false; + readonly 'postMessage': true; + readonly 'queueMicrotask': false; + readonly 'ReadableByteStreamController': false; + readonly 'ReadableStream': false; + readonly 'ReadableStreamBYOBReader': false; + readonly 'ReadableStreamBYOBRequest': false; + readonly 'ReadableStreamDefaultController': false; + readonly 'ReadableStreamDefaultReader': false; + readonly 'registration': false; + readonly 'removeEventListener': false; + readonly 'Request': false; + readonly 'Response': false; + readonly 'self': false; + readonly 'ServiceWorker': false; + readonly 'ServiceWorkerContainer': false; + readonly 'ServiceWorkerGlobalScope': false; + readonly 'ServiceWorkerMessageEvent': false; + readonly 'ServiceWorkerRegistration': false; + readonly 'setInterval': false; + readonly 'setTimeout': false; + readonly 'skipWaiting': false; + readonly 'SubtleCrypto': false; + readonly 'TextDecoder': false; + readonly 'TextDecoderStream': false; + readonly 'TextEncoder': false; + readonly 'TextEncoderStream': false; + readonly 'TransformStream': false; + readonly 'TransformStreamDefaultController': false; + readonly 'URL': false; + readonly 'URLSearchParams': false; + readonly 'WebAssembly': false; + readonly 'WebSocket': false; + readonly 'WindowClient': false; + readonly 'Worker': false; + readonly 'WorkerGlobalScope': false; + readonly 'WritableStream': false; + readonly 'WritableStreamDefaultController': false; + readonly 'WritableStreamDefaultWriter': false; + readonly 'XMLHttpRequest': false; +} + +type GlobalsSharednodebrowser = { + readonly 'AbortController': false; + readonly 'AbortSignal': false; + readonly 'atob': false; + readonly 'Blob': false; + readonly 'BroadcastChannel': false; + readonly 'btoa': false; + readonly 'ByteLengthQueuingStrategy': false; + readonly 'clearInterval': false; + readonly 'clearTimeout': false; + readonly 'CloseEvent': false; + readonly 'CompressionStream': false; + readonly 'console': false; + readonly 'CountQueuingStrategy': false; + readonly 'crypto': false; + readonly 'Crypto': false; + readonly 'CryptoKey': false; + readonly 'CustomEvent': false; + readonly 'DecompressionStream': false; + readonly 'DOMException': false; + readonly 'Event': false; + readonly 'EventTarget': false; + readonly 'fetch': false; + readonly 'File': false; + readonly 'FormData': false; + readonly 'Headers': false; + readonly 'MessageChannel': false; + readonly 'MessageEvent': false; + readonly 'MessagePort': false; + readonly 'navigator': false; + readonly 'Navigator': false; + readonly 'performance': false; + readonly 'Performance': false; + readonly 'PerformanceEntry': false; + readonly 'PerformanceMark': false; + readonly 'PerformanceMeasure': false; + readonly 'PerformanceObserver': false; + readonly 'PerformanceObserverEntryList': false; + readonly 'PerformanceResourceTiming': false; + readonly 'queueMicrotask': false; + readonly 'ReadableByteStreamController': false; + readonly 'ReadableStream': false; + readonly 'ReadableStreamBYOBReader': false; + readonly 'ReadableStreamBYOBRequest': false; + readonly 'ReadableStreamDefaultController': false; + readonly 'ReadableStreamDefaultReader': false; + readonly 'Request': false; + readonly 'Response': false; + readonly 'setInterval': false; + readonly 'setTimeout': false; + readonly 'structuredClone': false; + readonly 'SubtleCrypto': false; + readonly 'TextDecoder': false; + readonly 'TextDecoderStream': false; + readonly 'TextEncoder': false; + readonly 'TextEncoderStream': false; + readonly 'TransformStream': false; + readonly 'TransformStreamDefaultController': false; + readonly 'URL': false; + readonly 'URLSearchParams': false; + readonly 'WebAssembly': false; + readonly 'WebSocket': false; + readonly 'WritableStream': false; + readonly 'WritableStreamDefaultController': false; + readonly 'WritableStreamDefaultWriter': false; +} + +type GlobalsShelljs = { + readonly 'cat': false; + readonly 'cd': false; + readonly 'chmod': false; + readonly 'config': false; + readonly 'cp': false; + readonly 'dirs': false; + readonly 'echo': false; + readonly 'env': false; + readonly 'error': false; + readonly 'exec': false; + readonly 'exit': false; + readonly 'find': false; + readonly 'grep': false; + readonly 'head': false; + readonly 'ln': false; + readonly 'ls': false; + readonly 'mkdir': false; + readonly 'mv': false; + readonly 'popd': false; + readonly 'pushd': false; + readonly 'pwd': false; + readonly 'rm': false; + readonly 'sed': false; + readonly 'set': false; + readonly 'ShellString': false; + readonly 'sort': false; + readonly 'tail': false; + readonly 'tempdir': false; + readonly 'test': false; + readonly 'touch': false; + readonly 'uniq': false; + readonly 'which': false; +} + +type GlobalsVitest = { + readonly 'afterAll': false; + readonly 'afterEach': false; + readonly 'assert': false; + readonly 'assertType': false; + readonly 'beforeAll': false; + readonly 'beforeEach': false; + readonly 'chai': false; + readonly 'describe': false; + readonly 'expect': false; + readonly 'expectTypeOf': false; + readonly 'it': false; + readonly 'onTestFailed': false; + readonly 'onTestFinished': false; + readonly 'suite': false; + readonly 'test': false; + readonly 'vi': false; + readonly 'vitest': false; +} + +type GlobalsWebextensions = { + readonly 'browser': false; + readonly 'chrome': false; + readonly 'opr': false; +} + +type GlobalsWorker = { + readonly 'AbortController': false; + readonly 'AbortSignal': false; + readonly 'addEventListener': false; + readonly 'ai': false; + readonly 'atob': false; + readonly 'AudioData': false; + readonly 'AudioDecoder': false; + readonly 'AudioEncoder': false; + readonly 'BackgroundFetchManager': false; + readonly 'BackgroundFetchRecord': false; + readonly 'BackgroundFetchRegistration': false; + readonly 'BarcodeDetector': false; + readonly 'Blob': false; + readonly 'BroadcastChannel': false; + readonly 'btoa': false; + readonly 'ByteLengthQueuingStrategy': false; + readonly 'Cache': false; + readonly 'caches': false; + readonly 'CacheStorage': false; + readonly 'cancelAnimationFrame': false; + readonly 'CanvasGradient': false; + readonly 'CanvasPattern': false; + readonly 'clearInterval': false; + readonly 'clearTimeout': false; + readonly 'close': false; + readonly 'CloseEvent': false; + readonly 'CompressionStream': false; + readonly 'console': false; + readonly 'CountQueuingStrategy': false; + readonly 'createImageBitmap': false; + readonly 'CropTarget': false; + readonly 'crossOriginIsolated': false; + readonly 'crypto': false; + readonly 'Crypto': false; + readonly 'CryptoKey': false; + readonly 'CSSSkewX': false; + readonly 'CSSSkewY': false; + readonly 'CustomEvent': false; + readonly 'DecompressionStream': false; + readonly 'DedicatedWorkerGlobalScope': false; + readonly 'dispatchEvent': false; + readonly 'DOMException': false; + readonly 'DOMMatrix': false; + readonly 'DOMMatrixReadOnly': false; + readonly 'DOMPoint': false; + readonly 'DOMPointReadOnly': false; + readonly 'DOMQuad': false; + readonly 'DOMRect': false; + readonly 'DOMRectReadOnly': false; + readonly 'DOMStringList': false; + readonly 'EncodedAudioChunk': false; + readonly 'EncodedVideoChunk': false; + readonly 'ErrorEvent': false; + readonly 'Event': false; + readonly 'EventSource': false; + readonly 'EventTarget': false; + readonly 'fetch': false; + readonly 'File': false; + readonly 'FileList': false; + readonly 'FileReader': false; + readonly 'FileReaderSync': false; + readonly 'FileSystemDirectoryHandle': false; + readonly 'FileSystemFileHandle': false; + readonly 'FileSystemHandle': false; + readonly 'FileSystemSyncAccessHandle': false; + readonly 'FileSystemWritableFileStream': false; + readonly 'FontFace': false; + readonly 'fonts': false; + readonly 'FormData': false; + readonly 'GPU': false; + readonly 'GPUAdapter': false; + readonly 'GPUAdapterInfo': false; + readonly 'GPUBindGroup': false; + readonly 'GPUBindGroupLayout': false; + readonly 'GPUBuffer': false; + readonly 'GPUBufferUsage': false; + readonly 'GPUCanvasContext': false; + readonly 'GPUColorWrite': false; + readonly 'GPUCommandBuffer': false; + readonly 'GPUCommandEncoder': false; + readonly 'GPUCompilationInfo': false; + readonly 'GPUCompilationMessage': false; + readonly 'GPUComputePassEncoder': false; + readonly 'GPUComputePipeline': false; + readonly 'GPUDevice': false; + readonly 'GPUDeviceLostInfo': false; + readonly 'GPUError': false; + readonly 'GPUExternalTexture': false; + readonly 'GPUInternalError': false; + readonly 'GPUMapMode': false; + readonly 'GPUOutOfMemoryError': false; + readonly 'GPUPipelineError': false; + readonly 'GPUPipelineLayout': false; + readonly 'GPUQuerySet': false; + readonly 'GPUQueue': false; + readonly 'GPURenderBundle': false; + readonly 'GPURenderBundleEncoder': false; + readonly 'GPURenderPassEncoder': false; + readonly 'GPURenderPipeline': false; + readonly 'GPUSampler': false; + readonly 'GPUShaderModule': false; + readonly 'GPUShaderStage': false; + readonly 'GPUSupportedFeatures': false; + readonly 'GPUSupportedLimits': false; + readonly 'GPUTexture': false; + readonly 'GPUTextureUsage': false; + readonly 'GPUTextureView': false; + readonly 'GPUUncapturedErrorEvent': false; + readonly 'GPUValidationError': false; + readonly 'Headers': false; + readonly 'HID': false; + readonly 'HIDConnectionEvent': false; + readonly 'HIDDevice': false; + readonly 'HIDInputReportEvent': false; + readonly 'IDBCursor': false; + readonly 'IDBCursorWithValue': false; + readonly 'IDBDatabase': false; + readonly 'IDBFactory': false; + readonly 'IDBIndex': false; + readonly 'IDBKeyRange': false; + readonly 'IDBObjectStore': false; + readonly 'IDBOpenDBRequest': false; + readonly 'IDBRequest': false; + readonly 'IDBTransaction': false; + readonly 'IDBVersionChangeEvent': false; + readonly 'IdleDetector': false; + readonly 'ImageBitmap': false; + readonly 'ImageBitmapRenderingContext': false; + readonly 'ImageData': false; + readonly 'ImageDecoder': false; + readonly 'ImageTrack': false; + readonly 'ImageTrackList': false; + readonly 'importScripts': false; + readonly 'indexedDB': false; + readonly 'isSecureContext': false; + readonly 'location': false; + readonly 'Lock': false; + readonly 'LockManager': false; + readonly 'MediaCapabilities': false; + readonly 'MediaSource': false; + readonly 'MediaSourceHandle': false; + readonly 'MessageChannel': false; + readonly 'MessageEvent': false; + readonly 'MessagePort': false; + readonly 'name': false; + readonly 'NavigationPreloadManager': false; + readonly 'navigator': false; + readonly 'NavigatorUAData': false; + readonly 'NetworkInformation': false; + readonly 'Notification': false; + readonly 'OffscreenCanvas': false; + readonly 'OffscreenCanvasRenderingContext2D': false; + readonly 'onerror': true; + readonly 'onlanguagechange': true; + readonly 'onmessage': true; + readonly 'onmessageerror': true; + readonly 'onrejectionhandled': true; + readonly 'onunhandledrejection': true; + readonly 'origin': false; + readonly 'Path2D': false; + readonly 'performance': false; + readonly 'Performance': false; + readonly 'PerformanceEntry': false; + readonly 'PerformanceMark': false; + readonly 'PerformanceMeasure': false; + readonly 'PerformanceObserver': false; + readonly 'PerformanceObserverEntryList': false; + readonly 'PerformanceResourceTiming': false; + readonly 'PerformanceServerTiming': false; + readonly 'PeriodicSyncManager': false; + readonly 'Permissions': false; + readonly 'PermissionStatus': false; + readonly 'PERSISTENT': false; + readonly 'postMessage': false; + readonly 'PressureObserver': false; + readonly 'PressureRecord': false; + readonly 'ProgressEvent': false; + readonly 'PromiseRejectionEvent': false; + readonly 'PushManager': false; + readonly 'PushSubscription': false; + readonly 'PushSubscriptionOptions': false; + readonly 'queueMicrotask': false; + readonly 'ReadableByteStreamController': false; + readonly 'ReadableStream': false; + readonly 'ReadableStreamBYOBReader': false; + readonly 'ReadableStreamBYOBRequest': false; + readonly 'ReadableStreamDefaultController': false; + readonly 'ReadableStreamDefaultReader': false; + readonly 'removeEventListener': false; + readonly 'reportError': false; + readonly 'ReportingObserver': false; + readonly 'Request': false; + readonly 'requestAnimationFrame': false; + readonly 'Response': false; + readonly 'RTCDataChannel': false; + readonly 'RTCEncodedAudioFrame': false; + readonly 'RTCEncodedVideoFrame': false; + readonly 'scheduler': false; + readonly 'Scheduler': false; + readonly 'SecurityPolicyViolationEvent': false; + readonly 'self': false; + readonly 'Serial': false; + readonly 'SerialPort': false; + readonly 'ServiceWorkerRegistration': false; + readonly 'setInterval': false; + readonly 'setTimeout': false; + readonly 'SourceBuffer': false; + readonly 'SourceBufferList': false; + readonly 'StorageBucket': false; + readonly 'StorageBucketManager': false; + readonly 'StorageManager': false; + readonly 'structuredClone': false; + readonly 'SubtleCrypto': false; + readonly 'SyncManager': false; + readonly 'TaskController': false; + readonly 'TaskPriorityChangeEvent': false; + readonly 'TaskSignal': false; + readonly 'TEMPORARY': false; + readonly 'TextDecoder': false; + readonly 'TextDecoderStream': false; + readonly 'TextEncoder': false; + readonly 'TextEncoderStream': false; + readonly 'TextMetrics': false; + readonly 'TransformStream': false; + readonly 'TransformStreamDefaultController': false; + readonly 'TrustedHTML': false; + readonly 'TrustedScript': false; + readonly 'TrustedScriptURL': false; + readonly 'TrustedTypePolicy': false; + readonly 'TrustedTypePolicyFactory': false; + readonly 'trustedTypes': false; + readonly 'URL': false; + readonly 'URLPattern': false; + readonly 'URLSearchParams': false; + readonly 'USB': false; + readonly 'USBAlternateInterface': false; + readonly 'USBConfiguration': false; + readonly 'USBConnectionEvent': false; + readonly 'USBDevice': false; + readonly 'USBEndpoint': false; + readonly 'USBInterface': false; + readonly 'USBInTransferResult': false; + readonly 'USBIsochronousInTransferPacket': false; + readonly 'USBIsochronousInTransferResult': false; + readonly 'USBIsochronousOutTransferPacket': false; + readonly 'USBIsochronousOutTransferResult': false; + readonly 'USBOutTransferResult': false; + readonly 'UserActivation': false; + readonly 'VideoColorSpace': false; + readonly 'VideoDecoder': false; + readonly 'VideoEncoder': false; + readonly 'VideoFrame': false; + readonly 'WebAssembly': false; + readonly 'WebGL2RenderingContext': false; + readonly 'WebGLActiveInfo': false; + readonly 'WebGLBuffer': false; + readonly 'WebGLContextEvent': false; + readonly 'WebGLFramebuffer': false; + readonly 'WebGLObject': false; + readonly 'WebGLProgram': false; + readonly 'WebGLQuery': false; + readonly 'WebGLRenderbuffer': false; + readonly 'WebGLRenderingContext': false; + readonly 'WebGLSampler': false; + readonly 'WebGLShader': false; + readonly 'WebGLShaderPrecisionFormat': false; + readonly 'WebGLSync': false; + readonly 'WebGLTexture': false; + readonly 'WebGLTransformFeedback': false; + readonly 'WebGLUniformLocation': false; + readonly 'WebGLVertexArrayObject': false; + readonly 'webkitRequestFileSystem': false; + readonly 'webkitRequestFileSystemSync': false; + readonly 'webkitResolveLocalFileSystemSyncURL': false; + readonly 'webkitResolveLocalFileSystemURL': false; + readonly 'WebSocket': false; + readonly 'WebSocketError': false; + readonly 'WebSocketStream': false; + readonly 'WebTransport': false; + readonly 'WebTransportBidirectionalStream': false; + readonly 'WebTransportDatagramDuplexStream': false; + readonly 'WebTransportError': false; + readonly 'WGSLLanguageFeatures': false; + readonly 'Worker': false; + readonly 'WorkerGlobalScope': false; + readonly 'WorkerLocation': false; + readonly 'WorkerNavigator': false; + readonly 'WritableStream': false; + readonly 'WritableStreamDefaultController': false; + readonly 'WritableStreamDefaultWriter': false; + readonly 'XMLHttpRequest': false; + readonly 'XMLHttpRequestEventTarget': false; + readonly 'XMLHttpRequestUpload': false; +} + +type GlobalsWsh = { + readonly 'ActiveXObject': false; + readonly 'CollectGarbage': false; + readonly 'Debug': false; + readonly 'Enumerator': false; + readonly 'GetObject': false; + readonly 'RuntimeObject': false; + readonly 'ScriptEngine': false; + readonly 'ScriptEngineBuildVersion': false; + readonly 'ScriptEngineMajorVersion': false; + readonly 'ScriptEngineMinorVersion': false; + readonly 'VBArray': false; + readonly 'WScript': false; + readonly 'WSH': false; +} + +type GlobalsYui = { + readonly 'YAHOO': false; + readonly 'YAHOO_config': false; + readonly 'YUI': false; + readonly 'YUI_config': false; +} + +type Globals = { + readonly 'amd': GlobalsAmd; + readonly 'applescript': GlobalsApplescript; + readonly 'atomtest': GlobalsAtomtest; + readonly 'browser': GlobalsBrowser; + readonly 'builtin': GlobalsBuiltin; + readonly 'chai': GlobalsChai; + readonly 'commonjs': GlobalsCommonjs; + readonly 'couch': GlobalsCouch; + readonly 'devtools': GlobalsDevtools; + readonly 'embertest': GlobalsEmbertest; + readonly 'es2015': GlobalsEs2015; + readonly 'es2016': GlobalsEs2016; + readonly 'es2017': GlobalsEs2017; + readonly 'es2018': GlobalsEs2018; + readonly 'es2019': GlobalsEs2019; + readonly 'es2020': GlobalsEs2020; + readonly 'es2021': GlobalsEs2021; + readonly 'es2022': GlobalsEs2022; + readonly 'es2023': GlobalsEs2023; + readonly 'es2024': GlobalsEs2024; + readonly 'es2025': GlobalsEs2025; + readonly 'es3': GlobalsEs3; + readonly 'es5': GlobalsEs5; + readonly 'greasemonkey': GlobalsGreasemonkey; + readonly 'jasmine': GlobalsJasmine; + readonly 'jest': GlobalsJest; + readonly 'jquery': GlobalsJquery; + readonly 'meteor': GlobalsMeteor; + readonly 'mocha': GlobalsMocha; + readonly 'mongo': GlobalsMongo; + readonly 'nashorn': GlobalsNashorn; + readonly 'node': GlobalsNode; + readonly 'nodeBuiltin': GlobalsNodeBuiltin; + readonly 'phantomjs': GlobalsPhantomjs; + readonly 'prototypejs': GlobalsPrototypejs; + readonly 'protractor': GlobalsProtractor; + readonly 'qunit': GlobalsQunit; + readonly 'rhino': GlobalsRhino; + readonly 'serviceworker': GlobalsServiceworker; + readonly 'shared-node-browser': GlobalsSharednodebrowser; + readonly 'shelljs': GlobalsShelljs; + readonly 'vitest': GlobalsVitest; + readonly 'webextensions': GlobalsWebextensions; + readonly 'worker': GlobalsWorker; + readonly 'wsh': GlobalsWsh; + readonly 'yui': GlobalsYui; +} + +declare const globals: Globals; + +export = globals; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a951582e4176e860fdc0c9931723199310ad3d5b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = require('./globals.json'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/license new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/package.json new file mode 100644 index 0000000000000000000000000000000000000000..23e76f11190486b1baf9602eed1c1a9cad4c8183 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/package.json @@ -0,0 +1,100 @@ +{ + "name": "globals", + "version": "15.15.0", + "description": "Global identifiers from different JavaScript environments", + "license": "MIT", + "repository": "sindresorhus/globals", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "sideEffects": false, + "engines": { + "node": ">=18" + }, + "scripts": { + "test": "npm run build && xo && ava && tsd", + "prepare": "npm run build", + "update": "node scripts/update.mjs", + "update:browser": "node scripts/update.mjs --environment=browser", + "update:builtin": "node scripts/update.mjs --environment=builtin", + "update:nodeBuiltin": "node scripts/update.mjs --environment=nodeBuiltin", + "update:worker": "node scripts/update.mjs --environment=worker", + "update:shelljs": "node scripts/update.mjs --environment=shelljs", + "update:jest": "node scripts/update.mjs --environment=jest", + "update:vitest": "node scripts/update.mjs --environment=vitest", + "build": "run-s build:data build:types", + "build:data": "node scripts/generate-data.mjs", + "build:types": "node scripts/generate-types.mjs" + }, + "files": [ + "index.js", + "index.d.ts", + "globals.json" + ], + "keywords": [ + "globals", + "global", + "identifiers", + "variables", + "vars", + "jshint", + "eslint", + "environments" + ], + "devDependencies": { + "@vitest/eslint-plugin": "^1.1.30", + "ava": "^6.1.3", + "cheerio": "^1.0.0-rc.12", + "eslint-plugin-jest": "^28.8.3", + "execa": "^9.4.0", + "get-port": "^7.1.0", + "npm-run-all2": "^6.2.3", + "outdent": "^0.8.0", + "puppeteer": "^23.4.1", + "shelljs": "^0.8.5", + "tsd": "^0.31.2", + "type-fest": "^4.26.1", + "xo": "^0.59.3" + }, + "xo": { + "rules": { + "unicorn/prefer-module": "off" + }, + "overrides": [ + { + "files": [ + "data/*.mjs" + ], + "rules": { + "import/no-anonymous-default-export": "off", + "camelcase": "off", + "unicorn/filename-case": [ + "error", + { + "cases": { + "camelCase": true, + "kebabCase": true + } + } + ] + } + }, + { + "files": [ + "scripts/*.mjs" + ], + "rules": { + "n/no-unsupported-features/node-builtins": "off" + } + } + ] + }, + "tsd": { + "compilerOptions": { + "resolveJsonModule": true + } + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..3407019da7c9fa1cda5f4139b7abc30e79c45899 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/globals/readme.md @@ -0,0 +1,42 @@ +# globals + +> Global identifiers from different JavaScript environments + +It's just a [JSON file](globals.json), so you can use it in any environment. + +This package is used by ESLint 8 and earlier. For ESLint 9 and later, you should depend on this package directly in [your ESLint config](https://eslint.org/docs/latest/use/configure/language-options#predefined-global-variables). + +## Install + +```sh +npm install globals +``` + +## Usage + +```js +import globals from 'globals'; + +console.log(globals.browser); +/* +{ + addEventListener: false, + applicationCache: false, + ArrayBuffer: false, + atob: false, + … +} +*/ +``` + +Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise. + +For Node.js this package provides two sets of globals: + +- `globals.nodeBuiltin`: Globals available to all code running in Node.js. + These will usually be available as properties on the `globalThis` object and include `process`, `Buffer`, but not CommonJS arguments like `require`. + See: https://nodejs.org/api/globals.html +- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope"). + See: https://nodejs.org/api/modules.html#modules_the_module_scope + +When analyzing code that is known to run outside of a CommonJS wrapper, for example, JavaScript modules, `nodeBuiltin` can find accidental CommonJS references. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/CHANGELOG.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..6987fb4aebb578294b072c6ee645c171b80d8b08 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/CHANGELOG.md @@ -0,0 +1,151 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +## [2.8.9](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9) (2021-04-07) + + +### Bug Fixes + +* backport regex fix from [#76](https://github.com/npm/hosted-git-info/issues/76) ([29adfe5](https://github.com/npm/hosted-git-info/commit/29adfe5)), closes [#84](https://github.com/npm/hosted-git-info/issues/84) + + + + +## [2.8.8](https://github.com/npm/hosted-git-info/compare/v2.8.7...v2.8.8) (2020-02-29) + + +### Bug Fixes + +* [#61](https://github.com/npm/hosted-git-info/issues/61) & [#65](https://github.com/npm/hosted-git-info/issues/65) addressing issues w/ url.URL implmentation which regressed node 6 support ([5038b18](https://github.com/npm/hosted-git-info/commit/5038b18)), closes [#66](https://github.com/npm/hosted-git-info/issues/66) + + + + +## [2.8.7](https://github.com/npm/hosted-git-info/compare/v2.8.6...v2.8.7) (2020-02-26) + + +### Bug Fixes + +* Do not attempt to use url.URL when unavailable ([2d0bb66](https://github.com/npm/hosted-git-info/commit/2d0bb66)), closes [#61](https://github.com/npm/hosted-git-info/issues/61) [#62](https://github.com/npm/hosted-git-info/issues/62) +* Do not pass scp-style URLs to the WhatWG url.URL ([f2cdfcf](https://github.com/npm/hosted-git-info/commit/f2cdfcf)), closes [#60](https://github.com/npm/hosted-git-info/issues/60) + + + + +## [2.8.6](https://github.com/npm/hosted-git-info/compare/v2.8.5...v2.8.6) (2020-02-25) + + + + +## [2.8.5](https://github.com/npm/hosted-git-info/compare/v2.8.4...v2.8.5) (2019-10-07) + + +### Bug Fixes + +* updated pathmatch for gitlab ([e8325b5](https://github.com/npm/hosted-git-info/commit/e8325b5)), closes [#51](https://github.com/npm/hosted-git-info/issues/51) +* updated pathmatch for gitlab ([ffe056f](https://github.com/npm/hosted-git-info/commit/ffe056f)) + + + + +## [2.8.4](https://github.com/npm/hosted-git-info/compare/v2.8.3...v2.8.4) (2019-08-12) + + + + +## [2.8.3](https://github.com/npm/hosted-git-info/compare/v2.8.2...v2.8.3) (2019-08-12) + + + + +## [2.8.2](https://github.com/npm/hosted-git-info/compare/v2.8.1...v2.8.2) (2019-08-05) + + +### Bug Fixes + +* http protocol use sshurl by default ([3b1d629](https://github.com/npm/hosted-git-info/commit/3b1d629)), closes [#48](https://github.com/npm/hosted-git-info/issues/48) + + + + +## [2.8.1](https://github.com/npm/hosted-git-info/compare/v2.8.0...v2.8.1) (2019-08-05) + + +### Bug Fixes + +* ignore noCommittish on tarball url generation ([5d4a8d7](https://github.com/npm/hosted-git-info/commit/5d4a8d7)) +* use gist tarball url that works for anonymous gists ([1692435](https://github.com/npm/hosted-git-info/commit/1692435)) + + + + +# [2.8.0](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.0) (2019-08-05) + + +### Bug Fixes + +* Allow slashes in gitlab project section ([bbcf7b2](https://github.com/npm/hosted-git-info/commit/bbcf7b2)), closes [#46](https://github.com/npm/hosted-git-info/issues/46) [#43](https://github.com/npm/hosted-git-info/issues/43) +* **git-host:** disallow URI-encoded slash (%2F) in `path` ([3776fa5](https://github.com/npm/hosted-git-info/commit/3776fa5)), closes [#44](https://github.com/npm/hosted-git-info/issues/44) +* **gitlab:** Do not URL encode slashes in project name for GitLab https URL ([cbf04f9](https://github.com/npm/hosted-git-info/commit/cbf04f9)), closes [#47](https://github.com/npm/hosted-git-info/issues/47) +* do not allow invalid gist urls ([d5cf830](https://github.com/npm/hosted-git-info/commit/d5cf830)) +* **cache:** Switch to lru-cache to save ourselves from unlimited memory consumption ([e518222](https://github.com/npm/hosted-git-info/commit/e518222)), closes [#38](https://github.com/npm/hosted-git-info/issues/38) + + +### Features + +* give these objects a name ([60abaea](https://github.com/npm/hosted-git-info/commit/60abaea)) + + + + +## [2.7.1](https://github.com/npm/hosted-git-info/compare/v2.7.0...v2.7.1) (2018-07-07) + + +### Bug Fixes + +* **index:** Guard against non-string types ([5bc580d](https://github.com/npm/hosted-git-info/commit/5bc580d)) +* **parse:** Crash on strings that parse to having no host ([c931482](https://github.com/npm/hosted-git-info/commit/c931482)), closes [#35](https://github.com/npm/hosted-git-info/issues/35) + + + + +# [2.7.0](https://github.com/npm/hosted-git-info/compare/v2.6.1...v2.7.0) (2018-07-06) + + +### Bug Fixes + +* **github tarball:** update github tarballtemplate ([6efd582](https://github.com/npm/hosted-git-info/commit/6efd582)), closes [#34](https://github.com/npm/hosted-git-info/issues/34) +* **gitlab docs:** switched to lowercase anchors for readmes ([701bcd1](https://github.com/npm/hosted-git-info/commit/701bcd1)) + + +### Features + +* **all:** Support www. prefixes on hostnames ([3349575](https://github.com/npm/hosted-git-info/commit/3349575)), closes [#32](https://github.com/npm/hosted-git-info/issues/32) + + + + +## [2.6.1](https://github.com/npm/hosted-git-info/compare/v2.6.0...v2.6.1) (2018-06-25) + +### Bug Fixes + +* **Revert:** "compat: remove Object.assign fallback ([#25](https://github.com/npm/hosted-git-info/issues/25))" ([cce5a62](https://github.com/npm/hosted-git-info/commit/cce5a62)) +* **Revert:** "git-host: fix forgotten extend()" ([a815ec9](https://github.com/npm/hosted-git-info/commit/a815ec9)) + + + + +# [2.6.0](https://github.com/npm/hosted-git-info/compare/v2.5.0...v2.6.0) (2018-03-07) + + +### Bug Fixes + +* **compat:** remove Object.assign fallback ([#25](https://github.com/npm/hosted-git-info/issues/25)) ([627ab55](https://github.com/npm/hosted-git-info/commit/627ab55)) +* **git-host:** fix forgotten extend() ([eba1f7b](https://github.com/npm/hosted-git-info/commit/eba1f7b)) + + +### Features + +* **browse:** fragment support for browse() ([#28](https://github.com/npm/hosted-git-info/issues/28)) ([cd5e5bb](https://github.com/npm/hosted-git-info/commit/cd5e5bb)) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..45055763dc838d98e35b6f3bd9a94bf15218a16d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/README.md new file mode 100644 index 0000000000000000000000000000000000000000..7b723f6b9e2134a2cdc2399868b000adf502d270 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/README.md @@ -0,0 +1,133 @@ +# hosted-git-info + +This will let you identify and transform various git hosts URLs between +protocols. It also can tell you what the URL is for the raw path for +particular file for direct access without git. + +## Example + +```javascript +var hostedGitInfo = require("hosted-git-info") +var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git", opts) +/* info looks like: +{ + type: "github", + domain: "github.com", + user: "npm", + project: "hosted-git-info" +} +*/ +``` + +If the URL can't be matched with a git host, `null` will be returned. We +can match git, ssh and https urls. Additionally, we can match ssh connect +strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg, +`github:npm/hosted-git-info`). Github specifically, is detected in the case +of a third, unprefixed, form: `npm/hosted-git-info`. + +If it does match, the returned object has properties of: + +* info.type -- The short name of the service +* info.domain -- The domain for git protocol use +* info.user -- The name of the user/org on the git host +* info.project -- The name of the project on the git host + +## Version Contract + +The major version will be bumped any time… + +* The constructor stops accepting URLs that it previously accepted. +* A method is removed. +* A method can no longer accept the number and type of arguments it previously accepted. +* A method can return a different type than it currently returns. + +Implications: + +* I do not consider the specific format of the urls returned from, say + `.https()` to be a part of the contract. The contract is that it will + return a string that can be used to fetch the repo via HTTPS. But what + that string looks like, specifically, can change. +* Dropping support for a hosted git provider would constitute a breaking + change. + +## Usage + +### var info = hostedGitInfo.fromUrl(gitSpecifier[, options]) + +* *gitSpecifer* is a URL of a git repository or a SCP-style specifier of one. +* *options* is an optional object. It can have the following properties: + * *noCommittish* — If true then committishes won't be included in generated URLs. + * *noGitPlus* — If true then `git+` won't be prefixed on URLs. + +## Methods + +All of the methods take the same options as the `fromUrl` factory. Options +provided to a method override those provided to the constructor. + +* info.file(path, opts) + +Given the path of a file relative to the repository, returns a URL for +directly fetching it from the githost. If no committish was set then +`master` will be used as the default. + +For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")` +would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json` + +* info.shortcut(opts) + +eg, `github:npm/hosted-git-info` + +* info.browse(path, fragment, opts) + +eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`, +`https://github.com/npm/hosted-git-info/tree/v1.2.0/package.json`, +`https://github.com/npm/hosted-git-info/tree/v1.2.0/REAMDE.md#supported-hosts` + +* info.bugs(opts) + +eg, `https://github.com/npm/hosted-git-info/issues` + +* info.docs(opts) + +eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme` + +* info.https(opts) + +eg, `git+https://github.com/npm/hosted-git-info.git` + +* info.sshurl(opts) + +eg, `git+ssh://git@github.com/npm/hosted-git-info.git` + +* info.ssh(opts) + +eg, `git@github.com:npm/hosted-git-info.git` + +* info.path(opts) + +eg, `npm/hosted-git-info` + +* info.tarball(opts) + +eg, `https://github.com/npm/hosted-git-info/archive/v1.2.0.tar.gz` + +* info.getDefaultRepresentation() + +Returns the default output type. The default output type is based on the +string you passed in to be parsed + +* info.toString(opts) + +Uses the getDefaultRepresentation to call one of the other methods to get a URL for +this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give +you a normalized version of the URL that still uses the same protocol. + +Shortcuts will still be returned as shortcuts, but the special case github +form of `org/project` will be normalized to `github:org/project`. + +SSH connect strings will be normalized into `git+ssh` URLs. + +## Supported hosts + +Currently this supports Github, Bitbucket and Gitlab. Pull requests for +additional hosts welcome. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/git-host-info.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/git-host-info.js new file mode 100644 index 0000000000000000000000000000000000000000..8147e3348f5e8060d997e9066a73db052a6f492b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/git-host-info.js @@ -0,0 +1,79 @@ +'use strict' + +var gitHosts = module.exports = { + github: { + // First two are insecure and generally shouldn't be used any more, but + // they are still supported. + 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'github.com', + 'treepath': 'tree', + 'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}', + 'bugstemplate': 'https://{domain}/{user}/{project}/issues', + 'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}', + 'tarballtemplate': 'https://codeload.{domain}/{user}/{project}/tar.gz/{committish}' + }, + bitbucket: { + 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'bitbucket.org', + 'treepath': 'src', + 'tarballtemplate': 'https://{domain}/{user}/{project}/get/{committish}.tar.gz' + }, + gitlab: { + 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'gitlab.com', + 'treepath': 'tree', + 'bugstemplate': 'https://{domain}/{user}/{project}/issues', + 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}', + 'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}', + 'pathmatch': /^[/]([^/]+)[/]((?!.*(\/-\/|\/repository\/archive\.tar\.gz\?=.*|\/repository\/[^/]+\/archive.tar.gz$)).*?)(?:[.]git|[/])?$/ + }, + gist: { + 'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'gist.github.com', + 'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]{32,})(?:[.]git)?$/, + 'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}', + 'bugstemplate': 'https://{domain}/{project}', + 'gittemplate': 'git://{domain}/{project}.git{#committish}', + 'sshtemplate': 'git@{domain}:/{project}.git{#committish}', + 'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#committish}', + 'browsetemplate': 'https://{domain}/{project}{/committish}', + 'browsefiletemplate': 'https://{domain}/{project}{/committish}{#path}', + 'docstemplate': 'https://{domain}/{project}{/committish}', + 'httpstemplate': 'git+https://{domain}/{project}.git{#committish}', + 'shortcuttemplate': '{type}:{project}{#committish}', + 'pathtemplate': '{project}{#committish}', + 'tarballtemplate': 'https://codeload.github.com/gist/{project}/tar.gz/{committish}', + 'hashformat': function (fragment) { + return 'file-' + formatHashFragment(fragment) + } + } +} + +var gitHostDefaults = { + 'sshtemplate': 'git@{domain}:{user}/{project}.git{#committish}', + 'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#committish}', + 'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}', + 'browsefiletemplate': 'https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}', + 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme', + 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}', + 'filetemplate': 'https://{domain}/{user}/{project}/raw/{committish}/{path}', + 'shortcuttemplate': '{type}:{user}/{project}{#committish}', + 'pathtemplate': '{user}/{project}{#committish}', + 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/, + 'hashformat': formatHashFragment +} + +Object.keys(gitHosts).forEach(function (name) { + Object.keys(gitHostDefaults).forEach(function (key) { + if (gitHosts[name][key]) return + gitHosts[name][key] = gitHostDefaults[key] + }) + gitHosts[name].protocols_re = RegExp('^(' + + gitHosts[name].protocols.map(function (protocol) { + return protocol.replace(/([\\+*{}()[\]$^|])/g, '\\$1') + }).join('|') + '):$') +}) + +function formatHashFragment (fragment) { + return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-') +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/git-host.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/git-host.js new file mode 100644 index 0000000000000000000000000000000000000000..9616fbaa6b4af0781e21a867269fcc2d31f9b14a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/git-host.js @@ -0,0 +1,156 @@ +'use strict' +var gitHosts = require('./git-host-info.js') +/* eslint-disable node/no-deprecated-api */ + +// copy-pasta util._extend from node's source, to avoid pulling +// the whole util module into peoples' webpack bundles. +/* istanbul ignore next */ +var extend = Object.assign || function _extend (target, source) { + // Don't do anything if source isn't an object + if (source === null || typeof source !== 'object') return target + + var keys = Object.keys(source) + var i = keys.length + while (i--) { + target[keys[i]] = source[keys[i]] + } + return target +} + +module.exports = GitHost +function GitHost (type, user, auth, project, committish, defaultRepresentation, opts) { + var gitHostInfo = this + gitHostInfo.type = type + Object.keys(gitHosts[type]).forEach(function (key) { + gitHostInfo[key] = gitHosts[type][key] + }) + gitHostInfo.user = user + gitHostInfo.auth = auth + gitHostInfo.project = project + gitHostInfo.committish = committish + gitHostInfo.default = defaultRepresentation + gitHostInfo.opts = opts || {} +} + +GitHost.prototype.hash = function () { + return this.committish ? '#' + this.committish : '' +} + +GitHost.prototype._fill = function (template, opts) { + if (!template) return + var vars = extend({}, opts) + vars.path = vars.path ? vars.path.replace(/^[/]+/g, '') : '' + opts = extend(extend({}, this.opts), opts) + var self = this + Object.keys(this).forEach(function (key) { + if (self[key] != null && vars[key] == null) vars[key] = self[key] + }) + var rawAuth = vars.auth + var rawcommittish = vars.committish + var rawFragment = vars.fragment + var rawPath = vars.path + var rawProject = vars.project + Object.keys(vars).forEach(function (key) { + var value = vars[key] + if ((key === 'path' || key === 'project') && typeof value === 'string') { + vars[key] = value.split('/').map(function (pathComponent) { + return encodeURIComponent(pathComponent) + }).join('/') + } else { + vars[key] = encodeURIComponent(value) + } + }) + vars['auth@'] = rawAuth ? rawAuth + '@' : '' + vars['#fragment'] = rawFragment ? '#' + this.hashformat(rawFragment) : '' + vars.fragment = vars.fragment ? vars.fragment : '' + vars['#path'] = rawPath ? '#' + this.hashformat(rawPath) : '' + vars['/path'] = vars.path ? '/' + vars.path : '' + vars.projectPath = rawProject.split('/').map(encodeURIComponent).join('/') + if (opts.noCommittish) { + vars['#committish'] = '' + vars['/tree/committish'] = '' + vars['/committish'] = '' + vars.committish = '' + } else { + vars['#committish'] = rawcommittish ? '#' + rawcommittish : '' + vars['/tree/committish'] = vars.committish + ? '/' + vars.treepath + '/' + vars.committish + : '' + vars['/committish'] = vars.committish ? '/' + vars.committish : '' + vars.committish = vars.committish || 'master' + } + var res = template + Object.keys(vars).forEach(function (key) { + res = res.replace(new RegExp('[{]' + key + '[}]', 'g'), vars[key]) + }) + if (opts.noGitPlus) { + return res.replace(/^git[+]/, '') + } else { + return res + } +} + +GitHost.prototype.ssh = function (opts) { + return this._fill(this.sshtemplate, opts) +} + +GitHost.prototype.sshurl = function (opts) { + return this._fill(this.sshurltemplate, opts) +} + +GitHost.prototype.browse = function (P, F, opts) { + if (typeof P === 'string') { + if (typeof F !== 'string') { + opts = F + F = null + } + return this._fill(this.browsefiletemplate, extend({ + fragment: F, + path: P + }, opts)) + } else { + return this._fill(this.browsetemplate, P) + } +} + +GitHost.prototype.docs = function (opts) { + return this._fill(this.docstemplate, opts) +} + +GitHost.prototype.bugs = function (opts) { + return this._fill(this.bugstemplate, opts) +} + +GitHost.prototype.https = function (opts) { + return this._fill(this.httpstemplate, opts) +} + +GitHost.prototype.git = function (opts) { + return this._fill(this.gittemplate, opts) +} + +GitHost.prototype.shortcut = function (opts) { + return this._fill(this.shortcuttemplate, opts) +} + +GitHost.prototype.path = function (opts) { + return this._fill(this.pathtemplate, opts) +} + +GitHost.prototype.tarball = function (opts_) { + var opts = extend({}, opts_, { noCommittish: false }) + return this._fill(this.tarballtemplate, opts) +} + +GitHost.prototype.file = function (P, opts) { + return this._fill(this.filetemplate, extend({ path: P }, opts)) +} + +GitHost.prototype.getDefaultRepresentation = function () { + return this.default +} + +GitHost.prototype.toString = function (opts) { + if (this.default && typeof this[this.default] === 'function') return this[this.default](opts) + return this.sshurl(opts) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/index.js new file mode 100644 index 0000000000000000000000000000000000000000..0885772256362703ac509ab13eecde7b631c25f4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/index.js @@ -0,0 +1,148 @@ +'use strict' +var url = require('url') +var gitHosts = require('./git-host-info.js') +var GitHost = module.exports = require('./git-host.js') + +var protocolToRepresentationMap = { + 'git+ssh:': 'sshurl', + 'git+https:': 'https', + 'ssh:': 'sshurl', + 'git:': 'git' +} + +function protocolToRepresentation (protocol) { + return protocolToRepresentationMap[protocol] || protocol.slice(0, -1) +} + +var authProtocols = { + 'git:': true, + 'https:': true, + 'git+https:': true, + 'http:': true, + 'git+http:': true +} + +var cache = {} + +module.exports.fromUrl = function (giturl, opts) { + if (typeof giturl !== 'string') return + var key = giturl + JSON.stringify(opts || {}) + + if (!(key in cache)) { + cache[key] = fromUrl(giturl, opts) + } + + return cache[key] +} + +function fromUrl (giturl, opts) { + if (giturl == null || giturl === '') return + var url = fixupUnqualifiedGist( + isGitHubShorthand(giturl) ? 'github:' + giturl : giturl + ) + var parsed = parseGitUrl(url) + var shortcutMatch = url.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/) + var matches = Object.keys(gitHosts).map(function (gitHostName) { + try { + var gitHostInfo = gitHosts[gitHostName] + var auth = null + if (parsed.auth && authProtocols[parsed.protocol]) { + auth = parsed.auth + } + var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null + var user = null + var project = null + var defaultRepresentation = null + if (shortcutMatch && shortcutMatch[1] === gitHostName) { + user = shortcutMatch[2] && decodeURIComponent(shortcutMatch[2]) + project = decodeURIComponent(shortcutMatch[3].replace(/\.git$/, '')) + defaultRepresentation = 'shortcut' + } else { + if (parsed.host && parsed.host !== gitHostInfo.domain && parsed.host.replace(/^www[.]/, '') !== gitHostInfo.domain) return + if (!gitHostInfo.protocols_re.test(parsed.protocol)) return + if (!parsed.path) return + var pathmatch = gitHostInfo.pathmatch + var matched = parsed.path.match(pathmatch) + if (!matched) return + /* istanbul ignore else */ + if (matched[1] !== null && matched[1] !== undefined) { + user = decodeURIComponent(matched[1].replace(/^:/, '')) + } + project = decodeURIComponent(matched[2]) + defaultRepresentation = protocolToRepresentation(parsed.protocol) + } + return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts) + } catch (ex) { + /* istanbul ignore else */ + if (ex instanceof URIError) { + } else throw ex + } + }).filter(function (gitHostInfo) { return gitHostInfo }) + if (matches.length !== 1) return + return matches[0] +} + +function isGitHubShorthand (arg) { + // Note: This does not fully test the git ref format. + // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html + // + // The only way to do this properly would be to shell out to + // git-check-ref-format, and as this is a fast sync function, + // we don't want to do that. Just let git fail if it turns + // out that the commit-ish is invalid. + // GH usernames cannot start with . or - + return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg) +} + +function fixupUnqualifiedGist (giturl) { + // necessary for round-tripping gists + var parsed = url.parse(giturl) + if (parsed.protocol === 'gist:' && parsed.host && !parsed.path) { + return parsed.protocol + '/' + parsed.host + } else { + return giturl + } +} + +function parseGitUrl (giturl) { + var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/) + if (!matched) { + var legacy = url.parse(giturl) + // If we don't have url.URL, then sorry, this is just not fixable. + // This affects Node <= 6.12. + if (legacy.auth && typeof url.URL === 'function') { + // git urls can be in the form of scp-style/ssh-connect strings, like + // git+ssh://user@host.com:some/path, which the legacy url parser + // supports, but WhatWG url.URL class does not. However, the legacy + // parser de-urlencodes the username and password, so something like + // https://user%3An%40me:p%40ss%3Aword@x.com/ becomes + // https://user:n@me:p@ss:word@x.com/ which is all kinds of wrong. + // Pull off just the auth and host, so we dont' get the confusing + // scp-style URL, then pass that to the WhatWG parser to get the + // auth properly escaped. + var authmatch = giturl.match(/[^@]+@[^:/]+/) + /* istanbul ignore else - this should be impossible */ + if (authmatch) { + var whatwg = new url.URL(authmatch[0]) + legacy.auth = whatwg.username || '' + if (whatwg.password) legacy.auth += ':' + whatwg.password + } + } + return legacy + } + return { + protocol: 'git+ssh:', + slashes: true, + auth: matched[1], + host: matched[2], + port: null, + hostname: matched[2], + hash: matched[4], + search: null, + query: null, + pathname: '/' + matched[3], + path: '/' + matched[3], + href: 'git+ssh://' + matched[1] + '@' + matched[2] + + '/' + matched[3] + (matched[4] || '') + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8cc554c3e9608d79ebee6f20cf79561df1cafe79 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info/package.json @@ -0,0 +1,40 @@ +{ + "name": "hosted-git-info", + "version": "2.8.9", + "description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab", + "main": "index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/hosted-git-info.git" + }, + "keywords": [ + "git", + "github", + "bitbucket", + "gitlab" + ], + "author": "Rebecca Turner (http://re-becca.org)", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/hosted-git-info/issues" + }, + "homepage": "https://github.com/npm/hosted-git-info", + "scripts": { + "prerelease": "npm t", + "postrelease": "npm publish --tag=ancient-legacy-fixes && git push --follow-tags", + "posttest": "standard", + "release": "standard-version -s", + "test:coverage": "tap --coverage-report=html -J --coverage=90 --no-esm test/*.js", + "test": "tap -J --coverage=90 --no-esm test/*.js" + }, + "devDependencies": { + "standard": "^11.0.1", + "standard-version": "^4.4.0", + "tap": "^12.7.0" + }, + "files": [ + "index.js", + "git-host.js", + "git-host-info.js" + ] +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..118523115645a025b393592282d744b82e5b3159 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/index.d.ts @@ -0,0 +1,42 @@ +declare namespace indentString { + interface Options { + /** + The string to use for the indent. + + @default ' ' + */ + readonly indent?: string; + + /** + Also indent empty lines. + + @default false + */ + readonly includeEmptyLines?: boolean; + } +} + +/** +Indent each line in a string. + +@param string - The string to indent. +@param count - How many times you want `options.indent` repeated. Default: `1`. + +@example +``` +import indentString = require('indent-string'); + +indentString('Unicorns\nRainbows', 4); +//=> ' Unicorns\n Rainbows' + +indentString('Unicorns\nRainbows', 4, {indent: '♥'}); +//=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows' +``` +*/ +declare function indentString( + string: string, + count?: number, + options?: indentString.Options +): string; + +export = indentString; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e1ab804f2fd8a15f93c6556fed470aa87c5a37e3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/index.js @@ -0,0 +1,35 @@ +'use strict'; + +module.exports = (string, count = 1, options) => { + options = { + indent: ' ', + includeEmptyLines: false, + ...options + }; + + if (typeof string !== 'string') { + throw new TypeError( + `Expected \`input\` to be a \`string\`, got \`${typeof string}\`` + ); + } + + if (typeof count !== 'number') { + throw new TypeError( + `Expected \`count\` to be a \`number\`, got \`${typeof count}\`` + ); + } + + if (typeof options.indent !== 'string') { + throw new TypeError( + `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\`` + ); + } + + if (count === 0) { + return string; + } + + const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm; + + return string.replace(regex, options.indent.repeat(count)); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/package.json new file mode 100644 index 0000000000000000000000000000000000000000..497bb83bbd9b7f468081d0f8ce69f0c8cd547454 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/package.json @@ -0,0 +1,37 @@ +{ + "name": "indent-string", + "version": "4.0.0", + "description": "Indent each line in a string", + "license": "MIT", + "repository": "sindresorhus/indent-string", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "indent", + "string", + "pad", + "align", + "line", + "text", + "each", + "every" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..49967de074f2fd109cdb550a468e83ed579a668b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/indent-string/readme.md @@ -0,0 +1,70 @@ +# indent-string [![Build Status](https://travis-ci.org/sindresorhus/indent-string.svg?branch=master)](https://travis-ci.org/sindresorhus/indent-string) + +> Indent each line in a string + + +## Install + +``` +$ npm install indent-string +``` + + +## Usage + +```js +const indentString = require('indent-string'); + +indentString('Unicorns\nRainbows', 4); +//=> ' Unicorns\n Rainbows' + +indentString('Unicorns\nRainbows', 4, {indent: '♥'}); +//=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows' +``` + + +## API + +### indentString(string, [count], [options]) + +#### string + +Type: `string` + +The string to indent. + +#### count + +Type: `number`
+Default: `1` + +How many times you want `options.indent` repeated. + +#### options + +Type: `object` + +##### indent + +Type: `string`
+Default: `' '` + +The string to use for the indent. + +##### includeEmptyLines + +Type: `boolean`
+Default: `false` + +Also indent empty lines. + + +## Related + +- [indent-string-cli](https://github.com/sindresorhus/indent-string-cli) - CLI for this module +- [strip-indent](https://github.com/sindresorhus/strip-indent) - Strip leading whitespace from every line in a string + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fbde526c0ab230251114add36498114b9dc18e85 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/index.d.ts @@ -0,0 +1,83 @@ +declare namespace locatePath { + interface Options { + /** + Current working directory. + + @default process.cwd() + */ + readonly cwd?: string; + + /** + Type of path to match. + + @default 'file' + */ + readonly type?: 'file' | 'directory'; + + /** + Allow symbolic links to match if they point to the requested path type. + + @default true + */ + readonly allowSymlinks?: boolean; + } + + interface AsyncOptions extends Options { + /** + Number of concurrently pending promises. Minimum: `1`. + + @default Infinity + */ + readonly concurrency?: number; + + /** + Preserve `paths` order when searching. + + Disable this to improve performance if you don't care about the order. + + @default true + */ + readonly preserveOrder?: boolean; + } +} + +declare const locatePath: { + /** + Get the first path that exists on disk of multiple paths. + + @param paths - Paths to check. + @returns The first path that exists or `undefined` if none exists. + + @example + ``` + import locatePath = require('locate-path'); + + const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' + ]; + + (async () => { + console(await locatePath(files)); + //=> 'rainbow' + })(); + ``` + */ + (paths: Iterable, options?: locatePath.AsyncOptions): Promise< + string | undefined + >; + + /** + Synchronously get the first path that exists on disk of multiple paths. + + @param paths - Paths to check. + @returns The first path that exists or `undefined` if none exists. + */ + sync( + paths: Iterable, + options?: locatePath.Options + ): string | undefined; +}; + +export = locatePath; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4604bbf4015c418d46fef3093f0570a27efa85c1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/index.js @@ -0,0 +1,65 @@ +'use strict'; +const path = require('path'); +const fs = require('fs'); +const {promisify} = require('util'); +const pLocate = require('p-locate'); + +const fsStat = promisify(fs.stat); +const fsLStat = promisify(fs.lstat); + +const typeMappings = { + directory: 'isDirectory', + file: 'isFile' +}; + +function checkType({type}) { + if (type in typeMappings) { + return; + } + + throw new Error(`Invalid type specified: ${type}`); +} + +const matchType = (type, stat) => type === undefined || stat[typeMappings[type]](); + +module.exports = async (paths, options) => { + options = { + cwd: process.cwd(), + type: 'file', + allowSymlinks: true, + ...options + }; + checkType(options); + const statFn = options.allowSymlinks ? fsStat : fsLStat; + + return pLocate(paths, async path_ => { + try { + const stat = await statFn(path.resolve(options.cwd, path_)); + return matchType(options.type, stat); + } catch (_) { + return false; + } + }, options); +}; + +module.exports.sync = (paths, options) => { + options = { + cwd: process.cwd(), + allowSymlinks: true, + type: 'file', + ...options + }; + checkType(options); + const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync; + + for (const path_ of paths) { + try { + const stat = statFn(path.resolve(options.cwd, path_)); + + if (matchType(options.type, stat)) { + return path_; + } + } catch (_) { + } + } +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/package.json new file mode 100644 index 0000000000000000000000000000000000000000..063b290253f68e9a07e1958842cd2e36807b309f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/package.json @@ -0,0 +1,45 @@ +{ + "name": "locate-path", + "version": "5.0.0", + "description": "Get the first path that exists on disk of multiple paths", + "license": "MIT", + "repository": "sindresorhus/locate-path", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "locate", + "path", + "paths", + "file", + "files", + "exists", + "find", + "finder", + "search", + "searcher", + "array", + "iterable", + "iterator" + ], + "dependencies": { + "p-locate": "^4.1.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..2184c6f30c24c557b3593f727f01727914927c7e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/locate-path/readme.md @@ -0,0 +1,122 @@ +# locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path) + +> Get the first path that exists on disk of multiple paths + + +## Install + +``` +$ npm install locate-path +``` + + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +const locatePath = require('locate-path'); + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +(async () => { + console(await locatePath(files)); + //=> 'rainbow' +})(); +``` + + +## API + +### locatePath(paths, [options]) + +Returns a `Promise` for the first path that exists or `undefined` if none exists. + +#### paths + +Type: `Iterable` + +Paths to check. + +#### options + +Type: `Object` + +##### concurrency + +Type: `number`
+Default: `Infinity`
+Minimum: `1` + +Number of concurrently pending promises. + +##### preserveOrder + +Type: `boolean`
+Default: `true` + +Preserve `paths` order when searching. + +Disable this to improve performance if you don't care about the order. + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Current working directory. + +##### type + +Type: `string`
+Default: `file`
+Values: `file` `directory` + +The type of paths that can match. + +##### allowSymlinks + +Type: `boolean`
+Default: `true` + +Allow symbolic links to match if they point to the chosen path type. + +### locatePath.sync(paths, [options]) + +Returns the first path that exists or `undefined` if none exists. + +#### paths + +Type: `Iterable` + +Paths to check. + +#### options + +Type: `Object` + +##### cwd + +Same as above. + +##### type + +Same as above. + +##### allowSymlinks + +Same as above. + + +## Related + +- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/AUTHORS b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..66282ba1d11971a599d7a65b19756d8111489c2c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/AUTHORS @@ -0,0 +1,4 @@ +# Names sorted by how much code was originally theirs. +Isaac Z. Schlueter +Meryn Stol +Robert Kowalski diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..6ed662cd5d14de47fc0a0b1835d93986c5004fe5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/LICENSE @@ -0,0 +1,30 @@ +This package contains code originally written by Isaac Z. Schlueter. +Used with permission. + +Copyright (c) Meryn Stol ("Author") +All rights reserved. + +The BSD License + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d2bd7bc7ff60628582817aee5b49663504ba85d6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/README.md @@ -0,0 +1,106 @@ +# normalize-package-data [![Build Status](https://travis-ci.org/npm/normalize-package-data.png?branch=master)](https://travis-ci.org/npm/normalize-package-data) + +normalize-package-data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry. + +normalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools. + +## Installation + +``` +npm install normalize-package-data +``` + +## Usage + +Basic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`. + +```javascript +normalizeData = require('normalize-package-data') +packageData = require("./package.json") +normalizeData(packageData) +// packageData is now normalized +``` + +#### Strict mode + +You may activate strict validation by passing true as the second argument. + +```javascript +normalizeData = require('normalize-package-data') +packageData = require("./package.json") +normalizeData(packageData, true) +// packageData is now normalized +``` + +If strict mode is activated, only Semver 2.0 version strings are accepted. Otherwise, Semver 1.0 strings are accepted as well. Packages must have a name, and the name field must not have contain leading or trailing whitespace. + +#### Warnings + +Optionally, you may pass a "warning" function. It gets called whenever the `normalizeData` function encounters something that doesn't look right. It indicates less than perfect input data. + +```javascript +normalizeData = require('normalize-package-data') +packageData = require("./package.json") +warnFn = function(msg) { console.error(msg) } +normalizeData(packageData, warnFn) +// packageData is now normalized. Any number of warnings may have been logged. +``` + +You may combine strict validation with warnings by passing `true` as the second argument, and `warnFn` as third. + +When `private` field is set to `true`, warnings will be suppressed. + +### Potential exceptions + +If the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback. + +## What normalization (currently) entails + +* The value of `name` field gets trimmed (unless in strict mode). +* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver). +* If `name` and/or `version` fields are missing, they are set to empty strings. +* If `files` field is not an array, it will be removed. +* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value. +* If `man` field is a string, it will become an array with the original string as its sole member. +* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\s+`. +* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties. +* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`. +* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs. +* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched. +* As of v2: Dependencies that point at known hosted git providers (currently: github, bitbucket, gitlab) will have their URLs canonicalized, but protocols will be preserved. +* As of v2: Dependencies that use shortcuts for hosted git providers (`org/proj`, `github:org/proj`, `bitbucket:org/proj`, `gitlab:org/proj`, `gist:docid`) will have the shortcut left in place. (In the case of github, the `org/proj` form will be expanded to `github:org/proj`.) THIS MARKS A BREAKING CHANGE FROM V1, where the shorcut was previously expanded to a URL. +* If `description` field does not exist, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`. +* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `"git"`. +* If `repository.url` is not a valid url, but in the style of "[owner-name]/[repo-name]", `repository.url` will be set to git+https://github.com/[owner-name]/[repo-name].git +* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value. +* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen. +* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed. +* If `homepage` field is not a string, it will be removed. +* If the url in the `homepage` field does not specify a protocol, then http is assumed. For example, `myproject.org` will be changed to `http://myproject.org`. +* If `homepage` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `homepage` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]#readme . If the repository field points to a GitHub Gist repo url, the associated http url is chosen. + +### Rules for name field + +If `name` field is given, the value of the name field must be a string. The string may not: + +* start with a period. +* contain the following characters: `/@\s+%` +* contain any characters that would need to be encoded for use in urls. +* resemble the word `node_modules` or `favicon.ico` (case doesn't matter). + +### Rules for version field + +If `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver). + +### Rules for license field + +The `license` field should be a valid *SPDX license expression* or one of the special values allowed by [validate-npm-package-license](https://npmjs.com/package/validate-npm-package-license). See [documentation for the license field in package.json](https://docs.npmjs.com/files/package.json#license). + +## Credits + +This package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson. + +## License + +normalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT). +Copyright (c) 2013 Meryn Stol diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/extract_description.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/extract_description.js new file mode 100644 index 0000000000000000000000000000000000000000..83f10aa0a79066d6b8809eeccce6f8e8c228a7d5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/extract_description.js @@ -0,0 +1,14 @@ +module.exports = extractDescription + +// Extracts description from contents of a readme file in markdown format +function extractDescription (d) { + if (!d) return; + if (d === "ERROR: No README data found!") return; + // the first block of text before the first heading + // that isn't the first line heading + d = d.trim().split('\n') + for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++); + var l = d.length + for (var e = s + 1; e < l && d[e].trim(); e ++); + return d.slice(s, e).join(' ').trim() +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/fixer.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/fixer.js new file mode 100644 index 0000000000000000000000000000000000000000..27682e9611afd2d6b30469c3d4f4e3972f873d22 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/fixer.js @@ -0,0 +1,418 @@ +var semver = require("semver") +var validateLicense = require('validate-npm-package-license'); +var hostedGitInfo = require("hosted-git-info") +var isBuiltinModule = require("resolve").isCore +var depTypes = ["dependencies","devDependencies","optionalDependencies"] +var extractDescription = require("./extract_description") +var url = require("url") +var typos = require("./typos.json") + +var fixer = module.exports = { + // default warning function + warn: function() {}, + + fixRepositoryField: function(data) { + if (data.repositories) { + this.warn("repositories"); + data.repository = data.repositories[0] + } + if (!data.repository) return this.warn("missingRepository") + if (typeof data.repository === "string") { + data.repository = { + type: "git", + url: data.repository + } + } + var r = data.repository.url || "" + if (r) { + var hosted = hostedGitInfo.fromUrl(r) + if (hosted) { + r = data.repository.url + = hosted.getDefaultRepresentation() == "shortcut" ? hosted.https() : hosted.toString() + } + } + + if (r.match(/github.com\/[^\/]+\/[^\/]+\.git\.git$/)) { + this.warn("brokenGitUrl", r) + } + } + +, fixTypos: function(data) { + Object.keys(typos.topLevel).forEach(function (d) { + if (data.hasOwnProperty(d)) { + this.warn("typo", d, typos.topLevel[d]) + } + }, this) + } + +, fixScriptsField: function(data) { + if (!data.scripts) return + if (typeof data.scripts !== "object") { + this.warn("nonObjectScripts") + delete data.scripts + return + } + Object.keys(data.scripts).forEach(function (k) { + if (typeof data.scripts[k] !== "string") { + this.warn("nonStringScript") + delete data.scripts[k] + } else if (typos.script[k] && !data.scripts[typos.script[k]]) { + this.warn("typo", k, typos.script[k], "scripts") + } + }, this) + } + +, fixFilesField: function(data) { + var files = data.files + if (files && !Array.isArray(files)) { + this.warn("nonArrayFiles") + delete data.files + } else if (data.files) { + data.files = data.files.filter(function(file) { + if (!file || typeof file !== "string") { + this.warn("invalidFilename", file) + return false + } else { + return true + } + }, this) + } + } + +, fixBinField: function(data) { + if (!data.bin) return; + if (typeof data.bin === "string") { + var b = {} + var match + if (match = data.name.match(/^@[^/]+[/](.*)$/)) { + b[match[1]] = data.bin + } else { + b[data.name] = data.bin + } + data.bin = b + } + } + +, fixManField: function(data) { + if (!data.man) return; + if (typeof data.man === "string") { + data.man = [ data.man ] + } + } +, fixBundleDependenciesField: function(data) { + var bdd = "bundledDependencies" + var bd = "bundleDependencies" + if (data[bdd] && !data[bd]) { + data[bd] = data[bdd] + delete data[bdd] + } + if (data[bd] && !Array.isArray(data[bd])) { + this.warn("nonArrayBundleDependencies") + delete data[bd] + } else if (data[bd]) { + data[bd] = data[bd].filter(function(bd) { + if (!bd || typeof bd !== 'string') { + this.warn("nonStringBundleDependency", bd) + return false + } else { + if (!data.dependencies) { + data.dependencies = {} + } + if (!data.dependencies.hasOwnProperty(bd)) { + this.warn("nonDependencyBundleDependency", bd) + data.dependencies[bd] = "*" + } + return true + } + }, this) + } + } + +, fixDependencies: function(data, strict) { + var loose = !strict + objectifyDeps(data, this.warn) + addOptionalDepsToDeps(data, this.warn) + this.fixBundleDependenciesField(data) + + ;['dependencies','devDependencies'].forEach(function(deps) { + if (!(deps in data)) return + if (!data[deps] || typeof data[deps] !== "object") { + this.warn("nonObjectDependencies", deps) + delete data[deps] + return + } + Object.keys(data[deps]).forEach(function (d) { + var r = data[deps][d] + if (typeof r !== 'string') { + this.warn("nonStringDependency", d, JSON.stringify(r)) + delete data[deps][d] + } + var hosted = hostedGitInfo.fromUrl(data[deps][d]) + if (hosted) data[deps][d] = hosted.toString() + }, this) + }, this) + } + +, fixModulesField: function (data) { + if (data.modules) { + this.warn("deprecatedModules") + delete data.modules + } + } + +, fixKeywordsField: function (data) { + if (typeof data.keywords === "string") { + data.keywords = data.keywords.split(/,\s+/) + } + if (data.keywords && !Array.isArray(data.keywords)) { + delete data.keywords + this.warn("nonArrayKeywords") + } else if (data.keywords) { + data.keywords = data.keywords.filter(function(kw) { + if (typeof kw !== "string" || !kw) { + this.warn("nonStringKeyword"); + return false + } else { + return true + } + }, this) + } + } + +, fixVersionField: function(data, strict) { + // allow "loose" semver 1.0 versions in non-strict mode + // enforce strict semver 2.0 compliance in strict mode + var loose = !strict + if (!data.version) { + data.version = "" + return true + } + if (!semver.valid(data.version, loose)) { + throw new Error('Invalid version: "'+ data.version + '"') + } + data.version = semver.clean(data.version, loose) + return true + } + +, fixPeople: function(data) { + modifyPeople(data, unParsePerson) + modifyPeople(data, parsePerson) + } + +, fixNameField: function(data, options) { + if (typeof options === "boolean") options = {strict: options} + else if (typeof options === "undefined") options = {} + var strict = options.strict + if (!data.name && !strict) { + data.name = "" + return + } + if (typeof data.name !== "string") { + throw new Error("name field must be a string.") + } + if (!strict) + data.name = data.name.trim() + ensureValidName(data.name, strict, options.allowLegacyCase) + if (isBuiltinModule(data.name)) + this.warn("conflictingName", data.name) + } + + +, fixDescriptionField: function (data) { + if (data.description && typeof data.description !== 'string') { + this.warn("nonStringDescription") + delete data.description + } + if (data.readme && !data.description) + data.description = extractDescription(data.readme) + if(data.description === undefined) delete data.description; + if (!data.description) this.warn("missingDescription") + } + +, fixReadmeField: function (data) { + if (!data.readme) { + this.warn("missingReadme") + data.readme = "ERROR: No README data found!" + } + } + +, fixBugsField: function(data) { + if (!data.bugs && data.repository && data.repository.url) { + var hosted = hostedGitInfo.fromUrl(data.repository.url) + if(hosted && hosted.bugs()) { + data.bugs = {url: hosted.bugs()} + } + } + else if(data.bugs) { + var emailRe = /^.+@.*\..+$/ + if(typeof data.bugs == "string") { + if(emailRe.test(data.bugs)) + data.bugs = {email:data.bugs} + else if(url.parse(data.bugs).protocol) + data.bugs = {url: data.bugs} + else + this.warn("nonEmailUrlBugsString") + } + else { + bugsTypos(data.bugs, this.warn) + var oldBugs = data.bugs + data.bugs = {} + if(oldBugs.url) { + if(typeof(oldBugs.url) == "string" && url.parse(oldBugs.url).protocol) + data.bugs.url = oldBugs.url + else + this.warn("nonUrlBugsUrlField") + } + if(oldBugs.email) { + if(typeof(oldBugs.email) == "string" && emailRe.test(oldBugs.email)) + data.bugs.email = oldBugs.email + else + this.warn("nonEmailBugsEmailField") + } + } + if(!data.bugs.email && !data.bugs.url) { + delete data.bugs + this.warn("emptyNormalizedBugs") + } + } + } + +, fixHomepageField: function(data) { + if (!data.homepage && data.repository && data.repository.url) { + var hosted = hostedGitInfo.fromUrl(data.repository.url) + if (hosted && hosted.docs()) data.homepage = hosted.docs() + } + if (!data.homepage) return + + if(typeof data.homepage !== "string") { + this.warn("nonUrlHomepage") + return delete data.homepage + } + if(!url.parse(data.homepage).protocol) { + data.homepage = "http://" + data.homepage + } + } + +, fixLicenseField: function(data) { + if (!data.license) { + return this.warn("missingLicense") + } else{ + if ( + typeof(data.license) !== 'string' || + data.license.length < 1 || + data.license.trim() === '' + ) { + this.warn("invalidLicense") + } else { + if (!validateLicense(data.license).validForNewPackages) + this.warn("invalidLicense") + } + } + } +} + +function isValidScopedPackageName(spec) { + if (spec.charAt(0) !== '@') return false + + var rest = spec.slice(1).split('/') + if (rest.length !== 2) return false + + return rest[0] && rest[1] && + rest[0] === encodeURIComponent(rest[0]) && + rest[1] === encodeURIComponent(rest[1]) +} + +function isCorrectlyEncodedName(spec) { + return !spec.match(/[\/@\s\+%:]/) && + spec === encodeURIComponent(spec) +} + +function ensureValidName (name, strict, allowLegacyCase) { + if (name.charAt(0) === "." || + !(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) || + (strict && (!allowLegacyCase) && name !== name.toLowerCase()) || + name.toLowerCase() === "node_modules" || + name.toLowerCase() === "favicon.ico") { + throw new Error("Invalid name: " + JSON.stringify(name)) + } +} + +function modifyPeople (data, fn) { + if (data.author) data.author = fn(data.author) + ;["maintainers", "contributors"].forEach(function (set) { + if (!Array.isArray(data[set])) return; + data[set] = data[set].map(fn) + }) + return data +} + +function unParsePerson (person) { + if (typeof person === "string") return person + var name = person.name || "" + var u = person.url || person.web + var url = u ? (" ("+u+")") : "" + var e = person.email || person.mail + var email = e ? (" <"+e+">") : "" + return name+email+url +} + +function parsePerson (person) { + if (typeof person !== "string") return person + var name = person.match(/^([^\(<]+)/) + var url = person.match(/\(([^\)]+)\)/) + var email = person.match(/<([^>]+)>/) + var obj = {} + if (name && name[0].trim()) obj.name = name[0].trim() + if (email) obj.email = email[1]; + if (url) obj.url = url[1]; + return obj +} + +function addOptionalDepsToDeps (data, warn) { + var o = data.optionalDependencies + if (!o) return; + var d = data.dependencies || {} + Object.keys(o).forEach(function (k) { + d[k] = o[k] + }) + data.dependencies = d +} + +function depObjectify (deps, type, warn) { + if (!deps) return {} + if (typeof deps === "string") { + deps = deps.trim().split(/[\n\r\s\t ,]+/) + } + if (!Array.isArray(deps)) return deps + warn("deprecatedArrayDependencies", type) + var o = {} + deps.filter(function (d) { + return typeof d === "string" + }).forEach(function(d) { + d = d.trim().split(/(:?[@\s><=])/) + var dn = d.shift() + var dv = d.join("") + dv = dv.trim() + dv = dv.replace(/^@/, "") + o[dn] = dv + }) + return o +} + +function objectifyDeps (data, warn) { + depTypes.forEach(function (type) { + if (!data[type]) return; + data[type] = depObjectify(data[type], type, warn) + }) +} + +function bugsTypos(bugs, warn) { + if (!bugs) return + Object.keys(bugs).forEach(function (k) { + if (typos.bugs[k]) { + warn("typo", k, typos.bugs[k], "bugs") + bugs[typos.bugs[k]] = bugs[k] + delete bugs[k] + } + }) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/make_warning.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/make_warning.js new file mode 100644 index 0000000000000000000000000000000000000000..4ac74ad7cb25c3fb984570f873b9d4418099a92a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/make_warning.js @@ -0,0 +1,23 @@ +var util = require("util") +var messages = require("./warning_messages.json") + +module.exports = function() { + var args = Array.prototype.slice.call(arguments, 0) + var warningName = args.shift() + if (warningName == "typo") { + return makeTypoWarning.apply(null,args) + } + else { + var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'" + args.unshift(msgTemplate) + return util.format.apply(null, args) + } +} + +function makeTypoWarning (providedName, probableName, field) { + if (field) { + providedName = field + "['" + providedName + "']" + probableName = field + "['" + probableName + "']" + } + return util.format(messages.typo, providedName, probableName) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/normalize.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/normalize.js new file mode 100644 index 0000000000000000000000000000000000000000..bd1bfef123103a2c81aaf3b1405b392fdd8e8e0d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/normalize.js @@ -0,0 +1,39 @@ +module.exports = normalize + +var fixer = require("./fixer") +normalize.fixer = fixer + +var makeWarning = require("./make_warning") + +var fieldsToFix = ['name','version','description','repository','modules','scripts' + ,'files','bin','man','bugs','keywords','readme','homepage','license'] +var otherThingsToFix = ['dependencies','people', 'typos'] + +var thingsToFix = fieldsToFix.map(function(fieldName) { + return ucFirst(fieldName) + "Field" +}) +// two ways to do this in CoffeeScript on only one line, sub-70 chars: +// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field" +// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix) +thingsToFix = thingsToFix.concat(otherThingsToFix) + +function normalize (data, warn, strict) { + if(warn === true) warn = null, strict = true + if(!strict) strict = false + if(!warn || data.private) warn = function(msg) { /* noop */ } + + if (data.scripts && + data.scripts.install === "node-gyp rebuild" && + !data.scripts.preinstall) { + data.gypfile = true + } + fixer.warn = function() { warn(makeWarning.apply(null, arguments)) } + thingsToFix.forEach(function(thingName) { + fixer["fix" + ucFirst(thingName)](data, strict) + }) + data._id = data.name + "@" + data.version +} + +function ucFirst (string) { + return string.charAt(0).toUpperCase() + string.slice(1); +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/safe_format.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/safe_format.js new file mode 100644 index 0000000000000000000000000000000000000000..b07f1006d1ad299d3e33a9bae4ffd681f166cf2f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/safe_format.js @@ -0,0 +1,9 @@ +var util = require('util') + +module.exports = function() { + var args = Array.prototype.slice.call(arguments, 0) + args.forEach(function(arg) { + if (!arg) throw new TypeError('Bad arguments.') + }) + return util.format.apply(null, arguments) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/typos.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/typos.json new file mode 100644 index 0000000000000000000000000000000000000000..7f9dd283b30ff3602a3d317f67b61ea1bb10b797 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/typos.json @@ -0,0 +1,25 @@ +{ + "topLevel": { + "dependancies": "dependencies" + ,"dependecies": "dependencies" + ,"depdenencies": "dependencies" + ,"devEependencies": "devDependencies" + ,"depends": "dependencies" + ,"dev-dependencies": "devDependencies" + ,"devDependences": "devDependencies" + ,"devDepenencies": "devDependencies" + ,"devdependencies": "devDependencies" + ,"repostitory": "repository" + ,"repo": "repository" + ,"prefereGlobal": "preferGlobal" + ,"hompage": "homepage" + ,"hampage": "homepage" + ,"autohr": "author" + ,"autor": "author" + ,"contributers": "contributors" + ,"publicationConfig": "publishConfig" + ,"script": "scripts" + }, + "bugs": { "web": "url", "name": "url" }, + "script": { "server": "start", "tests": "test" } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/warning_messages.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/warning_messages.json new file mode 100644 index 0000000000000000000000000000000000000000..4890f506ed965a88030b278a0108bc41d4140d4c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/lib/warning_messages.json @@ -0,0 +1,30 @@ +{ + "repositories": "'repositories' (plural) Not supported. Please pick one as the 'repository' field" + ,"missingRepository": "No repository field." + ,"brokenGitUrl": "Probably broken git url: %s" + ,"nonObjectScripts": "scripts must be an object" + ,"nonStringScript": "script values must be string commands" + ,"nonArrayFiles": "Invalid 'files' member" + ,"invalidFilename": "Invalid filename in 'files' list: %s" + ,"nonArrayBundleDependencies": "Invalid 'bundleDependencies' list. Must be array of package names" + ,"nonStringBundleDependency": "Invalid bundleDependencies member: %s" + ,"nonDependencyBundleDependency": "Non-dependency in bundleDependencies: %s" + ,"nonObjectDependencies": "%s field must be an object" + ,"nonStringDependency": "Invalid dependency: %s %s" + ,"deprecatedArrayDependencies": "specifying %s as array is deprecated" + ,"deprecatedModules": "modules field is deprecated" + ,"nonArrayKeywords": "keywords should be an array of strings" + ,"nonStringKeyword": "keywords should be an array of strings" + ,"conflictingName": "%s is also the name of a node core module." + ,"nonStringDescription": "'description' field should be a string" + ,"missingDescription": "No description" + ,"missingReadme": "No README data" + ,"missingLicense": "No license field." + ,"nonEmailUrlBugsString": "Bug string field must be url, email, or {email,url}" + ,"nonUrlBugsUrlField": "bugs.url field must be a string url. Deleted." + ,"nonEmailBugsEmailField": "bugs.email field must be a string email. Deleted." + ,"emptyNormalizedBugs": "Normalized value of bugs field is an empty object. Deleted." + ,"nonUrlHomepage": "homepage field must be a string url. Deleted." + ,"invalidLicense": "license should be a valid SPDX license expression" + ,"typo": "%s should probably be %s." +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/.bin/semver b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/.bin/semver new file mode 100644 index 0000000000000000000000000000000000000000..cd4636ac6704de73732e7da50f86ca0cb50dcd1d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/.bin/semver @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03f83d135afd4855683ff95d708f671593af782471daf4794ba9079178aa1b03 +size 4418 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..19129e315fe593965a2fdd50ec0d1253bcbd2ece --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/README.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f8dfa5a0df5fc454d87c54fb702ad3c245a6b524 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/README.md @@ -0,0 +1,412 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install --save semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero digit in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/bin/semver b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/bin/semver new file mode 100644 index 0000000000000000000000000000000000000000..801e77f1303c153987fb9cec7fae3c06ddf0206a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/bin/semver @@ -0,0 +1,160 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/package.json new file mode 100644 index 0000000000000000000000000000000000000000..db035e97d98209b4f09aeaf7ebbfb184691780c8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/package.json @@ -0,0 +1,38 @@ +{ + "name": "semver", + "version": "5.7.2", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap test/ --100 --timeout=30", + "lint": "echo linting disabled", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap test/ --100 --timeout=30", + "posttest": "npm run lint" + }, + "devDependencies": { + "@npmcli/template-oss": "4.17.0", + "tap": "^12.7.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "./bin/semver" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "content": "./scripts/template-oss", + "version": "4.17.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/range.bnf b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/range.bnf new file mode 100644 index 0000000000000000000000000000000000000000..d4c6ae0d76c9ac0c10c93062e5ff9cec277b07cd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/semver.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/semver.js new file mode 100644 index 0000000000000000000000000000000000000000..dcb68334150b207485cff109830c88f236331a33 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver/semver.js @@ -0,0 +1,1525 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +// The actual regexps go on exports.re +var re = exports.re = [] +var safeRe = exports.safeRe = [] +var src = exports.src = [] +var R = 0 + +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++ +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' +var NUMERICIDENTIFIERLOOSE = R++ +src[NUMERICIDENTIFIERLOOSE] = '\\d+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++ +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++ +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')' + +var MAINVERSIONLOOSE = R++ +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++ +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +var PRERELEASEIDENTIFIERLOOSE = R++ +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++ +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' + +var PRERELEASELOOSE = R++ +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++ +src[BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++ +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++ +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?' + +src[FULL] = '^' + FULLPLAIN + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?' + +var LOOSE = R++ +src[LOOSE] = '^' + LOOSEPLAIN + '$' + +var GTLT = R++ +src[GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++ +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +var XRANGEIDENTIFIER = R++ +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' + +var XRANGEPLAIN = R++ +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGEPLAINLOOSE = R++ +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGE = R++ +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' +var XRANGELOOSE = R++ +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +var COERCE = R++ +src[COERCE] = '(?:^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++ +src[LONETILDE] = '(?:~>?)' + +var TILDETRIM = R++ +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') +safeRe[TILDETRIM] = new RegExp(makeSafeRe(src[TILDETRIM]), 'g') +var tildeTrimReplace = '$1~' + +var TILDE = R++ +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' +var TILDELOOSE = R++ +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++ +src[LONECARET] = '(?:\\^)' + +var CARETTRIM = R++ +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') +safeRe[CARETTRIM] = new RegExp(makeSafeRe(src[CARETTRIM]), 'g') +var caretTrimReplace = '$1^' + +var CARET = R++ +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' +var CARETLOOSE = R++ +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++ +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' +var COMPARATOR = R++ +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++ +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') +safeRe[COMPARATORTRIM] = new RegExp(makeSafeRe(src[COMPARATORTRIM]), 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++ +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$' + +var HYPHENRANGELOOSE = R++ +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +var STAR = R++ +src[STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? safeRe[LOOSE] : safeRe[FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? safeRe[LOOSE] : safeRe[FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compare(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.rcompare(a, b, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY) { + return true + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + this.raw) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(safeRe[TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(safeRe[CARETTRIM], caretTrimReplace) + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return thisComparators.every(function (thisComparator) { + return range.set.some(function (rangeComparators) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + }) + }) +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? safeRe[XRANGELOOSE] : safeRe[XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(safeRe[STAR], '') +} + +// This function is passed to string.replace(safeRe[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version) { + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + var match = version.match(safeRe[COERCE]) + + if (match == null) { + return null + } + + return parse(match[1] + + '.' + (match[2] || '0') + + '.' + (match[3] || '0')) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/package.json new file mode 100644 index 0000000000000000000000000000000000000000..dea34bb7ffcec8744dbb16eff68e8ef1dc296cb3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/package.json @@ -0,0 +1,31 @@ +{ + "name": "normalize-package-data", + "version": "2.5.0", + "author": "Meryn Stol ", + "description": "Normalizes data that can be found in package.json files.", + "license": "BSD-2-Clause", + "repository": { + "type": "git", + "url": "git://github.com/npm/normalize-package-data.git" + }, + "main": "lib/normalize.js", + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "devDependencies": { + "async": "^2.6.1", + "tap": "^12.4.0", + "underscore": "^1.8.3" + }, + "files": [ + "lib/*.js", + "lib/*.json", + "AUTHORS" + ] +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6bbfad4ac776654d69d41af25083a4b8b4ce8c3f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/index.d.ts @@ -0,0 +1,38 @@ +export interface Limit { + /** + @param fn - Promise-returning/async function. + @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. + @returns The promise returned by calling `fn(...arguments)`. + */ + ( + fn: (...arguments: Arguments) => PromiseLike | ReturnType, + ...arguments: Arguments + ): Promise; + + /** + The number of promises that are currently running. + */ + readonly activeCount: number; + + /** + The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). + */ + readonly pendingCount: number; + + /** + Discard pending promises that are waiting to run. + + This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. + + Note: This does not cancel promises that are already running. + */ + clearQueue(): void; +} + +/** +Run multiple promise-returning & async functions with limited concurrency. + +@param concurrency - Concurrency limit. Minimum: `1`. +@returns A `limit` function. +*/ +export default function pLimit(concurrency: number): Limit; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6a72a4c4fc3c723dd9cd3ba594bda3f5d02f32bd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/index.js @@ -0,0 +1,57 @@ +'use strict'; +const pTry = require('p-try'); + +const pLimit = concurrency => { + if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) { + return Promise.reject(new TypeError('Expected `concurrency` to be a number from 1 and up')); + } + + const queue = []; + let activeCount = 0; + + const next = () => { + activeCount--; + + if (queue.length > 0) { + queue.shift()(); + } + }; + + const run = (fn, resolve, ...args) => { + activeCount++; + + const result = pTry(fn, ...args); + + resolve(result); + + result.then(next, next); + }; + + const enqueue = (fn, resolve, ...args) => { + if (activeCount < concurrency) { + run(fn, resolve, ...args); + } else { + queue.push(run.bind(null, fn, resolve, ...args)); + } + }; + + const generator = (fn, ...args) => new Promise(resolve => enqueue(fn, resolve, ...args)); + Object.defineProperties(generator, { + activeCount: { + get: () => activeCount + }, + pendingCount: { + get: () => queue.length + }, + clearQueue: { + value: () => { + queue.length = 0; + } + } + }); + + return generator; +}; + +module.exports = pLimit; +module.exports.default = pLimit; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/package.json new file mode 100644 index 0000000000000000000000000000000000000000..99a814f6ecf317361d3a21ae0032389b42c58921 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/package.json @@ -0,0 +1,52 @@ +{ + "name": "p-limit", + "version": "2.3.0", + "description": "Run multiple promise-returning & async functions with limited concurrency", + "license": "MIT", + "repository": "sindresorhus/p-limit", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "test": "xo && ava && tsd-check" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "promise", + "limit", + "limited", + "concurrency", + "throttle", + "throat", + "rate", + "batch", + "ratelimit", + "task", + "queue", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "p-try": "^2.0.0" + }, + "devDependencies": { + "ava": "^1.2.1", + "delay": "^4.1.0", + "in-range": "^1.0.0", + "random-int": "^1.0.0", + "time-span": "^2.0.0", + "tsd-check": "^0.3.0", + "xo": "^0.24.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..64aa476e2370c120dd58a6e3b2029bf90a798019 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-limit/readme.md @@ -0,0 +1,101 @@ +# p-limit [![Build Status](https://travis-ci.org/sindresorhus/p-limit.svg?branch=master)](https://travis-ci.org/sindresorhus/p-limit) + +> Run multiple promise-returning & async functions with limited concurrency + +## Install + +``` +$ npm install p-limit +``` + +## Usage + +```js +const pLimit = require('p-limit'); + +const limit = pLimit(1); + +const input = [ + limit(() => fetchSomething('foo')), + limit(() => fetchSomething('bar')), + limit(() => doSomething()) +]; + +(async () => { + // Only one promise is run at once + const result = await Promise.all(input); + console.log(result); +})(); +``` + +## API + +### pLimit(concurrency) + +Returns a `limit` function. + +#### concurrency + +Type: `number`\ +Minimum: `1`\ +Default: `Infinity` + +Concurrency limit. + +### limit(fn, ...args) + +Returns the promise returned by calling `fn(...args)`. + +#### fn + +Type: `Function` + +Promise-returning/async function. + +#### args + +Any arguments to pass through to `fn`. + +Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions. + +### limit.activeCount + +The number of promises that are currently running. + +### limit.pendingCount + +The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). + +### limit.clearQueue() + +Discard pending promises that are waiting to run. + +This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. + +Note: This does not cancel promises that are already running. + +## FAQ + +### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package? + +This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue. + +## Related + +- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control +- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions +- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions +- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency +- [More…](https://github.com/sindresorhus/promise-fun) + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..14115e16bacc4f7dd9a8b4a25102ad30d329cb2f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/index.d.ts @@ -0,0 +1,64 @@ +declare namespace pLocate { + interface Options { + /** + Number of concurrently pending promises returned by `tester`. Minimum: `1`. + + @default Infinity + */ + readonly concurrency?: number; + + /** + Preserve `input` order when searching. + + Disable this to improve performance if you don't care about the order. + + @default true + */ + readonly preserveOrder?: boolean; + } +} + +declare const pLocate: { + /** + Get the first fulfilled promise that satisfies the provided testing function. + + @param input - An iterable of promises/values to test. + @param tester - This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. + @returns A `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. + + @example + ``` + import pathExists = require('path-exists'); + import pLocate = require('p-locate'); + + const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' + ]; + + (async () => { + const foundPath = await pLocate(files, file => pathExists(file)); + + console.log(foundPath); + //=> 'rainbow' + })(); + ``` + */ + ( + input: Iterable | ValueType>, + tester: (element: ValueType) => PromiseLike | boolean, + options?: pLocate.Options + ): Promise; + + // TODO: Remove this for the next major release, refactor the whole definition to: + // declare function pLocate( + // input: Iterable | ValueType>, + // tester: (element: ValueType) => PromiseLike | boolean, + // options?: pLocate.Options + // ): Promise; + // export = pLocate; + default: typeof pLocate; +}; + +export = pLocate; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e13ce1531cac0e95d5192b73a1e947b54ed4c669 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/index.js @@ -0,0 +1,52 @@ +'use strict'; +const pLimit = require('p-limit'); + +class EndError extends Error { + constructor(value) { + super(); + this.value = value; + } +} + +// The input can also be a promise, so we await it +const testElement = async (element, tester) => tester(await element); + +// The input can also be a promise, so we `Promise.all()` them both +const finder = async element => { + const values = await Promise.all(element); + if (values[1] === true) { + throw new EndError(values[0]); + } + + return false; +}; + +const pLocate = async (iterable, tester, options) => { + options = { + concurrency: Infinity, + preserveOrder: true, + ...options + }; + + const limit = pLimit(options.concurrency); + + // Start all the promises concurrently with optional limit + const items = [...iterable].map(element => [element, limit(testElement, element, tester)]); + + // Check the promises either serially or concurrently + const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity); + + try { + await Promise.all(items.map(element => checkLimit(finder, element))); + } catch (error) { + if (error instanceof EndError) { + return error.value; + } + + throw error; + } +}; + +module.exports = pLocate; +// TODO: Remove this for the next major release +module.exports.default = pLocate; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e3de27562508ae4855887686573377fcd7798ce7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/package.json @@ -0,0 +1,53 @@ +{ + "name": "p-locate", + "version": "4.1.0", + "description": "Get the first fulfilled promise that satisfies the provided testing function", + "license": "MIT", + "repository": "sindresorhus/p-locate", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "promise", + "locate", + "find", + "finder", + "search", + "searcher", + "test", + "array", + "collection", + "iterable", + "iterator", + "race", + "fulfilled", + "fastest", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "p-limit": "^2.2.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "delay": "^4.1.0", + "in-range": "^1.0.0", + "time-span": "^3.0.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..f8e2c2eafaac450d8df93d9f247e01aa756ba6e7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/p-locate/readme.md @@ -0,0 +1,90 @@ +# p-locate [![Build Status](https://travis-ci.org/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.org/sindresorhus/p-locate) + +> Get the first fulfilled promise that satisfies the provided testing function + +Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find). + + +## Install + +``` +$ npm install p-locate +``` + + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +const pathExists = require('path-exists'); +const pLocate = require('p-locate'); + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +(async () => { + const foundPath = await pLocate(files, file => pathExists(file)); + + console.log(foundPath); + //=> 'rainbow' +})(); +``` + +*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.* + + +## API + +### pLocate(input, tester, [options]) + +Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. + +#### input + +Type: `Iterable` + +An iterable of promises/values to test. + +#### tester(element) + +Type: `Function` + +This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. + +#### options + +Type: `Object` + +##### concurrency + +Type: `number`
+Default: `Infinity`
+Minimum: `1` + +Number of concurrently pending promises returned by `tester`. + +##### preserveOrder + +Type: `boolean`
+Default: `true` + +Preserve `input` order when searching. + +Disable this to improve performance if you don't care about the order. + + +## Related + +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently +- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..acb4c8c59206236873dab7c1ddd09f7c27c87e6f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/index.d.ts @@ -0,0 +1,87 @@ +import {Except} from 'type-fest'; +import readPkg = require('read-pkg'); + +declare namespace readPkgUp { + type Options = { + /** + Directory to start looking for a package.json file. + + @default process.cwd() + */ + cwd?: string; + } & Except; + + type NormalizeOptions = { + /** + Directory to start looking for a package.json file. + + @default process.cwd() + */ + cwd?: string; + } & Except; + + type PackageJson = readPkg.PackageJson; + type NormalizedPackageJson = readPkg.NormalizedPackageJson; + + interface ReadResult { + packageJson: PackageJson; + path: string; + } + + interface NormalizedReadResult { + packageJson: NormalizedPackageJson; + path: string; + } +} + +declare const readPkgUp: { + /** + Read the closest `package.json` file. + + @example + ``` + import readPkgUp = require('read-pkg-up'); + + (async () => { + console.log(await readPkgUp()); + // { + // packageJson: { + // name: 'awesome-package', + // version: '1.0.0', + // … + // }, + // path: '/Users/sindresorhus/dev/awesome-package/package.json' + // } + })(); + ``` + */ + (options?: readPkgUp.NormalizeOptions): Promise< + readPkgUp.NormalizedReadResult | undefined + >; + (options: readPkgUp.Options): Promise; + + /** + Synchronously read the closest `package.json` file. + + @example + ``` + import readPkgUp = require('read-pkg-up'); + + console.log(readPkgUp.sync()); + // { + // packageJson: { + // name: 'awesome-package', + // version: '1.0.0', + // … + // }, + // path: '/Users/sindresorhus/dev/awesome-package/package.json' + // } + ``` + */ + sync( + options?: readPkgUp.NormalizeOptions + ): readPkgUp.NormalizedReadResult | undefined; + sync(options: readPkgUp.Options): readPkgUp.ReadResult | undefined; +}; + +export = readPkgUp; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bf8ae3c9c6117796c489cc89a55f3084512b208c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/index.js @@ -0,0 +1,30 @@ +'use strict'; +const path = require('path'); +const findUp = require('find-up'); +const readPkg = require('read-pkg'); + +module.exports = async options => { + const filePath = await findUp('package.json', options); + + if (!filePath) { + return; + } + + return { + packageJson: await readPkg({...options, cwd: path.dirname(filePath)}), + path: filePath + }; +}; + +module.exports.sync = options => { + const filePath = findUp.sync('package.json', options); + + if (!filePath) { + return; + } + + return { + packageJson: readPkg.sync({...options, cwd: path.dirname(filePath)}), + path: filePath + }; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/package.json new file mode 100644 index 0000000000000000000000000000000000000000..09a6d499d6641bf88314e4a703a5684509c44523 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/package.json @@ -0,0 +1,59 @@ +{ + "name": "read-pkg-up", + "version": "7.0.1", + "description": "Read the closest package.json file", + "license": "MIT", + "repository": "sindresorhus/read-pkg-up", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "json", + "read", + "parse", + "file", + "fs", + "graceful", + "load", + "package", + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "search", + "match", + "resolve", + "parent", + "parents", + "folder", + "directory", + "walk", + "walking", + "path" + ], + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..cb8e98a2d8a0bd5f40ede4950c726e3dfc6c514c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up/readme.md @@ -0,0 +1,77 @@ +# read-pkg-up [![Build Status](https://travis-ci.org/sindresorhus/read-pkg-up.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg-up) + +> Read the closest package.json file + +## Why + +- [Finds the closest package.json](https://github.com/sindresorhus/find-up) +- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs) +- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json) +- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) + +## Install + +``` +$ npm install read-pkg-up +``` + +## Usage + +```js +const readPkgUp = require('read-pkg-up'); + +(async () => { + console.log(await readPkgUp()); + /* + { + packageJson: { + name: 'awesome-package', + version: '1.0.0', + … + }, + path: '/Users/sindresorhus/dev/awesome-package/package.json' + } + */ +})(); +``` + +## API + +### readPkgUp(options?) + +Returns a `Promise` or `Promise` if no `package.json` was found. + +### readPkgUp.sync(options?) + +Returns the result object or `undefined` if no `package.json` was found. + +#### options + +Type: `object` + +##### cwd + +Type: `string`\ +Default: `process.cwd()` + +Directory to start looking for a package.json file. + +##### normalize + +Type: `boolean`\ +Default: `true` + +[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data. + +## read-pkg-up for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of read-pkg-up and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-read-pkg-up?utm_source=npm-read-pkg-up&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +## Related + +- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories +- [pkg-conf](https://github.com/sindresorhus/pkg-conf) - Get namespaced config from the closest package.json diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9379261efdc948a833b990f3c4561c11638db17 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/index.d.ts @@ -0,0 +1,67 @@ +import * as typeFest from 'type-fest'; +import normalize = require('normalize-package-data'); + +declare namespace readPkg { + interface Options { + /** + [Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data. + + @default true + */ + readonly normalize?: boolean; + + /** + Current working directory. + + @default process.cwd() + */ + readonly cwd?: string; + } + + interface NormalizeOptions extends Options { + readonly normalize?: true; + } + + type NormalizedPackageJson = PackageJson & normalize.Package; + type PackageJson = typeFest.PackageJson; +} + +declare const readPkg: { + /** + @returns The parsed JSON. + + @example + ``` + import readPkg = require('read-pkg'); + + (async () => { + console.log(await readPkg()); + //=> {name: 'read-pkg', …} + + console.log(await readPkg({cwd: 'some-other-directory'}); + //=> {name: 'unicorn', …} + })(); + ``` + */ + (options?: readPkg.NormalizeOptions): Promise; + (options: readPkg.Options): Promise; + + /** + @returns The parsed JSON. + + @example + ``` + import readPkg = require('read-pkg'); + + console.log(readPkg.sync()); + //=> {name: 'read-pkg', …} + + console.log(readPkg.sync({cwd: 'some-other-directory'}); + //=> {name: 'unicorn', …} + ``` + */ + sync(options?: readPkg.NormalizeOptions): readPkg.NormalizedPackageJson; + sync(options: readPkg.Options): readPkg.PackageJson; +}; + +export = readPkg; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1243a8f7ab31aff401a7c81b76aaa749fc5bb57 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/index.js @@ -0,0 +1,41 @@ +'use strict'; +const {promisify} = require('util'); +const fs = require('fs'); +const path = require('path'); +const parseJson = require('parse-json'); + +const readFileAsync = promisify(fs.readFile); + +module.exports = async options => { + options = { + cwd: process.cwd(), + normalize: true, + ...options + }; + + const filePath = path.resolve(options.cwd, 'package.json'); + const json = parseJson(await readFileAsync(filePath, 'utf8')); + + if (options.normalize) { + require('normalize-package-data')(json); + } + + return json; +}; + +module.exports.sync = options => { + options = { + cwd: process.cwd(), + normalize: true, + ...options + }; + + const filePath = path.resolve(options.cwd, 'package.json'); + const json = parseJson(fs.readFileSync(filePath, 'utf8')); + + if (options.normalize) { + require('normalize-package-data')(json); + } + + return json; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4ef4b18b722ae99e5d44ebd1edc9b351e431b833 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/index.d.ts @@ -0,0 +1,15 @@ +// Basic +export * from './source/basic'; + +// Utilities +export {Except} from './source/except'; +export {Mutable} from './source/mutable'; +export {Merge} from './source/merge'; +export {MergeExclusive} from './source/merge-exclusive'; +export {RequireAtLeastOne} from './source/require-at-least-one'; +export {ReadonlyDeep} from './source/readonly-deep'; +export {LiteralUnion} from './source/literal-union'; +export {Promisable} from './source/promisable'; + +// Miscellaneous +export {PackageJson} from './source/package-json'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/package.json new file mode 100644 index 0000000000000000000000000000000000000000..234580942f41aa98932006400ad6e1f6e2a2a83b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/package.json @@ -0,0 +1,51 @@ +{ + "name": "type-fest", + "version": "0.6.0", + "description": "A collection of essential TypeScript types", + "license": "(MIT OR CC0-1.0)", + "repository": "sindresorhus/type-fest", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && tsd" + }, + "files": [ + "index.d.ts", + "source" + ], + "keywords": [ + "typescript", + "ts", + "types", + "utility", + "util", + "utilities", + "omit", + "merge", + "json" + ], + "devDependencies": { + "@sindresorhus/tsconfig": "^0.4.0", + "@typescript-eslint/eslint-plugin": "^1.9.0", + "@typescript-eslint/parser": "^1.10.2", + "eslint-config-xo-typescript": "^0.14.0", + "tsd": "^0.7.3", + "xo": "^0.24.0" + }, + "xo": { + "extends": "xo-typescript", + "extensions": [ + "ts" + ], + "rules": { + "import/no-unresolved": "off", + "@typescript-eslint/indent": "off" + } + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..ff3840c2b593a5cd5c62c912cb56dd81bb99726e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/readme.md @@ -0,0 +1,119 @@ +
+
+
+ type-fest +
+
+ A collection of essential TypeScript types +
+
+
+
+
+ +[![Build Status](https://travis-ci.com/sindresorhus/type-fest.svg?branch=master)](https://travis-ci.com/sindresorhus/type-fest) +[![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) + + +Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). + +Either add this package as a dependency or copy-paste the needed types. No credit required. 👌 + +PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first. + + +## Install + +``` +$ npm install type-fest +``` + +*Requires TypeScript >=3.2* + + +## Usage + +```ts +import {Except} from 'type-fest'; + +type Foo = { + unicorn: string; + rainbow: boolean; +}; + +type FooWithoutRainbow = Except; +//=> {unicorn: string} +``` + + +## API + +Click the type names for complete docs. + +### Basic + +- [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive). +- [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). +- [`TypedArray`](source/basic.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`. +- [`JsonObject`](source/basic.d.ts) - Matches a JSON object. +- [`JsonArray`](source/basic.d.ts) - Matches a JSON array. +- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value. +- [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable). + +### Utilities + +- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). +- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` properties into a mutable object. Inverse of `Readonly`. +- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type. +- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive properties. +- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given properties. +- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of a `object`/`Map`/`Set`/`Array` type. +- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). +- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`. + +### Miscellaneous + +- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). + + +## Declined types + +*If we decline a type addition, we will make sure to document the better solution here.* + +- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider. + + +## Tips + +### Built-in types + +There are many advanced types most users don't know about. + +- [`Partial`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional. +- [`Required`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required. +- [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly. +- [`Pick`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`. +- [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`. +- [`Exclude`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`. +- [`Extract`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`. +- [`NonNullable`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`. +- [`Parameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple. +- [`ConstructorParameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple. +- [`ReturnType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type. +- [`InstanceType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type. + +You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types). + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Jarek Radosz](https://github.com/CvX) +- [Dimitri Benin](https://github.com/BendingBender) + + +## License + +(MIT OR CC0-1.0) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/basic.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/basic.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f308c5f84aece495d9f3bda50cc3802c5046670b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/basic.d.ts @@ -0,0 +1,67 @@ +/// + +// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out. +/** +Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive). +*/ +export type Primitive = + | null + | undefined + | string + | number + | boolean + | symbol + | bigint; + +// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default +/** +Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). +*/ +export type Class = new(...arguments_: any[]) => T; + +/** +Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`. +*/ +export type TypedArray = + | Int8Array + | Uint8Array + | Uint8ClampedArray + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array + | BigInt64Array + | BigUint64Array; + +/** +Matches a JSON object. + +This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`. +*/ +export type JsonObject = {[key: string]: JsonValue}; + +/** +Matches a JSON array. +*/ +export interface JsonArray extends Array {} + +/** +Matches any valid JSON value. +*/ +export type JsonValue = string | number | boolean | null | JsonObject | JsonArray; + +declare global { + interface SymbolConstructor { + readonly observable: symbol; + } +} + +/** +Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable). +*/ +export interface ObservableLike { + subscribe(observer: (value: unknown) => void): void; + [Symbol.observable](): ObservableLike; +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/except.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/except.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7dedbaa4a93f9d214d9a105087914556a7992e84 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/except.d.ts @@ -0,0 +1,22 @@ +/** +Create a type from an object type without certain keys. + +This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/30825) if you want to have the stricter version as a built-in in TypeScript. + +@example +``` +import {Except} from 'type-fest'; + +type Foo = { + a: number; + b: string; + c: boolean; +}; + +type FooWithoutA = Except; +//=> {b: string}; +``` +*/ +export type Except = Pick>; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/literal-union.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/literal-union.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..52e8de633e4217e05af385f1ec29ea9b6b7aada3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/literal-union.d.ts @@ -0,0 +1,33 @@ +import {Primitive} from './basic'; + +/** +Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. + +Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals. + +This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore. + +@example +``` +import {LiteralUnion} from 'type-fest'; + +// Before + +type Pet = 'dog' | 'cat' | string; + +const pet: Pet = ''; +// Start typing in your TypeScript-enabled IDE. +// You **will not** get auto-completion for `dog` and `cat` literals. + +// After + +type Pet2 = LiteralUnion<'dog' | 'cat', string>; + +const pet: Pet2 = ''; +// You **will** get auto-completion for `dog` and `cat` literals. +``` + */ +export type LiteralUnion< + LiteralType extends BaseType, + BaseType extends Primitive +> = LiteralType | (BaseType & {_?: never}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/merge-exclusive.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/merge-exclusive.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6290f42320b0bedb1965a668f5d0c5cef7b451dc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/merge-exclusive.d.ts @@ -0,0 +1,39 @@ +// Helper type. Not useful on its own. +type Without = {[KeyType in Exclude]?: never}; + +/** +Create a type that has mutually exclusive properties. + +This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604). + +This type works with a helper type, called `Without`. `Without` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`. + +@example +``` +import {MergeExclusive} from 'type-fest'; + +interface ExclusiveVariation1 { + exclusive1: boolean; +} + +interface ExclusiveVariation2 { + exclusive2: string; +} + +type ExclusiveOptions = MergeExclusive; + +let exclusiveOptions: ExclusiveOptions; + +exclusiveOptions = {exclusive1: true}; +//=> Works +exclusiveOptions = {exclusive2: 'hi'}; +//=> Works +exclusiveOptions = {exclusive1: true, exclusive2: 'hi'}; +//=> Error +``` +*/ +export type MergeExclusive = + (FirstType | SecondType) extends object ? + (Without & SecondType) | (Without & FirstType) : + FirstType | SecondType; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/merge.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/merge.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4b3920b7a68385105a0602a1fa5e587f4f5701c2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/merge.d.ts @@ -0,0 +1,22 @@ +import {Except} from './except'; + +/** +Merge two types into a new type. Keys of the second type overrides keys of the first type. + +@example +``` +import {Merge} from 'type-fest'; + +type Foo = { + a: number; + b: string; +}; + +type Bar = { + b: number; +}; + +const ab: Merge = {a: 1, b: 2}; +``` +*/ +export type Merge = Except> & SecondType; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/mutable.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/mutable.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5c98039e78d06a0f879092b87fa3db9ef8e6f685 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/mutable.d.ts @@ -0,0 +1,22 @@ +/** +Convert an object with `readonly` properties into a mutable object. Inverse of `Readonly`. + +This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), and [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509). + +@example +``` +import {Mutable} from 'type-fest'; + +type Foo = { + readonly a: number; + readonly b: string; +}; + +const mutableFoo: Mutable = {a: 1, b: '2'}; +mutableFoo.a = 3; +``` +*/ +export type Mutable = { + // For each `Key` in the keys of `ObjectType`, make a mapped type by removing the `readonly` modifier from the property. + -readonly [KeyType in keyof ObjectType]: ObjectType[KeyType]; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/package-json.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/package-json.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3179e5887a212c294bacc14b8db72edfc782d6f7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/package-json.d.ts @@ -0,0 +1,501 @@ +import {LiteralUnion} from '..'; + +declare namespace PackageJson { + /** + A person who has been involved in creating or maintaining the package. + */ + export type Person = + | string + | { + name: string; + url?: string; + email?: string; + }; + + export type BugsLocation = + | string + | { + /** + The URL to the package's issue tracker. + */ + url?: string; + + /** + The email address to which issues should be reported. + */ + email?: string; + }; + + export interface DirectoryLocations { + /** + Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder. + */ + bin?: string; + + /** + Location for Markdown files. + */ + doc?: string; + + /** + Location for example scripts. + */ + example?: string; + + /** + Location for the bulk of the library. + */ + lib?: string; + + /** + Location for man pages. Sugar to generate a `man` array by walking the folder. + */ + man?: string; + + /** + Location for test files. + */ + test?: string; + + [directoryType: string]: unknown; + } + + export type Scripts = { + /** + Run **before** the package is published (Also run on local `npm install` without any arguments). + */ + prepublish?: string; + + /** + Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`. + */ + prepare?: string; + + /** + Run **before** the package is prepared and packed, **only** on `npm publish`. + */ + prepublishOnly?: string; + + /** + Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies). + */ + prepack?: string; + + /** + Run **after** the tarball has been generated and moved to its final destination. + */ + postpack?: string; + + /** + Run **after** the package is published. + */ + publish?: string; + + /** + Run **after** the package is published. + */ + postpublish?: string; + + /** + Run **before** the package is installed. + */ + preinstall?: string; + + /** + Run **after** the package is installed. + */ + install?: string; + + /** + Run **after** the package is installed and after `install`. + */ + postinstall?: string; + + /** + Run **before** the package is uninstalled and before `uninstall`. + */ + preuninstall?: string; + + /** + Run **before** the package is uninstalled. + */ + uninstall?: string; + + /** + Run **after** the package is uninstalled. + */ + postuninstall?: string; + + /** + Run **before** bump the package version and before `version`. + */ + preversion?: string; + + /** + Run **before** bump the package version. + */ + version?: string; + + /** + Run **after** bump the package version. + */ + postversion?: string; + + /** + Run with the `npm test` command, before `test`. + */ + pretest?: string; + + /** + Run with the `npm test` command. + */ + test?: string; + + /** + Run with the `npm test` command, after `test`. + */ + posttest?: string; + + /** + Run with the `npm stop` command, before `stop`. + */ + prestop?: string; + + /** + Run with the `npm stop` command. + */ + stop?: string; + + /** + Run with the `npm stop` command, after `stop`. + */ + poststop?: string; + + /** + Run with the `npm start` command, before `start`. + */ + prestart?: string; + + /** + Run with the `npm start` command. + */ + start?: string; + + /** + Run with the `npm start` command, after `start`. + */ + poststart?: string; + + /** + Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided. + */ + prerestart?: string; + + /** + Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided. + */ + restart?: string; + + /** + Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided. + */ + postrestart?: string; + } & { + [scriptName: string]: string; + }; + + /** + Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL. + */ + export interface Dependency { + [packageName: string]: string; + } + + export interface NonStandardEntryPoints { + /** + An ECMAScript module ID that is the primary entry point to the program. + */ + module?: string; + + /** + A module ID with untranspiled code that is the primary entry point to the program. + */ + esnext?: + | string + | { + main?: string; + browser?: string; + [moduleName: string]: string | undefined; + }; + + /** + A hint to JavaScript bundlers or component tools when packaging modules for client side use. + */ + browser?: + | string + | { + [moduleName: string]: string | false; + }; + } + + export interface TypeScriptConfiguration { + /** + Location of the bundled TypeScript declaration file. + */ + types?: string; + + /** + Location of the bundled TypeScript declaration file. Alias of `types`. + */ + typings?: string; + } + + export interface YarnConfiguration { + /** + If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command line, set this to `true`. + + Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an application), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line. + */ + flat?: boolean; + + /** + Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file. + */ + resolutions?: Dependency; + } + + export interface JSPMConfiguration { + /** + JSPM configuration. + */ + jspm?: PackageJson; + } +} + +/** +Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn. +*/ +export type PackageJson = { + /** + The name of the package. + */ + name?: string; + + /** + Package version, parseable by [`node-semver`](https://github.com/npm/node-semver). + */ + version?: string; + + /** + Package description, listed in `npm search`. + */ + description?: string; + + /** + Keywords associated with package, listed in `npm search`. + */ + keywords?: string[]; + + /** + The URL to the package's homepage. + */ + homepage?: LiteralUnion<'.', string>; + + /** + The URL to the package's issue tracker and/or the email address to which issues should be reported. + */ + bugs?: PackageJson.BugsLocation; + + /** + The license for the package. + */ + license?: string; + + /** + The licenses for the package. + */ + licenses?: Array<{ + type?: string; + url?: string; + }>; + + author?: PackageJson.Person; + + /** + A list of people who contributed to the package. + */ + contributors?: PackageJson.Person[]; + + /** + A list of people who maintain the package. + */ + maintainers?: PackageJson.Person[]; + + /** + The files included in the package. + */ + files?: string[]; + + /** + The module ID that is the primary entry point to the program. + */ + main?: string; + + /** + The executable files that should be installed into the `PATH`. + */ + bin?: + | string + | { + [binary: string]: string; + }; + + /** + Filenames to put in place for the `man` program to find. + */ + man?: string | string[]; + + /** + Indicates the structure of the package. + */ + directories?: PackageJson.DirectoryLocations; + + /** + Location for the code repository. + */ + repository?: + | string + | { + type: string; + url: string; + }; + + /** + Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point. + */ + scripts?: PackageJson.Scripts; + + /** + Is used to set configuration parameters used in package scripts that persist across upgrades. + */ + config?: { + [configKey: string]: unknown; + }; + + /** + The dependencies of the package. + */ + dependencies?: PackageJson.Dependency; + + /** + Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling. + */ + devDependencies?: PackageJson.Dependency; + + /** + Dependencies that are skipped if they fail to install. + */ + optionalDependencies?: PackageJson.Dependency; + + /** + Dependencies that will usually be required by the package user directly or via another dependency. + */ + peerDependencies?: PackageJson.Dependency; + + /** + Package names that are bundled when the package is published. + */ + bundledDependencies?: string[]; + + /** + Alias of `bundledDependencies`. + */ + bundleDependencies?: string[]; + + /** + Engines that this package runs on. + */ + engines?: { + [EngineName in 'npm' | 'node' | string]: string; + }; + + /** + @deprecated + */ + engineStrict?: boolean; + + /** + Operating systems the module runs on. + */ + os?: Array>; + + /** + CPU architectures the module runs on. + */ + cpu?: Array>; + + /** + If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally. + + @deprecated + */ + preferGlobal?: boolean; + + /** + If set to `true`, then npm will refuse to publish it. + */ + private?: boolean; + + /** + * A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default. + */ + publishConfig?: { + [config: string]: unknown; + }; +} & +PackageJson.NonStandardEntryPoints & +PackageJson.TypeScriptConfiguration & +PackageJson.YarnConfiguration & +PackageJson.JSPMConfiguration & { + [key: string]: unknown; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/promisable.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/promisable.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..71242a5db269279c75c25beda59182fe48c45b2d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/promisable.d.ts @@ -0,0 +1,23 @@ +/** +Create a type that represents either the value or the value wrapped in `PromiseLike`. + +Use-cases: +- A function accepts a callback that may either return a value synchronously or may return a promised value. +- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript. + +@example +``` +import {Promisable} from 'type-fest'; + +async function logger(getLogEntry: () => Promisable): Promise { + const entry = await getLogEntry(); + console.log(entry); +} + +logger(() => 'foo'); +logger(() => Promise.resolve('bar')); +``` +*/ +export type Promisable = T | PromiseLike; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/readonly-deep.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/readonly-deep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8de4677c93dc4d7c403b7722f192aa229a66c26d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/readonly-deep.d.ts @@ -0,0 +1,59 @@ +import {Primitive} from './basic'; + +/** +Convert `object`s, `Map`s, `Set`s, and `Array`s and all of their properties/elements into immutable structures recursively. + +This is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript. + +@example +``` +// data.json +{ + "foo": ["bar"] +} + +// main.ts +import {ReadonlyDeep} from 'type-fest'; +import dataJson = require('./data.json'); + +const data: ReadonlyDeep = dataJson; + +export default data; + +// test.ts +import data from './main'; + +data.foo.push('bar'); +//=> error TS2339: Property 'push' does not exist on type 'readonly string[]' +``` +*/ +export type ReadonlyDeep = T extends Primitive | ((...arguments: any[]) => unknown) + ? T + : T extends ReadonlyMap + ? ReadonlyMapDeep + : T extends ReadonlySet + ? ReadonlySetDeep + : T extends object + ? ReadonlyObjectDeep + : unknown; + +/** +Same as `ReadonlyDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `ReadonlyDeep`. +*/ +interface ReadonlyMapDeep + extends ReadonlyMap, ReadonlyDeep> {} + +/** +Same as `ReadonlyDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `ReadonlyDeep`. +*/ +interface ReadonlySetDeep + extends ReadonlySet> {} + +/** +Same as `ReadonlyDeep`, but accepts only `object`s as inputs. Internal helper for `ReadonlyDeep`. +*/ +type ReadonlyObjectDeep = { + readonly [PropertyType in keyof ObjectType]: ReadonlyDeep +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/require-at-least-one.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/require-at-least-one.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2200d495b61c0b0065d15f25ce034782c41e77eb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest/source/require-at-least-one.d.ts @@ -0,0 +1,32 @@ +import {Except} from './except'; + +/** +Create a type that requires at least one of the given properties. The remaining properties are kept as is. + +@example +``` +import {RequireAtLeastOne} from 'type-fest'; + +type Responder = { + text?: () => string; + json?: () => string; + + secure?: boolean; +}; + +const responder: RequireAtLeastOne = { + json: () => '{"message": "ok"}', + secure: true +}; +``` +*/ +export type RequireAtLeastOne = + { + // For each Key in KeysType make a mapped type + [Key in KeysType]: ( + // …by picking that Key's type and making it required + Required> + ) + }[KeysType] + // …then, make intersection types by adding the remaining properties to each mapped type. + & Except; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/package.json new file mode 100644 index 0000000000000000000000000000000000000000..05dc5320af3d3434adf2a073a4582da8ab6e7b98 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/package.json @@ -0,0 +1,49 @@ +{ + "name": "read-pkg", + "version": "5.2.0", + "description": "Read a package.json file", + "license": "MIT", + "repository": "sindresorhus/read-pkg", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "json", + "read", + "parse", + "file", + "fs", + "graceful", + "load", + "package", + "normalize" + ], + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "devDependencies": { + "ava": "^2.2.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "xo": { + "ignores": [ + "test/test.js" + ] + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..74afd10bed32413a25022d0e3c3b73a9e503f757 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/read-pkg/readme.md @@ -0,0 +1,81 @@ +# read-pkg [![Build Status](https://travis-ci.org/sindresorhus/read-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg) + +> Read a package.json file + + +## Why + +- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs) +- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json) +- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) + + +## Install + +``` +$ npm install read-pkg +``` + + +## Usage + +```js +const readPkg = require('read-pkg'); + +(async () => { + console.log(await readPkg()); + //=> {name: 'read-pkg', …} + + console.log(await readPkg({cwd: 'some-other-directory'})); + //=> {name: 'unicorn', …} +})(); +``` + + +## API + +### readPkg(options?) + +Returns a `Promise` with the parsed JSON. + +### readPkg.sync(options?) + +Returns the parsed JSON. + +#### options + +Type: `object` + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Current working directory. + +##### normalize + +Type: `boolean`
+Default: `true` + +[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data. + + +## Related + +- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file +- [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file +- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file + + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/.editorconfig b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..d63f0bb6cdfb9bff414b1493862deef1c385a5ec --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/.editorconfig @@ -0,0 +1,37 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 200 + +[*.js] +block_comment_start = /* +block_comment = * +block_comment_end = */ + +[*.yml] +indent_size = 1 + +[package.json] +indent_style = tab + +[lib/core.json] +indent_style = tab + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[{*.json,Makefile}] +max_line_length = off + +[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*] +indent_style = off +indent_size = off +max_line_length = off +insert_final_newline = off diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/.eslintrc b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/.eslintrc new file mode 100644 index 0000000000000000000000000000000000000000..ad05dd8c2ec56fb83470bb3b27b31c1fe8ba0aba --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/.eslintrc @@ -0,0 +1,65 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "indent": [2, 4], + "strict": 0, + "complexity": 0, + "consistent-return": 0, + "curly": 0, + "dot-notation": [2, { "allowKeywords": true }], + "func-name-matching": 0, + "func-style": 0, + "global-require": 1, + "id-length": [2, { "min": 1, "max": 40 }], + "max-lines": [2, 350], + "max-lines-per-function": 0, + "max-nested-callbacks": 0, + "max-params": 0, + "max-statements-per-line": [2, { "max": 2 }], + "max-statements": 0, + "no-magic-numbers": 0, + "no-shadow": 0, + "no-use-before-define": 0, + "sort-keys": 0, + }, + "overrides": [ + { + "files": "bin/**", + "rules": { + "no-process-exit": "off", + }, + }, + { + "files": "example/**", + "rules": { + "no-console": 0, + }, + }, + { + "files": "test/resolver/nested_symlinks/mylib/*.js", + "rules": { + "no-throw-literal": 0, + }, + }, + { + "files": "test/**", + "parserOptions": { + "ecmaVersion": 5, + "allowReserved": false, + }, + "rules": { + "dot-notation": [2, { "allowPattern": "throws" }], + "max-lines": 0, + "max-lines-per-function": 0, + "no-unused-vars": [2, { "vars": "all", "args": "none" }], + }, + }, + ], + + "ignorePatterns": [ + "./test/resolver/malformed_package_json/package.json", + ], +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/.github/FUNDING.yml b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..d9c05955459660bd6b6a972499502b8d09958220 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/resolve +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/LICENSE b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ff4fce28af33a4504d6960856a0bd603860a62e0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/SECURITY.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/SECURITY.md new file mode 100644 index 0000000000000000000000000000000000000000..82e4285adc6285693cd6c06af02d606e09dd8fcd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/async.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/async.js new file mode 100644 index 0000000000000000000000000000000000000000..f38c5813ebd04ab8bf6988cc0186b9f95433f7e2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/async.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/async'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/bin/resolve b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/bin/resolve new file mode 100644 index 0000000000000000000000000000000000000000..21d1a87eec1fe1557a535fc0cdfd877908cb5c71 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/bin/resolve @@ -0,0 +1,50 @@ +#!/usr/bin/env node + +'use strict'; + +var path = require('path'); +var fs = require('fs'); + +if ( + String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve ' + && ( + !process.argv + || process.argv.length < 2 + || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino) + || (process.env.npm_lifecycle_event !== 'npx' && process.env._ && fs.realpathSync(path.resolve(process.env._)) !== __filename) + ) +) { + console.error('Error: `resolve` must be run directly as an executable'); + process.exit(1); +} + +var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag'); + +var preserveSymlinks = false; +for (var i = 2; i < process.argv.length; i += 1) { + if (process.argv[i].slice(0, 2) === '--') { + if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') { + preserveSymlinks = true; + } else if (process.argv[i].length > 2) { + console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, '')); + process.exit(2); + } + process.argv.splice(i, 1); + i -= 1; + if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax + } +} + +if (process.argv.length < 3) { + console.error('Error: `resolve` expects a specifier'); + process.exit(2); +} + +var resolve = require('../'); + +var result = resolve.sync(process.argv[2], { + basedir: process.cwd(), + preserveSymlinks: preserveSymlinks +}); + +console.log(result); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/example/async.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/example/async.js new file mode 100644 index 0000000000000000000000000000000000000000..20e65dc281dbaa3947a1c5d1b1a0bc94167c2073 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/example/async.js @@ -0,0 +1,5 @@ +var resolve = require('../'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/example/sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/example/sync.js new file mode 100644 index 0000000000000000000000000000000000000000..54b2cc1004223d114e38bbd46fe9a0f5b73ca7e2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/example/sync.js @@ -0,0 +1,3 @@ +var resolve = require('../'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/index.js new file mode 100644 index 0000000000000000000000000000000000000000..125d8146423596fa289ec4edf8e3c78ef92eb7c7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/index.js @@ -0,0 +1,6 @@ +var async = require('./lib/async'); +async.core = require('./lib/core'); +async.isCore = require('./lib/is-core'); +async.sync = require('./lib/sync'); + +module.exports = async; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/async.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/async.js new file mode 100644 index 0000000000000000000000000000000000000000..60d2555fc3bd01a9461393cc52d3c746b137312f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/async.js @@ -0,0 +1,329 @@ +var fs = require('fs'); +var getHomedir = require('./homedir'); +var path = require('path'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); +var isCore = require('is-core-module'); + +var realpathFS = process.platform !== 'win32' && fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultIsDir = function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultRealpath = function realpath(x, cb) { + realpathFS(x, function (realpathErr, realPath) { + if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); + else cb(null, realpathErr ? x : realPath); + }); +}; + +var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { + if (opts && opts.preserveSymlinks === false) { + realpath(x, cb); + } else { + cb(null, x); + } +}; + +var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolve(x, options, callback) { + var cb = callback; + var opts = options; + if (typeof options === 'function') { + cb = opts; + opts = {}; + } + if (typeof x !== 'string') { + var err = new TypeError('Path must be a string.'); + return process.nextTick(function () { + cb(err); + }); + } + + opts = normalizeOptions(x, opts); + + var isFile = opts.isFile || defaultIsFile; + var isDirectory = opts.isDirectory || defaultIsDir; + var readFile = opts.readFile || fs.readFile; + var realpath = opts.realpath || defaultRealpath; + var readPackage = opts.readPackage || defaultReadPackage; + if (opts.readFile && opts.readPackage) { + var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.'); + return process.nextTick(function () { + cb(conflictErr); + }); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = path.resolve(basedir); + + maybeRealpath( + realpath, + absoluteStart, + opts, + function (err, realStart) { + if (err) cb(err); + else init(realStart); + } + ); + + var res; + function init(basedir) { + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + res = path.resolve(basedir, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + if ((/\/$/).test(x) && res === basedir) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else if (includeCoreModules && isCore(x)) { + return cb(null, x); + } else loadNodeModules(x, basedir, function (err, n, pkg) { + if (err) cb(err); + else if (n) { + return maybeRealpath(realpath, n, opts, function (err, realN) { + if (err) { + cb(err); + } else { + cb(null, realN, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function onfile(err, m, pkg) { + if (err) cb(err); + else if (m) cb(null, m, pkg); + else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err); + else if (d) { + maybeRealpath(realpath, d, opts, function (err, realD) { + if (err) { + cb(err); + } else { + cb(null, realD, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function loadAsFile(x, thePackage, callback) { + var loadAsFilePackage = thePackage; + var cb = callback; + if (typeof loadAsFilePackage === 'function') { + cb = loadAsFilePackage; + loadAsFilePackage = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, loadAsFilePackage); + + function load(exts, x, loadPackage) { + if (exts.length === 0) return cb(null, undefined, loadPackage); + var file = x + exts[0]; + + var pkg = loadPackage; + if (pkg) onpkg(null, pkg); + else loadpkg(path.dirname(file), onpkg); + + function onpkg(err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err); + if (dir && pkg && opts.pathFilter) { + var rfile = path.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load( + [''].concat(extensions.slice()), + path.resolve(dir, r), + pkg + ); + } + isFile(file, onex); + } + function onex(err, ex) { + if (err) return cb(err); + if (ex) return cb(null, file, pkg); + load(exts.slice(1), x, pkg); + } + } + } + + function loadpkg(dir, cb) { + if (dir === '' || dir === '/') return cb(null); + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return cb(null); + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); + + maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadpkg(path.dirname(dir), cb); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path.dirname(dir), cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + cb(null, pkg, dir); + }); + }); + }); + } + + function loadAsDirectory(x, loadAsDirectoryPackage, callback) { + var cb = callback; + var fpkg = loadAsDirectoryPackage; + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return cb(unwrapErr); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) return cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, 'index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + }); + } + + function processDirs(cb, dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + + isDirectory(path.dirname(dir), isdir); + + function isdir(err, isdir) { + if (err) return cb(err); + if (!isdir) return processDirs(cb, dirs.slice(1)); + loadAsFile(dir, opts.package, onfile); + } + + function onfile(err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(dir, opts.package, ondir); + } + + function ondir(err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + processDirs(cb, dirs.slice(1)); + } + } + function loadNodeModules(x, start, cb) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + processDirs( + cb, + packageIterator ? packageIterator(x, start, thunk, opts) : thunk() + ); + } +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/caller.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/caller.js new file mode 100644 index 0000000000000000000000000000000000000000..b14a2804ae828a4c39c9f949611236cd6ef7a45d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/caller.js @@ -0,0 +1,8 @@ +module.exports = function () { + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var origPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = function (_, stack) { return stack; }; + var stack = (new Error()).stack; + Error.prepareStackTrace = origPrepareStackTrace; + return stack[2].getFileName(); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/core.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/core.js new file mode 100644 index 0000000000000000000000000000000000000000..57b048f1386ff93b941e8d375d878041535f1964 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/core.js @@ -0,0 +1,12 @@ +'use strict'; + +var isCoreModule = require('is-core-module'); +var data = require('./core.json'); + +var core = {}; +for (var mod in data) { // eslint-disable-line no-restricted-syntax + if (Object.prototype.hasOwnProperty.call(data, mod)) { + core[mod] = isCoreModule(mod); + } +} +module.exports = core; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/core.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/core.json new file mode 100644 index 0000000000000000000000000000000000000000..928d34595fda776e22a7d35045f764314b5a8e0e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/core.json @@ -0,0 +1,162 @@ +{ + "assert": true, + "node:assert": [">= 14.18 && < 15", ">= 16"], + "assert/strict": ">= 15", + "node:assert/strict": ">= 16", + "async_hooks": ">= 8", + "node:async_hooks": [">= 14.18 && < 15", ">= 16"], + "buffer_ieee754": ">= 0.5 && < 0.9.7", + "buffer": true, + "node:buffer": [">= 14.18 && < 15", ">= 16"], + "child_process": true, + "node:child_process": [">= 14.18 && < 15", ">= 16"], + "cluster": ">= 0.5", + "node:cluster": [">= 14.18 && < 15", ">= 16"], + "console": true, + "node:console": [">= 14.18 && < 15", ">= 16"], + "constants": true, + "node:constants": [">= 14.18 && < 15", ">= 16"], + "crypto": true, + "node:crypto": [">= 14.18 && < 15", ">= 16"], + "_debug_agent": ">= 1 && < 8", + "_debugger": "< 8", + "dgram": true, + "node:dgram": [">= 14.18 && < 15", ">= 16"], + "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], + "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"], + "dns": true, + "node:dns": [">= 14.18 && < 15", ">= 16"], + "dns/promises": ">= 15", + "node:dns/promises": ">= 16", + "domain": ">= 0.7.12", + "node:domain": [">= 14.18 && < 15", ">= 16"], + "events": true, + "node:events": [">= 14.18 && < 15", ">= 16"], + "freelist": "< 6", + "fs": true, + "node:fs": [">= 14.18 && < 15", ">= 16"], + "fs/promises": [">= 10 && < 10.1", ">= 14"], + "node:fs/promises": [">= 14.18 && < 15", ">= 16"], + "_http_agent": ">= 0.11.1", + "node:_http_agent": [">= 14.18 && < 15", ">= 16"], + "_http_client": ">= 0.11.1", + "node:_http_client": [">= 14.18 && < 15", ">= 16"], + "_http_common": ">= 0.11.1", + "node:_http_common": [">= 14.18 && < 15", ">= 16"], + "_http_incoming": ">= 0.11.1", + "node:_http_incoming": [">= 14.18 && < 15", ">= 16"], + "_http_outgoing": ">= 0.11.1", + "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"], + "_http_server": ">= 0.11.1", + "node:_http_server": [">= 14.18 && < 15", ">= 16"], + "http": true, + "node:http": [">= 14.18 && < 15", ">= 16"], + "http2": ">= 8.8", + "node:http2": [">= 14.18 && < 15", ">= 16"], + "https": true, + "node:https": [">= 14.18 && < 15", ">= 16"], + "inspector": ">= 8", + "node:inspector": [">= 14.18 && < 15", ">= 16"], + "inspector/promises": [">= 19"], + "node:inspector/promises": [">= 19"], + "_linklist": "< 8", + "module": true, + "node:module": [">= 14.18 && < 15", ">= 16"], + "net": true, + "node:net": [">= 14.18 && < 15", ">= 16"], + "node-inspect/lib/_inspect": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", + "os": true, + "node:os": [">= 14.18 && < 15", ">= 16"], + "path": true, + "node:path": [">= 14.18 && < 15", ">= 16"], + "path/posix": ">= 15.3", + "node:path/posix": ">= 16", + "path/win32": ">= 15.3", + "node:path/win32": ">= 16", + "perf_hooks": ">= 8.5", + "node:perf_hooks": [">= 14.18 && < 15", ">= 16"], + "process": ">= 1", + "node:process": [">= 14.18 && < 15", ">= 16"], + "punycode": ">= 0.5", + "node:punycode": [">= 14.18 && < 15", ">= 16"], + "querystring": true, + "node:querystring": [">= 14.18 && < 15", ">= 16"], + "readline": true, + "node:readline": [">= 14.18 && < 15", ">= 16"], + "readline/promises": ">= 17", + "node:readline/promises": ">= 17", + "repl": true, + "node:repl": [">= 14.18 && < 15", ">= 16"], + "node:sea": [">= 20.12 && < 21", ">= 21.7"], + "smalloc": ">= 0.11.5 && < 3", + "node:sqlite": ">= 23.4", + "_stream_duplex": ">= 0.9.4", + "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"], + "_stream_transform": ">= 0.9.4", + "node:_stream_transform": [">= 14.18 && < 15", ">= 16"], + "_stream_wrap": ">= 1.4.1", + "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"], + "_stream_passthrough": ">= 0.9.4", + "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"], + "_stream_readable": ">= 0.9.4", + "node:_stream_readable": [">= 14.18 && < 15", ">= 16"], + "_stream_writable": ">= 0.9.4", + "node:_stream_writable": [">= 14.18 && < 15", ">= 16"], + "stream": true, + "node:stream": [">= 14.18 && < 15", ">= 16"], + "stream/consumers": ">= 16.7", + "node:stream/consumers": ">= 16.7", + "stream/promises": ">= 15", + "node:stream/promises": ">= 16", + "stream/web": ">= 16.5", + "node:stream/web": ">= 16.5", + "string_decoder": true, + "node:string_decoder": [">= 14.18 && < 15", ">= 16"], + "sys": [">= 0.4 && < 0.7", ">= 0.8"], + "node:sys": [">= 14.18 && < 15", ">= 16"], + "test/reporters": ">= 19.9 && < 20.2", + "node:test/reporters": [">= 18.17 && < 19", ">= 19.9", ">= 20"], + "test/mock_loader": ">= 22.3 && < 22.7", + "node:test/mock_loader": ">= 22.3 && < 22.7", + "node:test": [">= 16.17 && < 17", ">= 18"], + "timers": true, + "node:timers": [">= 14.18 && < 15", ">= 16"], + "timers/promises": ">= 15", + "node:timers/promises": ">= 16", + "_tls_common": ">= 0.11.13", + "node:_tls_common": [">= 14.18 && < 15", ">= 16"], + "_tls_legacy": ">= 0.11.3 && < 10", + "_tls_wrap": ">= 0.11.3", + "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"], + "tls": true, + "node:tls": [">= 14.18 && < 15", ">= 16"], + "trace_events": ">= 10", + "node:trace_events": [">= 14.18 && < 15", ">= 16"], + "tty": true, + "node:tty": [">= 14.18 && < 15", ">= 16"], + "url": true, + "node:url": [">= 14.18 && < 15", ">= 16"], + "util": true, + "node:util": [">= 14.18 && < 15", ">= 16"], + "util/types": ">= 15.3", + "node:util/types": ">= 16", + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8": ">= 1", + "node:v8": [">= 14.18 && < 15", ">= 16"], + "vm": true, + "node:vm": [">= 14.18 && < 15", ">= 16"], + "wasi": [">= 13.4 && < 13.5", ">= 18.17 && < 19", ">= 20"], + "node:wasi": [">= 18.17 && < 19", ">= 20"], + "worker_threads": ">= 11.7", + "node:worker_threads": [">= 14.18 && < 15", ">= 16"], + "zlib": ">= 0.5", + "node:zlib": [">= 14.18 && < 15", ">= 16"] +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/homedir.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/homedir.js new file mode 100644 index 0000000000000000000000000000000000000000..5ffdf73bb336aea8649f285547a6f08f779a7be1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/homedir.js @@ -0,0 +1,24 @@ +'use strict'; + +var os = require('os'); + +// adapted from https://github.com/sindresorhus/os-homedir/blob/11e089f4754db38bb535e5a8416320c4446e8cfd/index.js + +module.exports = os.homedir || function homedir() { + var home = process.env.HOME; + var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME; + + if (process.platform === 'win32') { + return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null; + } + + if (process.platform === 'darwin') { + return home || (user ? '/Users/' + user : null); + } + + if (process.platform === 'linux') { + return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); // eslint-disable-line no-extra-parens + } + + return home || null; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/is-core.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/is-core.js new file mode 100644 index 0000000000000000000000000000000000000000..537f5c782ffe55c97e43920e8405856a9e828ada --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/is-core.js @@ -0,0 +1,5 @@ +var isCoreModule = require('is-core-module'); + +module.exports = function isCore(x) { + return isCoreModule(x); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/node-modules-paths.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/node-modules-paths.js new file mode 100644 index 0000000000000000000000000000000000000000..1cff0107b5862c3cf080030ac3eeb8244e7328b5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/node-modules-paths.js @@ -0,0 +1,42 @@ +var path = require('path'); +var parse = path.parse || require('path-parse'); // eslint-disable-line global-require + +var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { + var prefix = '/'; + if ((/^([A-Za-z]:)/).test(absoluteStart)) { + prefix = ''; + } else if ((/^\\\\/).test(absoluteStart)) { + prefix = '\\\\'; + } + + var paths = [absoluteStart]; + var parsed = parse(absoluteStart); + while (parsed.dir !== paths[paths.length - 1]) { + paths.push(parsed.dir); + parsed = parse(parsed.dir); + } + + return paths.reduce(function (dirs, aPath) { + return dirs.concat(modules.map(function (moduleDir) { + return path.resolve(prefix, aPath, moduleDir); + })); + }, []); +}; + +module.exports = function nodeModulesPaths(start, opts, request) { + var modules = opts && opts.moduleDirectory + ? [].concat(opts.moduleDirectory) + : ['node_modules']; + + if (opts && typeof opts.paths === 'function') { + return opts.paths( + request, + start, + function () { return getNodeModulesDirs(start, modules); }, + opts + ); + } + + var dirs = getNodeModulesDirs(start, modules); + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/normalize-options.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/normalize-options.js new file mode 100644 index 0000000000000000000000000000000000000000..4b56904eaea72ba024f96728fff40e1be4af7df0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/normalize-options.js @@ -0,0 +1,10 @@ +module.exports = function (x, opts) { + /** + * This file is purposefully a passthrough. It's expected that third-party + * environments will override it at runtime in order to inject special logic + * into `resolve` (by manipulating the options). One such example is the PnP + * code path in Yarn. + */ + + return opts || {}; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/sync.js new file mode 100644 index 0000000000000000000000000000000000000000..0b6cd58d44b1c2be6e662f481ba3bc75f2a9780d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/lib/sync.js @@ -0,0 +1,208 @@ +var isCore = require('is-core-module'); +var fs = require('fs'); +var path = require('path'); +var getHomedir = require('./homedir'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); + +var realpathFS = process.platform !== 'win32' && fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file) { + try { + var stat = fs.statSync(file, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && (stat.isFile() || stat.isFIFO()); +}; + +var defaultIsDir = function isDirectory(dir) { + try { + var stat = fs.statSync(dir, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && stat.isDirectory(); +}; + +var defaultRealpathSync = function realpathSync(x) { + try { + return realpathFS(x); + } catch (realpathErr) { + if (realpathErr.code !== 'ENOENT') { + throw realpathErr; + } + } + return x; +}; + +var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { + if (opts && opts.preserveSymlinks === false) { + return realpathSync(x); + } + return x; +}; + +var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolveSync(x, options) { + if (typeof x !== 'string') { + throw new TypeError('Path must be a string.'); + } + var opts = normalizeOptions(x, options); + + var isFile = opts.isFile || defaultIsFile; + var readFileSync = opts.readFileSync || fs.readFileSync; + var isDirectory = opts.isDirectory || defaultIsDir; + var realpathSync = opts.realpathSync || defaultRealpathSync; + var readPackageSync = opts.readPackageSync || defaultReadPackageSync; + if (opts.readFileSync && opts.readPackageSync) { + throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.'); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); + + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + var res = path.resolve(absoluteStart, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return maybeRealpathSync(realpathSync, m, opts); + } else if (includeCoreModules && isCore(x)) { + return x; + } else { + var n = loadNodeModulesSync(x, absoluteStart); + if (n) return maybeRealpathSync(realpathSync, n, opts); + } + + var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + + function loadAsFileSync(x) { + var pkg = loadpkg(path.dirname(x)); + + if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { + var rfile = path.relative(pkg.dir, x); + var r = opts.pathFilter(pkg.pkg, x, rfile); + if (r) { + x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign + } + } + + if (isFile(x)) { + return x; + } + + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + if (isFile(file)) { + return file; + } + } + } + + function loadpkg(dir) { + if (dir === '' || dir === '/') return; + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return; + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; + + var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); + + if (!isFile(pkgfile)) { + return loadpkg(path.dirname(dir)); + } + + var pkg = readPackageSync(readFileSync, pkgfile); + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment + } + + return { pkg: pkg, dir: dir }; + } + + function loadAsDirectorySync(x) { + var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); + if (isFile(pkgfile)) { + try { + var pkg = readPackageSync(readFileSync, pkgfile); + } catch (e) {} + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + throw mainError; + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + try { + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); + if (n) return n; + } catch (e) {} + } + } + + return loadAsFileSync(path.join(x, '/index')); + } + + function loadNodeModulesSync(x, start) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); + + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + if (isDirectory(path.dirname(dir))) { + var m = loadAsFileSync(dir); + if (m) return m; + var n = loadAsDirectorySync(dir); + if (n) return n; + } + } + } +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/package.json new file mode 100644 index 0000000000000000000000000000000000000000..062bb742eaf3d6cdb248f002bd6cc0a82d604ce9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/package.json @@ -0,0 +1,75 @@ +{ + "name": "resolve", + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", + "version": "1.22.10", + "repository": { + "type": "git", + "url": "git://github.com/browserify/resolve.git" + }, + "bin": { + "resolve": "./bin/resolve" + }, + "main": "index.js", + "keywords": [ + "resolve", + "require", + "node", + "module" + ], + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated && cp node_modules/is-core-module/core.json ./lib/ ||:", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**'", + "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", + "tests-only": "tape test/*.js", + "pretest": "npm run lint", + "test": "npm run --silent tests-only", + "posttest": "npm run test:multirepo && npx npm@'>= 10.2' audit --production", + "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.1", + "array.prototype.map": "^1.0.7", + "copy-dir": "^1.3.0", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "mkdirp": "^0.5.5", + "mv": "^2.1.1", + "npmignore": "^0.3.1", + "object-keys": "^1.1.1", + "rimraf": "^2.7.1", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.1", + "tap": "0.4.13", + "tape": "^5.9.0", + "tmp": "^0.0.31" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "appveyor.yml", + "test/resolver/malformed_package_json", + "test/list-exports" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/readme.markdown b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/readme.markdown new file mode 100644 index 0000000000000000000000000000000000000000..ad34d60dd57771d805f0e6cf9f1104a63b98940d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/readme.markdown @@ -0,0 +1,301 @@ +# resolve [![Version Badge][2]][1] + +implements the [node `require.resolve()` algorithm](https://nodejs.org/api/modules.html#modules_all_together) such that you can `require.resolve()` on behalf of a file asynchronously and synchronously + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +# example + +asynchronously resolve: + +```js +var resolve = require('resolve/async'); // or, require('resolve') +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); +``` + +``` +$ node example/async.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +synchronously resolve: + +```js +var resolve = require('resolve/sync'); // or, `require('resolve').sync +var res = resolve('tap', { basedir: __dirname }); +console.log(res); +``` + +``` +$ node example/sync.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +# methods + +```js +var resolve = require('resolve'); +var async = require('resolve/async'); +var sync = require('resolve/sync'); +``` + +For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: + +- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module +- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory +- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) + +## resolve(id, opts={}, cb) + +Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.package - `package.json` data applicable to the module being loaded + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFile - how to read files asynchronously + +* opts.isFile - function to asynchronously test whether a file exists + +* opts.isDirectory - function to asynchronously test whether a file exists and is a directory + +* opts.realpath - function to asynchronously resolve a potential symlink to its real path + +* `opts.readPackage(readFile, pkgfile, cb)` - function to asynchronously read and parse a package.json file + * readFile - the passed `opts.readFile` or `fs.readFile` if not specified + * pkgfile - path to package.json + * cb - callback + +* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * pkgfile - path to package.json + * dir - directory that contains package.json + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFile: fs.readFile, + isFile: function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + isDirectory: function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + realpath: function realpath(file, cb) { + var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + realpath(file, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? file : realPath); + }); + }, + readPackage: function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +## resolve.sync(id, opts) + +Synchronously resolve the module path string `id`, returning the result and +throwing an error when `id` can't be resolved. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFileSync - how to read files synchronously + +* opts.isFile - function to synchronously test whether a file exists + +* opts.isDirectory - function to synchronously test whether a file exists and is a directory + +* opts.realpathSync - function to synchronously resolve a potential symlink to its real path + +* `opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file + * readFileSync - the passed `opts.readFileSync` or `fs.readFileSync` if not specified + * pkgfile - path to package.json + +* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * dir - directory that contains package.json (Note: the second argument will change to "pkgfile" in v2) + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFileSync: fs.readFileSync, + isFile: function isFile(file) { + try { + var stat = fs.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isFile() || stat.isFIFO(); + }, + isDirectory: function isDirectory(dir) { + try { + var stat = fs.statSync(dir); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isDirectory(); + }, + realpathSync: function realpathSync(file) { + try { + var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + return realpath(file); + } catch (realPathErr) { + if (realPathErr.code !== 'ENOENT') { + throw realPathErr; + } + } + return file; + }, + readPackageSync: function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +# install + +With [npm](https://npmjs.org) do: + +```sh +npm install resolve +``` + +# license + +MIT + +[1]: https://npmjs.org/package/resolve +[2]: https://versionbadg.es/browserify/resolve.svg +[5]: https://david-dm.org/browserify/resolve.svg +[6]: https://david-dm.org/browserify/resolve +[7]: https://david-dm.org/browserify/resolve/dev-status.svg +[8]: https://david-dm.org/browserify/resolve#info=devDependencies +[11]: https://nodei.co/npm/resolve.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/resolve.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/resolve.svg +[downloads-url]: https://npm-stat.com/charts.html?package=resolve +[codecov-image]: https://codecov.io/gh/browserify/resolve/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/browserify/resolve/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/resolve +[actions-url]: https://github.com/browserify/resolve/actions diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/sync.js new file mode 100644 index 0000000000000000000000000000000000000000..cd0ee040177e92c676b1a063406c743289719bd0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/sync.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/sync'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/core.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/core.js new file mode 100644 index 0000000000000000000000000000000000000000..a477adc5ce2a4464362d617a21604b367a8d9718 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/core.js @@ -0,0 +1,88 @@ +var test = require('tape'); +var keys = require('object-keys'); +var semver = require('semver'); + +var resolve = require('../'); + +var brokenNode = semver.satisfies(process.version, '11.11 - 11.13'); + +test('core modules', function (t) { + t.test('isCore()', function (st) { + st.ok(resolve.isCore('fs')); + st.ok(resolve.isCore('net')); + st.ok(resolve.isCore('http')); + + st.ok(!resolve.isCore('seq')); + st.ok(!resolve.isCore('../')); + + st.ok(!resolve.isCore('toString')); + + st.end(); + }); + + t.test('core list', function (st) { + var cores = keys(resolve.core); + st.plan(cores.length); + + for (var i = 0; i < cores.length; ++i) { + var mod = cores[i]; + // note: this must be require, not require.resolve, due to https://github.com/nodejs/node/issues/43274 + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + t.comment(mod + ': ' + resolve.core[mod]); + if (resolve.core[mod]) { + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); + } else if (brokenNode) { + st.ok(true, 'this version of node is broken: attempting to require things that fail to resolve breaks "home_paths" tests'); + } else { + st.throws(requireFunc, mod + ' not supported; requiring throws'); + } + } + + st.end(); + }); + + t.test('core via repl module', { skip: !resolve.core.repl }, function (st) { + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + st.end(); + }); + + t.test('core via builtinModules list', { skip: !resolve.core.module }, function (st) { + var libs = require('module').builtinModules; + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + var blacklist = [ + '_debug_agent', + 'v8/tools/tickprocessor-driver', + 'v8/tools/SourceMap', + 'v8/tools/tickprocessor', + 'v8/tools/profile' + ]; + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + if (blacklist.indexOf(mod) === -1) { + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + } + st.end(); + }); + + t.end(); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/dotdot.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/dotdot.js new file mode 100644 index 0000000000000000000000000000000000000000..30806659be2ef27d410722636d6f79c8f8e999b0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/dotdot.js @@ -0,0 +1,29 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('dotdot', function (t) { + t.plan(4); + var dir = path.join(__dirname, '/dotdot/abc'); + + resolve('..', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'dotdot/index.js')); + }); + + resolve('.', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('dotdot sync', function (t) { + t.plan(2); + var dir = path.join(__dirname, '/dotdot/abc'); + + var a = resolve.sync('..', { basedir: dir }); + t.equal(a, path.join(__dirname, 'dotdot/index.js')); + + var b = resolve.sync('.', { basedir: dir }); + t.equal(b, path.join(dir, 'index.js')); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/dotdot/abc/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/dotdot/abc/index.js new file mode 100644 index 0000000000000000000000000000000000000000..67f2534ebf90dcc4c2c1c13ce3ab52c41f4d2ed9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/dotdot/abc/index.js @@ -0,0 +1,2 @@ +var x = require('..'); +console.log(x); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/dotdot/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/dotdot/index.js new file mode 100644 index 0000000000000000000000000000000000000000..643f9fcc6a6a7cf025dcc86559e83d00b993ed96 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/dotdot/index.js @@ -0,0 +1 @@ +module.exports = 'whatever'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/faulty_basedir.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/faulty_basedir.js new file mode 100644 index 0000000000000000000000000000000000000000..5f2141a67267bceaf743ab292ca8e7bebb2b6bbc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/faulty_basedir.js @@ -0,0 +1,29 @@ +var test = require('tape'); +var path = require('path'); +var resolve = require('../'); + +test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) { + t.plan(1); + + var resolverDir = 'C:\\a\\b\\c\\d'; + + resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(!!err, true); + }); +}); + +test('non-existent basedir should not throw when preserveSymlinks is false', function (t) { + t.plan(2); + + var opts = { + basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'), + preserveSymlinks: false + }; + + var module = './dotdot/abc'; + + resolve(module, opts, function (err, res) { + t.equal(err.code, 'MODULE_NOT_FOUND'); + t.equal(res, undefined); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/filter.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/filter.js new file mode 100644 index 0000000000000000000000000000000000000000..8f8cccdb2f59f3ea03a27151da52f73ed9f068de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/filter.js @@ -0,0 +1,34 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + resolve('./baz', { + basedir: dir, + packageFilter: function (pkg, pkgfile) { + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = [pkg, pkgfile]; + return pkg; + } + }, function (err, res, pkg) { + if (err) t.fail(err); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(pkg, packageData, 'first packageFilter argument is "pkg"'); + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + var packageFile = packageFilterArgs[1]; + t.equal( + packageFile, + path.join(dir, 'baz/package.json'), + 'second packageFilter argument is "pkgfile"' + ); + + t.end(); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/filter_sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/filter_sync.js new file mode 100644 index 0000000000000000000000000000000000000000..8a43b9818973dfba95a2389f27e966ff4f315343 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/filter_sync.js @@ -0,0 +1,33 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + var res = resolve.sync('./baz', { + basedir: dir, + // NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility + packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef + return pkg; + } + }); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + if (!'is 1.x') { // eslint-disable-line no-constant-condition + var packageFile = packageFilterArgs[1]; + t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct'); + } + + var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition + // eslint-disable-next-line no-constant-condition + t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"'); + + t.end(); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/home_paths.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/home_paths.js new file mode 100644 index 0000000000000000000000000000000000000000..3b8c9b32c87bd73fb2a3ec42494d13faae1594e4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/home_paths.js @@ -0,0 +1,127 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../async'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazPkg = { name: 'baz', main: 'quux.js' }; + var dotMainPkg = { main: 'index' }; + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + var dotSlashMainPkg = { main: 'index' }; + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('dot_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_main`'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + s2t.deepEqual(pkg, dotMainPkg); + }); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(3); + + resolve('dot_slash_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_slash_main`'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + s2t.deepEqual(pkg, dotSlashMainPkg); + }); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('baz', function (err, res, pkg) { + s2t.error(err, 'no error resolving `baz`'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + s2t.deepEqual(pkg, bazPkg); + }); + }); + }); + }); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/home_paths_sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/home_paths_sync.js new file mode 100644 index 0000000000000000000000000000000000000000..5d2c56fd35d0a3ad072c3549f12695c93654aaed --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/home_paths_sync.js @@ -0,0 +1,114 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../sync'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_main'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_slash_main'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('baz'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + }); + }); + }); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/mock.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/mock.js new file mode 100644 index 0000000000000000000000000000000000000000..611627549889541b31e4eb8d8f9277871a452076 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/mock.js @@ -0,0 +1,315 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock from package', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, file)); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[file]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('mock package from package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('symlinked', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + cb(null, resolved); + return; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + cb(null, path.join(dir, 'symlinked', base)); + } else { + cb(null, path.join(resolved, 'symlinked')); + } + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); +}); + +test('readPackage', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + t.test('with readFile', function (st) { + st.plan(3); + + resolve('bar', opts('/foo'), function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + st.equal(pkg && pkg.main, './baz.js'); + }); + }); + + var readPackage = function (readFile, file, cb) { + var barPackage = path.join('bar', 'package.json'); + if (file.slice(-barPackage.length) === barPackage) { + cb(null, { main: './something-else.js' }); + } else { + cb(null, JSON.parse(files[path.resolve(file)])); + } + }; + + t.test('with readPackage', function (st) { + st.plan(3); + + var options = opts('/foo'); + delete options.readFile; + options.readPackage = readPackage; + resolve('bar', options, function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/something-else.js')); + st.equal(pkg && pkg.main, './something-else.js'); + }); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackage = readPackage; + resolve('bar', options, function (err) { + st.throws(function () { throw err; }, TypeError, 'errors when both readFile and readPackage are provided'); + }); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/mock_sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/mock_sync.js new file mode 100644 index 0000000000000000000000000000000000000000..c5a7e2a98030d90cc256c9f4174eafdce395280d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/mock_sync.js @@ -0,0 +1,214 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.throws(function () { + resolve.sync('baz', opts('/foo/bar')); + }); + + t.throws(function () { + resolve.sync('../baz', opts('/foo/bar')); + }); +}); + +test('mock package', function (t) { + t.plan(1); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); +}); + +test('symlinked', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + return resolved; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + return path.join(dir, 'symlinked', base); + } + return path.join(resolved, 'symlinked'); + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); +}); + +test('readPackageSync', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir, useReadPackage) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: useReadPackage ? null : function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + t.test('with readFile', function (st) { + st.plan(1); + + st.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); + }); + + var readPackageSync = function (readFileSync, file) { + if (file.indexOf(path.join('bar', 'package.json')) >= 0) { + return { main: './something-else.js' }; + } + return JSON.parse(files[path.resolve(file)]); + }; + + t.test('with readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + delete options.readFileSync; + options.readPackageSync = readPackageSync; + + st.equal( + resolve.sync('bar', options), + path.resolve('/foo/node_modules/bar/something-else.js') + ); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackageSync = readPackageSync; + st.throws( + function () { resolve.sync('bar', options); }, + TypeError, + 'errors when both readFile and readPackage are provided' + ); + }); +}); + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir.js new file mode 100644 index 0000000000000000000000000000000000000000..b50e5bb1751d69694deaae36d5f0bc6691498008 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir.js @@ -0,0 +1,56 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('moduleDirectory strings', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'module_dir'); + var xopts = { + basedir: dir, + moduleDirectory: 'xmodules' + }; + resolve('aaa', xopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var yopts = { + basedir: dir, + moduleDirectory: 'ymodules' + }; + resolve('aaa', yopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); +}); + +test('moduleDirectory array', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'module_dir'); + var aopts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('aaa', aopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var bopts = { + basedir: dir, + moduleDirectory: ['zmodules', 'ymodules', 'xmodules'] + }; + resolve('aaa', bopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); + + var copts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('bbb', copts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/zmodules/bbb/main.js')); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/xmodules/aaa/index.js new file mode 100644 index 0000000000000000000000000000000000000000..dd7cf7b2d022daae3c3f7628fcfb2f8bf186efac --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/xmodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x * 100; }; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/ymodules/aaa/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ef2d4d4bf76e61fdfe16ef406c9752c6435138f3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/ymodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x + 100; }; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/zmodules/bbb/main.js new file mode 100644 index 0000000000000000000000000000000000000000..e8ba629936a7ad11134ac826edfad2379759c7cb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/zmodules/bbb/main.js @@ -0,0 +1 @@ +module.exports = function (n) { return n * 111; }; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/zmodules/bbb/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c13b8cf6acfd3344bc2c7969a31d930d933fdf22 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/module_dir/zmodules/bbb/package.json @@ -0,0 +1,3 @@ +{ + "main": "main.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node-modules-paths.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node-modules-paths.js new file mode 100644 index 0000000000000000000000000000000000000000..675441db2ced7b7facac9b7344fe8ea98c16e45b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node-modules-paths.js @@ -0,0 +1,143 @@ +var test = require('tape'); +var path = require('path'); +var parse = path.parse || require('path-parse'); +var keys = require('object-keys'); + +var nodeModulesPaths = require('../lib/node-modules-paths'); + +var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) { + var moduleDirs = [].concat(moduleDirectories || 'node_modules'); + if (paths) { + for (var k = 0; k < paths.length; ++k) { + moduleDirs.push(path.basename(paths[k])); + } + } + + var foundModuleDirs = {}; + var uniqueDirs = {}; + var parsedDirs = {}; + for (var i = 0; i < dirs.length; ++i) { + var parsed = parse(dirs[i]); + if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; } + foundModuleDirs[parsed.base] += 1; + parsedDirs[parsed.dir] = true; + uniqueDirs[dirs[i]] = true; + } + t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has'); + var foundModuleDirNames = keys(foundModuleDirs); + t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found'); + t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique'); + + var counts = {}; + for (var j = 0; j < foundModuleDirNames.length; ++j) { + counts[foundModuleDirs[j]] = true; + } + t.equal(keys(counts).length, 1, 'all found module directories had the same count'); +}; + +test('node-modules-paths', function (t) { + t.test('no options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('empty options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, {}); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('with paths=array option', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var dirs = nodeModulesPaths(start, { paths: paths }); + + verifyDirs(t, start, dirs, null, paths); + + t.end(); + }); + + t.test('with paths=function option', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request)); + }; + + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg'); + + verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]); + + t.end(); + }); + + t.test('with paths=function skipping node modules resolution', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return []; + }; + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }); + t.deepEqual(dirs, [], 'no node_modules was computed'); + t.end(); + }); + + t.test('with moduleDirectory option', function (t) { + var start = path.join(__dirname, 'resolver'); + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory); + + t.end(); + }); + + t.test('with 1 moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory, paths); + + t.end(); + }); + + t.test('with 1+ moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectories = ['not node modules', 'other modules']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + verifyDirs(t, start, dirs, moduleDirectories, paths); + + t.end(); + }); + + t.test('combine paths correctly on Windows', function (t) { + var start = 'C:\\Users\\username\\myProject\\src'; + var paths = []; + var moduleDirectories = ['node_modules', start]; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); + + t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) { + var start = '/Users/username/git/myProject/src'; + var paths = []; + var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path.js new file mode 100644 index 0000000000000000000000000000000000000000..e463d6c8c313b3554d5d4e07643fea29cfa86c51 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path.js @@ -0,0 +1,70 @@ +var fs = require('fs'); +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('$NODE_PATH', function (t) { + t.plan(8); + + var isDir = function (dir, cb) { + if (dir === '/node_path' || dir === 'node_path/x') { + return cb(null, true); + } + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }; + + resolve('aaa', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves'); + }); + + resolve('bbb', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves'); + }); + + resolve('ccc', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves'); + }); + + // ensure that relative paths still resolve against the regular `node_modules` correctly + resolve('tap', { + paths: [ + 'node_path' + ], + basedir: path.join(__dirname, 'node_path/x'), + isDirectory: isDir + }, function (err, res) { + var root = require('tap/package.json').main; // eslint-disable-line global-require + t.error(err); + t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves'); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/x/aaa/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/x/aaa/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ad70d0bb03f6f433224a681f9055fe9d0a388dfc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/x/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'A'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/x/ccc/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/x/ccc/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a64132e4c7e52cfea76744d826e99932e994c7c1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/x/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'C'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/y/bbb/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/y/bbb/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4d0f32e24368185d6f3c16445f88b902329025d6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/y/bbb/index.js @@ -0,0 +1 @@ +module.exports = 'B'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/y/ccc/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/y/ccc/index.js new file mode 100644 index 0000000000000000000000000000000000000000..793315e846687e1dd2bae012fc30676b2a421753 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/node_path/y/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'CY'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/nonstring.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/nonstring.js new file mode 100644 index 0000000000000000000000000000000000000000..ef63c40f9393dc63219d5e3debb7ed6db175c455 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/nonstring.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var resolve = require('../'); + +test('nonstring', function (t) { + t.plan(1); + resolve(555, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/pathfilter.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/pathfilter.js new file mode 100644 index 0000000000000000000000000000000000000000..16519aeae51c4fb65b8ccdd69f303a2315358ef3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/pathfilter.js @@ -0,0 +1,75 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +var resolverDir = path.join(__dirname, '/pathfilter/deep_ref'); + +var pathFilterFactory = function (t) { + return function (pkg, x, remainder) { + t.equal(pkg.version, '1.2.3'); + t.equal(x, path.join(resolverDir, 'node_modules/deep/ref')); + t.equal(remainder, 'ref'); + return 'alt'; + }; +}; + +test('#62: deep module references and the pathFilter', function (t) { + t.test('deep/ref.js', function (st) { + st.plan(3); + + resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) { + if (err) st.fail(err); + + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + var res = resolve.sync('deep/ref', { basedir: resolverDir }); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + t.test('deep/deeper/ref', function (st) { + st.plan(4); + + resolve( + 'deep/deeper/ref', + { basedir: resolverDir }, + function (err, res, pkg) { + if (err) t.fail(err); + st.notEqual(pkg, undefined); + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + } + ); + + var res = resolve.sync( + 'deep/deeper/ref', + { basedir: resolverDir } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + }); + + t.test('deep/ref alt', function (st) { + st.plan(8); + + var pathFilter = pathFilterFactory(st); + + var res = resolve.sync( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + + resolve( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter }, + function (err, res, pkg) { + if (err) st.fail(err); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + st.end(); + } + ); + }); + + t.end(); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/pathfilter/deep_ref/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/pathfilter/deep_ref/main.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence.js new file mode 100644 index 0000000000000000000000000000000000000000..2febb598fbc06832ce5b076735cb9f79fb257c7c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence.js @@ -0,0 +1,23 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('precedence', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'precedence/aaa'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg.name, 'resolve'); + }); +}); + +test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string + t.plan(1); + var dir = path.join(__dirname, 'precedence/bbb'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/aaa.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/aaa.js new file mode 100644 index 0000000000000000000000000000000000000000..b83a3e7ad98d17536ebc574326276c0fe341b99a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/aaa.js @@ -0,0 +1 @@ +module.exports = 'wtf'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/aaa/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/aaa/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e0f8f6abf72f7fe517abf6c57fae219b831b1cc9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'okok'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/aaa/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/aaa/main.js new file mode 100644 index 0000000000000000000000000000000000000000..93542a965e0ea4fa1a548dcb4491e1defd73afe0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/aaa/main.js @@ -0,0 +1 @@ +console.log(require('./')); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/bbb.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/bbb.js new file mode 100644 index 0000000000000000000000000000000000000000..2298f47fdd16dcc8375b62d1a15109a5833da926 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/bbb.js @@ -0,0 +1 @@ +module.exports = '>_<'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/bbb/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/bbb/main.js new file mode 100644 index 0000000000000000000000000000000000000000..716b81d4bd463f66980f3cb44588b283bfb23edc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/precedence/bbb/main.js @@ -0,0 +1 @@ +console.log(require('./')); // should throw diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver.js new file mode 100644 index 0000000000000000000000000000000000000000..df8211af3af3d2059ce2a665e936390fcc4529a4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver.js @@ -0,0 +1,597 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var resolve = require('../'); +var async = require('../async'); + +test('`./async` entry point', function (t) { + t.equal(resolve, async, '`./async` entry point is the same as `main`'); + t.end(); +}); + +test('async foo', function (t) { + t.plan(12); + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo.js', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.main, 'resolver'); + }); + + resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg.main, 'resolver'); + }); + + resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + }); + + resolve('foo', { basedir: dir }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'"); + }); +}); + +test('bar', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'resolver'); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg.main, 'bar'); + }); +}); + +test('baz', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + + resolve('./baz', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); + + resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); +}); + +test('biz', function (t) { + t.plan(24); + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + resolve('./grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'biz'); + }); + + resolve('./garply', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, 'grux'); + }); + + resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'tiv'); + }); + + resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); +}); + +test('quux', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/quux'); + + resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo/index.js')); + t.equal(pkg.main, 'quux'); + }); +}); + +test('normalize', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + resolve('../grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg, undefined); + }); +}); + +test('cup', function (t) { + t.plan(5); + var dir = path.join(__dirname, 'resolver'); + + resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup.coffee', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'"); + }); +}); + +test('mug', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'resolver'); + + resolve('./mug', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'mug.js')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, '/mug.coffee')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + t.equal(res, path.join(dir, '/mug.js')); + }); +}); + +test('other path', function (t) { + t.plan(6); + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/root.js')); + }); + + resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js')); + }); + + resolve('root', { basedir: dir }, function (err, res) { + t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) { + t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('path iterator', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'baz/quux.js')); + t.equal(pkg && pkg.name, 'baz'); + }); +}); + +test('incorrect main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('missing index', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + resolve('./missing_index', { basedir: resolverDir }, function (err, res, pkg) { + t.ok(err instanceof Error); + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('missing main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./missing_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('null main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./null_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('main: false', function (t) { + t.plan(2); + + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + resolve('./false_main', { basedir: basedir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal( + res, + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + t.deepEqual(pkg, { + name: 'false_main', + main: false + }); + }); +}); + +test('without basedir', function (t) { + t.plan(1); + + var dir = path.join(__dirname, 'resolver/without_basedir'); + var tester = require(path.join(dir, 'main.js')); // eslint-disable-line global-require + + tester(t, function (err, res, pkg) { + if (err) { + t.fail(err); + } else { + t.equal(res, path.join(dir, 'node_modules/mymodule.js')); + } + }); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo.js')); + }); + + resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); + + resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('async: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.plan(1); + resolve('./' + testFile, function (err, res, pkg) { + if (err) t.fail(err); + st.equal(res, __filename, 'sanity check'); + }); + }); + + t.test('with a fake directory', function (st) { + st.plan(4); + + resolve('./' + testFile + '/blah', function (err, res, pkg) { + st.ok(err, 'there is an error'); + st.notOk(res, 'no result'); + + st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + err && err.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + st.end(); + }); + }); + + t.end(); +}); + +test('async dot main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('async dot slash main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_slash_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('not a directory', function (t) { + t.plan(6); + var path = './foo'; + resolve(path, { basedir: __filename }, function (err, res, pkg) { + t.ok(err, 'a non-directory errors'); + t.equal(arguments.length, 1); + t.equal(res, undefined); + t.equal(pkg, undefined); + + t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\''); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('browser field in package.json', function (t) { + t.plan(3); + + var dir = path.join(__dirname, 'resolver'); + resolve( + './browser_field', + { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }, + function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.equal(pkg && pkg.main, 'b'); + t.equal(pkg && pkg.browser, undefined); + } + ); +}); + +test('absolute paths', function (t) { + t.plan(4); + + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + resolve(__filename, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file resolves' + ); + }); + resolve(extensionless, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file resolves' + ); + }); + resolve(__filename, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file with a basedir resolves' + ); + }); + resolve(extensionless, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + }); +}); + +var malformedDir = path.join(__dirname, 'resolver/malformed_package_json'); +test('malformed package.json', { skip: !fs.existsSync(malformedDir) }, function (t) { + /* eslint operator-linebreak: ["error", "before"], function-paren-newline: "off" */ + t.plan( + (3 * 3) // 3 sets of 3 assertions in the final callback + + 2 // 1 readPackage call with malformed package.json + ); + + var basedir = malformedDir; + var expected = path.join(basedir, 'index.js'); + + resolve('./index.js', { basedir: basedir }, function (err, res, pkg) { + t.error(err, 'no error'); + t.equal(res, expected, 'malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'malformed package.json gives an undefined `pkg` argument'); + }); + + resolve( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + }, + function (err, res, pkg) { + t.error(err, 'with packageFilter: no error'); + t.equal(res, expected, 'with packageFilter: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with packageFilter: malformed package.json gives an undefined `pkg` argument'); + } + ); + + resolve( + './index.js', + { + basedir: basedir, + readPackage: function (readFile, pkgfile, cb) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + readFile(pkgfile, function (err, result) { + try { + cb(null, JSON.parse(result)); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackage: malformed package.json parses as a syntax error'); + cb(null); + } + }); + } + }, + function (err, res, pkg) { + t.error(err, 'with readPackage: no error'); + t.equal(res, expected, 'with readPackage: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with readPackage: malformed package.json gives an undefined `pkg` argument'); + } + ); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/baz/doom.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/baz/doom.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/baz/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/baz/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2f77720b8672a0e2ed8b49636775335884cb3ec0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/baz/package.json @@ -0,0 +1,4 @@ +{ + "name": "baz", + "main": "quux.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/baz/quux.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/baz/quux.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/baz/quux.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/browser_field/a.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/browser_field/a.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/browser_field/b.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/browser_field/b.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/browser_field/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/browser_field/package.json new file mode 100644 index 0000000000000000000000000000000000000000..bf406f0830f8aab6aaec9e3f60f1623fbe6854e6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/browser_field/package.json @@ -0,0 +1,5 @@ +{ + "name": "browser_field", + "main": "a", + "browser": "b" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/cup.coffee b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/cup.coffee new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/cup.coffee @@ -0,0 +1 @@ + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_main/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_main/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d7f4fc8079f60aaee820b293537b21d488a1bc31 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "." +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_slash_main/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_slash_main/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_slash_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_slash_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_slash_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f51287b9d1e739a8827578a541e89f7e91450615 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/dot_slash_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "./" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/false_main/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/false_main/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/false_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/false_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a7416c0c7aa4a1df56419f92dcc7519836db8978 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/false_main/package.json @@ -0,0 +1,4 @@ +{ + "name": "false_main", + "main": false +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/foo.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/foo.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/foo.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/incorrect_main/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/incorrect_main/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bc1fb0a6f4ede17ec05e767ca8ccacbc3015ff70 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/incorrect_main/index.js @@ -0,0 +1,2 @@ +// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/incorrect_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/incorrect_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b7188041763f8a94977f173a26c41fdbf5f2effb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/incorrect_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "wrong.js" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/invalid_main/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/invalid_main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0590748642ae2eadb17726ec3d1b501c94652277 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/invalid_main/package.json @@ -0,0 +1,7 @@ +{ + "name": "invalid_main", + "main": [ + "why is this a thing", + "srsly omg wtf" + ] +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/mug.coffee b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/mug.coffee new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/mug.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/mug.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/lerna.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/lerna.json new file mode 100644 index 0000000000000000000000000000000000000000..d6707ca0cd64d48d212b90abe2e72f24b092572f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/lerna.json @@ -0,0 +1,6 @@ +{ + "packages": [ + "packages/*" + ], + "version": "0.0.0" +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4391d392ea2761caea4d8286cc8ccc56cfa3e4a5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/package.json @@ -0,0 +1,20 @@ +{ + "name": "ljharb-monorepo-symlink-test", + "private": true, + "version": "0.0.0", + "description": "", + "main": "index.js", + "scripts": { + "postinstall": "lerna bootstrap", + "test": "node packages/package-a" + }, + "author": "", + "license": "MIT", + "dependencies": { + "jquery": "^3.3.1", + "resolve": "../../../" + }, + "devDependencies": { + "lerna": "^3.4.3" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8875a32df0ffc4eda94bb6c6dd9855ac604820c4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var assert = require('assert'); +var path = require('path'); +var resolve = require('resolve'); + +var basedir = __dirname + '/node_modules/@my-scope/package-b'; + +var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js'); + +/* + * preserveSymlinks === false + * will search NPM package from + * - packages/package-b/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected); +assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected); + +/* + * preserveSymlinks === true + * will search NPM package from + * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules + * - packages/package-a/node_modules/@my-scope/packages/node_modules + * - packages/package-a/node_modules/@my-scope/node_modules + * - packages/package-a/node_modules/node_modules + * - packages/package-a/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected); +assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected); + +console.log(' * all monorepo paths successfully resolved through symlinks'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json new file mode 100644 index 0000000000000000000000000000000000000000..204de51e05878b3451223ba654c5e4a790ef1e51 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-a", + "version": "0.0.0", + "private": true, + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-b": "^0.0.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f57c3b5f5e454d3948e1a4bc5aec10fdcd79d8b5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-b", + "private": true, + "version": "0.0.0", + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-a": "^0.0.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js new file mode 100644 index 0000000000000000000000000000000000000000..9b4846a82a77be169097f041f791070732229cb7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js @@ -0,0 +1,26 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b; +var c; + +var test = function test() { + console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); + console.log(b, ': preserveSymlinks true'); + console.log(c, ': preserveSymlinks false'); + + if (a !== b && a !== c) { + throw 'async: no match'; + } + console.log('async: success! a matched either b or c\n'); +}; + +require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) { + if (err) { throw err; } + b = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); +require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) { + if (err) { throw err; } + c = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json new file mode 100644 index 0000000000000000000000000000000000000000..acfe9e9517720ab5532c247052fadb214c5ffef3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json @@ -0,0 +1,15 @@ +{ + "name": "mylib", + "version": "0.0.0", + "description": "", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "buffer": "*" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js new file mode 100644 index 0000000000000000000000000000000000000000..3283efc2ec81f8d2a62be9a1fd28a192403ce549 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js @@ -0,0 +1,12 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD'); +var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD'); + +console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); +console.log(b, ': preserveSymlinks true'); +console.log(c, ': preserveSymlinks false'); + +if (a !== b && a !== c) { + throw 'sync: no match'; +} +console.log('sync: success! a matched either b or c\n'); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/other_path/lib/other-lib.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/other_path/root.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/other_path/root.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/quux/foo/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/quux/foo/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/quux/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/same_names/foo.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/same_names/foo.js new file mode 100644 index 0000000000000000000000000000000000000000..888cae37af95c51299d735439cf896dc4d5aaafc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/same_names/foo.js @@ -0,0 +1 @@ +module.exports = 42; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/same_names/foo/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/same_names/foo/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bd816eaba4ca3be8e4d68cfc0ae9f64b5aa712cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/same_names/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/package/bar.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/package/bar.js new file mode 100644 index 0000000000000000000000000000000000000000..cb1c2c01e753b31f6e550e991a82022f7acf8638 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/package/bar.js @@ -0,0 +1 @@ +module.exports = 'bar'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/package/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/package/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8e1b585914a7b46cd21d5d8709ac08bc1fe84962 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/symlinked/package/package.json @@ -0,0 +1,3 @@ +{ + "main": "bar.js" +} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/without_basedir/main.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/without_basedir/main.js new file mode 100644 index 0000000000000000000000000000000000000000..5b31975be69da5efea03fac676afa5f2199831be --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver/without_basedir/main.js @@ -0,0 +1,5 @@ +var resolve = require('../../../'); + +module.exports = function (t, cb) { + resolve('mymodule', null, cb); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver_sync.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver_sync.js new file mode 100644 index 0000000000000000000000000000000000000000..a6df8ced4682af11914d60c7a6a96b8a33ab438b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/resolver_sync.js @@ -0,0 +1,730 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); + +var resolve = require('../'); +var sync = require('../sync'); + +var requireResolveSupportsPaths = require.resolve.length > 1 + && !(/^v12\.[012]\./).test(process.version); // broken in v12.0-12.2, see https://github.com/nodejs/node/issues/27794 + +var requireResolveDefaultPathsBroken = (/^v8\.9\.|^v9\.[01]\.0|^v9\.2\./).test(process.version); +// broken in node v8.9.x, v9.0, v9.1, v9.2.x. see https://github.com/nodejs/node/pull/17113 + +test('`./sync` entry point', function (t) { + t.equal(resolve.sync, sync, '`./sync` entry point is the same as `.sync` on `main`'); + t.end(); +}); + +test('foo', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./foo', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: dir }), + require.resolve('./foo', { paths: [dir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + require.resolve('./foo.js', { paths: [dir] }), + './foo.js: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }), + path.join(dir, 'foo.js') + ); + + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }); + + // Test that filename is reported as the "from" value when passed. + t.throws( + function () { + resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') }); + }, + { + name: 'Error', + message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'" + } + ); + + t.end(); +}); + +test('bar', function (t) { + var dir = path.join(__dirname, 'resolver'); + + var basedir = path.join(dir, 'bar'); + + t.equal( + resolve.sync('foo', { basedir: basedir }), + path.join(dir, 'bar/node_modules/foo/index.js'), + 'foo in bar' + ); + if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) { + t.equal( + resolve.sync('foo', { basedir: basedir }), + require.resolve('foo', { paths: [basedir] }), + 'foo in bar: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('baz', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./baz', { basedir: dir }), + path.join(dir, 'baz/quux.js'), + './baz' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./baz', { basedir: dir }), + require.resolve('./baz', { paths: [dir] }), + './baz: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('biz', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + t.equal( + resolve.sync('./grux', { basedir: dir }), + path.join(dir, 'grux/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./grux', { basedir: dir }), + require.resolve('./grux', { paths: [dir] }), + './grux: resolve.sync === require.resolve' + ); + } + + var tivDir = path.join(dir, 'grux'); + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + path.join(dir, 'tiv/index.js') + ); + if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) { + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + require.resolve('tiv', { paths: [tivDir] }), + 'tiv: resolve.sync === require.resolve' + ); + } + + var gruxDir = path.join(dir, 'tiv'); + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + path.join(dir, 'grux/index.js') + ); + if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) { + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + require.resolve('grux', { paths: [gruxDir] }), + 'grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('normalize', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + t.equal( + resolve.sync('../grux', { basedir: dir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('../grux', { basedir: dir }), + require.resolve('../grux', { paths: [dir] }), + '../grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('cup', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'cup.coffee'), + './cup -> ./cup.coffee' + ); + + t.equal( + resolve.sync('./cup.coffee', { basedir: dir }), + path.join(dir, 'cup.coffee'), + './cup.coffee' + ); + + t.throws(function () { + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js'] + }); + }); + + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./cup.coffee', { basedir: dir, extensions: ['.js', '.coffee'] }), + require.resolve('./cup.coffee', { paths: [dir] }), + './cup.coffee: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('mug', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./mug', { basedir: dir }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./mug', { basedir: dir }), + require.resolve('./mug', { paths: [dir] }), + './mug: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.coffee', '.js'] + }), + path.join(dir, 'mug.coffee'), + './mug -> ./mug.coffee' + ); + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + + t.end(); +}); + +test('other path', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + t.equal( + resolve.sync('root', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/root.js') + ); + + t.equal( + resolve.sync('lib/other-lib', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/lib/other-lib.js') + ); + + t.throws(function () { + resolve.sync('root', { basedir: dir }); + }); + + t.throws(function () { + resolve.sync('zzz', { + basedir: dir, + paths: [otherDir] + }); + }); + + t.end(); +}); + +test('path iterator', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + t.equal( + resolve.sync('baz', { packageIterator: exactIterator }), + path.join(resolverDir, 'baz/quux.js') + ); + + t.end(); +}); + +test('incorrect main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + require.resolve('./incorrect_main', { paths: [resolverDir] }), + './incorrect_main: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('missing index', function (t) { + t.plan(requireResolveSupportsPaths ? 2 : 1); + + var resolverDir = path.join(__dirname, 'resolver'); + try { + resolve.sync('./missing_index', { basedir: resolverDir }); + t.fail('did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + require.resolve('./missing_index', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } +}); + +test('missing main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('null main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('main: false', function (t) { + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + require.resolve('./false_main', { paths: [basedir] }), + '`"main": false`: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +var stubStatSync = function stubStatSync(fn) { + var statSync = fs.statSync; + try { + fs.statSync = function () { + throw new EvalError('Unknown Error'); + }; + return fn(); + } finally { + fs.statSync = statSync; + } +}; + +test('#79 - re-throw non ENOENT errors from stat', function (t) { + var dir = path.join(__dirname, 'resolver'); + + stubStatSync(function () { + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }, /Unknown Error/); + }); + + t.end(); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names'); + + t.equal( + resolve.sync('./foo', { basedir: basedir }), + path.join(dir, 'same_names/foo.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: basedir }), + require.resolve('./foo', { paths: [basedir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + require.resolve('./foo/', { paths: [basedir] }), + './foo/: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names/foo'); + + t.equal( + resolve.sync('./', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + './' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./', { basedir: basedir }), + require.resolve('./', { paths: [basedir] }), + './: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('.', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + '.' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('.', { basedir: basedir }), + require.resolve('.', { paths: [basedir] }), + '.: resolve.sync === require.resolve', + { todo: true } + ); + } + + t.end(); +}); + +test('sync: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.equal( + resolve.sync('./' + testFile), + __filename, + 'sanity check' + ); + st.equal( + resolve.sync('./' + testFile), + require.resolve('./' + testFile), + 'sanity check: resolve.sync === require.resolve' + ); + + st.end(); + }); + + t.test('with a fake directory', function (st) { + function run() { return resolve.sync('./' + testFile + '/blah'); } + + st.throws(run, 'throws an error'); + + try { + run(); + } catch (e) { + st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + e.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + } + + st.end(); + }); + + t.end(); +}); + +test('sync dot main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_main'), + path.join(__dirname, 'resolver/dot_main/index.js'), + './resolver/dot_main' + ); + t.equal( + resolve.sync('./resolver/dot_main'), + require.resolve('./resolver/dot_main'), + './resolver/dot_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('sync dot slash main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_slash_main'), + path.join(__dirname, 'resolver/dot_slash_main/index.js') + ); + t.equal( + resolve.sync('./resolver/dot_slash_main'), + require.resolve('./resolver/dot_slash_main'), + './resolver/dot_slash_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('not a directory', function (t) { + var path = './foo'; + try { + resolve.sync(path, { basedir: __filename }); + t.fail(); + } catch (err) { + t.ok(err, 'a non-directory errors'); + t.equal(err && err.message, 'Cannot find module \'' + path + "' from '" + __filename + "'"); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('browser field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + var res = resolve.sync('./browser_field', { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.end(); +}); + +test('absolute paths', function (t) { + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + t.equal( + resolve.sync(__filename), + __filename, + 'absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(extensionless), + __filename, + 'extensionless absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + __filename, + 'absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + require.resolve(__filename, { paths: [process.cwd()] }), + 'absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + require.resolve(extensionless, { paths: [process.cwd()] }), + 'extensionless absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +var malformedDir = path.join(__dirname, 'resolver/malformed_package_json'); +test('malformed package.json', { skip: !fs.existsSync(malformedDir) }, function (t) { + t.plan(5 + (requireResolveSupportsPaths ? 1 : 0)); + + var basedir = malformedDir; + var expected = path.join(basedir, 'index.js'); + + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + expected, + 'malformed package.json is silently ignored' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + require.resolve('./index.js', { paths: [basedir] }), + 'malformed package.json: resolve.sync === require.resolve' + ); + } + + var res1 = resolve.sync( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + } + ); + + t.equal( + res1, + expected, + 'with packageFilter: malformed package.json is silently ignored' + ); + + var res2 = resolve.sync( + './index.js', + { + basedir: basedir, + readPackageSync: function (readFileSync, pkgfile) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + var result = String(readFileSync(pkgfile)); + try { + return JSON.parse(result); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackageSync: malformed package.json parses as a syntax error'); + } + } + } + ); + + t.equal( + res2, + expected, + 'with readPackageSync: malformed package.json is silently ignored' + ); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/shadowed_core.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/shadowed_core.js new file mode 100644 index 0000000000000000000000000000000000000000..3a5f4fcff728f305c2d3d17a416fea4cbfe31f6b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/shadowed_core.js @@ -0,0 +1,54 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('shadowed core modules still return core module', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, 'util'); + }); +}); + +test('shadowed core modules still return core module [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, 'util'); +}); + +test('shadowed core modules return shadow when appending `/`', function (t) { + t.plan(2); + + resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow when appending `/` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false`', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/shadowed_core/node_modules/util/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/shadowed_core/node_modules/util/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/subdirs.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/subdirs.js new file mode 100644 index 0000000000000000000000000000000000000000..b7b8450a9ef231940eca37b8fe951310147a9470 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/subdirs.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('subdirs', function (t) { + t.plan(2); + + var dir = path.join(__dirname, '/subdirs'); + resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); + }); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/symlinks.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/symlinks.js new file mode 100644 index 0000000000000000000000000000000000000000..35f881afb8c7e043567cf85953d9046c011cec3d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/resolve/test/symlinks.js @@ -0,0 +1,176 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var map = require('array.prototype.map'); +var resolve = require('../'); + +var symlinkDir = path.join(__dirname, 'resolver', 'symlinked', 'symlink'); +var packageDir = path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'package'); +var modADir = path.join(__dirname, 'symlinks', 'source', 'node_modules', 'mod-a'); +var symlinkModADir = path.join(__dirname, 'symlinks', 'dest', 'node_modules', 'mod-a'); +try { + fs.unlinkSync(symlinkDir); +} catch (err) {} +try { + fs.unlinkSync(packageDir); +} catch (err) {} +try { + fs.unlinkSync(modADir); +} catch (err) {} +try { + fs.unlinkSync(symlinkModADir); +} catch (err) {} + +try { + fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction'); +} +try { + fs.symlinkSync('../../package', packageDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'package') + '\\', packageDir, 'junction'); +} +try { + fs.symlinkSync('../../source/node_modules/mod-a', symlinkModADir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'source', 'node_modules', 'mod-a') + '\\', symlinkModADir, 'junction'); +} + +test('symlink', function (t) { + t.plan(2); + + resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) { + t.error(err); + t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + }); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.plan(4); + + resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) { + t.ok(err, 'there is an error'); + t.notOk(res, 'no result'); + + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + t.equal( + err && err.message, + 'Cannot find module \'foo\' from \'' + symlinkDir + '\'', + 'can not find nonexistent module' + ); + }); +}); + +test('sync symlink', function (t) { + var start = new Date(); + t.doesNotThrow(function () { + t.equal( + resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), + path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js') + ); + }); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.throws(function () { + resolve.sync('foo', { basedir: symlinkDir }); + }, /Cannot find module 'foo'/); + t.end(); +}); + +test('sync symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + var fn = resolve.sync('package', { basedir: basedir, preserveSymlinks: false }); + + t.equal(fn, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + t.end(); +}); + +test('async symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + t.plan(2); + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + resolve('package', { basedir: basedir, preserveSymlinks: false }, function (err, result) { + t.notOk(err, 'no error'); + t.equal(result, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + }); +}); + +test('packageFilter', function (t) { + function relative(x) { + return path.relative(__dirname, x); + } + + function testPackageFilter(preserveSymlinks) { + return function (st) { + st.plan('is 1.x' ? 3 : 5); // eslint-disable-line no-constant-condition + + var destMain = 'symlinks/dest/node_modules/mod-a/index.js'; + var destPkg = 'symlinks/dest/node_modules/mod-a/package.json'; + var sourceMain = 'symlinks/source/node_modules/mod-a/index.js'; + var sourcePkg = 'symlinks/source/node_modules/mod-a/package.json'; + var destDir = path.join(__dirname, 'symlinks', 'dest'); + + /* eslint multiline-comment-style: 0 */ + /* v2.x will restore these tests + var packageFilterPath = []; + var actualPath = resolve.sync('mod-a', { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile, dir) { + packageFilterPath.push(pkgfile); + } + }); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'sync: actual path is correct' + ); + st.deepEqual( + map(packageFilterPath, relative), + map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize), + 'sync: packageFilter pkgfile arg is correct' + ); + */ + + var asyncPackageFilterPath = []; + resolve( + 'mod-a', + { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile) { + asyncPackageFilterPath.push(pkgfile); + } + }, + function (err, actualPath) { + st.error(err, 'no error'); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'async: actual path is correct' + ); + st.deepEqual( + map(asyncPackageFilterPath, relative), + map( + preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg], + path.normalize + ), + 'async: packageFilter pkgfile arg is correct' + ); + } + ); + }; + } + + t.test('preserveSymlinks: false', testPackageFilter(false)); + + t.test('preserveSymlinks: true', testPackageFilter(true)); + + t.end(); +}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..44f2304b9d4817c4592b23110348d35d1881816a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/index.d.ts @@ -0,0 +1,21 @@ +/** +Strip leading whitespace from each line in a string. + +The line with the least number of leading whitespace, ignoring empty lines, determines the number to remove. + +@example +``` +import stripIndent = require('strip-indent'); + +const string = '\tunicorn\n\t\tcake'; +// unicorn +// cake + +stripIndent(string); +//unicorn +// cake +``` +*/ +declare function stripIndent(string: string): string; + +export = stripIndent; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7ba3b15b3e60f64a739d049a05fdd1a7df0546d5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/index.js @@ -0,0 +1,14 @@ +'use strict'; +const minIndent = require('min-indent'); + +module.exports = string => { + const indent = minIndent(string); + + if (indent === 0) { + return string; + } + + const regex = new RegExp(`^[ \\t]{${indent}}`, 'gm'); + + return string.replace(regex, ''); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d66a003b8ba555cb3316ee8c95f9f24b8c384cb6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/package.json @@ -0,0 +1,42 @@ +{ + "name": "strip-indent", + "version": "3.0.0", + "description": "Strip leading whitespace from each line in a string", + "license": "MIT", + "repository": "sindresorhus/strip-indent", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "indent", + "indentation", + "normalize", + "remove", + "delete", + "whitespace", + "space", + "tab", + "string" + ], + "dependencies": { + "min-indent": "^1.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..f14f6ba78912c8d2dfa8df678a6e03075c51a58c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/strip-indent/readme.md @@ -0,0 +1,44 @@ +# strip-indent [![Build Status](https://travis-ci.org/sindresorhus/strip-indent.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-indent) + +> Strip leading whitespace from each line in a string + +The line with the least number of leading whitespace, ignoring empty lines, determines the number to remove. + +Useful for removing redundant indentation. + + +## Install + +``` +$ npm install strip-indent +``` + + +## Usage + +```js +const stripIndent = require('strip-indent'); + +const string = '\tunicorn\n\t\tcake'; +/* + unicorn + cake +*/ + +stripIndent(string); +/* +unicorn + cake +*/ +``` + + +## Related + +- [strip-indent-cli](https://github.com/sindresorhus/strip-indent-cli) - CLI for this module +- [indent-string](https://github.com/sindresorhus/indent-string) - Indent each line in a string + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..520df2219ff6538fc1e8c6239fe71e5af944a62a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/index.d.ts @@ -0,0 +1,20 @@ +// Basic +export * from './source/basic'; + +// Utilities +export {Except} from './source/except'; +export {Mutable} from './source/mutable'; +export {Merge} from './source/merge'; +export {MergeExclusive} from './source/merge-exclusive'; +export {RequireAtLeastOne} from './source/require-at-least-one'; +export {RequireExactlyOne} from './source/require-exactly-one'; +export {PartialDeep} from './source/partial-deep'; +export {ReadonlyDeep} from './source/readonly-deep'; +export {LiteralUnion} from './source/literal-union'; +export {Promisable} from './source/promisable'; +export {Opaque} from './source/opaque'; +export {SetOptional} from './source/set-optional'; +export {SetRequired} from './source/set-required'; + +// Miscellaneous +export {PackageJson} from './source/package-json'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/license b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/license new file mode 100644 index 0000000000000000000000000000000000000000..e7af2f77107d73046421ef56c4684cbfdd3c1e89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ea6621129dc660677362f41ce310202aeda22b6d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/package.json @@ -0,0 +1,51 @@ +{ + "name": "type-fest", + "version": "0.8.1", + "description": "A collection of essential TypeScript types", + "license": "(MIT OR CC0-1.0)", + "repository": "sindresorhus/type-fest", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && tsd" + }, + "files": [ + "index.d.ts", + "source" + ], + "keywords": [ + "typescript", + "ts", + "types", + "utility", + "util", + "utilities", + "omit", + "merge", + "json" + ], + "devDependencies": { + "@sindresorhus/tsconfig": "^0.4.0", + "@typescript-eslint/eslint-plugin": "^2.2.0", + "@typescript-eslint/parser": "^2.2.0", + "eslint-config-xo-typescript": "^0.18.0", + "tsd": "^0.7.3", + "xo": "^0.24.0" + }, + "xo": { + "extends": "xo-typescript", + "extensions": [ + "ts" + ], + "rules": { + "import/no-unresolved": "off", + "@typescript-eslint/indent": "off" + } + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..1824bdabedecaa976dfe2bbd314a459170a14bc6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/readme.md @@ -0,0 +1,635 @@ +
+
+
+ type-fest +
+
+ A collection of essential TypeScript types +
+
+
+
+
+ +[![Build Status](https://travis-ci.com/sindresorhus/type-fest.svg?branch=master)](https://travis-ci.com/sindresorhus/type-fest) +[![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) + + +Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). + +Either add this package as a dependency or copy-paste the needed types. No credit required. 👌 + +PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first. + + +## Install + +``` +$ npm install type-fest +``` + +*Requires TypeScript >=3.2* + + +## Usage + +```ts +import {Except} from 'type-fest'; + +type Foo = { + unicorn: string; + rainbow: boolean; +}; + +type FooWithoutRainbow = Except; +//=> {unicorn: string} +``` + + +## API + +Click the type names for complete docs. + +### Basic + +- [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive). +- [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). +- [`TypedArray`](source/basic.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`. +- [`JsonObject`](source/basic.d.ts) - Matches a JSON object. +- [`JsonArray`](source/basic.d.ts) - Matches a JSON array. +- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value. +- [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable). + +### Utilities + +- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). +- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` keys into a mutable object. The inverse of `Readonly`. +- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type. +- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys. +- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys. +- [`RequireExactlyOne`](source/require-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more. +- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) if you only need one level deep. +- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) if you only need one level deep. +- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). +- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`. +- [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/). +- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional. +- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required. + +### Miscellaneous + +- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). + + +## Declined types + +*If we decline a type addition, we will make sure to document the better solution here.* + +- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider. +- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary` vs `Record`) from [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now. + + +## Tips + +### Built-in types + +There are many advanced types most users don't know about. + +- [`Partial`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/KYOwrgtgBAMg9gcxsAbsANlA3gKClAeQDMiAaPKAEWACMwFz8BRAJxbhcagDEBDAF17ocAXxw4AliH7AWRXgGNgUAHJwAJsADCcEEQkJsFXgAcTK3hGAAuKAGd+LKQgDcFEx363wEGrLf46IjIaOi28EioGG5iOArovHZ2qhrAAIJmAEJgEuiaLEb4Jk4oAsoKuvoIYCwCErq2apo6egZQALyF+FCm5pY2UABETelmg1xFnrYAzAAM8xNQQZGh4cFR6AB0xEQUIm4UFa0IABRHVbYACrws-BJCADwjLVUAfACUXfhEHFBnug4oABrYAATygcCIhBoACtgAp+JsQaC7P9ju9Prhut0joCwCZ1GUAGpCMDKTrnAwAbWRPWSyMhKWalQMAF0Dtj8BIoSd8YSZCT0GSOu1OmAQJp9CBgOpPkc7uBgBzOfwABYSOybSnVWp3XQ0sF04FgxnPFkIVkdKB84mkpUUfCxbEsYD8GogKBqjUBKBiWIAen9UGut3u6CeqReBlePXQQQA7skwMl+HAoMU4CgJJoISB0ODeOmbvwIVC1cAcIGmdpzVApDI5IpgJscNL49WMiZsrl8id3lrzScsD0zBYrLZBgAVOCUOCdwa+95uIA) + + ```ts + interface NodeConfig { + appName: string; + port: number; + } + + class NodeAppBuilder { + private configuration: NodeConfig = { + appName: 'NodeApp', + port: 3000 + }; + + config(config: Partial) { + type NodeConfigKey = keyof NodeConfig; + + for (const key of Object.keys(config) as NodeConfigKey[]) { + const updateValue = config[key]; + + if (updateValue === undefined) { + continue; + } + + this.configuration[key] = updateValue; + } + + return this; + } + } + + // `Partial`` allows us to provide only a part of the + // NodeConfig interface. + new NodeAppBuilder().config({appName: 'ToDoApp'}); + ``` +
+ +- [`Required`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA) + + ```ts + interface ContactForm { + email?: string; + message?: string; + } + + function submitContactForm(formData: Required) { + // Send the form data to the server. + } + + submitContactForm({ + email: 'ex@mple.com', + message: 'Hi! Could you tell me more about…', + }); + + // TypeScript error: missing property 'message' + submitContactForm({ + email: 'ex@mple.com', + }); + ``` +
+ +- [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA) + + ```ts + enum LogLevel { + Off, + Debug, + Error, + Fatal + }; + + interface LoggerConfig { + name: string; + level: LogLevel; + } + + class Logger { + config: Readonly; + + constructor({name, level}: LoggerConfig) { + this.config = {name, level}; + Object.freeze(this.config); + } + } + + const config: LoggerConfig = { + name: 'MyApp', + level: LogLevel.Debug + }; + + const logger = new Logger(config); + + // TypeScript Error: cannot assign to read-only property. + logger.config.level = LogLevel.Error; + + // We are able to edit config variable as we please. + config.level = LogLevel.Error; + ``` +
+ +- [`Pick`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA) + + ```ts + interface Article { + title: string; + thumbnail: string; + content: string; + } + + // Creates new type out of the `Article` interface composed + // from the Articles' two properties: `title` and `thumbnail`. + // `ArticlePreview = {title: string; thumbnail: string}` + type ArticlePreview = Pick; + + // Render a list of articles using only title and description. + function renderArticlePreviews(previews: ArticlePreview[]): HTMLElement { + const articles = document.createElement('div'); + + for (const preview of previews) { + // Append preview to the articles. + } + + return articles; + } + + const articles = renderArticlePreviews([ + { + title: 'TypeScript tutorial!', + thumbnail: '/assets/ts.jpg' + } + ]); + ``` +
+ +- [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA) + + ```ts + // Positions of employees in our company. + type MemberPosition = 'intern' | 'developer' | 'tech-lead'; + + // Interface describing properties of a single employee. + interface Employee { + firstName: string; + lastName: string; + yearsOfExperience: number; + } + + // Create an object that has all possible `MemberPosition` values set as keys. + // Those keys will store a collection of Employees of the same position. + const team: Record = { + intern: [], + developer: [], + 'tech-lead': [], + }; + + // Our team has decided to help John with his dream of becoming Software Developer. + team.intern.push({ + firstName: 'John', + lastName: 'Doe', + yearsOfExperience: 0 + }); + + // `Record` forces you to initialize all of the property keys. + // TypeScript Error: "tech-lead" property is missing + const teamEmpty: Record = { + intern: null, + developer: null, + }; + ``` +
+ +- [`Exclude`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA) + + ```ts + interface ServerConfig { + port: null | string | number; + } + + type RequestHandler = (request: Request, response: Response) => void; + + // Exclude `null` type from `null | string | number`. + // In case the port is equal to `null`, we will use default value. + function getPortValue(port: Exclude): number { + if (typeof port === 'string') { + return parseInt(port, 10); + } + + return port; + } + + function startServer(handler: RequestHandler, config: ServerConfig): void { + const server = require('http').createServer(handler); + + const port = config.port === null ? 3000 : getPortValue(config.port); + server.listen(port); + } + ``` +
+ +- [`Extract`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA) + + ```ts + declare function uniqueId(): number; + + const ID = Symbol('ID'); + + interface Person { + [ID]: number; + name: string; + age: number; + } + + // Allows changing the person data as long as the property key is of string type. + function changePersonData< + Obj extends Person, + Key extends Extract, + Value extends Obj[Key] + > (obj: Obj, key: Key, value: Value): void { + obj[key] = value; + } + + // Tiny Andrew was born. + const andrew = { + [ID]: uniqueId(), + name: 'Andrew', + age: 0, + }; + + // Cool, we're fine with that. + changePersonData(andrew, 'name', 'Pony'); + + // Goverment didn't like the fact that you wanted to change your identity. + changePersonData(andrew, ID, uniqueId()); + ``` +
+ +- [`NonNullable`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`. +
+ + Example + + Works with strictNullChecks set to true. (Read more here) + + [Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA) + + ```ts + type PortNumber = string | number | null; + + /** Part of a class definition that is used to build a server */ + class ServerBuilder { + portNumber!: NonNullable; + + port(this: ServerBuilder, port: PortNumber): ServerBuilder { + if (port == null) { + this.portNumber = 8000; + } else { + this.portNumber = port; + } + + return this; + } + } + + const serverBuilder = new ServerBuilder(); + + serverBuilder + .port('8000') // portNumber = '8000' + .port(null) // portNumber = 8000 + .port(3000); // portNumber = 3000 + + // TypeScript error + serverBuilder.portNumber = null; + ``` +
+ +- [`Parameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA) + + ```ts + function shuffle(input: any[]): void { + // Mutate array randomly changing its' elements indexes. + } + + function callNTimes any> (func: Fn, callCount: number) { + // Type that represents the type of the received function parameters. + type FunctionParameters = Parameters; + + return function (...args: FunctionParameters) { + for (let i = 0; i < callCount; i++) { + func(...args); + } + } + } + + const shuffleTwice = callNTimes(shuffle, 2); + ``` +
+ +- [`ConstructorParameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA) + + ```ts + class ArticleModel { + title: string; + content?: string; + + constructor(title: string) { + this.title = title; + } + } + + class InstanceCache any)> { + private ClassConstructor: T; + private cache: Map> = new Map(); + + constructor (ctr: T) { + this.ClassConstructor = ctr; + } + + getInstance (...args: ConstructorParameters): InstanceType { + const hash = this.calculateArgumentsHash(...args); + + const existingInstance = this.cache.get(hash); + if (existingInstance !== undefined) { + return existingInstance; + } + + return new this.ClassConstructor(...args); + } + + private calculateArgumentsHash(...args: any[]): string { + // Calculate hash. + return 'hash'; + } + } + + const articleCache = new InstanceCache(ArticleModel); + const amazonArticle = articleCache.getInstance('Amazon forests burining!'); + ``` +
+ +- [`ReturnType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA) + + ```ts + /** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */ + function mapIter< + Elem, + Func extends (elem: Elem) => any, + Ret extends ReturnType + >(iter: Iterable, callback: Func): Ret[] { + const mapped: Ret[] = []; + + for (const elem of iter) { + mapped.push(callback(elem)); + } + + return mapped; + } + + const setObject: Set = new Set(); + const mapObject: Map = new Map(); + + mapIter(setObject, (value: string) => value.indexOf('Foo')); // number[] + + mapIter(mapObject, ([key, value]: [number, string]) => { + return key % 2 === 0 ? value : 'Odd'; + }); // string[] + ``` +
+ +- [`InstanceType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA) + + ```ts + class IdleService { + doNothing (): void {} + } + + class News { + title: string; + content: string; + + constructor(title: string, content: string) { + this.title = title; + this.content = content; + } + } + + const instanceCounter: Map = new Map(); + + interface Constructor { + new(...args: any[]): any; + } + + // Keep track how many instances of `Constr` constructor have been created. + function getInstance< + Constr extends Constructor, + Args extends ConstructorParameters + >(constructor: Constr, ...args: Args): InstanceType { + let count = instanceCounter.get(constructor) || 0; + + const instance = new constructor(...args); + + instanceCounter.set(constructor, count + 1); + + console.log(`Created ${count + 1} instances of ${Constr.name} class`); + + return instance; + } + + + const idleService = getInstance(IdleService); + // Will log: `Created 1 instances of IdleService class` + const newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...'); + // Will log: `Created 1 instances of News class` + ``` +
+ +- [`Omit`](https://github.com/microsoft/TypeScript/blob/71af02f7459dc812e85ac31365bfe23daf14b4e4/src/lib/es5.d.ts#L1446) – Constructs a type by picking all properties from T and then removing K. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA) + + ```ts + interface Animal { + imageUrl: string; + species: string; + images: string[]; + paragraphs: string[]; + } + + // Creates new type with all properties of the `Animal` interface + // except 'images' and 'paragraphs' properties. We can use this + // type to render small hover tooltip for a wiki entry list. + type AnimalShortInfo = Omit; + + function renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement { + const container = document.createElement('div'); + // Internal implementation. + return container; + } + ``` +
+ +You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types). + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Jarek Radosz](https://github.com/CvX) +- [Dimitri Benin](https://github.com/BendingBender) + + +## License + +(MIT OR CC0-1.0) + + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/basic.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/basic.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5969ce59c3e73345b503048553777b2a0ab047d2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/basic.d.ts @@ -0,0 +1,67 @@ +/// + +// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out. +/** +Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive). +*/ +export type Primitive = + | null + | undefined + | string + | number + | boolean + | symbol + | bigint; + +// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default +/** +Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). +*/ +export type Class = new(...arguments_: Arguments) => T; + +/** +Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`. +*/ +export type TypedArray = + | Int8Array + | Uint8Array + | Uint8ClampedArray + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array + | BigInt64Array + | BigUint64Array; + +/** +Matches a JSON object. + +This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`. +*/ +export type JsonObject = {[key: string]: JsonValue}; + +/** +Matches a JSON array. +*/ +export interface JsonArray extends Array {} + +/** +Matches any valid JSON value. +*/ +export type JsonValue = string | number | boolean | null | JsonObject | JsonArray; + +declare global { + interface SymbolConstructor { + readonly observable: symbol; + } +} + +/** +Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable). +*/ +export interface ObservableLike { + subscribe(observer: (value: unknown) => void): void; + [Symbol.observable](): ObservableLike; +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/except.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/except.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7dedbaa4a93f9d214d9a105087914556a7992e84 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/except.d.ts @@ -0,0 +1,22 @@ +/** +Create a type from an object type without certain keys. + +This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/30825) if you want to have the stricter version as a built-in in TypeScript. + +@example +``` +import {Except} from 'type-fest'; + +type Foo = { + a: number; + b: string; + c: boolean; +}; + +type FooWithoutA = Except; +//=> {b: string}; +``` +*/ +export type Except = Pick>; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/literal-union.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/literal-union.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..52e8de633e4217e05af385f1ec29ea9b6b7aada3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/literal-union.d.ts @@ -0,0 +1,33 @@ +import {Primitive} from './basic'; + +/** +Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. + +Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals. + +This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore. + +@example +``` +import {LiteralUnion} from 'type-fest'; + +// Before + +type Pet = 'dog' | 'cat' | string; + +const pet: Pet = ''; +// Start typing in your TypeScript-enabled IDE. +// You **will not** get auto-completion for `dog` and `cat` literals. + +// After + +type Pet2 = LiteralUnion<'dog' | 'cat', string>; + +const pet: Pet2 = ''; +// You **will** get auto-completion for `dog` and `cat` literals. +``` + */ +export type LiteralUnion< + LiteralType extends BaseType, + BaseType extends Primitive +> = LiteralType | (BaseType & {_?: never}); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/merge-exclusive.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/merge-exclusive.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..059bd2cbe8d7c430cc735c2162a0b09c4dbbd305 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/merge-exclusive.d.ts @@ -0,0 +1,39 @@ +// Helper type. Not useful on its own. +type Without = {[KeyType in Exclude]?: never}; + +/** +Create a type that has mutually exclusive keys. + +This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604). + +This type works with a helper type, called `Without`. `Without` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`. + +@example +``` +import {MergeExclusive} from 'type-fest'; + +interface ExclusiveVariation1 { + exclusive1: boolean; +} + +interface ExclusiveVariation2 { + exclusive2: string; +} + +type ExclusiveOptions = MergeExclusive; + +let exclusiveOptions: ExclusiveOptions; + +exclusiveOptions = {exclusive1: true}; +//=> Works +exclusiveOptions = {exclusive2: 'hi'}; +//=> Works +exclusiveOptions = {exclusive1: true, exclusive2: 'hi'}; +//=> Error +``` +*/ +export type MergeExclusive = + (FirstType | SecondType) extends object ? + (Without & SecondType) | (Without & FirstType) : + FirstType | SecondType; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/merge.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/merge.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4b3920b7a68385105a0602a1fa5e587f4f5701c2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/merge.d.ts @@ -0,0 +1,22 @@ +import {Except} from './except'; + +/** +Merge two types into a new type. Keys of the second type overrides keys of the first type. + +@example +``` +import {Merge} from 'type-fest'; + +type Foo = { + a: number; + b: string; +}; + +type Bar = { + b: number; +}; + +const ab: Merge = {a: 1, b: 2}; +``` +*/ +export type Merge = Except> & SecondType; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/mutable.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/mutable.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..03d0dda7fa30c9a02b04f70bb7b765d2bda180b5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/mutable.d.ts @@ -0,0 +1,22 @@ +/** +Convert an object with `readonly` keys into a mutable object. Inverse of `Readonly`. + +This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), and [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509). + +@example +``` +import {Mutable} from 'type-fest'; + +type Foo = { + readonly a: number; + readonly b: string; +}; + +const mutableFoo: Mutable = {a: 1, b: '2'}; +mutableFoo.a = 3; +``` +*/ +export type Mutable = { + // For each `Key` in the keys of `ObjectType`, make a mapped type by removing the `readonly` modifier from the key. + -readonly [KeyType in keyof ObjectType]: ObjectType[KeyType]; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/opaque.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/opaque.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5311c1b99b86b603e9ef681b192f1397d8d6c298 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/opaque.d.ts @@ -0,0 +1,40 @@ +/** +Create an opaque type, which hides its internal details from the public, and can only be created by being used explicitly. + +The generic type parameter can be anything. It doesn't have to be an object. + +[Read more about opaque types.](https://codemix.com/opaque-types-in-javascript/) + +There have been several discussions about adding this feature to TypeScript via the `opaque type` operator, similar to how Flow does it. Unfortunately, nothing has (yet) moved forward: + - [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408) + - [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807) + +@example +``` +import {Opaque} from 'type-fest'; + +type AccountNumber = Opaque; +type AccountBalance = Opaque; + +function createAccountNumber(): AccountNumber { + return 2 as AccountNumber; +} + +function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance { + return 4 as AccountBalance; +} + +// This will compile successfully. +getMoneyForAccount(createAccountNumber()); + +// But this won't, because it has to be explicitly passed as an `AccountNumber` type. +getMoneyForAccount(2); + +// You can use opaque values like they aren't opaque too. +const accountNumber = createAccountNumber(); + +// This will compile successfully. +accountNumber + 2; +``` +*/ +export type Opaque = Type & {readonly __opaque__: unique symbol}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/package-json.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/package-json.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3179e5887a212c294bacc14b8db72edfc782d6f7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/package-json.d.ts @@ -0,0 +1,501 @@ +import {LiteralUnion} from '..'; + +declare namespace PackageJson { + /** + A person who has been involved in creating or maintaining the package. + */ + export type Person = + | string + | { + name: string; + url?: string; + email?: string; + }; + + export type BugsLocation = + | string + | { + /** + The URL to the package's issue tracker. + */ + url?: string; + + /** + The email address to which issues should be reported. + */ + email?: string; + }; + + export interface DirectoryLocations { + /** + Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder. + */ + bin?: string; + + /** + Location for Markdown files. + */ + doc?: string; + + /** + Location for example scripts. + */ + example?: string; + + /** + Location for the bulk of the library. + */ + lib?: string; + + /** + Location for man pages. Sugar to generate a `man` array by walking the folder. + */ + man?: string; + + /** + Location for test files. + */ + test?: string; + + [directoryType: string]: unknown; + } + + export type Scripts = { + /** + Run **before** the package is published (Also run on local `npm install` without any arguments). + */ + prepublish?: string; + + /** + Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`. + */ + prepare?: string; + + /** + Run **before** the package is prepared and packed, **only** on `npm publish`. + */ + prepublishOnly?: string; + + /** + Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies). + */ + prepack?: string; + + /** + Run **after** the tarball has been generated and moved to its final destination. + */ + postpack?: string; + + /** + Run **after** the package is published. + */ + publish?: string; + + /** + Run **after** the package is published. + */ + postpublish?: string; + + /** + Run **before** the package is installed. + */ + preinstall?: string; + + /** + Run **after** the package is installed. + */ + install?: string; + + /** + Run **after** the package is installed and after `install`. + */ + postinstall?: string; + + /** + Run **before** the package is uninstalled and before `uninstall`. + */ + preuninstall?: string; + + /** + Run **before** the package is uninstalled. + */ + uninstall?: string; + + /** + Run **after** the package is uninstalled. + */ + postuninstall?: string; + + /** + Run **before** bump the package version and before `version`. + */ + preversion?: string; + + /** + Run **before** bump the package version. + */ + version?: string; + + /** + Run **after** bump the package version. + */ + postversion?: string; + + /** + Run with the `npm test` command, before `test`. + */ + pretest?: string; + + /** + Run with the `npm test` command. + */ + test?: string; + + /** + Run with the `npm test` command, after `test`. + */ + posttest?: string; + + /** + Run with the `npm stop` command, before `stop`. + */ + prestop?: string; + + /** + Run with the `npm stop` command. + */ + stop?: string; + + /** + Run with the `npm stop` command, after `stop`. + */ + poststop?: string; + + /** + Run with the `npm start` command, before `start`. + */ + prestart?: string; + + /** + Run with the `npm start` command. + */ + start?: string; + + /** + Run with the `npm start` command, after `start`. + */ + poststart?: string; + + /** + Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided. + */ + prerestart?: string; + + /** + Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided. + */ + restart?: string; + + /** + Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided. + */ + postrestart?: string; + } & { + [scriptName: string]: string; + }; + + /** + Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL. + */ + export interface Dependency { + [packageName: string]: string; + } + + export interface NonStandardEntryPoints { + /** + An ECMAScript module ID that is the primary entry point to the program. + */ + module?: string; + + /** + A module ID with untranspiled code that is the primary entry point to the program. + */ + esnext?: + | string + | { + main?: string; + browser?: string; + [moduleName: string]: string | undefined; + }; + + /** + A hint to JavaScript bundlers or component tools when packaging modules for client side use. + */ + browser?: + | string + | { + [moduleName: string]: string | false; + }; + } + + export interface TypeScriptConfiguration { + /** + Location of the bundled TypeScript declaration file. + */ + types?: string; + + /** + Location of the bundled TypeScript declaration file. Alias of `types`. + */ + typings?: string; + } + + export interface YarnConfiguration { + /** + If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command line, set this to `true`. + + Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an application), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line. + */ + flat?: boolean; + + /** + Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file. + */ + resolutions?: Dependency; + } + + export interface JSPMConfiguration { + /** + JSPM configuration. + */ + jspm?: PackageJson; + } +} + +/** +Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn. +*/ +export type PackageJson = { + /** + The name of the package. + */ + name?: string; + + /** + Package version, parseable by [`node-semver`](https://github.com/npm/node-semver). + */ + version?: string; + + /** + Package description, listed in `npm search`. + */ + description?: string; + + /** + Keywords associated with package, listed in `npm search`. + */ + keywords?: string[]; + + /** + The URL to the package's homepage. + */ + homepage?: LiteralUnion<'.', string>; + + /** + The URL to the package's issue tracker and/or the email address to which issues should be reported. + */ + bugs?: PackageJson.BugsLocation; + + /** + The license for the package. + */ + license?: string; + + /** + The licenses for the package. + */ + licenses?: Array<{ + type?: string; + url?: string; + }>; + + author?: PackageJson.Person; + + /** + A list of people who contributed to the package. + */ + contributors?: PackageJson.Person[]; + + /** + A list of people who maintain the package. + */ + maintainers?: PackageJson.Person[]; + + /** + The files included in the package. + */ + files?: string[]; + + /** + The module ID that is the primary entry point to the program. + */ + main?: string; + + /** + The executable files that should be installed into the `PATH`. + */ + bin?: + | string + | { + [binary: string]: string; + }; + + /** + Filenames to put in place for the `man` program to find. + */ + man?: string | string[]; + + /** + Indicates the structure of the package. + */ + directories?: PackageJson.DirectoryLocations; + + /** + Location for the code repository. + */ + repository?: + | string + | { + type: string; + url: string; + }; + + /** + Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point. + */ + scripts?: PackageJson.Scripts; + + /** + Is used to set configuration parameters used in package scripts that persist across upgrades. + */ + config?: { + [configKey: string]: unknown; + }; + + /** + The dependencies of the package. + */ + dependencies?: PackageJson.Dependency; + + /** + Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling. + */ + devDependencies?: PackageJson.Dependency; + + /** + Dependencies that are skipped if they fail to install. + */ + optionalDependencies?: PackageJson.Dependency; + + /** + Dependencies that will usually be required by the package user directly or via another dependency. + */ + peerDependencies?: PackageJson.Dependency; + + /** + Package names that are bundled when the package is published. + */ + bundledDependencies?: string[]; + + /** + Alias of `bundledDependencies`. + */ + bundleDependencies?: string[]; + + /** + Engines that this package runs on. + */ + engines?: { + [EngineName in 'npm' | 'node' | string]: string; + }; + + /** + @deprecated + */ + engineStrict?: boolean; + + /** + Operating systems the module runs on. + */ + os?: Array>; + + /** + CPU architectures the module runs on. + */ + cpu?: Array>; + + /** + If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally. + + @deprecated + */ + preferGlobal?: boolean; + + /** + If set to `true`, then npm will refuse to publish it. + */ + private?: boolean; + + /** + * A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default. + */ + publishConfig?: { + [config: string]: unknown; + }; +} & +PackageJson.NonStandardEntryPoints & +PackageJson.TypeScriptConfiguration & +PackageJson.YarnConfiguration & +PackageJson.JSPMConfiguration & { + [key: string]: unknown; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/partial-deep.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/partial-deep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b962b84eb6b4cdada8190d3e10704e98de051cee --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/partial-deep.d.ts @@ -0,0 +1,72 @@ +import {Primitive} from './basic'; + +/** +Create a type from another type with all keys and nested keys set to optional. + +Use-cases: +- Merging a default settings/config object with another object, the second object would be a deep partial of the default object. +- Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test. + +@example +``` +import {PartialDeep} from 'type-fest'; + +const settings: Settings = { + textEditor: { + fontSize: 14; + fontColor: '#000000'; + fontWeight: 400; + } + autocomplete: false; + autosave: true; +}; + +const applySavedSettings = (savedSettings: PartialDeep) => { + return {...settings, ...savedSettings}; +} + +settings = applySavedSettings({textEditor: {fontWeight: 500}}); +``` +*/ +export type PartialDeep = T extends Primitive + ? Partial + : T extends Map + ? PartialMapDeep + : T extends Set + ? PartialSetDeep + : T extends ReadonlyMap + ? PartialReadonlyMapDeep + : T extends ReadonlySet + ? PartialReadonlySetDeep + : T extends ((...arguments: any[]) => unknown) + ? T | undefined + : T extends object + ? PartialObjectDeep + : unknown; + +/** +Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`. +*/ +interface PartialMapDeep extends Map, PartialDeep> {} + +/** +Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`. +*/ +interface PartialSetDeep extends Set> {} + +/** +Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`. +*/ +interface PartialReadonlyMapDeep extends ReadonlyMap, PartialDeep> {} + +/** +Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`. +*/ +interface PartialReadonlySetDeep extends ReadonlySet> {} + +/** +Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`. +*/ +type PartialObjectDeep = { + [KeyType in keyof ObjectType]?: PartialDeep +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/promisable.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/promisable.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..71242a5db269279c75c25beda59182fe48c45b2d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/promisable.d.ts @@ -0,0 +1,23 @@ +/** +Create a type that represents either the value or the value wrapped in `PromiseLike`. + +Use-cases: +- A function accepts a callback that may either return a value synchronously or may return a promised value. +- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript. + +@example +``` +import {Promisable} from 'type-fest'; + +async function logger(getLogEntry: () => Promisable): Promise { + const entry = await getLogEntry(); + console.log(entry); +} + +logger(() => 'foo'); +logger(() => Promise.resolve('bar')); +``` +*/ +export type Promisable = T | PromiseLike; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/readonly-deep.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/readonly-deep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b8c04de25c2837e5314d63634e5e60c50c7b1b0b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/readonly-deep.d.ts @@ -0,0 +1,59 @@ +import {Primitive} from './basic'; + +/** +Convert `object`s, `Map`s, `Set`s, and `Array`s and all of their keys/elements into immutable structures recursively. + +This is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript. + +@example +``` +// data.json +{ + "foo": ["bar"] +} + +// main.ts +import {ReadonlyDeep} from 'type-fest'; +import dataJson = require('./data.json'); + +const data: ReadonlyDeep = dataJson; + +export default data; + +// test.ts +import data from './main'; + +data.foo.push('bar'); +//=> error TS2339: Property 'push' does not exist on type 'readonly string[]' +``` +*/ +export type ReadonlyDeep = T extends Primitive | ((...arguments: any[]) => unknown) + ? T + : T extends ReadonlyMap + ? ReadonlyMapDeep + : T extends ReadonlySet + ? ReadonlySetDeep + : T extends object + ? ReadonlyObjectDeep + : unknown; + +/** +Same as `ReadonlyDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `ReadonlyDeep`. +*/ +interface ReadonlyMapDeep + extends ReadonlyMap, ReadonlyDeep> {} + +/** +Same as `ReadonlyDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `ReadonlyDeep`. +*/ +interface ReadonlySetDeep + extends ReadonlySet> {} + +/** +Same as `ReadonlyDeep`, but accepts only `object`s as inputs. Internal helper for `ReadonlyDeep`. +*/ +type ReadonlyObjectDeep = { + readonly [KeyType in keyof ObjectType]: ReadonlyDeep +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/require-at-least-one.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/require-at-least-one.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..337379f968d6e963a657a103f558fc615c516e32 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/require-at-least-one.d.ts @@ -0,0 +1,32 @@ +import {Except} from './except'; + +/** +Create a type that requires at least one of the given keys. The remaining keys are kept as is. + +@example +``` +import {RequireAtLeastOne} from 'type-fest'; + +type Responder = { + text?: () => string; + json?: () => string; + + secure?: boolean; +}; + +const responder: RequireAtLeastOne = { + json: () => '{"message": "ok"}', + secure: true +}; +``` +*/ +export type RequireAtLeastOne = + { + // For each Key in KeysType make a mapped type + [Key in KeysType]: ( + // …by picking that Key's type and making it required + Required> + ) + }[KeysType] + // …then, make intersection types by adding the remaining keys to each mapped type. + & Except; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/require-exactly-one.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/require-exactly-one.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d8c71b74b67a56a9a878b68554ccf811345ee717 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/require-exactly-one.d.ts @@ -0,0 +1,36 @@ +// TODO: Remove this when we target TypeScript >=3.5. +// eslint-disable-next-line @typescript-eslint/generic-type-naming +type _Omit = Pick>; + +/** +Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is. + +Use-cases: +- Creating interfaces for components that only need one of the keys to display properly. +- Declaring generic keys in a single place for a single use-case that gets narrowed down via `RequireExactlyOne`. + +The caveat with `RequireExactlyOne` is that TypeScript doesn't always know at compile time every key that will exist at runtime. Therefore `RequireExactlyOne` can't do anything to prevent extra keys it doesn't know about. + +@example +``` +import {RequireExactlyOne} from 'type-fest'; + +type Responder = { + text: () => string; + json: () => string; + secure: boolean; +}; + +const responder: RequireExactlyOne = { + // Adding a `text` key here would cause a compile error. + + json: () => '{"message": "ok"}', + secure: true +}; +``` +*/ +export type RequireExactlyOne = + {[Key in KeysType]: ( + Required> & + Partial, never>> + )}[KeysType] & _Omit; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/set-optional.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/set-optional.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9a256aac6254091ff43ac5a8607fa4bf2793ffa --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/set-optional.d.ts @@ -0,0 +1,32 @@ +/** +Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type. + +Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional. + +@example +``` +import {SetOptional} from 'type-fest'; + +type Foo = { + a: number; + b?: string; + c: boolean; +} + +type SomeOptional = SetOptional; +// type SomeOptional = { +// a: number; +// b?: string; // Was already optional and still is. +// c?: boolean; // Is now optional. +// } +``` +*/ +export type SetOptional = + // Pick just the keys that are not optional from the base type. + Pick> & + // Pick the keys that should be optional from the base type and make them optional. + Partial> extends + // If `InferredType` extends the previous, then for each key, use the inferred type key. + infer InferredType + ? {[KeyType in keyof InferredType]: InferredType[KeyType]} + : never; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/set-required.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/set-required.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2572bc12ceaa46d1c4f501acad66630f110b4388 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/node_modules/type-fest/source/set-required.d.ts @@ -0,0 +1,32 @@ +/** +Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type. + +Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required. + +@example +``` +import {SetRequired} from 'type-fest'; + +type Foo = { + a?: number; + b: string; + c?: boolean; +} + +type SomeRequired = SetRequired; +// type SomeRequired = { +// a?: number; +// b: string; // Was already required and still is. +// c: boolean; // Is now required. +// } +``` +*/ +export type SetRequired = + // Pick just the keys that are not required from the base type. + Pick> & + // Pick the keys that should be required from the base type and make them required. + Required> extends + // If `InferredType` extends the previous, then for each key, use the inferred type key. + infer InferredType + ? {[KeyType in keyof InferredType]: InferredType[KeyType]} + : never; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/call-or-new-expression.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/call-or-new-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..c8b7b45329b52c3deca9b9b958c24367632b7711 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/call-or-new-expression.js @@ -0,0 +1,127 @@ +'use strict'; + +/** +@typedef { + { + name?: string, + names?: string[], + argumentsLength?: number, + minimumArguments?: number, + maximumArguments?: number, + allowSpreadElement?: boolean, + optional?: boolean, + } | string | string[] +} CallOrNewExpressionCheckOptions +*/ +function create(node, options, types) { + if (!types.includes(node?.type)) { + return false; + } + + if (typeof options === 'string') { + options = {names: [options]}; + } + + if (Array.isArray(options)) { + options = {names: options}; + } + + let { + name, + names, + argumentsLength, + minimumArguments, + maximumArguments, + allowSpreadElement, + optional, + } = { + minimumArguments: 0, + maximumArguments: Number.POSITIVE_INFINITY, + allowSpreadElement: false, + ...options, + }; + + if (name) { + names = [name]; + } + + if ( + (optional === true && (node.optional !== optional)) + || ( + optional === false + // `node.optional` can be `undefined` in some parsers + && node.optional + ) + ) { + return false; + } + + if (typeof argumentsLength === 'number' && node.arguments.length !== argumentsLength) { + return false; + } + + if (minimumArguments !== 0 && node.arguments.length < minimumArguments) { + return false; + } + + if (Number.isFinite(maximumArguments) && node.arguments.length > maximumArguments) { + return false; + } + + if (!allowSpreadElement) { + const maximumArgumentsLength = Number.isFinite(maximumArguments) ? maximumArguments : argumentsLength; + if ( + typeof maximumArgumentsLength === 'number' + && node.arguments.some( + (node, index) => + node.type === 'SpreadElement' + && index < maximumArgumentsLength, + ) + ) { + return false; + } + } + + if ( + Array.isArray(names) + && names.length > 0 + && ( + node.callee.type !== 'Identifier' + || !names.includes(node.callee.name) + ) + ) { + return false; + } + + return true; +} + +/** +@param {CallOrNewExpressionCheckOptions} [options] +@returns {boolean} +*/ +const isCallExpression = (node, options) => create(node, options, ['CallExpression']); + +/** +@param {CallOrNewExpressionCheckOptions} [options] +@returns {boolean} +*/ +const isNewExpression = (node, options) => { + if (typeof options?.optional === 'boolean') { + throw new TypeError('Cannot check node.optional in `isNewExpression`.'); + } + + return create(node, options, ['NewExpression']); +}; + +/** +@param {CallOrNewExpressionCheckOptions} [options] +@returns {boolean} +*/ +const isCallOrNewExpression = (node, options) => create(node, options, ['CallExpression', 'NewExpression']); + +module.exports = { + isCallExpression, + isNewExpression, + isCallOrNewExpression, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/function-types.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/function-types.js new file mode 100644 index 0000000000000000000000000000000000000000..00ce4d69594ad33a2c69cf5d2bb99a73b88153b1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/function-types.js @@ -0,0 +1,5 @@ +'use strict'; + +const functionTypes = ['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression']; + +module.exports = functionTypes; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/index.js new file mode 100644 index 0000000000000000000000000000000000000000..523910ebe8fcbdebe7a2fac9919d55effea78298 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/index.js @@ -0,0 +1,42 @@ +'use strict'; + +const { + isLiteral, + isStringLiteral, + isNumberLiteral, + isBigIntLiteral, + isNullLiteral, + isRegexLiteral, +} = require('./literal.js'); +const { + isNewExpression, + isCallExpression, + isCallOrNewExpression, +} = require('./call-or-new-expression.js'); + +module.exports = { + isLiteral, + isStringLiteral, + isNumberLiteral, + isBigIntLiteral, + isNullLiteral, + isRegexLiteral, + + isArrowFunctionBody: require('./is-arrow-function-body.js'), + isCallExpression, + isCallOrNewExpression, + isDirective: require('./is-directive.js'), + isEmptyNode: require('./is-empty-node.js'), + isExpressionStatement: require('./is-expression-statement.js'), + isFunction: require('./is-function.js'), + isMemberExpression: require('./is-member-expression.js'), + isMethodCall: require('./is-method-call.js'), + isNegativeOne: require('./is-negative-one.js'), + isNewExpression, + isReferenceIdentifier: require('./is-reference-identifier.js'), + isStaticRequire: require('./is-static-require.js'), + isTaggedTemplateLiteral: require('./is-tagged-template-literal.js'), + isUndefined: require('./is-undefined.js'), + + functionTypes: require('./function-types.js'), +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-arrow-function-body.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-arrow-function-body.js new file mode 100644 index 0000000000000000000000000000000000000000..966de0d59e196f97e2e394ef11d5a7ead9a0fa39 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-arrow-function-body.js @@ -0,0 +1,7 @@ +'use strict'; + +function isArrowFunctionBody(node) { + return node.parent.type === 'ArrowFunctionExpression' && node.parent.body === node; +} + +module.exports = isArrowFunctionBody; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-directive.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-directive.js new file mode 100644 index 0000000000000000000000000000000000000000..3de65a0eba5e14225c80313b2b90f3884267ef17 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-directive.js @@ -0,0 +1,7 @@ +'use strict'; + +const isDirective = node => + node.type === 'ExpressionStatement' + && typeof node.directive === 'string'; + +module.exports = isDirective; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-empty-node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-empty-node.js new file mode 100644 index 0000000000000000000000000000000000000000..01e5a442419e3fbd4feabceec046e2ca4f4a1af7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-empty-node.js @@ -0,0 +1,20 @@ +'use strict'; +function isEmptyNode(node, additionalEmpty) { + const {type} = node; + + if (type === 'BlockStatement') { + return node.body.every(currentNode => isEmptyNode(currentNode, additionalEmpty)); + } + + if (type === 'EmptyStatement') { + return true; + } + + if (additionalEmpty?.(node)) { + return true; + } + + return false; +} + +module.exports = isEmptyNode; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-expression-statement.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..ab9b7dc851faef49da5a8d5b2491275a8415a723 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-expression-statement.js @@ -0,0 +1,11 @@ +'use strict'; + +function isExpressionStatement(node) { + return node.type === 'ExpressionStatement' + || ( + node.type === 'ChainExpression' + && node.parent.type === 'ExpressionStatement' + ); +} + +module.exports = isExpressionStatement; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-function.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-function.js new file mode 100644 index 0000000000000000000000000000000000000000..80897823ae37641b66e648db16ce6c0a34824bc5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-function.js @@ -0,0 +1,8 @@ +'use strict'; +const functionTypes = require('./function-types.js'); + +function isFunction(node) { + return functionTypes.includes(node.type); +} + +module.exports = isFunction; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-member-expression.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-member-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..d56beff68731fd971cdf4b332493cfbf75cdd015 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-member-expression.js @@ -0,0 +1,101 @@ +'use strict'; + +/** +@param { + { + property?: string, + properties?: string[], + object?: string, + objects?: string[], + optional?: boolean, + computed?: boolean + } | string | string[] +} [options] +@returns {string} +*/ +function isMemberExpression(node, options) { + if (node?.type !== 'MemberExpression') { + return false; + } + + if (typeof options === 'string') { + options = {properties: [options]}; + } + + if (Array.isArray(options)) { + options = {properties: options}; + } + + let { + property, + properties, + object, + objects, + optional, + computed, + } = { + property: '', + properties: [], + object: '', + ...options, + }; + + if (property) { + properties = [property]; + } + + if (object) { + objects = [object]; + } + + if ( + (optional === true && (node.optional !== optional)) + || ( + optional === false + // `node.optional` can be `undefined` in some parsers + && node.optional + ) + ) { + return false; + } + + if ( + Array.isArray(properties) + && properties.length > 0 + ) { + if ( + node.property.type !== 'Identifier' + || !properties.includes(node.property.name) + ) { + return false; + } + + computed ??= false; + } + + if ( + (computed === true && (node.computed !== computed)) + || ( + computed === false + // `node.computed` can be `undefined` in some parsers + && node.computed + ) + ) { + return false; + } + + if ( + Array.isArray(objects) + && objects.length > 0 + && ( + node.object.type !== 'Identifier' + || !objects.includes(node.object.name) + ) + ) { + return false; + } + + return true; +} + +module.exports = isMemberExpression; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-method-call.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-method-call.js new file mode 100644 index 0000000000000000000000000000000000000000..4868f1613679663044cd531311f7b701790a3ccf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-method-call.js @@ -0,0 +1,65 @@ +'use strict'; +const isMemberExpression = require('./is-member-expression.js'); +const {isCallExpression} = require('./call-or-new-expression.js'); + +/** +@param { + { + // `isCallExpression` options + argumentsLength?: number, + minimumArguments?: number, + maximumArguments?: number, + optionalCall?: boolean, + allowSpreadElement?: boolean, + + // `isMemberExpression` options + method?: string, + methods?: string[], + object?: string, + objects?: string[], + optionalMember?: boolean, + computed?: boolean + } | string | string[] +} [options] +@returns {string} +*/ +function isMethodCall(node, options) { + if (typeof options === 'string') { + options = {methods: [options]}; + } + + if (Array.isArray(options)) { + options = {methods: options}; + } + + const { + optionalCall, + optionalMember, + method, + methods, + } = { + method: '', + methods: [], + ...options, + }; + + return ( + isCallExpression(node, { + argumentsLength: options.argumentsLength, + minimumArguments: options.minimumArguments, + maximumArguments: options.maximumArguments, + allowSpreadElement: options.allowSpreadElement, + optional: optionalCall, + }) + && isMemberExpression(node.callee, { + object: options.object, + objects: options.objects, + computed: options.computed, + property: method, + properties: methods, + optional: optionalMember, + }) + ); +} + +module.exports = isMethodCall; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-negative-one.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-negative-one.js new file mode 100644 index 0000000000000000000000000000000000000000..8d598286a44caf245e7e3df00405e2e9301f53f6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-negative-one.js @@ -0,0 +1,12 @@ +'use strict'; + +const {isNumberLiteral} = require('./literal.js'); + +function isNegativeOne(node) { + return node?.type === 'UnaryExpression' + && node.operator === '-' + && isNumberLiteral(node.argument) + && node.argument.value === 1; +} + +module.exports = isNegativeOne; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-reference-identifier.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-reference-identifier.js new file mode 100644 index 0000000000000000000000000000000000000000..0794a3acd763b26e2bb42a17be1380609edd9de7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-reference-identifier.js @@ -0,0 +1,163 @@ +'use strict'; + +// eslint-disable-next-line complexity +function isNotReference(node) { + const {parent} = node; + + switch (parent.type) { + // `foo.Identifier` + case 'MemberExpression': { + return !parent.computed && parent.property === node; + } + + case 'FunctionDeclaration': + case 'FunctionExpression': { + return ( + // `function foo(Identifier) {}` + // `const foo = function(Identifier) {}` + parent.params.includes(node) + // `function Identifier() {}` + // `const foo = function Identifier() {}` + || parent.id === node + ); + } + + case 'ArrowFunctionExpression': { + // `const foo = (Identifier) => {}` + return parent.params.includes(node); + } + + // `class Identifier() {}` + // `const foo = class Identifier() {}` + // `const Identifier = 1` + case 'ClassDeclaration': + case 'ClassExpression': + case 'VariableDeclarator': { + return parent.id === node; + } + + // `class Foo {Identifier = 1}` + // `class Foo {Identifier() {}}` + case 'PropertyDefinition': + case 'MethodDefinition': { + return !parent.computed && parent.key === node; + } + + // `const foo = {Identifier: 1}` + // `const {Identifier} = {}` + // `const {Identifier: foo} = {}` + // `const {Identifier} = {}` + // `const {foo: Identifier} = {}` + case 'Property': { + return ( + ( + !parent.computed + && parent.key === node + && ( + (parent.parent.type === 'ObjectExpression' || parent.parent.type === 'ObjectPattern') + && parent.parent.properties.includes(parent) + ) + ) + || ( + parent.value === node + && parent.parent.type === 'ObjectPattern' + && parent.parent.properties.includes(parent) + ) + ); + } + + // `const [Identifier] = []` + case 'ArrayPattern': { + return parent.elements.includes(node); + } + + /* + ``` + Identifier: for (const foo of bar) { + continue Identifier; + break Identifier; + } + ``` + */ + case 'LabeledStatement': + case 'ContinueStatement': + case 'BreakStatement': { + return parent.label === node; + } + + // `import * as Identifier from 'foo'` + // `import Identifier from 'foo'` + case 'ImportDefaultSpecifier': + case 'ImportNamespaceSpecifier': { + return parent.local === node; + } + + // `export * as Identifier from 'foo'` + case 'ExportAllDeclaration': { + return parent.exported === node; + } + + // `import {foo as Identifier} from 'foo'` + // `import {Identifier as foo} from 'foo'` + case 'ImportSpecifier': { + return (parent.local === node || parent.imported === node); + } + + // `export {foo as Identifier}` + // `export {Identifier as foo}` + case 'ExportSpecifier': { + return (parent.local === node || parent.exported === node); + } + + // TypeScript + case 'TSDeclareFunction': + case 'TSEnumMember': { + return parent.id === node; + } + + // `type Foo = { [Identifier: string]: string }` + case 'TSIndexSignature': { + return parent.parameters.includes(node); + } + + // `@typescript-eslint/parse` v7 + // `type Foo = { [Identifier in keyof string]: number; };` + case 'TSTypeParameter': { + return parent.name === node; + } + + // `@typescript-eslint/parse` v8 + // `type Foo = { [Identifier in keyof string]: number; };` + case 'TSMappedType': { + return parent.key === node; + } + + // `type Identifier = Foo` + case 'TSTypeAliasDeclaration': { + return parent.id === node; + } + + case 'TSPropertySignature': { + return parent.key === node; + } + + // No default + } + + return false; +} + +function isReferenceIdentifier(node, nameOrNames = []) { + if (node.type !== 'Identifier') { + return false; + } + + const names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames]; + if (names.length > 0 && !names.includes(node.name)) { + return false; + } + + return !isNotReference(node); +} + +module.exports = isReferenceIdentifier; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-static-require.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-static-require.js new file mode 100644 index 0000000000000000000000000000000000000000..ca33785efc821083b706371c8a56b2309d2bf501 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-static-require.js @@ -0,0 +1,14 @@ +'use strict'; + +const {isStringLiteral} = require('./literal.js'); +const {isCallExpression} = require('./call-or-new-expression.js'); + +const isStaticRequire = node => + isCallExpression(node, { + name: 'require', + argumentsLength: 1, + optional: false, + }) + && isStringLiteral(node.arguments[0]); + +module.exports = isStaticRequire; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-tagged-template-literal.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-tagged-template-literal.js new file mode 100644 index 0000000000000000000000000000000000000000..a21fd819bba2b82785529f9c33ef06f4a3c314ee --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-tagged-template-literal.js @@ -0,0 +1,28 @@ +'use strict'; + +const {isNodeMatches} = require('../utils/is-node-matches.js'); + +/** +Check if the given node is a tagged template literal. + +@param {Node} node - The AST node to check. +@param {string[]} tags - The object name or key paths. +@returns {boolean} +*/ +function isTaggedTemplateLiteral(node, tags) { + if ( + node.type !== 'TemplateLiteral' + || node.parent.type !== 'TaggedTemplateExpression' + || node.parent.quasi !== node + ) { + return false; + } + + if (tags) { + return isNodeMatches(node.parent.tag, tags); + } + + return true; +} + +module.exports = isTaggedTemplateLiteral; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-undefined.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..11d0ef71ca5f0ae66a7ae9f7c00aa01775968fa7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/is-undefined.js @@ -0,0 +1,7 @@ +'use strict'; + +function isUndefined(node) { + return node.type === 'Identifier' && node.name === 'undefined'; +} + +module.exports = isUndefined; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/literal.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/literal.js new file mode 100644 index 0000000000000000000000000000000000000000..893e956219255ecdbc8c7f8c3615de9260d8b647 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/ast/literal.js @@ -0,0 +1,29 @@ +'use strict'; + +function isLiteral(node, value) { + if (node?.type !== 'Literal') { + return false; + } + + if (value === null) { + return node.raw === 'null'; + } + + return node.value === value; +} + +const isStringLiteral = node => node?.type === 'Literal' && typeof node.value === 'string'; +const isNumberLiteral = node => node.type === 'Literal' && typeof node.value === 'number'; +const isRegexLiteral = node => node.type === 'Literal' && Boolean(node.regex); +// eslint-disable-next-line unicorn/no-null +const isNullLiteral = node => isLiteral(node, null); +const isBigIntLiteral = node => node.type === 'Literal' && Boolean(node.bigint); + +module.exports = { + isLiteral, + isStringLiteral, + isNumberLiteral, + isBigIntLiteral, + isNullLiteral, + isRegexLiteral, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/better-regex.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/better-regex.js new file mode 100644 index 0000000000000000000000000000000000000000..6eb83a8902e38b3c0e5cb2154956e07a269f1fc7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/better-regex.js @@ -0,0 +1,145 @@ +'use strict'; +const cleanRegexp = require('clean-regexp'); +const {optimize} = require('regexp-tree'); +const escapeString = require('./utils/escape-string.js'); +const {isStringLiteral, isNewExpression, isRegexLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'better-regex'; +const MESSAGE_ID_PARSE_ERROR = 'better-regex/parse-error'; +const messages = { + [MESSAGE_ID]: '{{original}} can be optimized to {{optimized}}.', + [MESSAGE_ID_PARSE_ERROR]: 'Problem parsing {{original}}: {{error}}', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sortCharacterClasses} = context.options[0] || {}; + + const ignoreList = []; + + if (sortCharacterClasses === false) { + ignoreList.push('charClassClassrangesMerge'); + } + + return { + Literal(node) { + if (!isRegexLiteral(node)) { + return; + } + + const {raw: original, regex} = node; + // Regular Expressions with `u` and `v` flag are not well handled by `regexp-tree` + // https://github.com/DmitrySoshnikov/regexp-tree/issues/162 + if (regex.flags.includes('u') || regex.flags.includes('v')) { + return; + } + + let optimized = original; + + try { + optimized = optimize(original, undefined, {blacklist: ignoreList}).toString(); + } catch (error) { + return { + node, + messageId: MESSAGE_ID_PARSE_ERROR, + data: { + original, + error: error.message, + }, + }; + } + + if (original === optimized) { + return; + } + + const problem = { + node, + messageId: MESSAGE_ID, + data: { + original, + optimized, + }, + }; + + if ( + node.parent.type === 'MemberExpression' + && node.parent.object === node + && !node.parent.optional + && !node.parent.computed + && node.parent.property.type === 'Identifier' + && ( + node.parent.property.name === 'toString' + || node.parent.property.name === 'source' + ) + ) { + return problem; + } + + return Object.assign(problem, { + fix: fixer => fixer.replaceText(node, optimized), + }); + }, + NewExpression(node) { + if (!isNewExpression(node, {name: 'RegExp', minimumArguments: 1})) { + return; + } + + const [patternNode, flagsNode] = node.arguments; + + if (!isStringLiteral(patternNode)) { + return; + } + + const oldPattern = patternNode.value; + const flags = isStringLiteral(flagsNode) + ? flagsNode.value + : ''; + + const newPattern = cleanRegexp(oldPattern, flags); + + if (oldPattern !== newPattern) { + return { + node, + messageId: MESSAGE_ID, + data: { + original: oldPattern, + optimized: newPattern, + }, + fix: fixer => fixer.replaceText( + patternNode, + escapeString(newPattern, patternNode.raw.charAt(0)), + ), + }; + } + }, + }; +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + sortCharacterClasses: { + type: 'boolean', + default: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Improve regexes by making them shorter, consistent, and safer.', + recommended: false, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/catch-error-name.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/catch-error-name.js new file mode 100644 index 0000000000000000000000000000000000000000..58f2cdf1274c80c2a4c845c7b452bc64017d6896 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/catch-error-name.js @@ -0,0 +1,137 @@ +'use strict'; +const {findVariable} = require('@eslint-community/eslint-utils'); +const avoidCapture = require('./utils/avoid-capture.js'); +const {renameVariable} = require('./fix/index.js'); +const {isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID = 'catch-error-name'; +const messages = { + [MESSAGE_ID]: 'The catch parameter `{{originalName}}` should be named `{{fixedName}}`.', +}; + +// - `promise.then(…, foo => {})` +// - `promise.then(…, function(foo) {})` +// - `promise.catch(foo => {})` +// - `promise.catch(function(foo) {})` +const isPromiseCatchParameter = node => + (node.parent.type === 'FunctionExpression' || node.parent.type === 'ArrowFunctionExpression') + && node.parent.params[0] === node + && ( + isMethodCall(node.parent.parent, { + method: 'then', + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + }) + || isMethodCall(node.parent.parent, { + method: 'catch', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + ) + && node.parent.parent.arguments.at(-1) === node.parent; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const options = { + name: 'error', + ignore: [], + ...context.options[0], + }; + const {name: expectedName} = options; + const ignore = options.ignore.map( + pattern => pattern instanceof RegExp ? pattern : new RegExp(pattern, 'u'), + ); + const isNameAllowed = name => + name === expectedName + || ignore.some(regexp => regexp.test(name)) + || name.endsWith(expectedName) + || name.endsWith(expectedName.charAt(0).toUpperCase() + expectedName.slice(1)); + + return { + Identifier(node) { + if ( + !(node.parent.type === 'CatchClause' && node.parent.param === node) + && !isPromiseCatchParameter(node) + ) { + return; + } + + const originalName = node.name; + + if ( + isNameAllowed(originalName) + || isNameAllowed(originalName.replaceAll(/_+$/g, '')) + ) { + return; + } + + const scope = context.sourceCode.getScope(node); + const variable = findVariable(scope, node); + + // This was reported https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1075#issuecomment-768072967 + // But can't reproduce, just ignore this case + /* c8 ignore next 3 */ + if (!variable) { + return; + } + + if (originalName === '_' && variable.references.length === 0) { + return; + } + + const scopes = [ + variable.scope, + ...variable.references.map(({from}) => from), + ]; + const fixedName = avoidCapture(expectedName, scopes); + + const problem = { + node, + messageId: MESSAGE_ID, + data: { + originalName, + fixedName: fixedName || expectedName, + }, + }; + + if (fixedName) { + problem.fix = fixer => renameVariable(variable, fixedName, fixer); + } + + return problem; + }, + }; +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + name: { + type: 'string', + }, + ignore: { + type: 'array', + uniqueItems: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce a specific parameter name in catch clauses.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-destructuring.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-destructuring.js new file mode 100644 index 0000000000000000000000000000000000000000..dcd35594d20bb77fccd26b831ec9996eb810645c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-destructuring.js @@ -0,0 +1,169 @@ +'use strict'; +const avoidCapture = require('./utils/avoid-capture.js'); +const isLeftHandSide = require('./utils/is-left-hand-side.js'); +const {isCallOrNewExpression} = require('./ast/index.js'); + +const MESSAGE_ID = 'consistentDestructuring'; +const MESSAGE_ID_SUGGEST = 'consistentDestructuringSuggest'; + +const isSimpleExpression = expression => { + while (expression) { + if (expression.computed) { + return false; + } + + if (expression.type !== 'MemberExpression') { + break; + } + + expression = expression.object; + } + + return expression.type === 'Identifier' + || expression.type === 'ThisExpression'; +}; + +const isChildInParentScope = (child, parent) => { + while (child) { + if (child === parent) { + return true; + } + + child = child.upper; + } + + return false; +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + const declarations = new Map(); + + return { + VariableDeclarator(node) { + if (!( + node.id.type === 'ObjectPattern' + && node.init + && node.init.type !== 'Literal' + // Ignore any complex expressions (e.g. arrays, functions) + && isSimpleExpression(node.init) + )) { + return; + } + + declarations.set(sourceCode.getText(node.init), { + scope: sourceCode.getScope(node), + variables: sourceCode.getDeclaredVariables(node), + objectPattern: node.id, + }); + }, + MemberExpression(node) { + if ( + node.computed + || ( + isCallOrNewExpression(node.parent) + && node.parent.callee === node + ) + || isLeftHandSide(node) + ) { + return; + } + + const declaration = declarations.get(sourceCode.getText(node.object)); + + if (!declaration) { + return; + } + + const {scope, objectPattern} = declaration; + const memberScope = sourceCode.getScope(node); + + // Property is destructured outside the current scope + if (!isChildInParentScope(memberScope, scope)) { + return; + } + + const destructurings = objectPattern.properties.filter(property => + property.type === 'Property' + && property.key.type === 'Identifier' + && property.value.type === 'Identifier', + ); + const lastProperty = objectPattern.properties.at(-1); + + const hasRest = lastProperty && lastProperty.type === 'RestElement'; + + const expression = sourceCode.getText(node); + const member = sourceCode.getText(node.property); + + // Member might already be destructured + const destructuredMember = destructurings.find(property => + property.key.name === member, + ); + + if (!destructuredMember) { + // Don't destructure additional members when rest is used + if (hasRest) { + return; + } + + // Destructured member collides with an existing identifier + if (avoidCapture(member, [memberScope]) !== member) { + return; + } + } + + // Don't try to fix nested member expressions + if (node.parent.type === 'MemberExpression') { + return { + node, + messageId: MESSAGE_ID, + }; + } + + const newMember = destructuredMember ? destructuredMember.value.name : member; + + return { + node, + messageId: MESSAGE_ID, + suggest: [{ + messageId: MESSAGE_ID_SUGGEST, + data: { + expression, + property: newMember, + }, + * fix(fixer) { + const {properties} = objectPattern; + const lastProperty = properties.at(-1); + + yield fixer.replaceText(node, newMember); + + if (!destructuredMember) { + yield lastProperty + ? fixer.insertTextAfter(lastProperty, `, ${newMember}`) + : fixer.replaceText(objectPattern, `{${newMember}}`); + } + }, + }], + }; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Use destructured variables over properties.', + recommended: false, + }, + fixable: 'code', + hasSuggestions: true, + messages: { + [MESSAGE_ID]: 'Use destructured variables over properties.', + [MESSAGE_ID_SUGGEST]: 'Replace `{{expression}}` with destructured property `{{property}}`.', + }, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-empty-array-spread.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-empty-array-spread.js new file mode 100644 index 0000000000000000000000000000000000000000..7a8d0328d93af062da8a8e33f352219352d6e41c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-empty-array-spread.js @@ -0,0 +1,126 @@ +'use strict'; +const {getStaticValue} = require('@eslint-community/eslint-utils'); + +const MESSAGE_ID = 'consistent-empty-array-spread'; +const messages = { + [MESSAGE_ID]: 'Prefer using empty {{replacementDescription}} since the {{anotherNodePosition}} is {{anotherNodeDescription}}.', +}; + +const isEmptyArrayExpression = node => + node.type === 'ArrayExpression' + && node.elements.length === 0; + +const isEmptyStringLiteral = node => + node.type === 'Literal' + && node.value === ''; + +const isString = (node, context) => { + const staticValueResult = getStaticValue(node, context.sourceCode.getScope(node)); + return typeof staticValueResult?.value === 'string'; +}; + +const isArray = (node, context) => { + if (node.type === 'ArrayExpression') { + return true; + } + + const staticValueResult = getStaticValue(node, context.sourceCode.getScope(node)); + return Array.isArray(staticValueResult?.value); +}; + +const cases = [ + { + oneSidePredicate: isEmptyStringLiteral, + anotherSidePredicate: isArray, + anotherNodeDescription: 'an array', + replacementDescription: 'array', + replacementCode: '[]', + }, + { + oneSidePredicate: isEmptyArrayExpression, + anotherSidePredicate: isString, + anotherNodeDescription: 'a string', + replacementDescription: 'string', + replacementCode: '\'\'', + }, +]; + +function createProblem({ + problemNode, + anotherNodePosition, + anotherNodeDescription, + replacementDescription, + replacementCode, +}) { + return { + node: problemNode, + messageId: MESSAGE_ID, + data: { + replacementDescription, + anotherNodePosition, + anotherNodeDescription, + }, + fix: fixer => fixer.replaceText(problemNode, replacementCode), + }; +} + +function getProblem(conditionalExpression, context) { + const { + consequent, + alternate, + } = conditionalExpression; + + for (const problemCase of cases) { + const { + oneSidePredicate, + anotherSidePredicate, + } = problemCase; + + if (oneSidePredicate(consequent, context) && anotherSidePredicate(alternate, context)) { + return createProblem({ + ...problemCase, + problemNode: consequent, + anotherNodePosition: 'alternate', + }); + } + + if (oneSidePredicate(alternate, context) && anotherSidePredicate(consequent, context)) { + return createProblem({ + ...problemCase, + problemNode: alternate, + anotherNodePosition: 'consequent', + }); + } + } +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + * ArrayExpression(arrayExpression) { + for (const element of arrayExpression.elements) { + if ( + element?.type !== 'SpreadElement' + || element.argument.type !== 'ConditionalExpression' + ) { + continue; + } + + yield getProblem(element.argument, context); + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer consistent types when spreading a ternary in an array literal.', + recommended: true, + }, + fixable: 'code', + + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-existence-index-check.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-existence-index-check.js new file mode 100644 index 0000000000000000000000000000000000000000..d844245a39c4da0b084d7651707328c2cb28719f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-existence-index-check.js @@ -0,0 +1,133 @@ +'use strict'; +const toLocation = require('./utils/to-location.js'); +const {isMethodCall, isNegativeOne, isNumberLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'consistent-existence-index-check'; +const messages = { + [MESSAGE_ID]: 'Prefer `{{replacementOperator}} {{replacementValue}}` over `{{originalOperator}} {{originalValue}}` to check {{existenceOrNonExistence}}.', +}; + +const isZero = node => isNumberLiteral(node) && node.value === 0; + +/** +@param {parent: import('estree').BinaryExpression} binaryExpression +@returns {{ + replacementOperator: string, + replacementValue: string, + originalOperator: string, + originalValue: string, +} | undefined} +*/ +function getReplacement(binaryExpression) { + const {operator, right} = binaryExpression; + + if (operator === '<' && isZero(right)) { + return { + replacementOperator: '===', + replacementValue: '-1', + originalOperator: operator, + originalValue: '0', + }; + } + + if (operator === '>' && isNegativeOne(right)) { + return { + replacementOperator: '!==', + replacementValue: '-1', + originalOperator: operator, + originalValue: '-1', + }; + } + + if (operator === '>=' && isZero(right)) { + return { + replacementOperator: '!==', + replacementValue: '-1', + originalOperator: operator, + originalValue: '0', + }; + } +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + /** @param {import('estree').VariableDeclarator} variableDeclarator */ + * VariableDeclarator(variableDeclarator) { + if (!( + variableDeclarator.parent.type === 'VariableDeclaration' + && variableDeclarator.parent.kind === 'const' + && variableDeclarator.id.type === 'Identifier' + && isMethodCall(variableDeclarator.init, {methods: ['indexOf', 'lastIndexOf', 'findIndex', 'findLastIndex']}) + )) { + return; + } + + const variableIdentifier = variableDeclarator.id; + const variables = context.sourceCode.getDeclaredVariables(variableDeclarator); + const [variable] = variables; + + // Just for safety + if ( + variables.length !== 1 + || variable.identifiers.length !== 1 + || variable.identifiers[0] !== variableIdentifier + ) { + return; + } + + for (const {identifier} of variable.references) { + /** @type {{parent: import('estree').BinaryExpression}} */ + const binaryExpression = identifier.parent; + + if (binaryExpression.type !== 'BinaryExpression' || binaryExpression.left !== identifier) { + continue; + } + + const replacement = getReplacement(binaryExpression); + + if (!replacement) { + return; + } + + const {left, operator, right} = binaryExpression; + const {sourceCode} = context; + + const operatorToken = sourceCode.getTokenAfter( + left, + token => token.type === 'Punctuator' && token.value === operator, + ); + + yield { + node: binaryExpression, + loc: toLocation([operatorToken.range[0], right.range[1]], sourceCode), + messageId: MESSAGE_ID, + data: { + ...replacement, + existenceOrNonExistence: `${replacement.replacementOperator === '===' ? 'non-' : ''}existence`, + }, + * fix(fixer) { + yield fixer.replaceText(operatorToken, replacement.replacementOperator); + + if (replacement.replacementValue !== replacement.originalValue) { + yield fixer.replaceText(right, replacement.replacementValue); + } + }, + }; + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: + 'Enforce consistent style for element existence checks with `indexOf()`, `lastIndexOf()`, `findIndex()`, and `findLastIndex()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-function-scoping.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-function-scoping.js new file mode 100644 index 0000000000000000000000000000000000000000..b4199125cf1f2bb9ef526eef14fe7f84fbf3ebfd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/consistent-function-scoping.js @@ -0,0 +1,224 @@ +'use strict'; +const {getFunctionHeadLocation, getFunctionNameWithKind} = require('@eslint-community/eslint-utils'); +const { + getReferences, + isNodeMatches, +} = require('./utils/index.js'); +const { + functionTypes, +} = require('./ast/index.js'); + +const MESSAGE_ID = 'consistent-function-scoping'; +const messages = { + [MESSAGE_ID]: 'Move {{functionNameWithKind}} to the outer scope.', +}; + +const isSameScope = (scope1, scope2) => + scope1 && scope2 && (scope1 === scope2 || scope1.block === scope2.block); + +function checkReferences(scope, parent, scopeManager) { + const hitReference = references => references.some(reference => { + if (isSameScope(parent, reference.from)) { + return true; + } + + const {resolved} = reference; + const [definition] = resolved.defs; + + // Skip recursive function name + if (definition?.type === 'FunctionName' && resolved.name === definition.name.name) { + return false; + } + + return isSameScope(parent, resolved.scope); + }); + + const hitDefinitions = definitions => definitions.some(definition => { + const scope = scopeManager.acquire(definition.node); + return isSameScope(parent, scope); + }); + + // This check looks for neighboring function definitions + const hitIdentifier = identifiers => identifiers.some(identifier => { + // Only look at identifiers that live in a FunctionDeclaration + if ( + !identifier.parent + || identifier.parent.type !== 'FunctionDeclaration' + ) { + return false; + } + + const identifierScope = scopeManager.acquire(identifier); + + // If we have a scope, the earlier checks should have worked so ignore them here + /* c8 ignore next 3 */ + if (identifierScope) { + return false; + } + + const identifierParentScope = scopeManager.acquire(identifier.parent); + /* c8 ignore next 3 */ + if (!identifierParentScope) { + return false; + } + + // Ignore identifiers from our own scope + if (isSameScope(scope, identifierParentScope)) { + return false; + } + + // Look at the scope above the function definition to see if lives + // next to the reference being checked + return isSameScope(parent, identifierParentScope.upper); + }); + + return getReferences(scope) + .map(({resolved}) => resolved) + .filter(Boolean) + .some(variable => + hitReference(variable.references) + || hitDefinitions(variable.defs) + || hitIdentifier(variable.identifiers), + ); +} + +// https://reactjs.org/docs/hooks-reference.html +const reactHooks = [ + 'useState', + 'useEffect', + 'useContext', + 'useReducer', + 'useCallback', + 'useMemo', + 'useRef', + 'useImperativeHandle', + 'useLayoutEffect', + 'useDebugValue', +].flatMap(hookName => [hookName, `React.${hookName}`]); + +const isReactHook = scope => + scope.block?.parent?.callee + && isNodeMatches(scope.block.parent.callee, reactHooks); + +const isArrowFunctionWithThis = scope => + scope.type === 'function' + && scope.block?.type === 'ArrowFunctionExpression' + && (scope.thisFound || scope.childScopes.some(scope => isArrowFunctionWithThis(scope))); + +const iifeFunctionTypes = new Set([ + 'FunctionExpression', + 'ArrowFunctionExpression', +]); +const isIife = node => + iifeFunctionTypes.has(node.type) + && node.parent.type === 'CallExpression' + && node.parent.callee === node; + +function checkNode(node, scopeManager) { + const scope = scopeManager.acquire(node); + + if (!scope || isArrowFunctionWithThis(scope)) { + return true; + } + + let parentNode = node.parent; + + // Skip over junk like the block statement inside of a function declaration + // or the various pieces of an arrow function. + + if (parentNode.type === 'VariableDeclarator') { + parentNode = parentNode.parent; + } + + if (parentNode.type === 'VariableDeclaration') { + parentNode = parentNode.parent; + } + + if (parentNode.type === 'BlockStatement') { + parentNode = parentNode.parent; + } + + const parentScope = scopeManager.acquire(parentNode); + if ( + !parentScope + || parentScope.type === 'global' + || isReactHook(parentScope) + || isIife(parentNode) + ) { + return true; + } + + return checkReferences(scope, parentScope, scopeManager); +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {checkArrowFunctions} = {checkArrowFunctions: true, ...context.options[0]}; + const {sourceCode} = context; + const {scopeManager} = sourceCode; + + const functions = []; + + context.on(functionTypes, () => { + functions.push(false); + }); + + context.on('JSXElement', () => { + // Turn off this rule if we see a JSX element because scope + // references does not include JSXElement nodes. + if (functions.length > 0) { + functions[functions.length - 1] = true; + } + }); + + context.onExit(functionTypes, node => { + const currentFunctionHasJsx = functions.pop(); + if (currentFunctionHasJsx) { + return; + } + + if (node.type === 'ArrowFunctionExpression' && !checkArrowFunctions) { + return; + } + + if (checkNode(node, scopeManager)) { + return; + } + + return { + node, + loc: getFunctionHeadLocation(node, sourceCode), + messageId: MESSAGE_ID, + data: { + functionNameWithKind: getFunctionNameWithKind(node, sourceCode), + }, + }; + }); +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + checkArrowFunctions: { + type: 'boolean', + default: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Move function definitions to the highest possible scope.', + recommended: true, + }, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/custom-error-definition.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/custom-error-definition.js new file mode 100644 index 0000000000000000000000000000000000000000..23ce253769592c945c8b806cdf24b1eed47117b4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/custom-error-definition.js @@ -0,0 +1,216 @@ +'use strict'; +const {upperFirst} = require('./utils/lodash.js'); + +const MESSAGE_ID_INVALID_EXPORT = 'invalidExport'; +const messages = { + [MESSAGE_ID_INVALID_EXPORT]: 'Exported error name should match error class', +}; + +const nameRegexp = /^(?:[A-Z][\da-z]*)*Error$/; + +const getClassName = name => upperFirst(name).replace(/(?:error|)$/i, 'Error'); + +const getConstructorMethod = className => ` + constructor() { + super(); + this.name = '${className}'; + } +`; + +const hasValidSuperClass = node => { + if (!node.superClass) { + return false; + } + + let {name, type, property} = node.superClass; + + if (type === 'MemberExpression') { + ({name} = property); + } + + return nameRegexp.test(name); +}; + +const isSuperExpression = node => + node.type === 'ExpressionStatement' + && node.expression.type === 'CallExpression' + && node.expression.callee.type === 'Super'; + +const isAssignmentExpression = (node, name) => { + if ( + node.type !== 'ExpressionStatement' + || node.expression.type !== 'AssignmentExpression' + ) { + return false; + } + + const lhs = node.expression.left; + + if (!lhs.object || lhs.object.type !== 'ThisExpression') { + return false; + } + + return lhs.property.name === name; +}; + +const isPropertyDefinition = (node, name) => + node.type === 'PropertyDefinition' + && !node.computed + && node.key.type === 'Identifier' + && node.key.name === name; + +function * customErrorDefinition(context, node) { + if (!hasValidSuperClass(node)) { + return; + } + + if (node.id === null) { + return; + } + + const {name} = node.id; + const className = getClassName(name); + + if (name !== className) { + yield { + node: node.id, + message: `Invalid class name, use \`${className}\`.`, + }; + } + + const {body, range} = node.body; + const constructor = body.find(x => x.kind === 'constructor'); + + if (!constructor) { + yield { + node, + message: 'Add a constructor to your error.', + fix: fixer => fixer.insertTextAfterRange([ + range[0], + range[0] + 1, + ], getConstructorMethod(name)), + }; + return; + } + + const constructorBodyNode = constructor.value.body; + + // Verify the constructor has a body (TypeScript) + if (!constructorBodyNode) { + return; + } + + const constructorBody = constructorBodyNode.body; + + const superExpression = constructorBody.find(body => isSuperExpression(body)); + const messageExpressionIndex = constructorBody.findIndex(x => isAssignmentExpression(x, 'message')); + + if (!superExpression) { + yield { + node: constructorBodyNode, + message: 'Missing call to `super()` in constructor.', + }; + } else if (messageExpressionIndex !== -1) { + const expression = constructorBody[messageExpressionIndex]; + + yield { + node: superExpression, + message: 'Pass the error message to `super()` instead of setting `this.message`.', + * fix(fixer) { + if (superExpression.expression.arguments.length === 0) { + const rhs = expression.expression.right; + yield fixer.insertTextAfterRange([ + superExpression.range[0], + superExpression.range[0] + 6, + ], rhs.raw || rhs.name); + } + + yield fixer.removeRange([ + messageExpressionIndex === 0 ? constructorBodyNode.range[0] : constructorBody[messageExpressionIndex - 1].range[1], + expression.range[1], + ]); + }, + }; + } + + const nameExpression = constructorBody.find(x => isAssignmentExpression(x, 'name')); + if (!nameExpression) { + const nameProperty = body.find(node => isPropertyDefinition(node, 'name')); + + if (!nameProperty?.value || nameProperty.value.value !== name) { + yield { + node: nameProperty?.value ?? constructorBodyNode, + message: `The \`name\` property should be set to \`${name}\`.`, + }; + } + } else if (nameExpression.expression.right.value !== name) { + yield { + node: nameExpression?.expression.right ?? constructorBodyNode, + message: `The \`name\` property should be set to \`${name}\`.`, + }; + } +} + +const customErrorExport = (context, node) => { + const exportsName = node.left.property.name; + + const maybeError = node.right; + + if (maybeError.type !== 'ClassExpression') { + return; + } + + if (!hasValidSuperClass(maybeError)) { + return; + } + + if (!maybeError.id) { + return; + } + + // Assume rule has already fixed the error name + const errorName = maybeError.id.name; + + if (exportsName === errorName) { + return; + } + + return { + node: node.left.property, + messageId: MESSAGE_ID_INVALID_EXPORT, + fix: fixer => fixer.replaceText(node.left.property, errorName), + }; +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on('ClassDeclaration', node => customErrorDefinition(context, node)); + context.on('AssignmentExpression', node => { + if (node.right.type === 'ClassExpression') { + return customErrorDefinition(context, node.right); + } + }); + context.on('AssignmentExpression', node => { + if ( + node.left.type === 'MemberExpression' + && node.left.object.type === 'Identifier' + && node.left.object.name === 'exports' + ) { + return customErrorExport(context, node); + } + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Enforce correct `Error` subclassing.', + recommended: false, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/empty-brace-spaces.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/empty-brace-spaces.js new file mode 100644 index 0000000000000000000000000000000000000000..927cfba1fb0d7287c80b24fa95e8c307ec5e9da6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/empty-brace-spaces.js @@ -0,0 +1,73 @@ +'use strict'; +const {isOpeningBraceToken} = require('@eslint-community/eslint-utils'); + +const MESSAGE_ID = 'empty-brace-spaces'; +const messages = { + [MESSAGE_ID]: 'Do not add spaces between braces.', +}; + +const getProblem = (node, context) => { + const {sourceCode} = context; + const filter = node.type === 'RecordExpression' + ? token => token.type === 'Punctuator' && (token.value === '#{' || token.value === '{|') + : isOpeningBraceToken; + const openingBrace = sourceCode.getFirstToken(node, {filter}); + const closingBrace = sourceCode.getLastToken(node); + const [, start] = openingBrace.range; + const [end] = closingBrace.range; + const textBetween = sourceCode.text.slice(start, end); + + if (!/^\s+$/.test(textBetween)) { + return; + } + + return { + loc: { + start: openingBrace.loc.end, + end: closingBrace.loc.start, + }, + messageId: MESSAGE_ID, + fix: fixer => fixer.removeRange([start, end]), + }; +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on([ + 'BlockStatement', + 'ClassBody', + 'StaticBlock', + ], node => { + if (node.body.length > 0) { + return; + } + + return getProblem(node, context); + }); + + context.on([ + 'ObjectExpression', + // Experimental https://github.com/tc39/proposal-record-tuple + 'RecordExpression', + ], node => { + if (node.properties.length > 0) { + return; + } + + return getProblem(node, context); + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'layout', + docs: { + description: 'Enforce no spaces between braces.', + recommended: true, + }, + fixable: 'whitespace', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/error-message.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/error-message.js new file mode 100644 index 0000000000000000000000000000000000000000..5871630eeefb30bdf84ce095e0265e83d43d1eda --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/error-message.js @@ -0,0 +1,105 @@ +'use strict'; +const {getStaticValue} = require('@eslint-community/eslint-utils'); +const isShadowed = require('./utils/is-shadowed.js'); +const {isCallOrNewExpression} = require('./ast/index.js'); + +const MESSAGE_ID_MISSING_MESSAGE = 'missing-message'; +const MESSAGE_ID_EMPTY_MESSAGE = 'message-is-empty-string'; +const MESSAGE_ID_NOT_STRING = 'message-is-not-a-string'; +const messages = { + [MESSAGE_ID_MISSING_MESSAGE]: 'Pass a message to the `{{constructorName}}` constructor.', + [MESSAGE_ID_EMPTY_MESSAGE]: 'Error message should not be an empty string.', + [MESSAGE_ID_NOT_STRING]: 'Error message should be a string.', +}; + +const builtinErrors = [ + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error + 'Error', + 'EvalError', + 'RangeError', + 'ReferenceError', + 'SyntaxError', + 'TypeError', + 'URIError', + 'InternalError', + 'AggregateError', +]; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on(['CallExpression', 'NewExpression'], expression => { + if (!isCallOrNewExpression(expression, { + names: builtinErrors, + optional: false, + })) { + return; + } + + const scope = context.sourceCode.getScope(expression); + if (isShadowed(scope, expression.callee)) { + return; + } + + const constructorName = expression.callee.name; + const messageArgumentIndex = constructorName === 'AggregateError' ? 1 : 0; + const callArguments = expression.arguments; + + // If message is `SpreadElement` or there is `SpreadElement` before message + if (callArguments.some((node, index) => index <= messageArgumentIndex && node.type === 'SpreadElement')) { + return; + } + + const node = callArguments[messageArgumentIndex]; + if (!node) { + return { + node: expression, + messageId: MESSAGE_ID_MISSING_MESSAGE, + data: {constructorName}, + }; + } + + // These types can't be string, and `getStaticValue` may don't know the value + // Add more types, if issue reported + if (node.type === 'ArrayExpression' || node.type === 'ObjectExpression') { + return { + node, + messageId: MESSAGE_ID_NOT_STRING, + }; + } + + const staticResult = getStaticValue(node, scope); + + // We don't know the value of `message` + if (!staticResult) { + return; + } + + const {value} = staticResult; + if (typeof value !== 'string') { + return { + node, + messageId: MESSAGE_ID_NOT_STRING, + }; + } + + if (value === '') { + return { + node, + messageId: MESSAGE_ID_EMPTY_MESSAGE, + }; + } + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Enforce passing a `message` value when creating a built-in error.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/escape-case.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/escape-case.js new file mode 100644 index 0000000000000000000000000000000000000000..6c34aadae417fe0a1371d0af72ce634f085def8d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/escape-case.js @@ -0,0 +1,74 @@ +'use strict'; +const {replaceTemplateElement} = require('./fix/index.js'); +const { + isRegexLiteral, + isStringLiteral, + isTaggedTemplateLiteral, +} = require('./ast/index.js'); + +const MESSAGE_ID = 'escape-case'; +const messages = { + [MESSAGE_ID]: 'Use uppercase characters for the value of the escape sequence.', +}; + +const escapeWithLowercase = /(?<=(?:^|[^\\])(?:\\\\)*\\)(?x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+})/g; +const escapePatternWithLowercase = /(?<=(?:^|[^\\])(?:\\\\)*\\)(?x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+}|c[a-z])/g; +const getProblem = ({node, original, regex = escapeWithLowercase, fix}) => { + const fixed = original.replace(regex, data => data.slice(0, 1) + data.slice(1).toUpperCase()); + + if (fixed !== original) { + return { + node, + messageId: MESSAGE_ID, + fix: fixer => fix ? fix(fixer, fixed) : fixer.replaceText(node, fixed), + }; + } +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on('Literal', node => { + if (isStringLiteral(node)) { + return getProblem({ + node, + original: node.raw, + }); + } + }); + + context.on('Literal', node => { + if (isRegexLiteral(node)) { + return getProblem({ + node, + original: node.raw, + regex: escapePatternWithLowercase, + }); + } + }); + + context.on('TemplateElement', node => { + if (isTaggedTemplateLiteral(node.parent, ['String.raw'])) { + return; + } + + return getProblem({ + node, + original: node.value.raw, + fix: (fixer, fixed) => replaceTemplateElement(fixer, node, fixed), + }); + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Require escape sequences to use uppercase values.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/expiring-todo-comments.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/expiring-todo-comments.js new file mode 100644 index 0000000000000000000000000000000000000000..9f18f368961b424d20c506c75824f0b0f0f8d577 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/expiring-todo-comments.js @@ -0,0 +1,594 @@ +'use strict'; +const path = require('node:path'); +const readPkgUp = require('read-pkg-up'); +const semver = require('semver'); +const ci = require('ci-info'); +const getBuiltinRule = require('./utils/get-builtin-rule.js'); + +const baseRule = getBuiltinRule('no-warning-comments'); + +// `unicorn/` prefix is added to avoid conflicts with core rule +const MESSAGE_ID_AVOID_MULTIPLE_DATES = 'unicorn/avoidMultipleDates'; +const MESSAGE_ID_EXPIRED_TODO = 'unicorn/expiredTodo'; +const MESSAGE_ID_AVOID_MULTIPLE_PACKAGE_VERSIONS + = 'unicorn/avoidMultiplePackageVersions'; +const MESSAGE_ID_REACHED_PACKAGE_VERSION = 'unicorn/reachedPackageVersion'; +const MESSAGE_ID_HAVE_PACKAGE = 'unicorn/havePackage'; +const MESSAGE_ID_DONT_HAVE_PACKAGE = 'unicorn/dontHavePackage'; +const MESSAGE_ID_VERSION_MATCHES = 'unicorn/versionMatches'; +const MESSAGE_ID_ENGINE_MATCHES = 'unicorn/engineMatches'; +const MESSAGE_ID_REMOVE_WHITESPACE = 'unicorn/removeWhitespaces'; +const MESSAGE_ID_MISSING_AT_SYMBOL = 'unicorn/missingAtSymbol'; + +// Override of core rule message with a more specific one - no prefix +const MESSAGE_ID_CORE_RULE_UNEXPECTED_COMMENT = 'unexpectedComment'; +const messages = { + [MESSAGE_ID_AVOID_MULTIPLE_DATES]: + 'Avoid using multiple expiration dates in TODO: {{expirationDates}}. {{message}}', + [MESSAGE_ID_EXPIRED_TODO]: + 'There is a TODO that is past due date: {{expirationDate}}. {{message}}', + [MESSAGE_ID_REACHED_PACKAGE_VERSION]: + 'There is a TODO that is past due package version: {{comparison}}. {{message}}', + [MESSAGE_ID_AVOID_MULTIPLE_PACKAGE_VERSIONS]: + 'Avoid using multiple package versions in TODO: {{versions}}. {{message}}', + [MESSAGE_ID_HAVE_PACKAGE]: + 'There is a TODO that is deprecated since you installed: {{package}}. {{message}}', + [MESSAGE_ID_DONT_HAVE_PACKAGE]: + 'There is a TODO that is deprecated since you uninstalled: {{package}}. {{message}}', + [MESSAGE_ID_VERSION_MATCHES]: + 'There is a TODO match for package version: {{comparison}}. {{message}}', + [MESSAGE_ID_ENGINE_MATCHES]: + 'There is a TODO match for Node.js version: {{comparison}}. {{message}}', + [MESSAGE_ID_REMOVE_WHITESPACE]: + 'Avoid using whitespace on TODO argument. On \'{{original}}\' use \'{{fix}}\'. {{message}}', + [MESSAGE_ID_MISSING_AT_SYMBOL]: + 'Missing \'@\' on TODO argument. On \'{{original}}\' use \'{{fix}}\'. {{message}}', + ...baseRule.meta.messages, + [MESSAGE_ID_CORE_RULE_UNEXPECTED_COMMENT]: + 'Unexpected \'{{matchedTerm}}\' comment without any conditions: \'{{comment}}\'.', +}; + +/** @param {string} dirname */ +function getPackageHelpers(dirname) { + // We don't need to normalize the package.json data, because we are only using 2 properties and those 2 properties + // aren't validated by the normalization. But when this plugin is used in a monorepo, the name field in the + // package.json can be invalid and would make this plugin throw an error. See also #1871 + /** @type {readPkgUp.ReadResult | undefined} */ + let packageResult; + try { + packageResult = readPkgUp.sync({normalize: false, cwd: dirname}); + } catch { + // This can happen if package.json files have comments in them etc. + packageResult = undefined; + } + + const hasPackage = Boolean(packageResult); + const packageJson = packageResult ? packageResult.packageJson : {}; + + const packageDependencies = { + ...packageJson.dependencies, + ...packageJson.devDependencies, + }; + + function parseTodoWithArguments(string, {terms}) { + const lowerCaseString = string.toLowerCase(); + const lowerCaseTerms = terms.map(term => term.toLowerCase()); + const hasTerm = lowerCaseTerms.some(term => lowerCaseString.includes(term)); + + if (!hasTerm) { + return false; + } + + const TODO_ARGUMENT_RE = /\[(?[^}]+)]/i; + const result = TODO_ARGUMENT_RE.exec(string); + + if (!result) { + return false; + } + + const {rawArguments} = result.groups; + + const parsedArguments = rawArguments + .split(',') + .map(argument => parseArgument(argument.trim())); + + return createArgumentGroup(parsedArguments); + } + + function parseArgument(argumentString, dirname) { + const {hasPackage} = getPackageHelpers(dirname); + if (ISO8601_DATE.test(argumentString)) { + return { + type: 'dates', + value: argumentString, + }; + } + + if (hasPackage && DEPENDENCY_INCLUSION_RE.test(argumentString)) { + const condition = argumentString[0] === '+' ? 'in' : 'out'; + const name = argumentString.slice(1).trim(); + + return { + type: 'dependencies', + value: { + name, + condition, + }, + }; + } + + if (hasPackage && VERSION_COMPARISON_RE.test(argumentString)) { + const {groups} = VERSION_COMPARISON_RE.exec(argumentString); + const name = groups.name.trim(); + const condition = groups.condition.trim(); + const version = groups.version.trim(); + + const hasEngineKeyword = name.indexOf('engine:') === 0; + const isNodeEngine = hasEngineKeyword && name === 'engine:node'; + + if (hasEngineKeyword && isNodeEngine) { + return { + type: 'engines', + value: { + condition, + version, + }, + }; + } + + if (!hasEngineKeyword) { + return { + type: 'dependencies', + value: { + name, + condition, + version, + }, + }; + } + } + + if (hasPackage && PKG_VERSION_RE.test(argumentString)) { + const result = PKG_VERSION_RE.exec(argumentString); + const {condition, version} = result.groups; + + return { + type: 'packageVersions', + value: { + condition: condition.trim(), + version: version.trim(), + }, + }; + } + + // Currently being ignored as integration tests pointed + // some TODO comments have `[random data like this]` + return { + type: 'unknowns', + value: argumentString, + }; + } + + function parseTodoMessage(todoString) { + // @example "TODO [...]: message here" + // @example "TODO [...] message here" + const argumentsEnd = todoString.indexOf(']'); + + const afterArguments = todoString.slice(argumentsEnd + 1).trim(); + + // Check if have to skip colon + // @example "TODO [...]: message here" + const dropColon = afterArguments[0] === ':'; + if (dropColon) { + return afterArguments.slice(1).trim(); + } + + return afterArguments; + } + + return { + packageResult, + hasPackage, + packageJson, + packageDependencies, + parseArgument, + parseTodoMessage, + parseTodoWithArguments, + }; +} + +const DEPENDENCY_INCLUSION_RE = /^[+-]\s*@?\S+\/?\S+/; +const VERSION_COMPARISON_RE = /^(?@?\S\/?\S+)@(?>|>=)(?\d+(?:\.\d+){0,2}(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)/i; +const PKG_VERSION_RE = /^(?>|>=)(?\d+(?:\.\d+){0,2}(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)\s*$/; +const ISO8601_DATE = /\d{4}-\d{2}-\d{2}/; + +function createArgumentGroup(arguments_) { + const groups = {}; + for (const {value, type} of arguments_) { + groups[type] ??= []; + groups[type].push(value); + } + + return groups; +} + +function reachedDate(past, now) { + return Date.parse(past) < Date.parse(now); +} + +function tryToCoerceVersion(rawVersion) { + // `version` in `package.json` and comment can't be empty + /* c8 ignore next 3 */ + if (!rawVersion) { + return false; + } + + let version = String(rawVersion); + + // Remove leading things like `^1.0.0`, `>1.0.0` + const leadingNoises = [ + '>=', + '<=', + '>', + '<', + '~', + '^', + ]; + const foundTrailingNoise = leadingNoises.find(noise => version.startsWith(noise)); + if (foundTrailingNoise) { + version = version.slice(foundTrailingNoise.length); + } + + // Get only the first member for cases such as `1.0.0 - 2.9999.9999` + const parts = version.split(' '); + // We don't have this `package.json` to test + /* c8 ignore next 3 */ + if (parts.length > 1) { + version = parts[0]; + } + + // We don't have this `package.json` to test + /* c8 ignore next 3 */ + if (semver.valid(version)) { + return version; + } + + try { + // Try to semver.parse a perfect match while semver.coerce tries to fix errors + // But coerce can't parse pre-releases. + return semver.parse(version) || semver.coerce(version); + } catch { + // We don't have this `package.json` to test + /* c8 ignore next 3 */ + return false; + } +} + +function semverComparisonForOperator(operator) { + return { + '>': semver.gt, + '>=': semver.gte, + }[operator]; +} + +const DEFAULT_OPTIONS = { + terms: ['todo', 'fixme', 'xxx'], + ignore: [], + ignoreDatesOnPullRequests: true, + allowWarningComments: true, +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const options = { + ...DEFAULT_OPTIONS, + date: new Date().toISOString().slice(0, 10), + ...context.options[0], + }; + + const ignoreRegexes = options.ignore.map( + pattern => pattern instanceof RegExp ? pattern : new RegExp(pattern, 'u'), + ); + + const dirname = path.dirname(context.filename); + const {packageJson, packageDependencies, parseArgument, parseTodoMessage, parseTodoWithArguments} = getPackageHelpers(dirname); + + const {sourceCode} = context; + const comments = sourceCode.getAllComments(); + const unusedComments = comments + .filter(token => token.type !== 'Shebang') + // Block comments come as one. + // Split for situations like this: + // /* + // * TODO [2999-01-01]: Validate this + // * TODO [2999-01-01]: And this + // * TODO [2999-01-01]: Also this + // */ + .flatMap(comment => + comment.value.split('\n').map(line => ({ + ...comment, + value: line, + })), + ).filter(comment => processComment(comment)); + + // This is highly dependable on ESLint's `no-warning-comments` implementation. + // What we do is patch the parts we know the rule will use, `getAllComments`. + // Since we have priority, we leave only the comments that we didn't use. + const fakeContext = new Proxy(context, { + get(target, property, receiver) { + if (property === 'sourceCode') { + return { + ...sourceCode, + getAllComments: () => options.allowWarningComments ? [] : unusedComments, + }; + } + + return Reflect.get(target, property, receiver); + }, + }); + const rules = baseRule.create(fakeContext); + + function processComment(comment) { + if (ignoreRegexes.some(ignore => ignore.test(comment.value))) { + return; + } + + const parsed = parseTodoWithArguments(comment.value, options); + + if (!parsed) { + return true; + } + + // Count if there are valid properties. + // Otherwise, it's a useless TODO and falls back to `no-warning-comments`. + let uses = 0; + + const { + packageVersions = [], + dates = [], + dependencies = [], + engines = [], + unknowns = [], + } = parsed; + + if (dates.length > 1) { + uses++; + context.report({ + loc: comment.loc, + messageId: MESSAGE_ID_AVOID_MULTIPLE_DATES, + data: { + expirationDates: dates.join(', '), + message: parseTodoMessage(comment.value), + }, + }); + } else if (dates.length === 1) { + uses++; + const [expirationDate] = dates; + + const shouldIgnore = options.ignoreDatesOnPullRequests && ci.isPR; + if (!shouldIgnore && reachedDate(expirationDate, options.date)) { + context.report({ + loc: comment.loc, + messageId: MESSAGE_ID_EXPIRED_TODO, + data: { + expirationDate, + message: parseTodoMessage(comment.value), + }, + }); + } + } + + if (packageVersions.length > 1) { + uses++; + context.report({ + loc: comment.loc, + messageId: MESSAGE_ID_AVOID_MULTIPLE_PACKAGE_VERSIONS, + data: { + versions: packageVersions + .map(({condition, version}) => `${condition}${version}`) + .join(', '), + message: parseTodoMessage(comment.value), + }, + }); + } else if (packageVersions.length === 1) { + uses++; + const [{condition, version}] = packageVersions; + + const packageVersion = tryToCoerceVersion(packageJson.version); + const decidedPackageVersion = tryToCoerceVersion(version); + + const compare = semverComparisonForOperator(condition); + if (packageVersion && compare(packageVersion, decidedPackageVersion)) { + context.report({ + loc: comment.loc, + messageId: MESSAGE_ID_REACHED_PACKAGE_VERSION, + data: { + comparison: `${condition}${version}`, + message: parseTodoMessage(comment.value), + }, + }); + } + } + + // Inclusion: 'in', 'out' + // Comparison: '>', '>=' + for (const dependency of dependencies) { + uses++; + const targetPackageRawVersion = packageDependencies[dependency.name]; + const hasTargetPackage = Boolean(targetPackageRawVersion); + + const isInclusion = ['in', 'out'].includes(dependency.condition); + if (isInclusion) { + const [trigger, messageId] + = dependency.condition === 'in' + ? [hasTargetPackage, MESSAGE_ID_HAVE_PACKAGE] + : [!hasTargetPackage, MESSAGE_ID_DONT_HAVE_PACKAGE]; + + if (trigger) { + context.report({ + loc: comment.loc, + messageId, + data: { + package: dependency.name, + message: parseTodoMessage(comment.value), + }, + }); + } + + continue; + } + + const todoVersion = tryToCoerceVersion(dependency.version); + const targetPackageVersion = tryToCoerceVersion(targetPackageRawVersion); + + /* c8 ignore start */ + if (!hasTargetPackage || !targetPackageVersion) { + // Can't compare `¯\_(ツ)_/¯` + continue; + } + /* c8 ignore end */ + + const compare = semverComparisonForOperator(dependency.condition); + + if (compare(targetPackageVersion, todoVersion)) { + context.report({ + loc: comment.loc, + messageId: MESSAGE_ID_VERSION_MATCHES, + data: { + comparison: `${dependency.name} ${dependency.condition} ${dependency.version}`, + message: parseTodoMessage(comment.value), + }, + }); + } + } + + const packageEngines = packageJson.engines || {}; + + for (const engine of engines) { + uses++; + + const targetPackageRawEngineVersion = packageEngines.node; + const hasTargetEngine = Boolean(targetPackageRawEngineVersion); + + /* c8 ignore next 3 */ + if (!hasTargetEngine) { + continue; + } + + const todoEngine = tryToCoerceVersion(engine.version); + const targetPackageEngineVersion = tryToCoerceVersion( + targetPackageRawEngineVersion, + ); + + const compare = semverComparisonForOperator(engine.condition); + + if (compare(targetPackageEngineVersion, todoEngine)) { + context.report({ + loc: comment.loc, + messageId: MESSAGE_ID_ENGINE_MATCHES, + data: { + comparison: `node${engine.condition}${engine.version}`, + message: parseTodoMessage(comment.value), + }, + }); + } + } + + for (const unknown of unknowns) { + // In this case, check if there's just an '@' missing before a '>' or '>='. + const hasAt = unknown.includes('@'); + const comparisonIndex = unknown.indexOf('>'); + + if (!hasAt && comparisonIndex !== -1) { + const testString = `${unknown.slice( + 0, + comparisonIndex, + )}@${unknown.slice(comparisonIndex)}`; + + if (parseArgument(testString).type !== 'unknowns') { + uses++; + context.report({ + loc: comment.loc, + messageId: MESSAGE_ID_MISSING_AT_SYMBOL, + data: { + original: unknown, + fix: testString, + message: parseTodoMessage(comment.value), + }, + }); + continue; + } + } + + const withoutWhitespace = unknown.replaceAll(' ', ''); + + if (parseArgument(withoutWhitespace).type !== 'unknowns') { + uses++; + context.report({ + loc: comment.loc, + messageId: MESSAGE_ID_REMOVE_WHITESPACE, + data: { + original: unknown, + fix: withoutWhitespace, + message: parseTodoMessage(comment.value), + }, + }); + continue; + } + } + + return uses === 0; + } + + return { + Program() { + rules.Program(); // eslint-disable-line new-cap + }, + }; +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + terms: { + type: 'array', + items: { + type: 'string', + }, + }, + ignore: { + type: 'array', + uniqueItems: true, + }, + ignoreDatesOnPullRequests: { + type: 'boolean', + default: true, + }, + allowWarningComments: { + type: 'boolean', + default: true, + }, + date: { + type: 'string', + format: 'date', + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Add expiration conditions to TODO comments.', + recommended: true, + }, + schema, + defaultOptions: [{...DEFAULT_OPTIONS}], + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/explicit-length-check.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/explicit-length-check.js new file mode 100644 index 0000000000000000000000000000000000000000..5fcbf5c0137cd1b2453c9b8b3bdf5674b2243481 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/explicit-length-check.js @@ -0,0 +1,235 @@ +'use strict'; +const {isParenthesized, getStaticValue} = require('@eslint-community/eslint-utils'); +const {checkVueTemplate} = require('./utils/rule.js'); +const isLogicalExpression = require('./utils/is-logical-expression.js'); +const {isBooleanNode, getBooleanAncestor} = require('./utils/boolean.js'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); +const {isLiteral, isMemberExpression, isNumberLiteral} = require('./ast/index.js'); + +const TYPE_NON_ZERO = 'non-zero'; +const TYPE_ZERO = 'zero'; +const MESSAGE_ID_SUGGESTION = 'suggestion'; +const messages = { + [TYPE_NON_ZERO]: 'Use `.{{property}} {{code}}` when checking {{property}} is not zero.', + [TYPE_ZERO]: 'Use `.{{property}} {{code}}` when checking {{property}} is zero.', + [MESSAGE_ID_SUGGESTION]: 'Replace `.{{property}}` with `.{{property}} {{code}}`.', +}; + +const isCompareRight = (node, operator, value) => + node.type === 'BinaryExpression' + && node.operator === operator + && isLiteral(node.right, value); +const isCompareLeft = (node, operator, value) => + node.type === 'BinaryExpression' + && node.operator === operator + && isLiteral(node.left, value); +const nonZeroStyles = new Map([ + [ + 'greater-than', + { + code: '> 0', + test: node => isCompareRight(node, '>', 0), + }, + ], + [ + 'not-equal', + { + code: '!== 0', + test: node => isCompareRight(node, '!==', 0), + }, + ], +]); +const zeroStyle = { + code: '=== 0', + test: node => isCompareRight(node, '===', 0), +}; + +function getLengthCheckNode(node) { + node = node.parent; + + // Zero length check + if ( + // `foo.length === 0` + isCompareRight(node, '===', 0) + // `foo.length == 0` + || isCompareRight(node, '==', 0) + // `foo.length < 1` + || isCompareRight(node, '<', 1) + // `0 === foo.length` + || isCompareLeft(node, '===', 0) + // `0 == foo.length` + || isCompareLeft(node, '==', 0) + // `1 > foo.length` + || isCompareLeft(node, '>', 1) + ) { + return {isZeroLengthCheck: true, node}; + } + + // Non-Zero length check + if ( + // `foo.length !== 0` + isCompareRight(node, '!==', 0) + // `foo.length != 0` + || isCompareRight(node, '!=', 0) + // `foo.length > 0` + || isCompareRight(node, '>', 0) + // `foo.length >= 1` + || isCompareRight(node, '>=', 1) + // `0 !== foo.length` + || isCompareLeft(node, '!==', 0) + // `0 !== foo.length` + || isCompareLeft(node, '!=', 0) + // `0 < foo.length` + || isCompareLeft(node, '<', 0) + // `1 <= foo.length` + || isCompareLeft(node, '<=', 1) + ) { + return {isZeroLengthCheck: false, node}; + } + + return {}; +} + +function isNodeValueNumber(node, context) { + if (isNumberLiteral(node)) { + return true; + } + + const staticValue = getStaticValue(node, context.sourceCode.getScope(node)); + return staticValue && typeof staticValue.value === 'number'; +} + +function create(context) { + const options = { + 'non-zero': 'greater-than', + ...context.options[0], + }; + const nonZeroStyle = nonZeroStyles.get(options['non-zero']); + const {sourceCode} = context; + + function getProblem({node, isZeroLengthCheck, lengthNode, autoFix}) { + const {code, test} = isZeroLengthCheck ? zeroStyle : nonZeroStyle; + if (test(node)) { + return; + } + + let fixed = `${sourceCode.getText(lengthNode)} ${code}`; + if ( + !isParenthesized(node, sourceCode) + && node.type === 'UnaryExpression' + && (node.parent.type === 'UnaryExpression' || node.parent.type === 'AwaitExpression') + ) { + fixed = `(${fixed})`; + } + + const fix = function * (fixer) { + yield fixer.replaceText(node, fixed); + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + }; + + const problem = { + node, + messageId: isZeroLengthCheck ? TYPE_ZERO : TYPE_NON_ZERO, + data: {code, property: lengthNode.property.name}, + }; + + if (autoFix) { + problem.fix = fix; + } else { + problem.suggest = [ + { + messageId: MESSAGE_ID_SUGGESTION, + fix, + }, + ]; + } + + return problem; + } + + return { + MemberExpression(memberExpression) { + if ( + !isMemberExpression(memberExpression, { + properties: ['length', 'size'], + optional: false, + }) + || memberExpression.object.type === 'ThisExpression' + ) { + return; + } + + const lengthNode = memberExpression; + const staticValue = getStaticValue(lengthNode, sourceCode.getScope(lengthNode)); + if (staticValue && (!Number.isInteger(staticValue.value) || staticValue.value < 0)) { + // Ignore known, non-positive-integer length properties. + return; + } + + let node; + let autoFix = true; + let {isZeroLengthCheck, node: lengthCheckNode} = getLengthCheckNode(lengthNode); + if (lengthCheckNode) { + const {isNegative, node: ancestor} = getBooleanAncestor(lengthCheckNode); + node = ancestor; + if (isNegative) { + isZeroLengthCheck = !isZeroLengthCheck; + } + } else { + const {isNegative, node: ancestor} = getBooleanAncestor(lengthNode); + if (isBooleanNode(ancestor)) { + isZeroLengthCheck = isNegative; + node = ancestor; + } else if ( + isLogicalExpression(lengthNode.parent) + && !( + lengthNode.parent.operator === '||' + && isNodeValueNumber(lengthNode.parent.right, context) + ) + ) { + isZeroLengthCheck = isNegative; + node = lengthNode; + autoFix = false; + } + } + + if (node) { + return getProblem({ + node, + isZeroLengthCheck, + lengthNode, + autoFix, + }); + } + }, + }; +} + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + 'non-zero': { + enum: [...nonZeroStyles.keys()], + default: 'greater-than', + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create: checkVueTemplate(create), + meta: { + type: 'problem', + docs: { + description: 'Enforce explicitly comparing the `length` or `size` property of a value.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + hasSuggestions: true, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/filename-case.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/filename-case.js new file mode 100644 index 0000000000000000000000000000000000000000..8fdaf69d6384db8afae600162cff2d0762a9bf3b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/filename-case.js @@ -0,0 +1,292 @@ +'use strict'; +const path = require('node:path'); +const {camelCase, kebabCase, snakeCase, upperFirst} = require('./utils/lodash.js'); +const cartesianProductSamples = require('./utils/cartesian-product-samples.js'); + +const MESSAGE_ID = 'filename-case'; +const MESSAGE_ID_EXTENSION = 'filename-extension'; +const messages = { + [MESSAGE_ID]: 'Filename is not in {{chosenCases}}. Rename it to {{renamedFilenames}}.', + [MESSAGE_ID_EXTENSION]: 'File extension `{{extension}}` is not in lowercase. Rename it to `{{filename}}`.', +}; + +const pascalCase = string => upperFirst(camelCase(string)); +const numberRegex = /\d+/; +const PLACEHOLDER = '\uFFFF\uFFFF\uFFFF'; +const PLACEHOLDER_REGEX = new RegExp(PLACEHOLDER, 'i'); +const isIgnoredChar = char => !/^[a-z\d-_]$/i.test(char); +const ignoredByDefault = new Set(['index.js', 'index.mjs', 'index.cjs', 'index.ts', 'index.tsx', 'index.vue']); +const isLowerCase = string => string === string.toLowerCase(); + +function ignoreNumbers(caseFunction) { + return string => { + const stack = []; + let execResult = numberRegex.exec(string); + + while (execResult) { + stack.push(execResult[0]); + string = string.replace(execResult[0], PLACEHOLDER); + execResult = numberRegex.exec(string); + } + + let withCase = caseFunction(string); + + while (stack.length > 0) { + withCase = withCase.replace(PLACEHOLDER_REGEX, stack.shift()); + } + + return withCase; + }; +} + +const cases = { + camelCase: { + fn: camelCase, + name: 'camel case', + }, + kebabCase: { + fn: kebabCase, + name: 'kebab case', + }, + snakeCase: { + fn: snakeCase, + name: 'snake case', + }, + pascalCase: { + fn: pascalCase, + name: 'pascal case', + }, +}; + +/** +Get the cases specified by the option. + +@param {object} options +@returns {string[]} The chosen cases. +*/ +function getChosenCases(options) { + if (options.case) { + return [options.case]; + } + + if (options.cases) { + const cases = Object.keys(options.cases) + .filter(cases => options.cases[cases]); + + return cases.length > 0 ? cases : ['kebabCase']; + } + + return ['kebabCase']; +} + +function validateFilename(words, caseFunctions) { + return words + .filter(({ignored}) => !ignored) + .every(({word}) => caseFunctions.some(caseFunction => caseFunction(word) === word)); +} + +function fixFilename(words, caseFunctions, {leading, trailing}) { + const replacements = words + .map(({word, ignored}) => ignored ? [word] : caseFunctions.map(caseFunction => caseFunction(word))); + + const { + samples: combinations, + } = cartesianProductSamples(replacements); + + return [...new Set(combinations.map(parts => `${leading}${parts.join('')}${trailing}`))]; +} + +function getFilenameParts(filenameWithExtension, {multipleFileExtensions}) { + const extension = path.extname(filenameWithExtension); + const filename = path.basename(filenameWithExtension, extension); + const basename = filename + extension; + + const parts = { + basename, + filename, + middle: '', + extension, + }; + + if (multipleFileExtensions) { + const [firstPart] = filename.split('.'); + Object.assign(parts, { + filename: firstPart, + middle: filename.slice(firstPart.length), + }); + } + + return parts; +} + +const leadingUnderscoresRegex = /^(?_+)(?.*)$/; +function splitFilename(filename) { + const result = leadingUnderscoresRegex.exec(filename) || {groups: {}}; + const {leading = '', tailing = filename} = result.groups; + + const words = []; + + let lastWord; + for (const char of tailing) { + const isIgnored = isIgnoredChar(char); + + if (lastWord?.ignored === isIgnored) { + lastWord.word += char; + } else { + lastWord = { + word: char, + ignored: isIgnored, + }; + words.push(lastWord); + } + } + + return { + leading, + words, + }; +} + +/** +Turns `[a, b, c]` into `a, b, or c`. + +@param {string[]} words +@returns {string} +*/ +const englishishJoinWords = words => new Intl.ListFormat('en-US', {type: 'disjunction'}).format(words); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const options = context.options[0] || {}; + const chosenCases = getChosenCases(options); + const ignore = (options.ignore || []).map(item => { + if (item instanceof RegExp) { + return item; + } + + return new RegExp(item, 'u'); + }); + const multipleFileExtensions = options.multipleFileExtensions !== false; + const chosenCasesFunctions = chosenCases.map(case_ => ignoreNumbers(cases[case_].fn)); + const filenameWithExtension = context.physicalFilename; + + if (filenameWithExtension === '' || filenameWithExtension === '') { + return; + } + + return { + Program() { + const { + basename, + filename, + middle, + extension, + } = getFilenameParts(filenameWithExtension, {multipleFileExtensions}); + + if (ignoredByDefault.has(basename) || ignore.some(regexp => regexp.test(basename))) { + return; + } + + const {leading, words} = splitFilename(filename); + const isValid = validateFilename(words, chosenCasesFunctions); + + if (isValid) { + if (!isLowerCase(extension)) { + return { + loc: {column: 0, line: 1}, + messageId: MESSAGE_ID_EXTENSION, + data: {filename: filename + middle + extension.toLowerCase(), extension}, + }; + } + + return; + } + + const renamedFilenames = fixFilename(words, chosenCasesFunctions, { + leading, + trailing: middle + extension.toLowerCase(), + }); + + return { + // Report on first character like `unicode-bom` rule + // https://github.com/eslint/eslint/blob/8a77b661bc921c3408bae01b3aa41579edfc6e58/lib/rules/unicode-bom.js#L46 + loc: {column: 0, line: 1}, + messageId: MESSAGE_ID, + data: { + chosenCases: englishishJoinWords(chosenCases.map(x => cases[x].name)), + renamedFilenames: englishishJoinWords(renamedFilenames.map(x => `\`${x}\``)), + }, + }; + }, + }; +}; + +const schema = [ + { + oneOf: [ + { + properties: { + case: { + enum: [ + 'camelCase', + 'snakeCase', + 'kebabCase', + 'pascalCase', + ], + }, + ignore: { + type: 'array', + uniqueItems: true, + }, + multipleFileExtensions: { + type: 'boolean', + }, + }, + additionalProperties: false, + }, + { + properties: { + cases: { + properties: { + camelCase: { + type: 'boolean', + }, + snakeCase: { + type: 'boolean', + }, + kebabCase: { + type: 'boolean', + }, + pascalCase: { + type: 'boolean', + }, + }, + additionalProperties: false, + }, + ignore: { + type: 'array', + uniqueItems: true, + }, + multipleFileExtensions: { + type: 'boolean', + }, + }, + additionalProperties: false, + }, + ], + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce a case style for filenames.', + recommended: true, + }, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/add-parenthesizes-to-return-or-throw-expression.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/add-parenthesizes-to-return-or-throw-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..8b94ed758dfc793e99ea882a707e0a8752e3d2e4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/add-parenthesizes-to-return-or-throw-expression.js @@ -0,0 +1,21 @@ +'use strict'; +const {isSemicolonToken} = require('@eslint-community/eslint-utils'); + +function * addParenthesizesToReturnOrThrowExpression(fixer, node, sourceCode) { + if (node.type !== 'ReturnStatement' && node.type !== 'ThrowStatement') { + return; + } + + const returnOrThrowToken = sourceCode.getFirstToken(node); + yield fixer.insertTextAfter(returnOrThrowToken, ' ('); + + const lastToken = sourceCode.getLastToken(node); + if (!isSemicolonToken(lastToken)) { + yield fixer.insertTextAfter(node, ')'); + return; + } + + yield fixer.insertTextBefore(lastToken, ')'); +} + +module.exports = addParenthesizesToReturnOrThrowExpression; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/append-argument.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/append-argument.js new file mode 100644 index 0000000000000000000000000000000000000000..2f6b30b75ae9593c175c731afbf739873b4083f8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/append-argument.js @@ -0,0 +1,20 @@ +'use strict'; +const {isCommaToken} = require('@eslint-community/eslint-utils'); + +function appendArgument(fixer, node, text, sourceCode) { + // This function should also work for `NewExpression` + // But parentheses of `NewExpression` could be omitted, add this check to prevent accident use on it + /* c8 ignore next 3 */ + if (node.type !== 'CallExpression') { + throw new Error(`Unexpected node "${node.type}".`); + } + + const [penultimateToken, lastToken] = sourceCode.getLastTokens(node, 2); + if (node.arguments.length > 0) { + text = isCommaToken(penultimateToken) ? ` ${text},` : `, ${text}`; + } + + return fixer.insertTextBefore(lastToken, text); +} + +module.exports = appendArgument; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/extend-fix-range.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/extend-fix-range.js new file mode 100644 index 0000000000000000000000000000000000000000..7a13c6d7a8e927ed3ffe2ee655aab907e72d597b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/extend-fix-range.js @@ -0,0 +1,15 @@ +'use strict'; + +/** +Extend fix range to prevent changes from other rules. +https://github.com/eslint/eslint/pull/13748/files#diff-c692f3fde09eda7c89f1802c908511a3fb59f5d207fe95eb009cb52e46a99e84R348 + +@param {ruleFixer} fixer - The fixer to fix. +@param {int[]} range - The extended range node. +*/ +function * extendFixRange(fixer, range) { + yield fixer.insertTextBeforeRange(range, ''); + yield fixer.insertTextAfterRange(range, ''); +} + +module.exports = extendFixRange; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/fix-space-around-keywords.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/fix-space-around-keywords.js new file mode 100644 index 0000000000000000000000000000000000000000..fbff5ee66a183eb2a4256cdc6186f6ffbf994754 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/fix-space-around-keywords.js @@ -0,0 +1,35 @@ +'use strict'; +const {getParenthesizedRange} = require('../utils/parentheses.js'); + +const isProblematicToken = ({type, value}) => ( + (type === 'Keyword' && /^[a-z]*$/.test(value)) + // ForOfStatement + || (type === 'Identifier' && value === 'of') + // AwaitExpression + || (type === 'Identifier' && value === 'await') +); + +function * fixSpaceAroundKeyword(fixer, node, sourceCode) { + const range = getParenthesizedRange(node, sourceCode); + const tokenBefore = sourceCode.getTokenBefore({range}, {includeComments: true}); + + if ( + tokenBefore + && range[0] === tokenBefore.range[1] + && isProblematicToken(tokenBefore) + ) { + yield fixer.insertTextAfter(tokenBefore, ' '); + } + + const tokenAfter = sourceCode.getTokenAfter({range}, {includeComments: true}); + + if ( + tokenAfter + && range[1] === tokenAfter.range[0] + && isProblematicToken(tokenAfter) + ) { + yield fixer.insertTextBefore(tokenAfter, ' '); + } +} + +module.exports = fixSpaceAroundKeyword; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/index.js new file mode 100644 index 0000000000000000000000000000000000000000..18d896f52cb9cd639854423526b9647e000ea39e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/index.js @@ -0,0 +1,23 @@ +'use strict'; + +module.exports = { + // Utilities + extendFixRange: require('./extend-fix-range.js'), + removeParentheses: require('./remove-parentheses.js'), + + appendArgument: require('./append-argument.js'), + removeArgument: require('./remove-argument.js'), + replaceArgument: require('./replace-argument.js'), + switchNewExpressionToCallExpression: require('./switch-new-expression-to-call-expression.js'), + switchCallExpressionToNewExpression: require('./switch-call-expression-to-new-expression.js'), + removeMemberExpressionProperty: require('./remove-member-expression-property.js'), + removeMethodCall: require('./remove-method-call.js'), + replaceTemplateElement: require('./replace-template-element.js'), + replaceReferenceIdentifier: require('./replace-reference-identifier.js'), + renameVariable: require('./rename-variable.js'), + replaceNodeOrTokenAndSpacesBefore: require('./replace-node-or-token-and-spaces-before.js'), + removeSpacesAfter: require('./remove-spaces-after.js'), + fixSpaceAroundKeyword: require('./fix-space-around-keywords.js'), + replaceStringLiteral: require('./replace-string-literal.js'), + addParenthesizesToReturnOrThrowExpression: require('./add-parenthesizes-to-return-or-throw-expression.js'), +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-argument.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-argument.js new file mode 100644 index 0000000000000000000000000000000000000000..8ad5fd98240aa310ea7092f09e4fa2e0b3a13dea --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-argument.js @@ -0,0 +1,32 @@ +'use strict'; +const {isCommaToken} = require('@eslint-community/eslint-utils'); +const {getParentheses} = require('../utils/parentheses.js'); + +function removeArgument(fixer, node, sourceCode) { + const callExpression = node.parent; + const index = callExpression.arguments.indexOf(node); + const parentheses = getParentheses(node, sourceCode); + const firstToken = parentheses[0] || node; + const lastToken = parentheses.at(-1) || node; + + let [start] = firstToken.range; + let [, end] = lastToken.range; + + if (index !== 0) { + start = sourceCode.getTokenBefore(firstToken).range[0]; + } + + // If the removed argument is the only argument, the trailing comma must be removed too + /* c8 ignore start */ + if (callExpression.arguments.length === 1) { + const tokenAfter = sourceCode.getTokenBefore(lastToken); + if (isCommaToken(tokenAfter)) { + end = tokenAfter[1]; + } + } + /* c8 ignore end */ + + return fixer.replaceTextRange([start, end], ''); +} + +module.exports = removeArgument; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-member-expression-property.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-member-expression-property.js new file mode 100644 index 0000000000000000000000000000000000000000..26e4aff116eb0a600a39343acad1e949b9e09c01 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-member-expression-property.js @@ -0,0 +1,11 @@ +'use strict'; +const {getParenthesizedRange} = require('../utils/parentheses.js'); + +function removeMemberExpressionProperty(fixer, memberExpression, sourceCode) { + const [, start] = getParenthesizedRange(memberExpression.object, sourceCode); + const [, end] = memberExpression.range; + + return fixer.removeRange([start, end]); +} + +module.exports = removeMemberExpressionProperty; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-method-call.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-method-call.js new file mode 100644 index 0000000000000000000000000000000000000000..5386b8be66677b84c27746e6fd8b8184ca2cb892 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-method-call.js @@ -0,0 +1,20 @@ +'use strict'; +const {getParenthesizedRange} = require('../utils/parentheses.js'); +const removeMemberExpressionProperty = require('./remove-member-expression-property.js'); + +function * removeMethodCall(fixer, callExpression, sourceCode) { + const memberExpression = callExpression.callee; + + // `(( (( foo )).bar ))()` + // ^^^^ + yield removeMemberExpressionProperty(fixer, memberExpression, sourceCode); + + // `(( (( foo )).bar ))()` + // ^^ + const [, start] = getParenthesizedRange(memberExpression, sourceCode); + const [, end] = callExpression.range; + + yield fixer.removeRange([start, end]); +} + +module.exports = removeMethodCall; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-parentheses.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-parentheses.js new file mode 100644 index 0000000000000000000000000000000000000000..42d68f2cd20a32379e207301cd07288fba21162c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-parentheses.js @@ -0,0 +1,11 @@ +'use strict'; +const {getParentheses} = require('../utils/parentheses.js'); + +function * removeParentheses(node, fixer, sourceCode) { + const parentheses = getParentheses(node, sourceCode); + for (const token of parentheses) { + yield fixer.remove(token); + } +} + +module.exports = removeParentheses; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-spaces-after.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-spaces-after.js new file mode 100644 index 0000000000000000000000000000000000000000..0fadd909753abdb6e044b2fba9a35999f618dede --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/remove-spaces-after.js @@ -0,0 +1,14 @@ +'use strict'; + +function removeSpacesAfter(indexOrNodeOrToken, sourceCode, fixer) { + let index = indexOrNodeOrToken; + if (typeof indexOrNodeOrToken === 'object' && Array.isArray(indexOrNodeOrToken.range)) { + index = indexOrNodeOrToken.range[1]; + } + + const textAfter = sourceCode.text.slice(index); + const [leadingSpaces] = textAfter.match(/^\s*/); + return fixer.removeRange([index, index + leadingSpaces.length]); +} + +module.exports = removeSpacesAfter; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/rename-variable.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/rename-variable.js new file mode 100644 index 0000000000000000000000000000000000000000..5677df09cc93320ba889fa01d1572d79128e7895 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/rename-variable.js @@ -0,0 +1,9 @@ +'use strict'; +const getVariableIdentifiers = require('../utils/get-variable-identifiers.js'); +const replaceReferenceIdentifier = require('./replace-reference-identifier.js'); + +const renameVariable = (variable, name, fixer) => + getVariableIdentifiers(variable) + .map(identifier => replaceReferenceIdentifier(identifier, name, fixer)); + +module.exports = renameVariable; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-argument.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-argument.js new file mode 100644 index 0000000000000000000000000000000000000000..c07a39f0f6a77878f511d765eb57a4077da46b4f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-argument.js @@ -0,0 +1,8 @@ +'use strict'; +const {getParenthesizedRange} = require('../utils/parentheses.js'); + +function replaceArgument(fixer, node, text, sourceCode) { + return fixer.replaceTextRange(getParenthesizedRange(node, sourceCode), text); +} + +module.exports = replaceArgument; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-node-or-token-and-spaces-before.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-node-or-token-and-spaces-before.js new file mode 100644 index 0000000000000000000000000000000000000000..a145829f60c731759e986ca58201c2e8b27a6f5e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-node-or-token-and-spaces-before.js @@ -0,0 +1,21 @@ +'use strict'; +const {getParentheses} = require('../utils/parentheses.js'); + +function * replaceNodeOrTokenAndSpacesBefore(nodeOrToken, replacement, fixer, sourceCode, tokenStore = sourceCode) { + const tokens = getParentheses(nodeOrToken, tokenStore); + + for (const token of tokens) { + yield * replaceNodeOrTokenAndSpacesBefore(token, '', fixer, sourceCode, tokenStore); + } + + let [start, end] = nodeOrToken.range; + + const textBefore = sourceCode.text.slice(0, start); + const [trailingSpaces] = textBefore.match(/\s*$/); + const [lineBreak] = trailingSpaces.match(/(?:\r?\n|\r){0,1}/); + start -= trailingSpaces.length; + + yield fixer.replaceTextRange([start, end], `${lineBreak}${replacement}`); +} + +module.exports = replaceNodeOrTokenAndSpacesBefore; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-reference-identifier.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-reference-identifier.js new file mode 100644 index 0000000000000000000000000000000000000000..f2a0791640553d8d6bbf7557caa8ee8686751ba2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-reference-identifier.js @@ -0,0 +1,35 @@ +'use strict'; + +const isShorthandPropertyValue = require('../utils/is-shorthand-property-value.js'); +const isShorthandPropertyAssignmentPatternLeft = require('../utils/is-shorthand-property-assignment-pattern-left.js'); +const isShorthandImportLocal = require('../utils/is-shorthand-import-local.js'); +const isShorthandExportLocal = require('../utils/is-shorthand-export-local.js'); + +function replaceReferenceIdentifier(identifier, replacement, fixer) { + if ( + isShorthandPropertyValue(identifier) + || isShorthandPropertyAssignmentPatternLeft(identifier) + ) { + return fixer.replaceText(identifier, `${identifier.name}: ${replacement}`); + } + + if (isShorthandImportLocal(identifier)) { + return fixer.replaceText(identifier, `${identifier.name} as ${replacement}`); + } + + if (isShorthandExportLocal(identifier)) { + return fixer.replaceText(identifier, `${replacement} as ${identifier.name}`); + } + + // `typeAnnotation` + if (identifier.typeAnnotation) { + return fixer.replaceTextRange( + [identifier.range[0], identifier.typeAnnotation.range[0]], + `${replacement}${identifier.optional ? '?' : ''}`, + ); + } + + return fixer.replaceText(identifier, replacement); +} + +module.exports = replaceReferenceIdentifier; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-string-literal.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-string-literal.js new file mode 100644 index 0000000000000000000000000000000000000000..bc0c9b581e94c3655d0dea031eb1e0953a280586 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-string-literal.js @@ -0,0 +1,11 @@ +'use strict'; + +function replaceStringLiteral(fixer, node, text, relativeRangeStart, relativeRangeEnd) { + const firstCharacterIndex = node.range[0] + 1; + const start = Number.isInteger(relativeRangeEnd) ? relativeRangeStart + firstCharacterIndex : firstCharacterIndex; + const end = Number.isInteger(relativeRangeEnd) ? relativeRangeEnd + firstCharacterIndex : node.range[1] - 1; + + return fixer.replaceTextRange([start, end], text); +} + +module.exports = replaceStringLiteral; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-string-raw.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-string-raw.js new file mode 100644 index 0000000000000000000000000000000000000000..e50b0b6a81c2f8f17f341293fc900e9ffbde4c40 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-string-raw.js @@ -0,0 +1,14 @@ +'use strict'; + +// Replace `StringLiteral` or `TemplateLiteral` node with raw text +const replaceStringRaw = (fixer, node, raw) => + fixer.replaceTextRange( + // Ignore quotes and backticks + [ + node.range[0] + 1, + node.range[1] - 1, + ], + raw, + ); + +module.exports = replaceStringRaw; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-template-element.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-template-element.js new file mode 100644 index 0000000000000000000000000000000000000000..c3927ac96711101b2dc7f5381f430791c51c5afd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/replace-template-element.js @@ -0,0 +1,11 @@ +'use strict'; + +const replaceTemplateElement = (fixer, node, replacement) => { + const {range: [start, end], tail} = node; + return fixer.replaceTextRange( + [start + 1, end - (tail ? 1 : 2)], + replacement, + ); +}; + +module.exports = replaceTemplateElement; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/switch-call-expression-to-new-expression.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/switch-call-expression-to-new-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..813e3dfdf0610e8aeebf98ba18bacd1e5e89fab7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/switch-call-expression-to-new-expression.js @@ -0,0 +1,20 @@ +'use strict'; +const {isParenthesized} = require('../utils/parentheses.js'); +const shouldAddParenthesesToNewExpressionCallee = require('../utils/should-add-parentheses-to-new-expression-callee.js'); +const fixSpaceAroundKeyword = require('./fix-space-around-keywords.js'); + +function * switchCallExpressionToNewExpression(node, sourceCode, fixer) { + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + yield fixer.insertTextBefore(node, 'new '); + + const {callee} = node; + if ( + !isParenthesized(callee, sourceCode) + && shouldAddParenthesesToNewExpressionCallee(callee) + ) { + yield fixer.insertTextBefore(callee, '('); + yield fixer.insertTextAfter(callee, ')'); + } +} + +module.exports = switchCallExpressionToNewExpression; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/switch-new-expression-to-call-expression.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/switch-new-expression-to-call-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..1707ae69b9b8ba5e79e9df8cfd11c13a2310e409 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/fix/switch-new-expression-to-call-expression.js @@ -0,0 +1,34 @@ +'use strict'; +const isNewExpressionWithParentheses = require('../utils/is-new-expression-with-parentheses.js'); +const {isParenthesized} = require('../utils/parentheses.js'); +const isOnSameLine = require('../utils/is-on-same-line.js'); +const addParenthesizesToReturnOrThrowExpression = require('./add-parenthesizes-to-return-or-throw-expression.js'); +const removeSpaceAfter = require('./remove-spaces-after.js'); + +function * switchNewExpressionToCallExpression(newExpression, sourceCode, fixer) { + const newToken = sourceCode.getFirstToken(newExpression); + yield fixer.remove(newToken); + yield removeSpaceAfter(newToken, sourceCode, fixer); + + if (!isNewExpressionWithParentheses(newExpression, sourceCode)) { + yield fixer.insertTextAfter(newExpression, '()'); + } + + /* + Remove `new` from this code will makes the function return `undefined` + + ```js + () => { + return new // comment + Foo() + } + ``` + */ + if (!isOnSameLine(newToken, newExpression.callee) && !isParenthesized(newExpression, sourceCode)) { + // Ideally, we should use first parenthesis of the `callee`, and should check spaces after the `new` token + // But adding extra parentheses is harmless, no need to be too complicated + yield * addParenthesizesToReturnOrThrowExpression(fixer, newExpression.parent, sourceCode); + } +} + +module.exports = switchNewExpressionToCallExpression; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/import-style.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/import-style.js new file mode 100644 index 0000000000000000000000000000000000000000..6674d063496d5db8ac5ebbb38cc63a735ff31e63 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/import-style.js @@ -0,0 +1,371 @@ +'use strict'; +const {defaultsDeep} = require('./utils/lodash.js'); +const {getStringIfConstant} = require('@eslint-community/eslint-utils'); +const {isCallExpression} = require('./ast/index.js'); + +const MESSAGE_ID = 'importStyle'; +const messages = { + [MESSAGE_ID]: 'Use {{allowedStyles}} import for module `{{moduleName}}`.', +}; + +const getActualImportDeclarationStyles = importDeclaration => { + const {specifiers} = importDeclaration; + + if (specifiers.length === 0) { + return ['unassigned']; + } + + const styles = new Set(); + + for (const specifier of specifiers) { + if (specifier.type === 'ImportDefaultSpecifier') { + styles.add('default'); + continue; + } + + if (specifier.type === 'ImportNamespaceSpecifier') { + styles.add('namespace'); + continue; + } + + if (specifier.type === 'ImportSpecifier') { + if (specifier.imported.type === 'Identifier' && specifier.imported.name === 'default') { + styles.add('default'); + continue; + } + + styles.add('named'); + continue; + } + } + + return [...styles]; +}; + +const getActualExportDeclarationStyles = exportDeclaration => { + const {specifiers} = exportDeclaration; + + if (specifiers.length === 0) { + return ['unassigned']; + } + + const styles = new Set(); + + for (const specifier of specifiers) { + if (specifier.type === 'ExportSpecifier') { + if (specifier.exported.type === 'Identifier' && specifier.exported.name === 'default') { + styles.add('default'); + continue; + } + + styles.add('named'); + continue; + } + } + + return [...styles]; +}; + +const getActualAssignmentTargetImportStyles = assignmentTarget => { + if (assignmentTarget.type === 'Identifier' || assignmentTarget.type === 'ArrayPattern') { + return ['namespace']; + } + + if (assignmentTarget.type === 'ObjectPattern') { + if (assignmentTarget.properties.length === 0) { + return ['unassigned']; + } + + const styles = new Set(); + + for (const property of assignmentTarget.properties) { + if (property.type === 'RestElement') { + styles.add('named'); + continue; + } + + if (property.key.type === 'Identifier') { + if (property.key.name === 'default') { + styles.add('default'); + } else { + styles.add('named'); + } + } + } + + return [...styles]; + } + + // Next line is not test-coverable until unforceable changes to the language + // like an addition of new AST node types usable in `const __HERE__ = foo;`. + // An exotic custom parser or a bug in one could cover it too. + /* c8 ignore next */ + return []; +}; + +const isAssignedDynamicImport = node => + node.parent.type === 'AwaitExpression' + && node.parent.argument === node + && node.parent.parent.type === 'VariableDeclarator' + && node.parent.parent.init === node.parent; + +// Keep this alphabetically sorted for easier maintenance +const defaultStyles = { + chalk: { + default: true, + }, + path: { + default: true, + }, + 'node:path': { + default: true, + }, + util: { + named: true, + }, + 'node:util': { + named: true, + }, +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + let [ + { + styles = {}, + extendDefaultStyles = true, + checkImport = true, + checkDynamicImport = true, + checkExportFrom = false, + checkRequire = true, + } = {}, + ] = context.options; + + styles = extendDefaultStyles + ? defaultsDeep({}, styles, defaultStyles) + : styles; + + styles = new Map( + Object.entries(styles).map( + ([moduleName, styles]) => + [moduleName, new Set(Object.entries(styles).filter(([, isAllowed]) => isAllowed).map(([style]) => style))], + ), + ); + + const {sourceCode} = context; + + const report = (node, moduleName, actualImportStyles, allowedImportStyles, isRequire = false) => { + if (!allowedImportStyles || allowedImportStyles.size === 0) { + return; + } + + let effectiveAllowedImportStyles = allowedImportStyles; + + // For `require`, `'default'` style allows both `x = require('x')` (`'namespace'` style) and + // `{default: x} = require('x')` (`'default'` style) since we don't know in advance + // whether `'x'` is a compiled ES6 module (with `default` key) or a CommonJS module and `require` + // does not provide any automatic interop for this, so the user may have to use either of these. + if (isRequire && allowedImportStyles.has('default') && !allowedImportStyles.has('namespace')) { + effectiveAllowedImportStyles = new Set(allowedImportStyles); + effectiveAllowedImportStyles.add('namespace'); + } + + if (actualImportStyles.every(style => effectiveAllowedImportStyles.has(style))) { + return; + } + + const data = { + allowedStyles: new Intl.ListFormat('en-US', {type: 'disjunction'}).format([...allowedImportStyles.keys()]), + moduleName, + }; + + context.report({ + node, + messageId: MESSAGE_ID, + data, + }); + }; + + if (checkImport) { + context.on('ImportDeclaration', node => { + const moduleName = getStringIfConstant(node.source, sourceCode.getScope(node.source)); + + const allowedImportStyles = styles.get(moduleName); + const actualImportStyles = getActualImportDeclarationStyles(node); + + report(node, moduleName, actualImportStyles, allowedImportStyles); + }); + } + + if (checkDynamicImport) { + context.on('ImportExpression', node => { + if (isAssignedDynamicImport(node)) { + return; + } + + const moduleName = getStringIfConstant(node.source, sourceCode.getScope(node.source)); + const allowedImportStyles = styles.get(moduleName); + const actualImportStyles = ['unassigned']; + + report(node, moduleName, actualImportStyles, allowedImportStyles); + }); + + context.on('VariableDeclarator', node => { + if (!( + node.init?.type === 'AwaitExpression' + && node.init.argument.type === 'ImportExpression' + )) { + return; + } + + const assignmentTargetNode = node.id; + const moduleNameNode = node.init.argument.source; + const moduleName = getStringIfConstant(moduleNameNode, sourceCode.getScope(moduleNameNode)); + + if (!moduleName) { + return; + } + + const allowedImportStyles = styles.get(moduleName); + const actualImportStyles = getActualAssignmentTargetImportStyles(assignmentTargetNode); + + report(node, moduleName, actualImportStyles, allowedImportStyles); + }); + } + + if (checkExportFrom) { + context.on('ExportAllDeclaration', node => { + const moduleName = getStringIfConstant(node.source, sourceCode.getScope(node.source)); + + const allowedImportStyles = styles.get(moduleName); + const actualImportStyles = ['namespace']; + + report(node, moduleName, actualImportStyles, allowedImportStyles); + }); + + context.on('ExportNamedDeclaration', node => { + const moduleName = getStringIfConstant(node.source, sourceCode.getScope(node.source)); + + const allowedImportStyles = styles.get(moduleName); + const actualImportStyles = getActualExportDeclarationStyles(node); + + report(node, moduleName, actualImportStyles, allowedImportStyles); + }); + } + + if (checkRequire) { + context.on('CallExpression', node => { + if (!( + isCallExpression(node, { + name: 'require', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && (node.parent.type === 'ExpressionStatement' && node.parent.expression === node) + )) { + return; + } + + const moduleName = getStringIfConstant(node.arguments[0], sourceCode.getScope(node.arguments[0])); + const allowedImportStyles = styles.get(moduleName); + const actualImportStyles = ['unassigned']; + + report(node, moduleName, actualImportStyles, allowedImportStyles, true); + }); + + context.on('VariableDeclarator', node => { + if (!( + node.init?.type === 'CallExpression' + && node.init.callee.type === 'Identifier' + && node.init.callee.name === 'require' + )) { + return; + } + + const assignmentTargetNode = node.id; + const moduleNameNode = node.init.arguments[0]; + const moduleName = getStringIfConstant(moduleNameNode, sourceCode.getScope(moduleNameNode)); + + if (!moduleName) { + return; + } + + const allowedImportStyles = styles.get(moduleName); + const actualImportStyles = getActualAssignmentTargetImportStyles(assignmentTargetNode); + + report(node, moduleName, actualImportStyles, allowedImportStyles, true); + }); + } +}; + +const schema = { + type: 'array', + additionalItems: false, + items: [ + { + type: 'object', + additionalProperties: false, + properties: { + checkImport: { + type: 'boolean', + }, + checkDynamicImport: { + type: 'boolean', + }, + checkExportFrom: { + type: 'boolean', + }, + checkRequire: { + type: 'boolean', + }, + extendDefaultStyles: { + type: 'boolean', + }, + styles: { + $ref: '#/definitions/moduleStyles', + }, + }, + }, + ], + definitions: { + moduleStyles: { + type: 'object', + additionalProperties: { + $ref: '#/definitions/styles', + }, + }, + styles: { + anyOf: [ + { + enum: [ + false, + ], + }, + { + $ref: '#/definitions/booleanObject', + }, + ], + }, + booleanObject: { + type: 'object', + additionalProperties: { + type: 'boolean', + }, + }, + }, +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Enforce specific import styles per module.', + recommended: true, + }, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/new-for-builtins.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/new-for-builtins.js new file mode 100644 index 0000000000000000000000000000000000000000..b60844653df9a317c413b6ccf28308924fe5f3c8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/new-for-builtins.js @@ -0,0 +1,86 @@ +'use strict'; +const {GlobalReferenceTracker} = require('./utils/global-reference-tracker.js'); +const builtins = require('./utils/builtins.js'); +const { + switchCallExpressionToNewExpression, + switchNewExpressionToCallExpression, +} = require('./fix/index.js'); + +const messages = { + enforce: 'Use `new {{name}}()` instead of `{{name}}()`.', + disallow: 'Use `{{name}}()` instead of `new {{name}}()`.', +}; + +function enforceNewExpression({node, path: [name]}, sourceCode) { + if (name === 'Object') { + const {parent} = node; + if ( + parent.type === 'BinaryExpression' + && (parent.operator === '===' || parent.operator === '!==') + && (parent.left === node || parent.right === node) + ) { + return; + } + } + + return { + node, + messageId: 'enforce', + data: {name}, + fix: fixer => switchCallExpressionToNewExpression(node, sourceCode, fixer), + }; +} + +function enforceCallExpression({node, path: [name]}, sourceCode) { + const problem = { + node, + messageId: 'disallow', + data: {name}, + }; + + if (name !== 'String' && name !== 'Boolean' && name !== 'Number') { + problem.fix = function * (fixer) { + yield * switchNewExpressionToCallExpression(node, sourceCode, fixer); + }; + } + + return problem; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + const newExpressionTracker = new GlobalReferenceTracker({ + objects: builtins.disallowNew, + type: GlobalReferenceTracker.CONSTRUCT, + handle: reference => enforceCallExpression(reference, sourceCode), + }); + const callExpressionTracker = new GlobalReferenceTracker({ + objects: builtins.enforceNew, + type: GlobalReferenceTracker.CALL, + handle: reference => enforceNewExpression(reference, sourceCode), + }); + + return { + * 'Program:exit'(program) { + const scope = sourceCode.getScope(program); + + yield * newExpressionTracker.track(scope); + yield * callExpressionTracker.track(scope); + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce the use of `new` for all builtins, except `String`, `Number`, `Boolean`, `Symbol` and `BigInt`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-abusive-eslint-disable.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-abusive-eslint-disable.js new file mode 100644 index 0000000000000000000000000000000000000000..9bd759e041ba9e63bf55ecda5ad35f7ea4b78890 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-abusive-eslint-disable.js @@ -0,0 +1,49 @@ +'use strict'; + +const MESSAGE_ID = 'no-abusive-eslint-disable'; +const messages = { + [MESSAGE_ID]: 'Specify the rules you want to disable.', +}; + +const disableRegex = /^eslint-disable(?:-next-line|-line)?(?$|(?:\s+(?:@(?:[\w-]+\/){1,2})?[\w-]+)?)/; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + * Program(node) { + for (const comment of node.comments) { + const value = comment.value.trim(); + const result = disableRegex.exec(value); + + if ( + result // It's a eslint-disable comment + && !result.groups.ruleId // But it did not specify any rules + ) { + yield { + // Can't set it at the given location as the warning + // will be ignored due to the disable comment + loc: { + start: { + ...comment.loc.start, + column: -1, + }, + end: comment.loc.end, + }, + messageId: MESSAGE_ID, + }; + } + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce specifying rules to disable in `eslint-disable` comments.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-anonymous-default-export.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-anonymous-default-export.js new file mode 100644 index 0000000000000000000000000000000000000000..3fe29706eaacac21d9afa98b50ea47b25ede791b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-anonymous-default-export.js @@ -0,0 +1,213 @@ +'use strict'; + +const path = require('node:path'); +const { + getFunctionHeadLocation, + getFunctionNameWithKind, + isOpeningParenToken, +} = require('@eslint-community/eslint-utils'); +const { + isIdentifierName, +} = require('@babel/helper-validator-identifier'); +const getClassHeadLocation = require('./utils/get-class-head-location.js'); +const {upperFirst, camelCase} = require('./utils/lodash.js'); +const {getParenthesizedRange} = require('./utils/parentheses.js'); +const { + getScopes, + avoidCapture, +} = require('./utils/index.js'); +const {isMemberExpression} = require('./ast/index.js'); + +const MESSAGE_ID_ERROR = 'no-anonymous-default-export/error'; +const MESSAGE_ID_SUGGESTION = 'no-anonymous-default-export/suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'The {{description}} should be named.', + [MESSAGE_ID_SUGGESTION]: 'Name it as `{{name}}`.', +}; + +const isClassKeywordToken = token => token.type === 'Keyword' && token.value === 'class'; +const isAnonymousClassOrFunction = node => + ( + ( + node.type === 'FunctionDeclaration' + || node.type === 'FunctionExpression' + || node.type === 'ClassDeclaration' + || node.type === 'ClassExpression' + ) + && !node.id + ) + || node.type === 'ArrowFunctionExpression'; + +function getSuggestionName(node, filename, sourceCode) { + if (filename === '' || filename === '') { + return; + } + + let [name] = path.basename(filename).split('.'); + name = camelCase(name); + + if (!isIdentifierName(name)) { + return; + } + + name = node.type === 'ClassDeclaration' || node.type === 'ClassExpression' ? upperFirst(name) : name; + name = avoidCapture(name, getScopes(sourceCode.getScope(node))); + + return name; +} + +function addName(fixer, node, name, sourceCode) { + switch (node.type) { + case 'ClassDeclaration': + case 'ClassExpression': { + const lastDecorator = node.decorators?.at(-1); + const classToken = lastDecorator + ? sourceCode.getTokenAfter(lastDecorator, isClassKeywordToken) + : sourceCode.getFirstToken(node, isClassKeywordToken); + return fixer.insertTextAfter(classToken, ` ${name}`); + } + + case 'FunctionDeclaration': + case 'FunctionExpression': { + const openingParenthesisToken = sourceCode.getFirstToken( + node, + isOpeningParenToken, + ); + return fixer.insertTextBefore( + openingParenthesisToken, + `${sourceCode.text.charAt(openingParenthesisToken.range[0] - 1) === ' ' ? '' : ' '}${name} `, + ); + } + + case 'ArrowFunctionExpression': { + const [exportDeclarationStart, exportDeclarationEnd] + = node.parent.type === 'ExportDefaultDeclaration' + ? node.parent.range + : node.parent.parent.range; + const [arrowFunctionStart, arrowFunctionEnd] = getParenthesizedRange(node, sourceCode); + + let textBefore = sourceCode.text.slice(exportDeclarationStart, arrowFunctionStart); + let textAfter = sourceCode.text.slice(arrowFunctionEnd, exportDeclarationEnd); + + textBefore = `\n${textBefore}`; + if (!/\s$/.test(textBefore)) { + textBefore = `${textBefore} `; + } + + if (!textAfter.endsWith(';')) { + textAfter = `${textAfter};`; + } + + return [ + fixer.replaceTextRange( + [exportDeclarationStart, arrowFunctionStart], + `const ${name} = `, + ), + fixer.replaceTextRange( + [arrowFunctionEnd, exportDeclarationEnd], + ';', + ), + fixer.insertTextAfterRange( + [exportDeclarationEnd, exportDeclarationEnd], + `${textBefore}${name}${textAfter}`, + ), + ]; + } + + // No default + } +} + +function getProblem(node, context) { + const {sourceCode, physicalFilename} = context; + + const suggestionName = getSuggestionName(node, physicalFilename, sourceCode); + + let loc; + let description; + if (node.type === 'ClassDeclaration' || node.type === 'ClassExpression') { + loc = getClassHeadLocation(node, sourceCode); + description = 'class'; + } else { + loc = getFunctionHeadLocation(node, sourceCode); + // [TODO: @fisker]: Ask `@eslint-community/eslint-utils` to expose `getFunctionKind` + const nameWithKind = getFunctionNameWithKind(node); + description = nameWithKind.replace(/ '.*?'$/, ''); + } + + const problem = { + node, + loc, + messageId: MESSAGE_ID_ERROR, + data: { + description, + }, + }; + + if (!suggestionName) { + return problem; + } + + problem.suggest = [ + { + messageId: MESSAGE_ID_SUGGESTION, + data: { + name: suggestionName, + }, + fix: fixer => addName(fixer, node, suggestionName, sourceCode), + }, + ]; + + return problem; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on('ExportDefaultDeclaration', node => { + if (!isAnonymousClassOrFunction(node.declaration)) { + return; + } + + return getProblem(node.declaration, context); + }); + + context.on('AssignmentExpression', node => { + if ( + !isAnonymousClassOrFunction(node.right) + || !( + node.parent.type === 'ExpressionStatement' + && node.parent.expression === node + ) + || !( + isMemberExpression(node.left, { + object: 'module', + property: 'exports', + computed: false, + optional: false, + }) + || ( + node.left.type === 'Identifier', + node.left.name === 'exports' + ) + ) + ) { + return; + } + + return getProblem(node.right, context); + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow anonymous functions and classes as the default export.', + recommended: true, + }, + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-callback-reference.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-callback-reference.js new file mode 100644 index 0000000000000000000000000000000000000000..6325c586cc3cdfff94466c0f5c5a14a3b1df4ff4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-callback-reference.js @@ -0,0 +1,286 @@ +'use strict'; +const {isMethodCall} = require('./ast/index.js'); +const { + isNodeMatches, + isNodeValueNotFunction, + isParenthesized, + getParenthesizedRange, + getParenthesizedText, + shouldAddParenthesesToCallExpressionCallee, +} = require('./utils/index.js'); + +const ERROR_WITH_NAME_MESSAGE_ID = 'error-with-name'; +const ERROR_WITHOUT_NAME_MESSAGE_ID = 'error-without-name'; +const REPLACE_WITH_NAME_MESSAGE_ID = 'replace-with-name'; +const REPLACE_WITHOUT_NAME_MESSAGE_ID = 'replace-without-name'; +const messages = { + [ERROR_WITH_NAME_MESSAGE_ID]: 'Do not pass function `{{name}}` directly to `.{{method}}(…)`.', + [ERROR_WITHOUT_NAME_MESSAGE_ID]: 'Do not pass function directly to `.{{method}}(…)`.', + [REPLACE_WITH_NAME_MESSAGE_ID]: 'Replace function `{{name}}` with `… => {{name}}({{parameters}})`.', + [REPLACE_WITHOUT_NAME_MESSAGE_ID]: 'Replace function with `… => …({{parameters}})`.', +}; + +const isAwaitExpressionArgument = node => node.parent.type === 'AwaitExpression' && node.parent.argument === node; + +const iteratorMethods = new Map([ + { + method: 'every', + ignore: [ + 'Boolean', + ], + }, + { + method: 'filter', + shouldIgnoreCallExpression: node => (node.callee.object.type === 'Identifier' && node.callee.object.name === 'Vue'), + ignore: [ + 'Boolean', + ], + }, + { + method: 'find', + ignore: [ + 'Boolean', + ], + }, + { + method: 'findLast', + ignore: [ + 'Boolean', + ], + }, + { + method: 'findIndex', + ignore: [ + 'Boolean', + ], + }, + { + method: 'findLastIndex', + ignore: [ + 'Boolean', + ], + }, + { + method: 'flatMap', + }, + { + method: 'forEach', + returnsUndefined: true, + }, + { + method: 'map', + shouldIgnoreCallExpression: node => (node.callee.object.type === 'Identifier' && node.callee.object.name === 'types'), + ignore: [ + 'String', + 'Number', + 'BigInt', + 'Boolean', + 'Symbol', + ], + }, + { + method: 'reduce', + parameters: [ + 'accumulator', + 'element', + 'index', + 'array', + ], + minParameters: 2, + }, + { + method: 'reduceRight', + parameters: [ + 'accumulator', + 'element', + 'index', + 'array', + ], + minParameters: 2, + }, + { + method: 'some', + ignore: [ + 'Boolean', + ], + }, +].map(({ + method, + parameters = ['element', 'index', 'array'], + ignore = [], + minParameters = 1, + returnsUndefined = false, + shouldIgnoreCallExpression, +}) => [method, { + minParameters, + parameters, + returnsUndefined, + shouldIgnoreCallExpression(callExpression) { + if ( + method !== 'reduce' + && method !== 'reduceRight' + && isAwaitExpressionArgument(callExpression) + ) { + return true; + } + + if (isNodeMatches(callExpression.callee.object, ignoredCallee)) { + return true; + } + + if ( + callExpression.callee.object.type === 'CallExpression' + && isNodeMatches(callExpression.callee.object.callee, ignoredCallee) + ) { + return true; + } + + return shouldIgnoreCallExpression?.(callExpression) ?? false; + }, + shouldIgnoreCallback(callback) { + if (callback.type === 'Identifier' && ignore.includes(callback.name)) { + return true; + } + + return false; + }, +}])); + +const ignoredCallee = [ + // http://bluebirdjs.com/docs/api/promise.map.html + 'Promise', + 'React.Children', + 'Children', + 'lodash', + 'underscore', + '_', + 'Async', + 'async', + 'this', + '$', + 'jQuery', +]; + +function getProblem(context, node, method, options) { + const {type} = node; + + const name = type === 'Identifier' ? node.name : ''; + + const problem = { + node, + messageId: name ? ERROR_WITH_NAME_MESSAGE_ID : ERROR_WITHOUT_NAME_MESSAGE_ID, + data: { + name, + method, + }, + }; + + if (node.type === 'YieldExpression' || node.type === 'AwaitExpression') { + return problem; + } + + problem.suggest = []; + + const {parameters, minParameters, returnsUndefined} = options; + for (let parameterLength = minParameters; parameterLength <= parameters.length; parameterLength++) { + const suggestionParameters = parameters.slice(0, parameterLength).join(', '); + + const suggest = { + messageId: name ? REPLACE_WITH_NAME_MESSAGE_ID : REPLACE_WITHOUT_NAME_MESSAGE_ID, + data: { + name, + parameters: suggestionParameters, + }, + fix(fixer) { + const {sourceCode} = context; + let text = getParenthesizedText(node, sourceCode); + + if ( + !isParenthesized(node, sourceCode) + && shouldAddParenthesesToCallExpressionCallee(node) + ) { + text = `(${text})`; + } + + return fixer.replaceTextRange( + getParenthesizedRange(node, sourceCode), + returnsUndefined + ? `(${suggestionParameters}) => { ${text}(${suggestionParameters}); }` + : `(${suggestionParameters}) => ${text}(${suggestionParameters})`, + ); + }, + }; + + problem.suggest.push(suggest); + } + + return problem; +} + +function * getTernaryConsequentAndALternate(node) { + if (node.type === 'ConditionalExpression') { + yield * getTernaryConsequentAndALternate(node.consequent); + yield * getTernaryConsequentAndALternate(node.alternate); + return; + } + + yield node; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + * CallExpression(callExpression) { + if ( + !isMethodCall(callExpression, { + minimumArguments: 1, + maximumArguments: 2, + optionalCall: false, + optionalMember: false, + computed: false, + }) + || callExpression.callee.property.type !== 'Identifier' + ) { + return; + } + + const methodNode = callExpression.callee.property; + const methodName = methodNode.name; + if (!iteratorMethods.has(methodName)) { + return; + } + + const options = iteratorMethods.get(methodName); + if (options.shouldIgnoreCallExpression(callExpression)) { + return; + } + + for (const callback of getTernaryConsequentAndALternate(callExpression.arguments[0])) { + if ( + callback.type === 'FunctionExpression' + || callback.type === 'ArrowFunctionExpression' + // Ignore all `CallExpression`s include `function.bind()` + || callback.type === 'CallExpression' + || options.shouldIgnoreCallback(callback) + || isNodeValueNotFunction(callback) + ) { + continue; + } + + yield getProblem(context, callback, methodName, options); + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Prevent passing a function reference directly to iterator methods.', + recommended: true, + }, + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-for-each.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-for-each.js new file mode 100644 index 0000000000000000000000000000000000000000..025ffff593cf70b43a64ec8fe603228d438eae51 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-for-each.js @@ -0,0 +1,484 @@ +'use strict'; +const { + isParenthesized, + isCommaToken, + isSemicolonToken, + isClosingParenToken, + findVariable, + hasSideEffect, +} = require('@eslint-community/eslint-utils'); +const {extendFixRange} = require('./fix/index.js'); +const needsSemicolon = require('./utils/needs-semicolon.js'); +const shouldAddParenthesesToExpressionStatementExpression = require('./utils/should-add-parentheses-to-expression-statement-expression.js'); +const shouldAddParenthesesToMemberExpressionObject = require('./utils/should-add-parentheses-to-member-expression-object.js'); +const {getParentheses, getParenthesizedRange} = require('./utils/parentheses.js'); +const isFunctionSelfUsedInside = require('./utils/is-function-self-used-inside.js'); +const {isNodeMatches} = require('./utils/is-node-matches.js'); +const assertToken = require('./utils/assert-token.js'); +const {fixSpaceAroundKeyword, removeParentheses} = require('./fix/index.js'); +const {isArrowFunctionBody, isMethodCall, isReferenceIdentifier, functionTypes} = require('./ast/index.js'); + +const MESSAGE_ID_ERROR = 'no-array-for-each/error'; +const MESSAGE_ID_SUGGESTION = 'no-array-for-each/suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Use `for…of` instead of `.forEach(…)`.', + [MESSAGE_ID_SUGGESTION]: 'Switch to `for…of`.', +}; + +const continueAbleNodeTypes = new Set([ + 'WhileStatement', + 'DoWhileStatement', + 'ForStatement', + 'ForOfStatement', + 'ForInStatement', +]); + +const stripChainExpression = node => + (node.parent.type === 'ChainExpression' && node.parent.expression === node) + ? node.parent + : node; + +function isReturnStatementInContinueAbleNodes(returnStatement, callbackFunction) { + for (let node = returnStatement; node && node !== callbackFunction; node = node.parent) { + if (continueAbleNodeTypes.has(node.type)) { + return true; + } + } + + return false; +} + +function shouldSwitchReturnStatementToBlockStatement(returnStatement) { + const {parent} = returnStatement; + + switch (parent.type) { + case 'IfStatement': { + return parent.consequent === returnStatement || parent.alternate === returnStatement; + } + + // These parent's body need switch to `BlockStatement` too, but since they are "continueAble", won't fix + // case 'ForStatement': + // case 'ForInStatement': + // case 'ForOfStatement': + // case 'WhileStatement': + // case 'DoWhileStatement': + case 'WithStatement': { + return parent.body === returnStatement; + } + + default: { + return false; + } + } +} + +function getFixFunction(callExpression, functionInfo, context) { + const {sourceCode} = context; + const [callback] = callExpression.arguments; + const parameters = callback.params; + const iterableObject = callExpression.callee.object; + const {returnStatements} = functionInfo.get(callback); + const isOptionalObject = callExpression.callee.optional; + const ancestor = stripChainExpression(callExpression).parent; + const objectText = sourceCode.getText(iterableObject); + + const getForOfLoopHeadText = () => { + const [elementText, indexText] = parameters.map(parameter => sourceCode.getText(parameter)); + const shouldUseEntries = parameters.length === 2; + + let text = 'for ('; + text += isFunctionParameterVariableReassigned(callback, sourceCode) ? 'let' : 'const'; + text += ' '; + text += shouldUseEntries ? `[${indexText}, ${elementText}]` : elementText; + text += ' of '; + + const shouldAddParenthesesToObject + = isParenthesized(iterableObject, sourceCode) + || ( + // `1?.forEach()` -> `(1).entries()` + isOptionalObject + && shouldUseEntries + && shouldAddParenthesesToMemberExpressionObject(iterableObject, sourceCode) + ); + + text += shouldAddParenthesesToObject ? `(${objectText})` : objectText; + + if (shouldUseEntries) { + text += '.entries()'; + } + + text += ') '; + + return text; + }; + + const getForOfLoopHeadRange = () => { + const [start] = callExpression.range; + const [end] = getParenthesizedRange(callback.body, sourceCode); + return [start, end]; + }; + + function * replaceReturnStatement(returnStatement, fixer) { + const returnToken = sourceCode.getFirstToken(returnStatement); + assertToken(returnToken, { + expected: 'return', + ruleId: 'no-array-for-each', + }); + + if (!returnStatement.argument) { + yield fixer.replaceText(returnToken, 'continue'); + return; + } + + // Remove `return` + yield fixer.remove(returnToken); + + const previousToken = sourceCode.getTokenBefore(returnToken); + const nextToken = sourceCode.getTokenAfter(returnToken); + let textBefore = ''; + let textAfter = ''; + const shouldAddParentheses + = !isParenthesized(returnStatement.argument, sourceCode) + && shouldAddParenthesesToExpressionStatementExpression(returnStatement.argument); + if (shouldAddParentheses) { + textBefore = `(${textBefore}`; + textAfter = `${textAfter})`; + } + + const insertBraces = shouldSwitchReturnStatementToBlockStatement(returnStatement); + if (insertBraces) { + textBefore = `{ ${textBefore}`; + } else if (needsSemicolon(previousToken, sourceCode, shouldAddParentheses ? '(' : nextToken.value)) { + textBefore = `;${textBefore}`; + } + + if (textBefore) { + yield fixer.insertTextBefore(nextToken, textBefore); + } + + if (textAfter) { + yield fixer.insertTextAfter(returnStatement.argument, textAfter); + } + + const returnStatementHasSemicolon = isSemicolonToken(sourceCode.getLastToken(returnStatement)); + if (!returnStatementHasSemicolon) { + yield fixer.insertTextAfter(returnStatement, ';'); + } + + yield fixer.insertTextAfter(returnStatement, ' continue;'); + + if (insertBraces) { + yield fixer.insertTextAfter(returnStatement, ' }'); + } + } + + const shouldRemoveExpressionStatementLastToken = token => { + if (!isSemicolonToken(token)) { + return false; + } + + if (callback.body.type !== 'BlockStatement') { + return false; + } + + return true; + }; + + function * removeCallbackParentheses(fixer) { + // Opening parenthesis tokens already included in `getForOfLoopHeadRange` + const closingParenthesisTokens = getParentheses(callback, sourceCode) + .filter(token => isClosingParenToken(token)); + + for (const closingParenthesisToken of closingParenthesisTokens) { + yield fixer.remove(closingParenthesisToken); + } + } + + return function * (fixer) { + // `(( foo.forEach(bar => bar) ))` + yield * removeParentheses(callExpression, fixer, sourceCode); + + // Replace these with `for (const … of …) ` + // foo.forEach(bar => bar) + // ^^^^^^^^^^^^^^^^^^^^^^ + // foo.forEach(bar => (bar)) + // ^^^^^^^^^^^^^^^^^^^^^^ + // foo.forEach(bar => {}) + // ^^^^^^^^^^^^^^^^^^^^^^ + // foo.forEach(function(bar) {}) + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + yield fixer.replaceTextRange(getForOfLoopHeadRange(), getForOfLoopHeadText()); + + // Parenthesized callback function + // foo.forEach( ((bar => {})) ) + // ^^ + yield * removeCallbackParentheses(fixer); + + const [ + penultimateToken, + lastToken, + ] = sourceCode.getLastTokens(callExpression, 2); + + // The possible trailing comma token of `Array#forEach()` CallExpression + // foo.forEach(bar => {},) + // ^ + if (isCommaToken(penultimateToken)) { + yield fixer.remove(penultimateToken); + } + + // The closing parenthesis token of `Array#forEach()` CallExpression + // foo.forEach(bar => {}) + // ^ + yield fixer.remove(lastToken); + + for (const returnStatement of returnStatements) { + yield * replaceReturnStatement(returnStatement, fixer); + } + + if (ancestor.type === 'ExpressionStatement') { + const expressionStatementLastToken = sourceCode.getLastToken(ancestor); + // Remove semicolon if it's not needed anymore + // foo.forEach(bar => {}); + // ^ + if (shouldRemoveExpressionStatementLastToken(expressionStatementLastToken)) { + yield fixer.remove(expressionStatementLastToken, fixer); + } + } else if (ancestor.type === 'ArrowFunctionExpression') { + yield fixer.insertTextBefore(callExpression, '{ '); + yield fixer.insertTextAfter(callExpression, ' }'); + } + + yield * fixSpaceAroundKeyword(fixer, callExpression.parent, sourceCode); + + if (isOptionalObject) { + yield fixer.insertTextBefore(callExpression, `if (${objectText}) `); + } + + // Prevent possible variable conflicts + yield * extendFixRange(fixer, callExpression.parent.range); + }; +} + +const isChildScope = (child, parent) => { + for (let scope = child; scope; scope = scope.upper) { + if (scope === parent) { + return true; + } + } + + return false; +}; + +function isFunctionParametersSafeToFix(callbackFunction, {sourceCode, scope, callExpression, allIdentifiers}) { + const variables = sourceCode.getDeclaredVariables(callbackFunction); + + for (const variable of variables) { + if (variable.defs.length !== 1) { + return false; + } + + const [definition] = variable.defs; + if (definition.type !== 'Parameter') { + continue; + } + + const variableName = definition.name.name; + const [callExpressionStart, callExpressionEnd] = callExpression.range; + for (const identifier of allIdentifiers) { + const {name, range: [start, end]} = identifier; + if ( + name !== variableName + || start < callExpressionStart + || end > callExpressionEnd + ) { + continue; + } + + const variable = findVariable(scope, identifier); + if (!variable || variable.scope === scope || isChildScope(scope, variable.scope)) { + return false; + } + } + } + + return true; +} + +function isFunctionParameterVariableReassigned(callbackFunction, sourceCode) { + return sourceCode.getDeclaredVariables(callbackFunction) + .filter(variable => variable.defs[0].type === 'Parameter') + .some(variable => + variable.references.some(reference => !reference.init && reference.isWrite()), + ); +} + +function isFixable(callExpression, {scope, functionInfo, allIdentifiers, sourceCode}) { + // Check `CallExpression` + if (callExpression.optional || callExpression.arguments.length !== 1) { + return false; + } + + // Check ancestors, we only fix `ExpressionStatement` + const callOrChainExpression = stripChainExpression(callExpression); + if ( + callOrChainExpression.parent.type !== 'ExpressionStatement' + && !isArrowFunctionBody(callOrChainExpression) + ) { + return false; + } + + // Check `CallExpression.arguments[0]`; + const [callback] = callExpression.arguments; + if ( + // Leave non-function type to `no-array-callback-reference` rule + (callback.type !== 'FunctionExpression' && callback.type !== 'ArrowFunctionExpression') + || callback.async + || callback.generator + ) { + return false; + } + + // Check `callback.params` + const parameters = callback.params; + if ( + !(parameters.length === 1 || parameters.length === 2) + // `array.forEach((element = defaultValue) => {})` + || (parameters.length === 1 && parameters[0].type === 'AssignmentPattern') + // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1814 + || (parameters.length === 2 && parameters[1].type !== 'Identifier') + || parameters.some(({type, typeAnnotation}) => type === 'RestElement' || typeAnnotation) + || !isFunctionParametersSafeToFix(callback, { + scope, + callExpression, + allIdentifiers, + sourceCode, + }) + ) { + return false; + } + + // Check `ReturnStatement`s in `callback` + const {returnStatements, scope: callbackScope} = functionInfo.get(callback); + if (returnStatements.some(returnStatement => isReturnStatementInContinueAbleNodes(returnStatement, callback))) { + return false; + } + + if (isFunctionSelfUsedInside(callback, callbackScope)) { + return false; + } + + return true; +} + +const ignoredObjects = [ + 'React.Children', + 'Children', + 'R', + // https://www.npmjs.com/package/p-iteration + 'pIteration', +]; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const functionStack = []; + const callExpressions = []; + const allIdentifiers = []; + const functionInfo = new Map(); + const {sourceCode} = context; + + context.on(functionTypes, node => { + functionStack.push(node); + functionInfo.set(node, { + returnStatements: [], + scope: sourceCode.getScope(node), + }); + }); + + context.onExit(functionTypes, () => { + functionStack.pop(); + }); + + context.on('Identifier', node => { + if (isReferenceIdentifier(node)) { + allIdentifiers.push(node); + } + }); + + context.on('ReturnStatement', node => { + const currentFunction = functionStack.at(-1); + if (!currentFunction) { + return; + } + + const {returnStatements} = functionInfo.get(currentFunction); + returnStatements.push(node); + }); + + context.on('CallExpression', node => { + if ( + !isMethodCall(node, { + method: 'forEach', + }) + || isNodeMatches(node.callee.object, ignoredObjects) + ) { + return; + } + + callExpressions.push({ + node, + scope: sourceCode.getScope(node), + }); + }); + + context.onExit('Program', function * () { + for (const {node, scope} of callExpressions) { + const iterable = node.callee; + + const problem = { + node: iterable.property, + messageId: MESSAGE_ID_ERROR, + }; + + if (!isFixable(node, { + scope, + allIdentifiers, + functionInfo, + sourceCode, + })) { + yield problem; + continue; + } + + const shouldUseSuggestion = iterable.optional && hasSideEffect(iterable, sourceCode); + const fix = getFixFunction(node, functionInfo, context); + + if (shouldUseSuggestion) { + problem.suggest = [ + { + messageId: MESSAGE_ID_SUGGESTION, + fix, + }, + ]; + } else { + problem.fix = fix; + } + + yield problem; + } + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `for…of` over the `forEach` method.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-method-this-argument.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-method-this-argument.js new file mode 100644 index 0000000000000000000000000000000000000000..ee50d3a586f6242be70102bd79e1c90bcb944193 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-method-this-argument.js @@ -0,0 +1,225 @@ +'use strict'; +const {hasSideEffect} = require('@eslint-community/eslint-utils'); +const {removeArgument} = require('./fix/index.js'); +const {getParentheses, getParenthesizedText} = require('./utils/parentheses.js'); +const shouldAddParenthesesToMemberExpressionObject = require('./utils/should-add-parentheses-to-member-expression-object.js'); +const {isNodeMatches} = require('./utils/is-node-matches.js'); +const {isNodeValueNotFunction} = require('./utils/index.js'); +const {isMethodCall} = require('./ast/index.js'); + +const ERROR_PROTOTYPE_METHOD = 'error-prototype-method'; +const ERROR_STATIC_METHOD = 'error-static-method'; +const SUGGESTION_BIND = 'suggestion-bind'; +const SUGGESTION_REMOVE = 'suggestion-remove'; +const messages = { + [ERROR_PROTOTYPE_METHOD]: 'Do not use the `this` argument in `Array#{{method}}()`.', + [ERROR_STATIC_METHOD]: 'Do not use the `this` argument in `Array.{{method}}()`.', + [SUGGESTION_REMOVE]: 'Remove this argument.', + [SUGGESTION_BIND]: 'Use a bound function.', +}; + +const ignored = [ + 'lodash.every', + '_.every', + 'underscore.every', + + 'lodash.filter', + '_.filter', + 'underscore.filter', + 'Vue.filter', + 'R.filter', + + 'lodash.find', + '_.find', + 'underscore.find', + 'R.find', + + 'lodash.findLast', + '_.findLast', + 'underscore.findLast', + 'R.findLast', + + 'lodash.findIndex', + '_.findIndex', + 'underscore.findIndex', + 'R.findIndex', + + 'lodash.findLastIndex', + '_.findLastIndex', + 'underscore.findLastIndex', + 'R.findLastIndex', + + 'lodash.flatMap', + '_.flatMap', + + 'lodash.forEach', + '_.forEach', + 'React.Children.forEach', + 'Children.forEach', + 'R.forEach', + + 'lodash.map', + '_.map', + 'underscore.map', + 'React.Children.map', + 'Children.map', + 'jQuery.map', + '$.map', + 'R.map', + + 'lodash.some', + '_.some', + 'underscore.some', +]; + +function removeThisArgument(thisArgumentNode, sourceCode) { + return fixer => removeArgument(fixer, thisArgumentNode, sourceCode); +} + +function useBoundFunction(callbackNode, thisArgumentNode, sourceCode) { + return function * (fixer) { + yield removeThisArgument(thisArgumentNode, sourceCode)(fixer); + + const callbackParentheses = getParentheses(callbackNode, sourceCode); + const isParenthesized = callbackParentheses.length > 0; + const callbackLastToken = isParenthesized + ? callbackParentheses.at(-1) + : callbackNode; + if ( + !isParenthesized + && shouldAddParenthesesToMemberExpressionObject(callbackNode, sourceCode) + ) { + yield fixer.insertTextBefore(callbackLastToken, '('); + yield fixer.insertTextAfter(callbackLastToken, ')'); + } + + const thisArgumentText = getParenthesizedText(thisArgumentNode, sourceCode); + // `thisArgument` was a argument, no need add extra parentheses + yield fixer.insertTextAfter(callbackLastToken, `.bind(${thisArgumentText})`); + }; +} + +function getProblem({ + sourceCode, + callExpression, + callbackNode, + thisArgumentNode, + messageId, +}) { + const problem = { + node: thisArgumentNode, + messageId, + data: { + method: callExpression.callee.property.name, + }, + }; + + const isArrowCallback = callbackNode.type === 'ArrowFunctionExpression'; + if (isArrowCallback) { + const thisArgumentHasSideEffect = hasSideEffect(thisArgumentNode, sourceCode); + if (thisArgumentHasSideEffect) { + problem.suggest = [ + { + messageId: SUGGESTION_REMOVE, + fix: removeThisArgument(thisArgumentNode, sourceCode), + }, + ]; + } else { + problem.fix = removeThisArgument(thisArgumentNode, sourceCode); + } + + return problem; + } + + problem.suggest = [ + { + messageId: SUGGESTION_REMOVE, + fix: removeThisArgument(thisArgumentNode, sourceCode), + }, + { + messageId: SUGGESTION_BIND, + fix: useBoundFunction(callbackNode, thisArgumentNode, sourceCode), + }, + ]; + + return problem; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + // Prototype methods + context.on('CallExpression', callExpression => { + if ( + !isMethodCall(callExpression, { + methods: [ + 'every', + 'filter', + 'find', + 'findLast', + 'findIndex', + 'findLastIndex', + 'flatMap', + 'forEach', + 'map', + 'some', + ], + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + }) + || isNodeMatches(callExpression.callee, ignored) + || isNodeValueNotFunction(callExpression.arguments[0]) + ) { + return; + } + + return getProblem({ + sourceCode, + callExpression, + callbackNode: callExpression.arguments[0], + thisArgumentNode: callExpression.arguments[1], + messageId: ERROR_PROTOTYPE_METHOD, + }); + }); + + // `Array.from()` and `Array.fromAsync()` + context.on('CallExpression', callExpression => { + if ( + !isMethodCall(callExpression, { + object: 'Array', + methods: ['from', 'fromAsync'], + argumentsLength: 3, + optionalCall: false, + optionalMember: false, + }) + || isNodeValueNotFunction(callExpression.arguments[1]) + ) { + return; + } + + return getProblem({ + sourceCode, + callExpression, + callbackNode: callExpression.arguments[1], + thisArgumentNode: callExpression.arguments[2], + messageId: ERROR_STATIC_METHOD, + }); + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow using the `this` argument in array methods.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-push-push.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-push-push.js new file mode 100644 index 0000000000000000000000000000000000000000..96c2719b08174392c97c1914ab067400a57a71f9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-push-push.js @@ -0,0 +1,152 @@ +'use strict'; +const {hasSideEffect, isSemicolonToken} = require('@eslint-community/eslint-utils'); +const { + getCallExpressionTokens, + getCallExpressionArgumentsText, +} = require('./utils/index.js'); +const isSameReference = require('./utils/is-same-reference.js'); +const {isNodeMatches} = require('./utils/is-node-matches.js'); +const getPreviousNode = require('./utils/get-previous-node.js'); +const {isMethodCall} = require('./ast/index.js'); + +const ERROR = 'error'; +const SUGGESTION = 'suggestion'; +const messages = { + [ERROR]: 'Do not call `Array#push()` multiple times.', + [SUGGESTION]: 'Merge with previous one.', +}; + +const isArrayPushCall = node => + node + && node.parent.type === 'ExpressionStatement' + && node.parent.expression === node + && isMethodCall(node, { + method: 'push', + optionalCall: false, + optionalMember: false, + }); + +function getFirstArrayPushCall(secondCall, sourceCode) { + const firstCall = getPreviousNode(secondCall.parent, sourceCode)?.expression; + if (isArrayPushCall(firstCall)) { + return firstCall; + } +} + +function create(context) { + const {ignore} = { + ignore: [], + ...context.options[0], + }; + const ignoredObjects = [ + 'stream', + 'this', + 'this.stream', + 'process.stdin', + 'process.stdout', + 'process.stderr', + ...ignore, + ]; + const {sourceCode} = context; + + return { + CallExpression(secondCall) { + if (!isArrayPushCall(secondCall)) { + return; + } + + const secondCallArray = secondCall.callee.object; + + if (isNodeMatches(secondCallArray, ignoredObjects)) { + return; + } + + const firstCall = getFirstArrayPushCall(secondCall, sourceCode); + if (!firstCall) { + return; + } + + const firstCallArray = firstCall.callee.object; + + // Not same array + if (!isSameReference(firstCallArray, secondCallArray)) { + return; + } + + const secondCallArguments = secondCall.arguments; + const problem = { + node: secondCall.callee.property, + messageId: ERROR, + }; + + const fix = function * (fixer) { + if (secondCallArguments.length > 0) { + const text = getCallExpressionArgumentsText(sourceCode, secondCall); + + const { + trailingCommaToken, + closingParenthesisToken, + } = getCallExpressionTokens(sourceCode, firstCall); + + yield ( + trailingCommaToken + ? fixer.insertTextAfter(trailingCommaToken, ` ${text}`) + : fixer.insertTextBefore(closingParenthesisToken, firstCall.arguments.length > 0 ? `, ${text}` : text) + ); + } + + const firstExpression = firstCall.parent; + const secondExpression = secondCall.parent; + const shouldKeepSemicolon = !isSemicolonToken(sourceCode.getLastToken(firstExpression)) + && isSemicolonToken(sourceCode.getLastToken(secondExpression)); + + yield fixer.replaceTextRange( + [firstExpression.range[1], secondExpression.range[1]], + shouldKeepSemicolon ? ';' : '', + ); + }; + + if (secondCallArguments.some(element => hasSideEffect(element, sourceCode))) { + problem.suggest = [ + { + messageId: SUGGESTION, + fix, + }, + ]; + } else { + problem.fix = fix; + } + + return problem; + }, + }; +} + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + ignore: { + type: 'array', + uniqueItems: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce combining multiple `Array#push()` into one call.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-reduce.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-reduce.js new file mode 100644 index 0000000000000000000000000000000000000000..c401c08ef248fe284db3d1b320e79b6b6857d105 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-array-reduce.js @@ -0,0 +1,128 @@ +'use strict'; +const {isMethodCall} = require('./ast/index.js'); +const {isNodeValueNotFunction, isArrayPrototypeProperty} = require('./utils/index.js'); + +const MESSAGE_ID_REDUCE = 'reduce'; +const MESSAGE_ID_REDUCE_RIGHT = 'reduceRight'; +const messages = { + [MESSAGE_ID_REDUCE]: '`Array#reduce()` is not allowed. Prefer other types of loop for readability.', + [MESSAGE_ID_REDUCE_RIGHT]: '`Array#reduceRight()` is not allowed. Prefer other types of loop for readability. You may want to call `Array#toReversed()` before looping it.', +}; + +const cases = [ + // `array.{reduce,reduceRight}()` + { + test: callExpression => + isMethodCall(callExpression, { + methods: ['reduce', 'reduceRight'], + minimumArguments: 1, + maximumArguments: 2, + optionalCall: false, + optionalMember: false, + }) + && !isNodeValueNotFunction(callExpression.arguments[0]), + getMethodNode: callExpression => callExpression.callee.property, + isSimpleOperation(callExpression) { + const [callback] = callExpression.arguments; + + return ( + callback + && ( + // `array.reduce((accumulator, element) => accumulator + element)` + (callback.type === 'ArrowFunctionExpression' && callback.body.type === 'BinaryExpression') + // `array.reduce((accumulator, element) => {return accumulator + element;})` + // `array.reduce(function (accumulator, element){return accumulator + element;})` + || ( + (callback.type === 'ArrowFunctionExpression' || callback.type === 'FunctionExpression') + && callback.body.type === 'BlockStatement' + && callback.body.body.length === 1 + && callback.body.body[0].type === 'ReturnStatement' + && callback.body.body[0].argument.type === 'BinaryExpression' + ) + ) + ); + }, + }, + // `[].{reduce,reduceRight}.call()` and `Array.{reduce,reduceRight}.call()` + { + test: callExpression => + isMethodCall(callExpression, { + method: 'call', + optionalCall: false, + optionalMember: false, + }) + && isArrayPrototypeProperty(callExpression.callee.object, { + properties: ['reduce', 'reduceRight'], + }) + && ( + !callExpression.arguments[1] + || !isNodeValueNotFunction(callExpression.arguments[1]) + ), + getMethodNode: callExpression => callExpression.callee.object.property, + }, + // `[].{reduce,reduceRight}.apply()` and `Array.{reduce,reduceRight}.apply()` + { + test: callExpression => + isMethodCall(callExpression, { + method: 'apply', + optionalCall: false, + optionalMember: false, + }) + && isArrayPrototypeProperty(callExpression.callee.object, { + properties: ['reduce', 'reduceRight'], + }), + getMethodNode: callExpression => callExpression.callee.object.property, + }, +]; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + allowSimpleOperations: { + type: 'boolean', + default: true, + }, + }, + }, +]; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {allowSimpleOperations} = {allowSimpleOperations: true, ...context.options[0]}; + + return { + * CallExpression(callExpression) { + for (const {test, getMethodNode, isSimpleOperation} of cases) { + if (!test(callExpression)) { + continue; + } + + if (allowSimpleOperations && isSimpleOperation?.(callExpression)) { + continue; + } + + const methodNode = getMethodNode(callExpression); + yield { + node: methodNode, + messageId: methodNode.name, + }; + } + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow `Array#reduce()` and `Array#reduceRight()`.', + recommended: true, + }, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-await-expression-member.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-await-expression-member.js new file mode 100644 index 0000000000000000000000000000000000000000..c7cfd8206caf2b45a851b709aee68e68b952ff35 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-await-expression-member.js @@ -0,0 +1,91 @@ +'use strict'; +const { + removeParentheses, + removeMemberExpressionProperty, +} = require('./fix/index.js'); +const {isLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'no-await-expression-member'; +const messages = { + [MESSAGE_ID]: 'Do not access a member directly from an await expression.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + return { + MemberExpression(memberExpression) { + if (memberExpression.object.type !== 'AwaitExpression') { + return; + } + + const {property} = memberExpression; + const problem = { + node: property, + messageId: MESSAGE_ID, + }; + + // `const foo = (await bar)[0]` + if ( + memberExpression.computed + && !memberExpression.optional + && (isLiteral(property, 0) || isLiteral(property, 1)) + && memberExpression.parent.type === 'VariableDeclarator' + && memberExpression.parent.init === memberExpression + && memberExpression.parent.id.type === 'Identifier' + && !memberExpression.parent.id.typeAnnotation + ) { + problem.fix = function * (fixer) { + const variable = memberExpression.parent.id; + yield fixer.insertTextBefore(variable, property.value === 0 ? '[' : '[, '); + yield fixer.insertTextAfter(variable, ']'); + + yield removeMemberExpressionProperty(fixer, memberExpression, sourceCode); + yield * removeParentheses(memberExpression.object, fixer, sourceCode); + }; + + return problem; + } + + // `const foo = (await bar).foo` + if ( + !memberExpression.computed + && !memberExpression.optional + && property.type === 'Identifier' + && memberExpression.parent.type === 'VariableDeclarator' + && memberExpression.parent.init === memberExpression + && memberExpression.parent.id.type === 'Identifier' + && memberExpression.parent.id.name === property.name + && !memberExpression.parent.id.typeAnnotation + ) { + problem.fix = function * (fixer) { + const variable = memberExpression.parent.id; + yield fixer.insertTextBefore(variable, '{'); + yield fixer.insertTextAfter(variable, '}'); + + yield removeMemberExpressionProperty(fixer, memberExpression, sourceCode); + yield * removeParentheses(memberExpression.object, fixer, sourceCode); + }; + + return problem; + } + + return problem; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow member access from await expression.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-await-in-promise-methods.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-await-in-promise-methods.js new file mode 100644 index 0000000000000000000000000000000000000000..7ece11f2c414ffd7a7398eab15e29c0f6ca8d0a6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-await-in-promise-methods.js @@ -0,0 +1,69 @@ +'use strict'; +const {isMethodCall} = require('./ast/index.js'); +const {removeSpacesAfter} = require('./fix/index.js'); + +const MESSAGE_ID_ERROR = 'no-await-in-promise-methods/error'; +const MESSAGE_ID_SUGGESTION = 'no-await-in-promise-methods/suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Promise in `Promise.{{method}}()` should not be awaited.', + [MESSAGE_ID_SUGGESTION]: 'Remove `await`.', +}; +const METHODS = ['all', 'allSettled', 'any', 'race']; + +const isPromiseMethodCallWithArrayExpression = node => + isMethodCall(node, { + object: 'Promise', + methods: METHODS, + optionalMember: false, + optionalCall: false, + argumentsLength: 1, + }) + && node.arguments[0].type === 'ArrayExpression'; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + * CallExpression(callExpression) { + if (!isPromiseMethodCallWithArrayExpression(callExpression)) { + return; + } + + for (const element of callExpression.arguments[0].elements) { + if (element?.type !== 'AwaitExpression') { + continue; + } + + yield { + node: element, + messageId: MESSAGE_ID_ERROR, + data: { + method: callExpression.callee.property.name, + }, + suggest: [ + { + messageId: MESSAGE_ID_SUGGESTION, + * fix(fixer) { + const {sourceCode} = context; + const awaitToken = context.sourceCode.getFirstToken(element); + yield fixer.remove(awaitToken); + yield removeSpacesAfter(awaitToken, sourceCode, fixer); + }, + }, + ], + }; + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow using `await` in `Promise` method parameters.', + recommended: true, + }, + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-console-spaces.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-console-spaces.js new file mode 100644 index 0000000000000000000000000000000000000000..558fe24f3193a0f22b5f0a99550ae9de321abc45 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-console-spaces.js @@ -0,0 +1,87 @@ +'use strict'; +const toLocation = require('./utils/to-location.js'); +const {isStringLiteral, isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID = 'no-console-spaces'; +const messages = { + [MESSAGE_ID]: 'Do not use {{position}} space between `console.{{method}}` parameters.', +}; + +// Find exactly one leading space, allow exactly one space +const hasLeadingSpace = value => value.length > 1 && value.charAt(0) === ' ' && value.charAt(1) !== ' '; + +// Find exactly one trailing space, allow exactly one space +const hasTrailingSpace = value => value.length > 1 && value.at(-1) === ' ' && value.at(-2) !== ' '; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + const getProblem = (node, method, position) => { + const index = position === 'leading' + ? node.range[0] + 1 + : node.range[1] - 2; + const range = [index, index + 1]; + + return { + loc: toLocation(range, sourceCode), + messageId: MESSAGE_ID, + data: {method, position}, + fix: fixer => fixer.removeRange(range), + }; + }; + + return { + * CallExpression(node) { + if ( + !isMethodCall(node, { + object: 'console', + methods: [ + 'log', + 'debug', + 'info', + 'warn', + 'error', + ], + minimumArguments: 1, + optionalCall: false, + optionalMember: false, + }) + ) { + return; + } + + const method = node.callee.property.name; + const {arguments: messages} = node; + const {length} = messages; + for (const [index, node] of messages.entries()) { + if (!isStringLiteral(node) && node.type !== 'TemplateLiteral') { + continue; + } + + const raw = sourceCode.getText(node).slice(1, -1); + + if (index !== 0 && hasLeadingSpace(raw)) { + yield getProblem(node, method, 'leading'); + } + + if (index !== length - 1 && hasTrailingSpace(raw)) { + yield getProblem(node, method, 'trailing'); + } + } + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Do not use leading/trailing space between `console.log` parameters.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-document-cookie.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-document-cookie.js new file mode 100644 index 0000000000000000000000000000000000000000..ac95ccc21b49267116a7c91c7b41416cb15d681f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-document-cookie.js @@ -0,0 +1,26 @@ +'use strict'; +const {GlobalReferenceTracker} = require('./utils/global-reference-tracker.js'); + +const MESSAGE_ID = 'no-document-cookie'; +const messages = { + [MESSAGE_ID]: 'Do not use `document.cookie` directly.', +}; + +const tracker = new GlobalReferenceTracker({ + object: 'document.cookie', + filter: ({node}) => node.parent.type === 'AssignmentExpression' && node.parent.left === node, + handle: ({node}) => ({node, messageId: MESSAGE_ID}), +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create: context => tracker.createListeners(context), + meta: { + type: 'problem', + docs: { + description: 'Do not use `document.cookie` directly.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-empty-file.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-empty-file.js new file mode 100644 index 0000000000000000000000000000000000000000..f833886e05161d932e8512a2710b1ec67e6fef0d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-empty-file.js @@ -0,0 +1,57 @@ +'use strict'; +const {isEmptyNode, isDirective} = require('./ast/index.js'); + +const MESSAGE_ID = 'no-empty-file'; +const messages = { + [MESSAGE_ID]: 'Empty files are not allowed.', +}; + +const isEmpty = node => isEmptyNode(node, isDirective); + +const isTripleSlashDirective = node => + node.type === 'Line' && node.value.startsWith('/'); + +const hasTripeSlashDirectives = comments => + comments.some(currentNode => isTripleSlashDirective(currentNode)); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const filename = context.physicalFilename; + + if (!/\.(?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$/i.test(filename)) { + return; + } + + return { + Program(node) { + if (node.body.some(node => !isEmpty(node))) { + return; + } + + const {sourceCode} = context; + const comments = sourceCode.getAllComments(); + + if (hasTripeSlashDirectives(comments)) { + return; + } + + return { + node, + messageId: MESSAGE_ID, + }; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow empty files.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-for-loop.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-for-loop.js new file mode 100644 index 0000000000000000000000000000000000000000..429af6a401d45bf34a65f66b2722555ea0659dcf --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-for-loop.js @@ -0,0 +1,414 @@ +'use strict'; +const {isClosingParenToken, getStaticValue} = require('@eslint-community/eslint-utils'); +const avoidCapture = require('./utils/avoid-capture.js'); +const getScopes = require('./utils/get-scopes.js'); +const singular = require('./utils/singular.js'); +const toLocation = require('./utils/to-location.js'); +const getReferences = require('./utils/get-references.js'); +const {isLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'no-for-loop'; +const messages = { + [MESSAGE_ID]: 'Use a `for-of` loop instead of this `for` loop.', +}; + +const defaultElementName = 'element'; +const isLiteralZero = node => isLiteral(node, 0); +const isLiteralOne = node => isLiteral(node, 1); + +const isIdentifierWithName = (node, name) => node?.type === 'Identifier' && node.name === name; + +const getIndexIdentifierName = forStatement => { + const {init: variableDeclaration} = forStatement; + + if ( + !variableDeclaration + || variableDeclaration.type !== 'VariableDeclaration' + ) { + return; + } + + if (variableDeclaration.declarations.length !== 1) { + return; + } + + const [variableDeclarator] = variableDeclaration.declarations; + + if (!isLiteralZero(variableDeclarator.init)) { + return; + } + + if (variableDeclarator.id.type !== 'Identifier') { + return; + } + + return variableDeclarator.id.name; +}; + +const getStrictComparisonOperands = binaryExpression => { + if (binaryExpression.operator === '<') { + return { + lesser: binaryExpression.left, + greater: binaryExpression.right, + }; + } + + if (binaryExpression.operator === '>') { + return { + lesser: binaryExpression.right, + greater: binaryExpression.left, + }; + } +}; + +const getArrayIdentifierFromBinaryExpression = (binaryExpression, indexIdentifierName) => { + const operands = getStrictComparisonOperands(binaryExpression); + + if (!operands) { + return; + } + + const {lesser, greater} = operands; + + if (!isIdentifierWithName(lesser, indexIdentifierName)) { + return; + } + + if (greater.type !== 'MemberExpression') { + return; + } + + if ( + greater.object.type !== 'Identifier' + || greater.property.type !== 'Identifier' + ) { + return; + } + + if (greater.property.name !== 'length') { + return; + } + + return greater.object; +}; + +const getArrayIdentifier = (forStatement, indexIdentifierName) => { + const {test} = forStatement; + + if (!test || test.type !== 'BinaryExpression') { + return; + } + + return getArrayIdentifierFromBinaryExpression(test, indexIdentifierName); +}; + +const isLiteralOnePlusIdentifierWithName = (node, identifierName) => { + if (node?.type === 'BinaryExpression' && node.operator === '+') { + return (isIdentifierWithName(node.left, identifierName) && isLiteralOne(node.right)) + || (isIdentifierWithName(node.right, identifierName) && isLiteralOne(node.left)); + } + + return false; +}; + +const checkUpdateExpression = (forStatement, indexIdentifierName) => { + const {update} = forStatement; + + if (!update) { + return false; + } + + if (update.type === 'UpdateExpression') { + return update.operator === '++' && isIdentifierWithName(update.argument, indexIdentifierName); + } + + if ( + update.type === 'AssignmentExpression' + && isIdentifierWithName(update.left, indexIdentifierName) + ) { + if (update.operator === '+=') { + return isLiteralOne(update.right); + } + + if (update.operator === '=') { + return isLiteralOnePlusIdentifierWithName(update.right, indexIdentifierName); + } + } + + return false; +}; + +const isOnlyArrayOfIndexVariableRead = (arrayReferences, indexIdentifierName) => arrayReferences.every(reference => { + const node = reference.identifier.parent; + + if (node.type !== 'MemberExpression') { + return false; + } + + if (node.property.name !== indexIdentifierName) { + return false; + } + + if ( + node.parent.type === 'AssignmentExpression' + && node.parent.left === node + ) { + return false; + } + + return true; +}); + +const getRemovalRange = (node, sourceCode) => { + const declarationNode = node.parent; + + if (declarationNode.declarations.length === 1) { + const {line} = declarationNode.loc.start; + const lineText = sourceCode.lines[line - 1]; + + const isOnlyNodeOnLine = lineText.trim() === sourceCode.getText(declarationNode); + + return isOnlyNodeOnLine ? [ + sourceCode.getIndexFromLoc({line, column: 0}), + sourceCode.getIndexFromLoc({line: line + 1, column: 0}), + ] : declarationNode.range; + } + + const index = declarationNode.declarations.indexOf(node); + + if (index === 0) { + return [ + node.range[0], + declarationNode.declarations[1].range[0], + ]; + } + + return [ + declarationNode.declarations[index - 1].range[1], + node.range[1], + ]; +}; + +const resolveIdentifierName = (name, scope) => { + while (scope) { + const variable = scope.set.get(name); + + if (variable) { + return variable; + } + + scope = scope.upper; + } +}; + +const scopeContains = (ancestor, descendant) => { + while (descendant) { + if (descendant === ancestor) { + return true; + } + + descendant = descendant.upper; + } + + return false; +}; + +const nodeContains = (ancestor, descendant) => { + while (descendant) { + if (descendant === ancestor) { + return true; + } + + descendant = descendant.parent; + } + + return false; +}; + +const isIndexVariableUsedElsewhereInTheLoopBody = (indexVariable, bodyScope, arrayIdentifierName) => { + const inBodyReferences = indexVariable.references.filter(reference => scopeContains(bodyScope, reference.from)); + + const referencesOtherThanArrayAccess = inBodyReferences.filter(reference => { + const node = reference.identifier.parent; + + if (node.type !== 'MemberExpression') { + return true; + } + + if (node.object.name !== arrayIdentifierName) { + return true; + } + + return false; + }); + + return referencesOtherThanArrayAccess.length > 0; +}; + +const isIndexVariableAssignedToInTheLoopBody = (indexVariable, bodyScope) => + indexVariable.references + .filter(reference => scopeContains(bodyScope, reference.from)) + .some(inBodyReference => inBodyReference.isWrite()); + +const someVariablesLeakOutOfTheLoop = (forStatement, variables, forScope) => + variables.some( + variable => !variable.references.every( + reference => scopeContains(forScope, reference.from) || nodeContains(forStatement, reference.identifier), + ), + ); + +const getReferencesInChildScopes = (scope, name) => + getReferences(scope).filter(reference => reference.identifier.name === name); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + const {scopeManager} = sourceCode; + + return { + ForStatement(node) { + const indexIdentifierName = getIndexIdentifierName(node); + + if (!indexIdentifierName) { + return; + } + + const arrayIdentifier = getArrayIdentifier(node, indexIdentifierName); + if (!arrayIdentifier) { + return; + } + + const arrayIdentifierName = arrayIdentifier.name; + + const scope = sourceCode.getScope(node); + const staticResult = getStaticValue(arrayIdentifier, scope); + if (staticResult && !Array.isArray(staticResult.value)) { + // Bail out if we can tell that the array variable has a non-array value (i.e. we're looping through the characters of a string constant). + return; + } + + if (!checkUpdateExpression(node, indexIdentifierName)) { + return; + } + + if (!node.body || node.body.type !== 'BlockStatement') { + return; + } + + const forScope = scopeManager.acquire(node); + const bodyScope = scopeManager.acquire(node.body); + + if (!bodyScope) { + return; + } + + const indexVariable = resolveIdentifierName(indexIdentifierName, bodyScope); + + if (isIndexVariableAssignedToInTheLoopBody(indexVariable, bodyScope)) { + return; + } + + const arrayReferences = getReferencesInChildScopes(bodyScope, arrayIdentifierName); + + if (arrayReferences.length === 0) { + return; + } + + if (!isOnlyArrayOfIndexVariableRead(arrayReferences, indexIdentifierName)) { + return; + } + + const [start] = node.range; + const [, end] = sourceCode.getTokenBefore(node.body, isClosingParenToken).range; + + const problem = { + loc: toLocation([start, end], sourceCode), + messageId: MESSAGE_ID, + }; + + const elementReference = arrayReferences.find(reference => { + const node = reference.identifier.parent; + + if (node.parent.type !== 'VariableDeclarator') { + return false; + } + + return true; + }); + const elementNode = elementReference?.identifier.parent.parent; + const elementIdentifierName = elementNode?.id.name; + const elementVariable = elementIdentifierName && resolveIdentifierName(elementIdentifierName, bodyScope); + + const shouldFix = !someVariablesLeakOutOfTheLoop(node, [indexVariable, elementVariable].filter(Boolean), forScope) + && !elementNode?.id.typeAnnotation; + + if (shouldFix) { + problem.fix = function * (fixer) { + const shouldGenerateIndex = isIndexVariableUsedElsewhereInTheLoopBody(indexVariable, bodyScope, arrayIdentifierName); + const index = indexIdentifierName; + const element = elementIdentifierName + || avoidCapture(singular(arrayIdentifierName) || defaultElementName, getScopes(bodyScope)); + const array = arrayIdentifierName; + + let declarationElement = element; + let declarationType = 'const'; + let removeDeclaration = true; + + if (elementNode) { + if (elementNode.id.type === 'ObjectPattern' || elementNode.id.type === 'ArrayPattern') { + removeDeclaration = arrayReferences.length === 1; + } + + if (removeDeclaration) { + declarationType = element.type === 'VariableDeclarator' ? elementNode.kind : elementNode.parent.kind; + declarationElement = sourceCode.getText(elementNode.id); + } + } + + const parts = [declarationType]; + if (shouldGenerateIndex) { + parts.push(` [${index}, ${declarationElement}] of ${array}.entries()`); + } else { + parts.push(` ${declarationElement} of ${array}`); + } + + const replacement = parts.join(''); + + yield fixer.replaceTextRange([ + node.init.range[0], + node.update.range[1], + ], replacement); + + for (const reference of arrayReferences) { + if (reference !== elementReference) { + yield fixer.replaceText(reference.identifier.parent, element); + } + } + + if (elementNode) { + yield removeDeclaration + ? fixer.removeRange(getRemovalRange(elementNode, sourceCode)) + : fixer.replaceText(elementNode.init, element); + } + }; + } + + return problem; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Do not use a `for` loop that can be replaced with a `for-of` loop.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-hex-escape.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-hex-escape.js new file mode 100644 index 0000000000000000000000000000000000000000..f57b093b011f14d361ef10478482e5cb1a6cde19 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-hex-escape.js @@ -0,0 +1,57 @@ +'use strict'; +const {replaceTemplateElement} = require('./fix/index.js'); +const { + isStringLiteral, + isRegexLiteral, + isTaggedTemplateLiteral, +} = require('./ast/index.js'); + +const MESSAGE_ID = 'no-hex-escape'; +const messages = { + [MESSAGE_ID]: 'Use Unicode escapes instead of hexadecimal escapes.', +}; + +function checkEscape(context, node, value) { + const fixedValue = value.replaceAll(/(?<=(?:^|[^\\])(?:\\\\)*\\)x/g, 'u00'); + + if (value !== fixedValue) { + return { + node, + messageId: MESSAGE_ID, + fix: fixer => + node.type === 'TemplateElement' + ? replaceTemplateElement(fixer, node, fixedValue) + : fixer.replaceText(node, fixedValue), + }; + } +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + Literal(node) { + if (isStringLiteral(node) || isRegexLiteral(node)) { + return checkEscape(context, node, node.raw); + } + }, + TemplateElement(node) { + if (isTaggedTemplateLiteral(node.parent, ['String.raw'])) { + return; + } + + return checkEscape(context, node, node.value.raw); + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce the use of Unicode escapes instead of hexadecimal escapes.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-instanceof-array.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-instanceof-array.js new file mode 100644 index 0000000000000000000000000000000000000000..539b8e75607b1b3530b604f9ac50c9f293483ea2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-instanceof-array.js @@ -0,0 +1,66 @@ +'use strict'; +const {checkVueTemplate} = require('./utils/rule.js'); +const {getParenthesizedRange} = require('./utils/parentheses.js'); +const {replaceNodeOrTokenAndSpacesBefore, fixSpaceAroundKeyword} = require('./fix/index.js'); + +const isInstanceofToken = token => token.value === 'instanceof' && token.type === 'Keyword'; + +const MESSAGE_ID = 'no-instanceof-array'; +const messages = { + [MESSAGE_ID]: 'Use `Array.isArray()` instead of `instanceof Array`.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + return { + BinaryExpression(node) { + if (!( + node.operator === 'instanceof' + && node.right.type === 'Identifier' + && node.right.name === 'Array' + )) { + return; + } + + const {left, right} = node; + let tokenStore = sourceCode; + let instanceofToken = tokenStore.getTokenAfter(left, isInstanceofToken); + if (!instanceofToken && sourceCode.parserServices.getTemplateBodyTokenStore) { + tokenStore = sourceCode.parserServices.getTemplateBodyTokenStore(); + instanceofToken = tokenStore.getTokenAfter(left, isInstanceofToken); + } + + return { + node: instanceofToken, + messageId: MESSAGE_ID, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + * fix(fixer) { + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + + const range = getParenthesizedRange(left, tokenStore); + yield fixer.insertTextBeforeRange(range, 'Array.isArray('); + yield fixer.insertTextAfterRange(range, ')'); + + yield * replaceNodeOrTokenAndSpacesBefore(instanceofToken, '', fixer, sourceCode, tokenStore); + yield * replaceNodeOrTokenAndSpacesBefore(right, '', fixer, sourceCode, tokenStore); + }, + }; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create: checkVueTemplate(create), + meta: { + type: 'suggestion', + docs: { + description: 'Require `Array.isArray()` instead of `instanceof Array`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-invalid-fetch-options.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-invalid-fetch-options.js new file mode 100644 index 0000000000000000000000000000000000000000..8989f0478efc3203e698f749a635113ab7041087 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-invalid-fetch-options.js @@ -0,0 +1,111 @@ +'use strict'; +const {getStaticValue} = require('@eslint-community/eslint-utils'); +const { + isCallExpression, + isNewExpression, + isUndefined, + isNullLiteral, +} = require('./ast/index.js'); + +const MESSAGE_ID_ERROR = 'no-invalid-fetch-options'; +const messages = { + [MESSAGE_ID_ERROR]: '"body" is not allowed when method is "{{method}}".', +}; + +const isObjectPropertyWithName = (node, name) => + node.type === 'Property' + && !node.computed + && node.key.type === 'Identifier' + && node.key.name === name; + +function checkFetchOptions(context, node) { + if (node.type !== 'ObjectExpression') { + return; + } + + const {properties} = node; + + const bodyProperty = properties.findLast(property => isObjectPropertyWithName(property, 'body')); + + if (!bodyProperty) { + return; + } + + const bodyValue = bodyProperty.value; + if (isUndefined(bodyValue) || isNullLiteral(bodyValue)) { + return; + } + + const methodProperty = properties.findLast(property => isObjectPropertyWithName(property, 'method')); + // If `method` is omitted but there is an `SpreadElement`, we just ignore the case + if (!methodProperty) { + if (properties.some(node => node.type === 'SpreadElement')) { + return; + } + + return { + node: bodyProperty.key, + messageId: MESSAGE_ID_ERROR, + data: {method: 'GET'}, + }; + } + + const methodValue = methodProperty.value; + + const scope = context.sourceCode.getScope(methodValue); + let method = getStaticValue(methodValue, scope)?.value; + + if (typeof method !== 'string') { + return; + } + + method = method.toUpperCase(); + if (method !== 'GET' && method !== 'HEAD') { + return; + } + + return { + node: bodyProperty.key, + messageId: MESSAGE_ID_ERROR, + data: {method}, + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on('CallExpression', callExpression => { + if (!isCallExpression(callExpression, { + name: 'fetch', + minimumArguments: 2, + optional: false, + })) { + return; + } + + return checkFetchOptions(context, callExpression.arguments[1]); + }); + + context.on('NewExpression', newExpression => { + if (!isNewExpression(newExpression, { + name: 'Request', + minimumArguments: 2, + })) { + return; + } + + return checkFetchOptions(context, newExpression.arguments[1]); + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Disallow invalid options in `fetch()` and `new Request()`.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-invalid-remove-event-listener.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-invalid-remove-event-listener.js new file mode 100644 index 0000000000000000000000000000000000000000..24115de226defcdf22d38329d91edfc7f5a2fd06 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-invalid-remove-event-listener.js @@ -0,0 +1,61 @@ +'use strict'; +const {getFunctionHeadLocation} = require('@eslint-community/eslint-utils'); +const {isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID = 'no-invalid-remove-event-listener'; +const messages = { + [MESSAGE_ID]: 'The listener argument should be a function reference.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(callExpression) { + if (!( + isMethodCall(callExpression, { + method: 'removeEventListener', + minimumArguments: 2, + optionalCall: false, + optionalMember: false, + }) + && callExpression.arguments[0].type !== 'SpreadElement' + && ( + callExpression.arguments[1].type === 'FunctionExpression' + || callExpression.arguments[1].type === 'ArrowFunctionExpression' + || isMethodCall(callExpression.arguments[1], { + method: 'bind', + optionalCall: false, + optionalMember: false, + }) + ) + )) { + return; + } + + const [, listener] = callExpression.arguments; + if (['ArrowFunctionExpression', 'FunctionExpression'].includes(listener.type)) { + return { + node: listener, + loc: getFunctionHeadLocation(listener, context.sourceCode), + messageId: MESSAGE_ID, + }; + } + + return { + node: listener.callee.property, + messageId: MESSAGE_ID, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Prevent calling `EventTarget#removeEventListener()` with the result of an expression.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-keyword-prefix.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-keyword-prefix.js new file mode 100644 index 0000000000000000000000000000000000000000..f595edad0d71f718bbf04f0e1b08a023332c2047 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-keyword-prefix.js @@ -0,0 +1,200 @@ +'use strict'; +const isShorthandPropertyAssignmentPatternLeft = require('./utils/is-shorthand-property-assignment-pattern-left.js'); + +const MESSAGE_ID = 'noKeywordPrefix'; +const messages = { + [MESSAGE_ID]: 'Do not prefix identifiers with keyword `{{keyword}}`.', +}; + +const prepareOptions = ({ + disallowedPrefixes, + checkProperties = true, + onlyCamelCase = true, +} = {}) => ({ + disallowedPrefixes: (disallowedPrefixes || [ + 'new', + 'class', + ]), + checkProperties, + onlyCamelCase, +}); + +function findKeywordPrefix(name, options) { + return options.disallowedPrefixes.find(keyword => { + const suffix = options.onlyCamelCase ? '[A-Z]' : '.'; + const regex = new RegExp(`^${keyword}${suffix}`); + return name.match(regex); + }); +} + +function checkMemberExpression(report, node, options) { + const {name, parent} = node; + const keyword = findKeywordPrefix(name, options); + const effectiveParent = parent.type === 'MemberExpression' ? parent.parent : parent; + + if (!options.checkProperties) { + return; + } + + if (parent.object.type === 'Identifier' && parent.object.name === name && Boolean(keyword)) { + report(node, keyword); + } else if ( + effectiveParent.type === 'AssignmentExpression' + && Boolean(keyword) + && (effectiveParent.right.type !== 'MemberExpression' || effectiveParent.left.type === 'MemberExpression') + && effectiveParent.left.property.name === name + ) { + report(node, keyword); + } +} + +function checkObjectPattern(report, node, options) { + const {name, parent} = node; + const keyword = findKeywordPrefix(name, options); + + /* c8 ignore next 3 */ + if (parent.shorthand && parent.value.left && Boolean(keyword)) { + report(node, keyword); + } + + const assignmentKeyEqualsValue = parent.key.name === parent.value.name; + + if (Boolean(keyword) && parent.computed) { + report(node, keyword); + } + + // Prevent checking right hand side of destructured object + if (parent.key === node && parent.value !== node) { + return true; + } + + const valueIsInvalid = parent.value.name && Boolean(keyword); + + // Ignore destructuring if the option is set, unless a new identifier is created + if (valueIsInvalid && !assignmentKeyEqualsValue) { + report(node, keyword); + } + + return false; +} + +// Core logic copied from: +// https://github.com/eslint/eslint/blob/master/lib/rules/camelcase.js +const create = context => { + const options = prepareOptions(context.options[0]); + + // Contains reported nodes to avoid reporting twice on destructuring with shorthand notation + const reported = []; + const ALLOWED_PARENT_TYPES = new Set(['CallExpression', 'NewExpression']); + + function report(node, keyword) { + if (!reported.includes(node)) { + reported.push(node); + context.report({ + node, + messageId: MESSAGE_ID, + data: { + name: node.name, + keyword, + }, + }); + } + } + + return { + Identifier(node) { + const {name, parent} = node; + const keyword = findKeywordPrefix(name, options); + const effectiveParent = parent.type === 'MemberExpression' ? parent.parent : parent; + + if (parent.type === 'MemberExpression') { + checkMemberExpression(report, node, options); + } else if ( + parent.type === 'Property' + || parent.type === 'AssignmentPattern' + ) { + if (parent.parent.type === 'ObjectPattern') { + const finished = checkObjectPattern(report, node, options); + if (finished) { + return; + } + } + + if ( + !options.checkProperties + ) { + return; + } + + // Don't check right hand side of AssignmentExpression to prevent duplicate warnings + if ( + Boolean(keyword) + && !ALLOWED_PARENT_TYPES.has(effectiveParent.type) + && !(parent.right === node) + && !isShorthandPropertyAssignmentPatternLeft(node) + ) { + report(node, keyword); + } + + // Check if it's an import specifier + } else if ( + [ + 'ImportSpecifier', + 'ImportNamespaceSpecifier', + 'ImportDefaultSpecifier', + ].includes(parent.type) + ) { + // Report only if the local imported identifier is invalid + if (Boolean(keyword) && parent.local?.name === name) { + report(node, keyword); + } + + // Report anything that is invalid that isn't a CallExpression + } else if ( + Boolean(keyword) + && !ALLOWED_PARENT_TYPES.has(effectiveParent.type) + ) { + report(node, keyword); + } + }, + }; +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + disallowedPrefixes: { + type: 'array', + items: [ + { + type: 'string', + }, + ], + minItems: 0, + uniqueItems: true, + }, + checkProperties: { + type: 'boolean', + }, + onlyCamelCase: { + type: 'boolean', + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow identifiers starting with `new` or `class`.', + recommended: false, + }, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-length-as-slice-end.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-length-as-slice-end.js new file mode 100644 index 0000000000000000000000000000000000000000..51ddb55de5c55d472dba28acb5f5283091d470d3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-length-as-slice-end.js @@ -0,0 +1,53 @@ +'use strict'; +const {isMethodCall, isMemberExpression} = require('./ast/index.js'); +const {removeArgument} = require('./fix/index.js'); +const {isSameReference} = require('./utils/index.js'); + +const MESSAGE_ID = 'no-length-as-slice-end'; +const messages = { + [MESSAGE_ID]: 'Passing `….length` as the `end` argument is unnecessary.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on('CallExpression', callExpression => { + if (!isMethodCall(callExpression, { + method: 'slice', + argumentsLength: 2, + optionalCall: false, + })) { + return; + } + + const secondArgument = callExpression.arguments[1]; + const node = secondArgument.type === 'ChainExpression' ? secondArgument.expression : secondArgument; + + if ( + !isMemberExpression(node, {property: 'length', computed: false}) + || !isSameReference(callExpression.callee.object, node.object) + ) { + return; + } + + return { + node, + messageId: MESSAGE_ID, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix: fixer => removeArgument(fixer, secondArgument, context.sourceCode), + }; + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow using `.length` as the `end` argument of `{Array,String,TypedArray}#slice()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-lonely-if.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-lonely-if.js new file mode 100644 index 0000000000000000000000000000000000000000..4f224d8f4b9fefa28cec086ee68af15ad2f77646 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-lonely-if.js @@ -0,0 +1,152 @@ +'use strict'; +const {isParenthesized, isNotSemicolonToken} = require('@eslint-community/eslint-utils'); +const {needsSemicolon} = require('./utils/index.js'); +const {removeSpacesAfter} = require('./fix/index.js'); + +const MESSAGE_ID = 'no-lonely-if'; +const messages = { + [MESSAGE_ID]: 'Unexpected `if` as the only statement in a `if` block without `else`.', +}; + +const isIfStatementWithoutAlternate = node => node.type === 'IfStatement' && !node.alternate; + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table +// Lower precedence than `&&` +const needParenthesis = node => ( + (node.type === 'LogicalExpression' && (node.operator === '||' || node.operator === '??')) + || node.type === 'ConditionalExpression' + || node.type === 'AssignmentExpression' + || node.type === 'YieldExpression' + || node.type === 'SequenceExpression' +); + +function getIfStatementTokens(node, sourceCode) { + const tokens = {}; + + tokens.ifToken = sourceCode.getFirstToken(node); + tokens.openingParenthesisToken = sourceCode.getFirstToken(node, 1); + + const {consequent} = node; + tokens.closingParenthesisToken = sourceCode.getTokenBefore(consequent); + + if (consequent.type === 'BlockStatement') { + tokens.openingBraceToken = sourceCode.getFirstToken(consequent); + tokens.closingBraceToken = sourceCode.getLastToken(consequent); + } + + return tokens; +} + +function fix(innerIfStatement, sourceCode) { + return function * (fixer) { + const outerIfStatement = ( + innerIfStatement.parent.type === 'BlockStatement' + ? innerIfStatement.parent + : innerIfStatement + ).parent; + const outer = { + ...outerIfStatement, + ...getIfStatementTokens(outerIfStatement, sourceCode), + }; + const inner = { + ...innerIfStatement, + ...getIfStatementTokens(innerIfStatement, sourceCode), + }; + + // Remove inner `if` token + yield fixer.remove(inner.ifToken); + yield removeSpacesAfter(inner.ifToken, sourceCode, fixer); + + // Remove outer `{}` + if (outer.openingBraceToken) { + yield fixer.remove(outer.openingBraceToken); + yield removeSpacesAfter(outer.openingBraceToken, sourceCode, fixer); + yield fixer.remove(outer.closingBraceToken); + + const tokenBefore = sourceCode.getTokenBefore(outer.closingBraceToken, {includeComments: true}); + yield removeSpacesAfter(tokenBefore, sourceCode, fixer); + } + + // Add new `()` + yield fixer.insertTextBefore(outer.openingParenthesisToken, '('); + yield fixer.insertTextAfter( + inner.closingParenthesisToken, + `)${inner.consequent.type === 'EmptyStatement' ? '' : ' '}`, + ); + + // Add ` && ` + yield fixer.insertTextAfter(outer.closingParenthesisToken, ' && '); + + // Remove `()` if `test` don't need it + for (const {test, openingParenthesisToken, closingParenthesisToken} of [outer, inner]) { + if ( + isParenthesized(test, sourceCode) + || !needParenthesis(test) + ) { + yield fixer.remove(openingParenthesisToken); + yield fixer.remove(closingParenthesisToken); + } + + yield removeSpacesAfter(closingParenthesisToken, sourceCode, fixer); + } + + // If the `if` statement has no block, and is not followed by a semicolon, + // make sure that fixing the issue would not change semantics due to ASI. + // Similar logic https://github.com/eslint/eslint/blob/2124e1b5dad30a905dc26bde9da472bf622d3f50/lib/rules/no-lonely-if.js#L61-L77 + if (inner.consequent.type !== 'BlockStatement') { + const lastToken = sourceCode.getLastToken(inner.consequent); + if (isNotSemicolonToken(lastToken)) { + const nextToken = sourceCode.getTokenAfter(outer); + if (nextToken && needsSemicolon(lastToken, sourceCode, nextToken.value)) { + yield fixer.insertTextBefore(nextToken, ';'); + } + } + } + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + IfStatement(ifStatement) { + if (!( + isIfStatementWithoutAlternate(ifStatement) + && ( + // `if (a) { if (b) {} }` + ( + ifStatement.parent.type === 'BlockStatement' + && ifStatement.parent.body.length === 1 + && ifStatement.parent.body[0] === ifStatement + && isIfStatementWithoutAlternate(ifStatement.parent.parent) + && ifStatement.parent.parent.consequent === ifStatement.parent + ) + // `if (a) if (b) {}` + || ( + isIfStatementWithoutAlternate(ifStatement.parent) + && ifStatement.parent.consequent === ifStatement + ) + ) + )) { + return; + } + + return { + node: ifStatement, + messageId: MESSAGE_ID, + fix: fix(ifStatement, context.sourceCode), + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow `if` statements as the only statement in `if` blocks without `else`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-magic-array-flat-depth.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-magic-array-flat-depth.js new file mode 100644 index 0000000000000000000000000000000000000000..a3d54494b50715ee5b476f33e4808103975547f4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-magic-array-flat-depth.js @@ -0,0 +1,54 @@ +'use strict'; +const {isMethodCall, isNumberLiteral} = require('./ast/index.js'); +const {getCallExpressionTokens} = require('./utils/index.js'); + +const MESSAGE_ID = 'no-magic-array-flat-depth'; +const messages = { + [MESSAGE_ID]: 'Magic number as depth is not allowed.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(callExpression) { + if (!isMethodCall(callExpression, { + method: 'flat', + argumentsLength: 1, + optionalCall: false, + })) { + return; + } + + const [depth] = callExpression.arguments; + + if (!isNumberLiteral(depth) || depth.value === 1) { + return; + } + + const {sourceCode} = context; + const { + openingParenthesisToken, + closingParenthesisToken, + } = getCallExpressionTokens(sourceCode, callExpression); + if (sourceCode.commentsExistBetween(openingParenthesisToken, closingParenthesisToken)) { + return; + } + + return { + node: depth, + messageId: MESSAGE_ID, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow a magic number as the `depth` argument in `Array#flat(…).`', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-negated-condition.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-negated-condition.js new file mode 100644 index 0000000000000000000000000000000000000000..7af4db67747d62f2c52c41e82371f925df97458f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-negated-condition.js @@ -0,0 +1,145 @@ +/* +Based on ESLint builtin `no-negated-condition` rule +https://github.com/eslint/eslint/blob/5c39425fc55ecc0b97bbd07ac22654c0eb4f789c/lib/rules/no-negated-condition.js +*/ +'use strict'; +const { + removeParentheses, + fixSpaceAroundKeyword, + addParenthesizesToReturnOrThrowExpression, +} = require('./fix/index.js'); +const { + getParenthesizedRange, + isParenthesized, +} = require('./utils/parentheses.js'); +const isOnSameLine = require('./utils/is-on-same-line.js'); +const needsSemicolon = require('./utils/needs-semicolon.js'); + +const MESSAGE_ID = 'no-negated-condition'; +const messages = { + [MESSAGE_ID]: 'Unexpected negated condition.', +}; + +function * convertNegatedCondition(fixer, node, sourceCode) { + const {test} = node; + if (test.type === 'UnaryExpression') { + const token = sourceCode.getFirstToken(test); + + if (node.type === 'IfStatement') { + yield * removeParentheses(test.argument, fixer, sourceCode); + } + + yield fixer.remove(token); + return; + } + + const token = sourceCode.getTokenAfter( + test.left, + token => token.type === 'Punctuator' && token.value === test.operator, + ); + + yield fixer.replaceText(token, '=' + token.value.slice(1)); +} + +function * swapConsequentAndAlternate(fixer, node, sourceCode) { + const isIfStatement = node.type === 'IfStatement'; + const [consequent, alternate] = [ + node.consequent, + node.alternate, + ].map(node => { + const range = getParenthesizedRange(node, sourceCode); + let text = sourceCode.text.slice(...range); + // `if (!a) b(); else c()` can't fix to `if (!a) c() else b();` + if (isIfStatement && node.type !== 'BlockStatement') { + text = `{${text}}`; + } + + return { + range, + text, + }; + }); + + if (consequent.text === alternate.text) { + return; + } + + yield fixer.replaceTextRange(consequent.range, alternate.text); + yield fixer.replaceTextRange(alternate.range, consequent.text); +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on(['IfStatement', 'ConditionalExpression'], node => { + if ( + node.type === 'IfStatement' + && ( + !node.alternate + || node.alternate.type === 'IfStatement' + ) + ) { + return; + } + + const {test} = node; + + if (!( + (test.type === 'UnaryExpression' && test.operator === '!') + || (test.type === 'BinaryExpression' && (test.operator === '!=' || test.operator === '!==')) + )) { + return; + } + + return { + node: test, + messageId: MESSAGE_ID, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + * fix(fixer) { + const {sourceCode} = context; + yield * convertNegatedCondition(fixer, node, sourceCode); + yield * swapConsequentAndAlternate(fixer, node, sourceCode); + + if ( + node.type !== 'ConditionalExpression' + || test.type !== 'UnaryExpression' + ) { + return; + } + + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + + const {parent} = node; + const [firstToken, secondToken] = sourceCode.getFirstTokens(test, 2); + if ( + (parent.type === 'ReturnStatement' || parent.type === 'ThrowStatement') + && parent.argument === node + && !isOnSameLine(firstToken, secondToken) + && !isParenthesized(node, sourceCode) + && !isParenthesized(test, sourceCode) + ) { + yield * addParenthesizesToReturnOrThrowExpression(fixer, parent, sourceCode); + return; + } + + const tokenBefore = sourceCode.getTokenBefore(node); + if (needsSemicolon(tokenBefore, sourceCode, secondToken.value)) { + yield fixer.insertTextBefore(node, ';'); + } + }, + }; + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow negated conditions.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-negation-in-equality-check.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-negation-in-equality-check.js new file mode 100644 index 0000000000000000000000000000000000000000..170bdfcfbf3c641cf2110b36ed319475b9abb0c0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-negation-in-equality-check.js @@ -0,0 +1,105 @@ +'use strict'; +const { + fixSpaceAroundKeyword, + addParenthesizesToReturnOrThrowExpression, +} = require('./fix/index.js'); +const { + needsSemicolon, + isParenthesized, + isOnSameLine, +} = require('./utils/index.js'); + +const MESSAGE_ID_ERROR = 'no-negation-in-equality-check/error'; +const MESSAGE_ID_SUGGESTION = 'no-negation-in-equality-check/suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Negated expression is not allowed in equality check.', + [MESSAGE_ID_SUGGESTION]: 'Switch to \'{{operator}}\' check.', +}; + +const EQUALITY_OPERATORS = new Set([ + '===', + '!==', + '==', + '!=', +]); + +const isEqualityCheck = node => node.type === 'BinaryExpression' && EQUALITY_OPERATORS.has(node.operator); +const isNegatedExpression = node => node.type === 'UnaryExpression' && node.prefix && node.operator === '!'; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + BinaryExpression(binaryExpression) { + const {operator, left} = binaryExpression; + + if (!( + isEqualityCheck(binaryExpression) + && isNegatedExpression(left) + && !isNegatedExpression(left.argument) + )) { + return; + } + + const {sourceCode} = context; + const bangToken = sourceCode.getFirstToken(left); + const negatedOperator = `${operator.startsWith('!') ? '=' : '!'}${operator.slice(1)}`; + + return { + node: bangToken, + messageId: MESSAGE_ID_ERROR, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + suggest: [ + { + messageId: MESSAGE_ID_SUGGESTION, + data: { + operator: negatedOperator, + }, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + * fix(fixer) { + yield * fixSpaceAroundKeyword(fixer, binaryExpression, sourceCode); + + const tokenAfterBang = sourceCode.getTokenAfter(bangToken); + + const {parent} = binaryExpression; + if ( + (parent.type === 'ReturnStatement' || parent.type === 'ThrowStatement') + && !isParenthesized(binaryExpression, sourceCode) + ) { + const returnToken = sourceCode.getFirstToken(parent); + if (!isOnSameLine(returnToken, tokenAfterBang)) { + yield * addParenthesizesToReturnOrThrowExpression(fixer, parent, sourceCode); + } + } + + yield fixer.remove(bangToken); + + const previousToken = sourceCode.getTokenBefore(bangToken); + if (needsSemicolon(previousToken, sourceCode, tokenAfterBang.value)) { + yield fixer.insertTextAfter(bangToken, ';'); + } + + const operatorToken = sourceCode.getTokenAfter( + left, + token => token.type === 'Punctuator' && token.value === operator, + ); + yield fixer.replaceText(operatorToken, negatedOperator); + }, + }, + ], + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Disallow negated expression in equality check.', + recommended: true, + }, + + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-nested-ternary.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-nested-ternary.js new file mode 100644 index 0000000000000000000000000000000000000000..57f3ea8182003c8e9056c525f09080bdcfac21f2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-nested-ternary.js @@ -0,0 +1,59 @@ +'use strict'; +const {isParenthesized} = require('@eslint-community/eslint-utils'); + +const MESSAGE_ID_TOO_DEEP = 'too-deep'; +const MESSAGE_ID_SHOULD_PARENTHESIZED = 'should-parenthesized'; +const messages = { + [MESSAGE_ID_TOO_DEEP]: 'Do not nest ternary expressions.', + [MESSAGE_ID_SHOULD_PARENTHESIZED]: 'Nest ternary expression should be parenthesized.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + ConditionalExpression(node) { + if ([ + node.test, + node.consequent, + node.alternate, + ].some(node => node.type === 'ConditionalExpression')) { + return; + } + + const {sourceCode} = context; + const ancestors = sourceCode.getAncestors(node).reverse(); + const nestLevel = ancestors.findIndex(node => node.type !== 'ConditionalExpression'); + + if (nestLevel === 1 && !isParenthesized(node, sourceCode)) { + return { + node, + messageId: MESSAGE_ID_SHOULD_PARENTHESIZED, + fix: fixer => [ + fixer.insertTextBefore(node, '('), + fixer.insertTextAfter(node, ')'), + ], + }; + } + + // Nesting more than one level not allowed + if (nestLevel > 1) { + return { + node: nestLevel > 2 ? ancestors[nestLevel - 3] : node, + messageId: MESSAGE_ID_TOO_DEEP, + }; + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow nested ternary expressions.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-new-array.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-new-array.js new file mode 100644 index 0000000000000000000000000000000000000000..a1a3fcfaace0520598ba6c779c3872b4901e89b5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-new-array.js @@ -0,0 +1,105 @@ +'use strict'; +const {isParenthesized, getStaticValue} = require('@eslint-community/eslint-utils'); +const needsSemicolon = require('./utils/needs-semicolon.js'); +const isNumber = require('./utils/is-number.js'); +const {isNewExpression} = require('./ast/index.js'); + +const MESSAGE_ID_ERROR = 'error'; +const MESSAGE_ID_LENGTH = 'array-length'; +const MESSAGE_ID_ONLY_ELEMENT = 'only-element'; +const MESSAGE_ID_SPREAD = 'spread'; +const messages = { + [MESSAGE_ID_ERROR]: '`new Array()` is unclear in intent; use either `[x]` or `Array.from({length: x})`', + [MESSAGE_ID_LENGTH]: 'The argument is the length of array.', + [MESSAGE_ID_ONLY_ELEMENT]: 'The argument is the only element of array.', + [MESSAGE_ID_SPREAD]: 'Spread the argument.', +}; + +function getProblem(context, node) { + if ( + !isNewExpression(node, { + name: 'Array', + argumentsLength: 1, + allowSpreadElement: true, + }) + ) { + return; + } + + const problem = { + node, + messageId: MESSAGE_ID_ERROR, + }; + + const [argumentNode] = node.arguments; + + const {sourceCode} = context; + let text = sourceCode.getText(argumentNode); + if (isParenthesized(argumentNode, sourceCode)) { + text = `(${text})`; + } + + const maybeSemiColon = needsSemicolon(sourceCode.getTokenBefore(node), sourceCode, '[') + ? ';' + : ''; + + // We are not sure how many `arguments` passed + if (argumentNode.type === 'SpreadElement') { + problem.suggest = [ + { + messageId: MESSAGE_ID_SPREAD, + fix: fixer => fixer.replaceText(node, `${maybeSemiColon}[${text}]`), + }, + ]; + return problem; + } + + const fromLengthText = `Array.from(${text === 'length' ? '{length}' : `{length: ${text}}`})`; + const scope = sourceCode.getScope(node); + if (isNumber(argumentNode, scope)) { + problem.fix = fixer => fixer.replaceText(node, fromLengthText); + return problem; + } + + const onlyElementText = `${maybeSemiColon}[${text}]`; + const result = getStaticValue(argumentNode, scope); + if (result !== null && typeof result.value !== 'number') { + problem.fix = fixer => fixer.replaceText(node, onlyElementText); + return problem; + } + + // We don't know the argument is number or not + problem.suggest = [ + { + messageId: MESSAGE_ID_LENGTH, + fix: fixer => fixer.replaceText(node, fromLengthText), + }, + { + messageId: MESSAGE_ID_ONLY_ELEMENT, + fix: fixer => fixer.replaceText(node, onlyElementText), + }, + ]; + return problem; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + NewExpression(node) { + return getProblem(context, node); + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow `new Array()`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-new-buffer.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-new-buffer.js new file mode 100644 index 0000000000000000000000000000000000000000..42c529264d70ca5e5c45bf7e8eb2e0279b25e60e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-new-buffer.js @@ -0,0 +1,99 @@ +'use strict'; +const {getStaticValue} = require('@eslint-community/eslint-utils'); +const {switchNewExpressionToCallExpression} = require('./fix/index.js'); +const isNumber = require('./utils/is-number.js'); +const {isNewExpression} = require('./ast/index.js'); + +const ERROR = 'error'; +const ERROR_UNKNOWN = 'error-unknown'; +const SUGGESTION = 'suggestion'; +const messages = { + [ERROR]: '`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.', + [ERROR_UNKNOWN]: '`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.', + [SUGGESTION]: 'Switch to `Buffer.{{replacement}}()`.', +}; + +const inferMethod = (bufferArguments, scope) => { + if (bufferArguments.length !== 1) { + return 'from'; + } + + const [firstArgument] = bufferArguments; + if (firstArgument.type === 'SpreadElement') { + return; + } + + if (firstArgument.type === 'ArrayExpression' || firstArgument.type === 'TemplateLiteral') { + return 'from'; + } + + if (isNumber(firstArgument, scope)) { + return 'alloc'; + } + + const staticResult = getStaticValue(firstArgument, scope); + if (staticResult) { + const {value} = staticResult; + if ( + typeof value === 'string' + || Array.isArray(value) + ) { + return 'from'; + } + } +}; + +function fix(node, sourceCode, method) { + return function * (fixer) { + yield fixer.insertTextAfter(node.callee, `.${method}`); + yield * switchNewExpressionToCallExpression(node, sourceCode, fixer); + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + return { + NewExpression(node) { + if (!isNewExpression(node, {name: 'Buffer'})) { + return; + } + + const method = inferMethod(node.arguments, sourceCode.getScope(node)); + + if (method) { + return { + node, + messageId: ERROR, + data: {method}, + fix: fix(node, sourceCode, method), + }; + } + + return { + node, + messageId: ERROR_UNKNOWN, + suggest: ['from', 'alloc'].map(replacement => ({ + messageId: SUGGESTION, + data: {replacement}, + fix: fix(node, sourceCode, replacement), + })), + }; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-null.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-null.js new file mode 100644 index 0000000000000000000000000000000000000000..b18fc9cf95d8dba9dc6949f8c7e094324f517b89 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-null.js @@ -0,0 +1,154 @@ +'use strict'; +const { + isMethodCall, + isCallExpression, + isLiteral, +} = require('./ast/index.js'); + +const ERROR_MESSAGE_ID = 'error'; +const SUGGESTION_REPLACE_MESSAGE_ID = 'replace'; +const SUGGESTION_REMOVE_MESSAGE_ID = 'remove'; +const messages = { + [ERROR_MESSAGE_ID]: 'Use `undefined` instead of `null`.', + [SUGGESTION_REPLACE_MESSAGE_ID]: 'Replace `null` with `undefined`.', + [SUGGESTION_REMOVE_MESSAGE_ID]: 'Remove `null`.', +}; + +const isLooseEqual = node => node.type === 'BinaryExpression' && ['==', '!='].includes(node.operator); +const isStrictEqual = node => node.type === 'BinaryExpression' && ['===', '!=='].includes(node.operator); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {checkStrictEquality} = { + checkStrictEquality: false, + ...context.options[0], + }; + + return { + Literal(node) { + if ( + // eslint-disable-next-line unicorn/no-null + !isLiteral(node, null) + || (!checkStrictEquality && isStrictEqual(node.parent)) + // `Object.create(null)`, `Object.create(null, foo)` + || ( + isMethodCall(node.parent, { + object: 'Object', + method: 'create', + minimumArguments: 1, + maximumArguments: 2, + optionalCall: false, + optionalMember: false, + }) + && node.parent.arguments[0] === node + ) + // `useRef(null)` + || ( + isCallExpression(node.parent, { + name: 'useRef', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && node.parent.arguments[0] === node + ) + // `React.useRef(null)` + || ( + isMethodCall(node.parent, { + object: 'React', + method: 'useRef', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && node.parent.arguments[0] === node + ) + // `foo.insertBefore(bar, null)` + || ( + isMethodCall(node.parent, { + method: 'insertBefore', + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + }) + && node.parent.arguments[1] === node + ) + ) { + return; + } + + const {parent} = node; + + const problem = { + node, + messageId: ERROR_MESSAGE_ID, + }; + + const useUndefinedFix = fixer => fixer.replaceText(node, 'undefined'); + + if (isLooseEqual(parent)) { + problem.fix = useUndefinedFix; + return problem; + } + + const useUndefinedSuggestion = { + messageId: SUGGESTION_REPLACE_MESSAGE_ID, + fix: useUndefinedFix, + }; + + if (parent.type === 'ReturnStatement' && parent.argument === node) { + problem.suggest = [ + { + messageId: SUGGESTION_REMOVE_MESSAGE_ID, + fix: fixer => fixer.remove(node), + }, + useUndefinedSuggestion, + ]; + return problem; + } + + if (parent.type === 'VariableDeclarator' && parent.init === node && parent.parent.kind !== 'const') { + problem.suggest = [ + { + messageId: SUGGESTION_REMOVE_MESSAGE_ID, + fix: fixer => fixer.removeRange([parent.id.range[1], node.range[1]]), + }, + useUndefinedSuggestion, + ]; + return problem; + } + + problem.suggest = [useUndefinedSuggestion]; + return problem; + }, + }; +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + checkStrictEquality: { + type: 'boolean', + default: false, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow the use of the `null` literal.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-object-as-default-parameter.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-object-as-default-parameter.js new file mode 100644 index 0000000000000000000000000000000000000000..49cd9ad6552e077e0eddcf5c927a29eb96882c47 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-object-as-default-parameter.js @@ -0,0 +1,51 @@ +'use strict'; +const {isFunction} = require('./ast/index.js'); + +const MESSAGE_ID_IDENTIFIER = 'identifier'; +const MESSAGE_ID_NON_IDENTIFIER = 'non-identifier'; +const messages = { + [MESSAGE_ID_IDENTIFIER]: 'Do not use an object literal as default for parameter `{{parameter}}`.', + [MESSAGE_ID_NON_IDENTIFIER]: 'Do not use an object literal as default.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + AssignmentPattern(node) { + if (!( + node.right.type === 'ObjectExpression' + && node.right.properties.length > 0 + && isFunction(node.parent) + && node.parent.params.includes(node) + )) { + return; + } + + const {left, right} = node; + + if (left.type === 'Identifier') { + return { + node: left, + messageId: MESSAGE_ID_IDENTIFIER, + data: {parameter: left.name}, + }; + } + + return { + node: right, + messageId: MESSAGE_ID_NON_IDENTIFIER, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Disallow the use of objects as default parameters.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-process-exit.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-process-exit.js new file mode 100644 index 0000000000000000000000000000000000000000..1cc6ea99881ca3a927b4a82d69519a20c96199ac --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-process-exit.js @@ -0,0 +1,105 @@ +'use strict'; +const {isStaticRequire, isMethodCall, isLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'no-process-exit'; +const messages = { + [MESSAGE_ID]: 'Only use `process.exit()` in CLI apps. Throw an error instead.', +}; + +const isWorkerThreads = node => + isLiteral(node, 'node:worker_threads') + || isLiteral(node, 'worker_threads'); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const startsWithHashBang = context.sourceCode.lines[0].indexOf('#!') === 0; + + if (startsWithHashBang) { + return {}; + } + + let processEventHandler; + + // Only report if it's outside an worker thread context. See #328. + let requiredWorkerThreadsModule = false; + const problemNodes = []; + + // `require('worker_threads')` + context.on('CallExpression', callExpression => { + if ( + isStaticRequire(callExpression) + && isWorkerThreads(callExpression.arguments[0]) + ) { + requiredWorkerThreadsModule = true; + } + }); + + // `import workerThreads from 'worker_threads'` + context.on('ImportDeclaration', importDeclaration => { + if ( + importDeclaration.source.type === 'Literal' + && isWorkerThreads(importDeclaration.source) + ) { + requiredWorkerThreadsModule = true; + } + }); + + // Check `process.on` / `process.once` call + context.on('CallExpression', node => { + if (isMethodCall(node, { + object: 'process', + methods: ['on', 'once'], + minimumArguments: 1, + optionalCall: false, + optionalMember: false, + })) { + processEventHandler = node; + } + }); + context.onExit('CallExpression', node => { + if (node === processEventHandler) { + processEventHandler = undefined; + } + }); + + // Check `process.exit` call + context.on('CallExpression', node => { + if ( + !processEventHandler + && isMethodCall(node, { + object: 'process', + method: 'exit', + optionalCall: false, + optionalMember: false, + }) + ) { + problemNodes.push(node); + } + }); + + context.onExit('Program', function * () { + if (requiredWorkerThreadsModule) { + return; + } + + for (const node of problemNodes) { + yield { + node, + messageId: MESSAGE_ID, + }; + } + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow `process.exit()`.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-single-promise-in-promise-methods.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-single-promise-in-promise-methods.js new file mode 100644 index 0000000000000000000000000000000000000000..83bf9faacd213595acca35a00f7d34a36324796a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-single-promise-in-promise-methods.js @@ -0,0 +1,181 @@ +'use strict'; +const { + isCommaToken, +} = require('@eslint-community/eslint-utils'); +const { + isMethodCall, + isExpressionStatement, +} = require('./ast/index.js'); +const { + getParenthesizedText, + isParenthesized, + needsSemicolon, + shouldAddParenthesesToAwaitExpressionArgument, +} = require('./utils/index.js'); + +const MESSAGE_ID_ERROR = 'no-single-promise-in-promise-methods/error'; +const MESSAGE_ID_SUGGESTION_UNWRAP = 'no-single-promise-in-promise-methods/unwrap'; +const MESSAGE_ID_SUGGESTION_SWITCH_TO_PROMISE_RESOLVE = 'no-single-promise-in-promise-methods/use-promise-resolve'; +const messages = { + [MESSAGE_ID_ERROR]: 'Wrapping single-element array with `Promise.{{method}}()` is unnecessary.', + [MESSAGE_ID_SUGGESTION_UNWRAP]: 'Use the value directly.', + [MESSAGE_ID_SUGGESTION_SWITCH_TO_PROMISE_RESOLVE]: 'Switch to `Promise.resolve(…)`.', +}; +const METHODS = ['all', 'any', 'race']; + +const isPromiseMethodCallWithSingleElementArray = node => + isMethodCall(node, { + object: 'Promise', + methods: METHODS, + optionalMember: false, + optionalCall: false, + argumentsLength: 1, + }) + && node.arguments[0].type === 'ArrayExpression' + && node.arguments[0].elements.length === 1 + && node.arguments[0].elements[0] + && node.arguments[0].elements[0].type !== 'SpreadElement'; + +const unwrapAwaitedCallExpression = (callExpression, sourceCode) => fixer => { + const [promiseNode] = callExpression.arguments[0].elements; + let text = getParenthesizedText(promiseNode, sourceCode); + + if ( + !isParenthesized(promiseNode, sourceCode) + && shouldAddParenthesesToAwaitExpressionArgument(promiseNode) + ) { + text = `(${text})`; + } + + // The next node is already behind a `CallExpression`, there should be no ASI problem + + return fixer.replaceText(callExpression, text); +}; + +const unwrapNonAwaitedCallExpression = (callExpression, sourceCode) => fixer => { + const [promiseNode] = callExpression.arguments[0].elements; + let text = getParenthesizedText(promiseNode, sourceCode); + + if ( + !isParenthesized(promiseNode, sourceCode) + // Since the original call expression can be anywhere, it's hard to tell if the promise + // need to be parenthesized, but it's safe to add parentheses + && !( + // Known cases that not need parentheses + promiseNode.type === 'Identifier' + || promiseNode.type === 'MemberExpression' + ) + ) { + text = `(${text})`; + } + + const previousToken = sourceCode.getTokenBefore(callExpression); + if (needsSemicolon(previousToken, sourceCode, text)) { + text = `;${text}`; + } + + return fixer.replaceText(callExpression, text); +}; + +const switchToPromiseResolve = (callExpression, sourceCode) => function * (fixer) { + /* + ``` + Promise.race([promise,]) + // ^^^^ methodNameNode + ``` + */ + const methodNameNode = callExpression.callee.property; + yield fixer.replaceText(methodNameNode, 'resolve'); + + const [arrayExpression] = callExpression.arguments; + /* + ``` + Promise.race([promise,]) + // ^ openingBracketToken + ``` + */ + const openingBracketToken = sourceCode.getFirstToken(arrayExpression); + /* + ``` + Promise.race([promise,]) + // ^ penultimateToken + // ^ closingBracketToken + ``` + */ + const [ + penultimateToken, + closingBracketToken, + ] = sourceCode.getLastTokens(arrayExpression, 2); + + yield fixer.remove(openingBracketToken); + yield fixer.remove(closingBracketToken); + + if (isCommaToken(penultimateToken)) { + yield fixer.remove(penultimateToken); + } +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(callExpression) { + if (!isPromiseMethodCallWithSingleElementArray(callExpression)) { + return; + } + + const methodName = callExpression.callee.property.name; + + const problem = { + node: callExpression.arguments[0], + messageId: MESSAGE_ID_ERROR, + data: { + method: methodName, + }, + }; + + const {sourceCode} = context; + + if ( + callExpression.parent.type === 'AwaitExpression' + && callExpression.parent.argument === callExpression + && ( + methodName !== 'all' + || isExpressionStatement(callExpression.parent.parent) + ) + ) { + problem.fix = unwrapAwaitedCallExpression(callExpression, sourceCode); + return problem; + } + + if (methodName === 'all') { + return problem; + } + + problem.suggest = [ + { + messageId: MESSAGE_ID_SUGGESTION_UNWRAP, + fix: unwrapNonAwaitedCallExpression(callExpression, sourceCode), + }, + { + messageId: MESSAGE_ID_SUGGESTION_SWITCH_TO_PROMISE_RESOLVE, + fix: switchToPromiseResolve(callExpression, sourceCode), + }, + ]; + + return problem; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow passing single-element arrays to `Promise` methods.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-static-only-class.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-static-only-class.js new file mode 100644 index 0000000000000000000000000000000000000000..c320bc6da0a995a9c49b1c175d342a6f231f1bbe --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-static-only-class.js @@ -0,0 +1,225 @@ +'use strict'; +const {isSemicolonToken} = require('@eslint-community/eslint-utils'); +const getClassHeadLocation = require('./utils/get-class-head-location.js'); +const assertToken = require('./utils/assert-token.js'); +const {removeSpacesAfter} = require('./fix/index.js'); + +const MESSAGE_ID = 'no-static-only-class'; +const messages = { + [MESSAGE_ID]: 'Use an object instead of a class with only static members.', +}; + +const isEqualToken = ({type, value}) => type === 'Punctuator' && value === '='; +const isDeclarationOfExportDefaultDeclaration = node => + node.type === 'ClassDeclaration' + && node.parent.type === 'ExportDefaultDeclaration' + && node.parent.declaration === node; + +const isPropertyDefinition = node => node.type === 'PropertyDefinition'; +const isMethodDefinition = node => node.type === 'MethodDefinition'; + +function isStaticMember(node) { + const { + private: isPrivate, + static: isStatic, + declare: isDeclare, + readonly: isReadonly, + accessibility, + decorators, + key, + } = node; + + // Avoid matching unexpected node. For example: https://github.com/tc39/proposal-class-static-block + if (!isPropertyDefinition(node) && !isMethodDefinition(node)) { + return false; + } + + if (!isStatic || isPrivate || key.type === 'PrivateIdentifier') { + return false; + } + + // TypeScript class + if ( + isDeclare + || isReadonly + || accessibility !== undefined + || (Array.isArray(decorators) && decorators.length > 0) + ) { + return false; + } + + return true; +} + +function * switchClassMemberToObjectProperty(node, sourceCode, fixer) { + const staticToken = sourceCode.getFirstToken(node); + assertToken(staticToken, { + expected: {type: 'Keyword', value: 'static'}, + ruleId: 'no-static-only-class', + }); + + yield fixer.remove(staticToken); + yield removeSpacesAfter(staticToken, sourceCode, fixer); + + const maybeSemicolonToken = isPropertyDefinition(node) + ? sourceCode.getLastToken(node) + : sourceCode.getTokenAfter(node); + const hasSemicolonToken = isSemicolonToken(maybeSemicolonToken); + + if (isPropertyDefinition(node)) { + const {key, value} = node; + + if (value) { + // Computed key may have `]` after `key` + const equalToken = sourceCode.getTokenAfter(key, isEqualToken); + yield fixer.replaceText(equalToken, ':'); + } else if (hasSemicolonToken) { + yield fixer.insertTextBefore(maybeSemicolonToken, ': undefined'); + } else { + yield fixer.insertTextAfter(node, ': undefined'); + } + } + + yield ( + hasSemicolonToken + ? fixer.replaceText(maybeSemicolonToken, ',') + : fixer.insertTextAfter(node, ',') + ); +} + +function switchClassToObject(node, sourceCode) { + const { + type, + id, + body, + declare: isDeclare, + abstract: isAbstract, + implements: classImplements, + parent, + } = node; + + if ( + isDeclare + || isAbstract + || (Array.isArray(classImplements) && classImplements.length > 0) + ) { + return; + } + + if (type === 'ClassExpression' && id) { + return; + } + + const isExportDefault = isDeclarationOfExportDefaultDeclaration(node); + + if (isExportDefault && id) { + return; + } + + for (const node of body.body) { + if ( + isPropertyDefinition(node) + && ( + node.typeAnnotation + // This is a stupid way to check if `value` of `PropertyDefinition` uses `this` + || (node.value && sourceCode.getText(node.value).includes('this')) + ) + ) { + return; + } + } + + return function * (fixer) { + const classToken = sourceCode.getFirstToken(node); + /* c8 ignore next */ + assertToken(classToken, { + expected: {type: 'Keyword', value: 'class'}, + ruleId: 'no-static-only-class', + }); + + if (isExportDefault || type === 'ClassExpression') { + /* + There are comments after return, and `{` is not on same line + + ```js + function a() { + return class // comment + { + static a() {} + } + } + ``` + */ + if ( + type === 'ClassExpression' + && parent.type === 'ReturnStatement' + && body.loc.start.line !== parent.loc.start.line + && sourceCode.text.slice(classToken.range[1], body.range[0]).trim() + ) { + yield fixer.replaceText(classToken, '{'); + + const openingBraceToken = sourceCode.getFirstToken(body); + yield fixer.remove(openingBraceToken); + } else { + yield fixer.replaceText(classToken, ''); + + /* + Avoid breaking case like + + ```js + return class + {}; + ``` + */ + yield removeSpacesAfter(classToken, sourceCode, fixer); + } + + // There should not be ASI problem + } else { + yield fixer.replaceText(classToken, 'const'); + yield fixer.insertTextBefore(body, '= '); + yield fixer.insertTextAfter(body, ';'); + } + + for (const node of body.body) { + yield * switchClassMemberToObjectProperty(node, sourceCode, fixer); + } + }; +} + +function create(context) { + context.on(['ClassDeclaration', 'ClassExpression'], node => { + if ( + node.superClass + || (node.decorators && node.decorators.length > 0) + || node.body.type !== 'ClassBody' + || node.body.body.length === 0 + || node.body.body.some(node => !isStaticMember(node)) + ) { + return; + } + + const {sourceCode} = context; + + return { + node, + loc: getClassHeadLocation(node, sourceCode), + messageId: MESSAGE_ID, + fix: switchClassToObject(node, sourceCode), + }; + }); +} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow classes that only have static members.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-thenable.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-thenable.js new file mode 100644 index 0000000000000000000000000000000000000000..238c8b874924d70798963fae2c344e9cf213a69d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-thenable.js @@ -0,0 +1,199 @@ +'use strict'; +const {getStaticValue, getPropertyName} = require('@eslint-community/eslint-utils'); +const {isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID_OBJECT = 'no-thenable-object'; +const MESSAGE_ID_EXPORT = 'no-thenable-export'; +const MESSAGE_ID_CLASS = 'no-thenable-class'; +const messages = { + [MESSAGE_ID_OBJECT]: 'Do not add `then` to an object.', + [MESSAGE_ID_EXPORT]: 'Do not export `then`.', + [MESSAGE_ID_CLASS]: 'Do not add `then` to a class.', +}; + +const isStringThen = (node, context) => + getStaticValue(node, context.sourceCode.getScope(node))?.value === 'then'; +const isPropertyThen = (node, context) => { + // `getPropertyName` throws on `({[Symbol.prototype]: 0})` + // https://github.com/eslint-community/eslint-utils/pull/182 + try { + return getPropertyName(node, context.sourceCode.getScope(node)) === 'then'; + } catch {} + + return false; +}; + +const cases = [ + // `{then() {}}`, + // `{get then() {}}`, + // `{[computedKey]() {}}`, + // `{get [computedKey]() {}}`, + { + selector: 'ObjectExpression', + * getNodes(node, context) { + for (const property of node.properties) { + if (property.type === 'Property' && isPropertyThen(property, context)) { + yield property.key; + } + } + }, + messageId: MESSAGE_ID_OBJECT, + }, + // `class Foo {then}`, + // `class Foo {static then}`, + // `class Foo {get then() {}}`, + // `class Foo {static get then() {}}`, + { + selectors: ['PropertyDefinition', 'MethodDefinition'], + * getNodes(node, context) { + if (getPropertyName(node, context.sourceCode.getScope(node)) === 'then') { + yield node.key; + } + }, + messageId: MESSAGE_ID_CLASS, + }, + // `foo.then = …` + // `foo[computedKey] = …` + { + selector: 'MemberExpression', + * getNodes(node, context) { + if (!(node.parent.type === 'AssignmentExpression' && node.parent.left === node)) { + return; + } + + if (getPropertyName(node, context.sourceCode.getScope(node)) === 'then') { + yield node.property; + } + }, + messageId: MESSAGE_ID_OBJECT, + }, + // `Object.defineProperty(foo, 'then', …)` + // `Reflect.defineProperty(foo, 'then', …)` + { + selector: 'CallExpression', + * getNodes(node, context) { + if (!( + isMethodCall(node, { + objects: ['Object', 'Reflect'], + method: 'defineProperty', + minimumArguments: 3, + optionalCall: false, + optionalMember: false, + }) + && node.arguments[0].type !== 'SpreadElement' + )) { + return; + } + + const [, secondArgument] = node.arguments; + if (isStringThen(secondArgument, context)) { + yield secondArgument; + } + }, + messageId: MESSAGE_ID_OBJECT, + }, + // `Object.fromEntries([['then', …]])` + { + selector: 'CallExpression', + * getNodes(node, context) { + if (!( + isMethodCall(node, { + object: 'Object', + method: 'fromEntries', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && node.arguments[0].type === 'ArrayExpression' + )) { + return; + } + + for (const pairs of node.arguments[0].elements) { + if ( + pairs?.type === 'ArrayExpression' + && pairs.elements[0] + && pairs.elements[0].type !== 'SpreadElement' + ) { + const [key] = pairs.elements; + + if (isStringThen(key, context)) { + yield key; + } + } + } + }, + messageId: MESSAGE_ID_OBJECT, + }, + // `export {then}` + { + selector: 'Identifier', + * getNodes(node) { + if ( + node.name === 'then' + && node.parent.type === 'ExportSpecifier' + && node.parent.exported === node + ) { + yield node; + } + }, + messageId: MESSAGE_ID_EXPORT, + }, + // `export function then() {}`, + // `export class then {}`, + { + selector: 'Identifier', + * getNodes(node) { + if ( + node.name === 'then' + && (node.parent.type === 'FunctionDeclaration' || node.parent.type === 'ClassDeclaration') + && node.parent.id === node + && node.parent.parent.type === 'ExportNamedDeclaration' + && node.parent.parent.declaration === node.parent + ) { + yield node; + } + }, + messageId: MESSAGE_ID_EXPORT, + }, + // `export const … = …`; + { + selector: 'VariableDeclaration', + * getNodes(node, context) { + if (!(node.parent.type === 'ExportNamedDeclaration' && node.parent.declaration === node)) { + return; + } + + for (const variable of context.sourceCode.getDeclaredVariables(node)) { + if (variable.name === 'then') { + yield * variable.identifiers; + } + } + }, + messageId: MESSAGE_ID_EXPORT, + }, +]; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + for (const {selector, selectors, messageId, getNodes} of cases) { + context.on(selector ?? selectors, function * (node) { + for (const problematicNode of getNodes(node, context)) { + yield {node: problematicNode, messageId}; + } + }); + } +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Disallow `then` property.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-this-assignment.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-this-assignment.js new file mode 100644 index 0000000000000000000000000000000000000000..7ba5b97b7d6979f8511441204daa51433653770c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-this-assignment.js @@ -0,0 +1,39 @@ +'use strict'; +const MESSAGE_ID = 'no-this-assignment'; +const messages = { + [MESSAGE_ID]: 'Do not assign `this` to `{{name}}`.', +}; + +function getProblem(variableNode, valueNode) { + if ( + variableNode.type !== 'Identifier' + || valueNode?.type !== 'ThisExpression' + ) { + return; + } + + return { + node: valueNode.parent, + data: {name: variableNode.name}, + messageId: MESSAGE_ID, + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on('VariableDeclarator', node => getProblem(node.id, node.init)); + context.on('AssignmentExpression', node => getProblem(node.left, node.right)); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow assigning `this` to a variable.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-typeof-undefined.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-typeof-undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..54a53064641f7844f7be2692799267a3abd51427 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-typeof-undefined.js @@ -0,0 +1,144 @@ +'use strict'; +const {isLiteral} = require('./ast/index.js'); +const { + addParenthesizesToReturnOrThrowExpression, + removeSpacesAfter, +} = require('./fix/index.js'); +const { + needsSemicolon, + isParenthesized, + isOnSameLine, + isShadowed, +} = require('./utils/index.js'); + +const MESSAGE_ID_ERROR = 'no-typeof-undefined/error'; +const MESSAGE_ID_SUGGESTION = 'no-typeof-undefined/suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Compare with `undefined` directly instead of using `typeof`.', + [MESSAGE_ID_SUGGESTION]: 'Switch to `… {{operator}} undefined`.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const { + checkGlobalVariables, + } = { + checkGlobalVariables: false, + ...context.options[0], + }; + const {sourceCode} = context; + + return { + BinaryExpression(binaryExpression) { + if (!( + ( + binaryExpression.operator === '===' + || binaryExpression.operator === '!==' + || binaryExpression.operator === '==' + || binaryExpression.operator === '!=' + ) + && binaryExpression.left.type === 'UnaryExpression' + && binaryExpression.left.operator === 'typeof' + && binaryExpression.left.prefix + && isLiteral(binaryExpression.right, 'undefined') + )) { + return; + } + + const {left: typeofNode, right: undefinedString, operator} = binaryExpression; + + const valueNode = typeofNode.argument; + const isGlobalVariable = valueNode.type === 'Identifier' + && !isShadowed(sourceCode.getScope(valueNode), valueNode); + + if (!checkGlobalVariables && isGlobalVariable) { + return; + } + + const [typeofToken, secondToken] = sourceCode.getFirstTokens(typeofNode, 2); + + const fix = function * (fixer) { + // Change `==`/`!=` to `===`/`!==` + if (operator === '==' || operator === '!=') { + const operatorToken = sourceCode.getTokenAfter( + typeofNode, + token => token.type === 'Punctuator' && token.value === operator, + ); + + yield fixer.insertTextAfter(operatorToken, '='); + } + + yield fixer.replaceText(undefinedString, 'undefined'); + + yield fixer.remove(typeofToken); + yield removeSpacesAfter(typeofToken, sourceCode, fixer); + + const {parent} = binaryExpression; + if ( + (parent.type === 'ReturnStatement' || parent.type === 'ThrowStatement') + && parent.argument === binaryExpression + && !isOnSameLine(typeofToken, secondToken) + && !isParenthesized(binaryExpression, sourceCode) + && !isParenthesized(typeofNode, sourceCode) + ) { + yield * addParenthesizesToReturnOrThrowExpression(fixer, parent, sourceCode); + return; + } + + const tokenBefore = sourceCode.getTokenBefore(binaryExpression); + if (needsSemicolon(tokenBefore, sourceCode, secondToken.value)) { + yield fixer.insertTextBefore(binaryExpression, ';'); + } + }; + + const problem = { + node: binaryExpression, + loc: typeofToken.loc, + messageId: MESSAGE_ID_ERROR, + }; + + if (isGlobalVariable) { + problem.suggest = [ + { + messageId: MESSAGE_ID_SUGGESTION, + data: {operator: operator.startsWith('!') ? '!==' : '==='}, + fix, + }, + ]; + } else { + problem.fix = fix; + } + + return problem; + }, + }; +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + checkGlobalVariables: { + type: 'boolean', + default: false, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow comparing `undefined` using `typeof`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-await.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-await.js new file mode 100644 index 0000000000000000000000000000000000000000..f0b9516766f6614afba510b1bbc9f948b7ab5dbc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-await.js @@ -0,0 +1,108 @@ +'use strict'; +const { + addParenthesizesToReturnOrThrowExpression, + removeSpacesAfter, +} = require('./fix/index.js'); +const {isParenthesized} = require('./utils/parentheses.js'); +const needsSemicolon = require('./utils/needs-semicolon.js'); +const isOnSameLine = require('./utils/is-on-same-line.js'); + +const MESSAGE_ID = 'no-unnecessary-await'; +const messages = { + [MESSAGE_ID]: 'Do not `await` non-promise value.', +}; + +function notPromise(node) { + switch (node.type) { + case 'ArrayExpression': + case 'ArrowFunctionExpression': + case 'AwaitExpression': + case 'BinaryExpression': + case 'ClassExpression': + case 'FunctionExpression': + case 'JSXElement': + case 'JSXFragment': + case 'Literal': + case 'TemplateLiteral': + case 'UnaryExpression': + case 'UpdateExpression': { + return true; + } + + case 'SequenceExpression': { + return notPromise(node.expressions.at(-1)); + } + + // No default + } + + return false; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + AwaitExpression(node) { + if (!notPromise(node.argument)) { + return; + } + + const {sourceCode} = context; + const awaitToken = sourceCode.getFirstToken(node); + const problem = { + node, + loc: awaitToken.loc, + messageId: MESSAGE_ID, + }; + + const valueNode = node.argument; + if ( + // Removing `await` may change them to a declaration, if there is no `id` will cause SyntaxError + valueNode.type === 'FunctionExpression' + || valueNode.type === 'ClassExpression' + // `+await +1` -> `++1` + || ( + node.parent.type === 'UnaryExpression' + && valueNode.type === 'UnaryExpression' + && node.parent.operator === valueNode.operator + ) + ) { + return problem; + } + + return Object.assign(problem, { + /** @param {import('eslint').Rule.RuleFixer} fixer */ + * fix(fixer) { + if ( + !isOnSameLine(awaitToken, valueNode) + && !isParenthesized(node, sourceCode) + ) { + yield * addParenthesizesToReturnOrThrowExpression(fixer, node.parent, sourceCode); + } + + yield fixer.remove(awaitToken); + yield removeSpacesAfter(awaitToken, sourceCode, fixer); + + const nextToken = sourceCode.getTokenAfter(awaitToken); + const tokenBefore = sourceCode.getTokenBefore(awaitToken); + if (needsSemicolon(tokenBefore, sourceCode, nextToken.value)) { + yield fixer.insertTextBefore(nextToken, ';'); + } + }, + }); + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow awaiting non-promise values.', + recommended: true, + }, + fixable: 'code', + + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-polyfills.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-polyfills.js new file mode 100644 index 0000000000000000000000000000000000000000..7ab4e904d07f31d9119cca89f3beee916e988726 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-polyfills.js @@ -0,0 +1,177 @@ +'use strict'; +const path = require('node:path'); +const readPkgUp = require('read-pkg-up'); +const coreJsCompat = require('core-js-compat'); +const {camelCase} = require('./utils/lodash.js'); +const isStaticRequire = require('./ast/is-static-require.js'); + +const {data: compatData, entries: coreJsEntries} = coreJsCompat; + +const MESSAGE_ID_POLYFILL = 'unnecessaryPolyfill'; +const MESSAGE_ID_CORE_JS = 'unnecessaryCoreJsModule'; +const messages = { + [MESSAGE_ID_POLYFILL]: 'Use built-in instead.', + [MESSAGE_ID_CORE_JS]: + 'All polyfilled features imported from `{{coreJsModule}}` are available as built-ins. Use the built-ins instead.', +}; + +const additionalPolyfillPatterns = { + 'es.promise.finally': '|(p-finally)', + 'es.object.set-prototype-of': '|(setprototypeof)', + 'es.string.code-point-at': '|(code-point-at)', +}; + +const prefixes = '(mdn-polyfills/|polyfill-)'; +const suffixes = '(-polyfill)'; +const delimiter = String.raw`(\.|-|\.prototype\.|/)?`; + +const polyfills = Object.keys(compatData).map(feature => { + let [ecmaVersion, constructorName, methodName = ''] = feature.split('.'); + + if (ecmaVersion === 'es') { + ecmaVersion = String.raw`(es\d*)`; + } + + constructorName = `(${constructorName}|${camelCase(constructorName)})`; + methodName &&= `(${methodName}|${camelCase(methodName)})`; + + const methodOrConstructor = methodName || constructorName; + + const patterns = [ + `^((${prefixes}?(`, + methodName && `(${ecmaVersion}${delimiter}${constructorName}${delimiter}${methodName})|`, // Ex: es6-array-copy-within + methodName && `(${constructorName}${delimiter}${methodName})|`, // Ex: array-copy-within + `(${ecmaVersion}${delimiter}${constructorName}))`, // Ex: es6-array + `${suffixes}?)|`, + `(${prefixes}${methodOrConstructor}|${methodOrConstructor}${suffixes})`, // Ex: polyfill-copy-within / polyfill-promise + `${additionalPolyfillPatterns[feature] || ''})$`, + ]; + + return { + feature, + pattern: new RegExp(patterns.join(''), 'i'), + }; +}); + +function getTargets(options, dirname) { + if (options?.targets) { + return options.targets; + } + + /** @type {readPkgUp.ReadResult | undefined} */ + let packageResult; + try { + // It can fail if, for example, the package.json file has comments. + packageResult = readPkgUp.sync({normalize: false, cwd: dirname}); + } catch {} + + if (!packageResult) { + return; + } + + const {browserlist, engines} = packageResult.packageJson; + return browserlist ?? engines; +} + +function create(context) { + const targets = getTargets(context.options[0], path.dirname(context.filename)); + if (!targets) { + return {}; + } + + let unavailableFeatures; + try { + unavailableFeatures = coreJsCompat({targets}).list; + } catch { + // This can happen if the targets are invalid or use unsupported syntax like `{node:'*'}`. + return {}; + } + + const checkFeatures = features => !features.every(feature => unavailableFeatures.includes(feature)); + + return { + Literal(node) { + if ( + !( + (['ImportDeclaration', 'ImportExpression'].includes(node.parent.type) && node.parent.source === node) + || (isStaticRequire(node.parent) && node.parent.arguments[0] === node) + ) + ) { + return; + } + + const importedModule = node.value; + if (typeof importedModule !== 'string' || ['.', '/'].includes(importedModule[0])) { + return; + } + + const coreJsModuleFeatures = coreJsEntries[importedModule.replace('core-js-pure', 'core-js')]; + + if (coreJsModuleFeatures) { + if (coreJsModuleFeatures.length > 1) { + if (checkFeatures(coreJsModuleFeatures)) { + return { + node, + messageId: MESSAGE_ID_CORE_JS, + data: { + coreJsModule: importedModule, + }, + }; + } + } else if (!unavailableFeatures.includes(coreJsModuleFeatures[0])) { + return {node, messageId: MESSAGE_ID_POLYFILL}; + } + + return; + } + + const polyfill = polyfills.find(({pattern}) => pattern.test(importedModule)); + if (polyfill) { + const [, namespace, method = ''] = polyfill.feature.split('.'); + const [, features] = Object.entries(coreJsEntries).find( + entry => entry[0] === `core-js/full/${namespace}${method && '/'}${method}`, + ); + if (checkFeatures(features)) { + return {node, messageId: MESSAGE_ID_POLYFILL}; + } + } + }, + }; +} + +const schema = [ + { + type: 'object', + additionalProperties: false, + required: ['targets'], + properties: { + targets: { + oneOf: [ + { + type: 'string', + }, + { + type: 'array', + }, + { + type: 'object', + }, + ], + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce the use of built-in methods instead of unnecessary polyfills.', + recommended: true, + }, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unreadable-array-destructuring.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unreadable-array-destructuring.js new file mode 100644 index 0000000000000000000000000000000000000000..6e17b4720b5bb5c1f05cc98ee66a1c8a3e27a744 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unreadable-array-destructuring.js @@ -0,0 +1,84 @@ +'use strict'; +const {isParenthesized} = require('@eslint-community/eslint-utils'); +const shouldAddParenthesesToMemberExpressionObject = require('./utils/should-add-parentheses-to-member-expression-object.js'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); + +const MESSAGE_ID = 'no-unreadable-array-destructuring'; +const messages = { + [MESSAGE_ID]: 'Array destructuring may not contain consecutive ignored values.', +}; + +const isCommaFollowedWithComma = (element, index, array) => + element === null && array[index + 1] === null; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + return { + ArrayPattern(node) { + const {elements, parent} = node; + + if ( + elements.length < 3 + || !elements.some((element, index, elements) => isCommaFollowedWithComma(element, index, elements))) { + return; + } + + const problem = { + node, + messageId: MESSAGE_ID, + }; + + const nonNullElements = elements.filter(node => node !== null); + if ( + parent.type === 'VariableDeclarator' + && parent.id === node + && parent.init !== null + && nonNullElements.length === 1 + ) { + const [element] = nonNullElements; + + if (element.type !== 'AssignmentPattern') { + problem.fix = function * (fixer) { + const index = elements.indexOf(element); + const isSlice = element.type === 'RestElement'; + const variable = isSlice ? element.argument : element; + + yield fixer.replaceText(node, sourceCode.getText(variable)); + + const code = isSlice ? `.slice(${index})` : `[${index}]`; + const array = parent.init; + if ( + !isParenthesized(array, sourceCode) + && shouldAddParenthesesToMemberExpressionObject(array, sourceCode) + ) { + yield fixer.insertTextBefore(array, '('); + yield fixer.insertTextAfter(parent, `)${code}`); + } else { + yield fixer.insertTextAfter(parent, code); + } + + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + }; + } + } + + return problem; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow unreadable array destructuring.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unreadable-iife.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unreadable-iife.js new file mode 100644 index 0000000000000000000000000000000000000000..d8f00983400c08d35878de9447b25047e99a6b23 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unreadable-iife.js @@ -0,0 +1,46 @@ +'use strict'; +const { + isParenthesized, + getParenthesizedRange, + toLocation, +} = require('./utils/index.js'); + +const MESSAGE_ID_ERROR = 'no-unreadable-iife'; +const messages = { + [MESSAGE_ID_ERROR]: 'IIFE with parenthesized arrow function body is considered unreadable.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(callExpression) { + const {sourceCode} = context; + + if ( + callExpression.callee.type !== 'ArrowFunctionExpression' + || callExpression.callee.body.type === 'BlockStatement' + || !isParenthesized(callExpression.callee.body, sourceCode) + ) { + return; + } + + return { + node: callExpression, + loc: toLocation(getParenthesizedRange(callExpression.callee.body, sourceCode), sourceCode), + messageId: MESSAGE_ID_ERROR, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow unreadable IIFEs.', + recommended: true, + }, + hasSuggestions: false, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unused-properties.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unused-properties.js new file mode 100644 index 0000000000000000000000000000000000000000..912d48f933baea406ca21a0d73303496081db99c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-unused-properties.js @@ -0,0 +1,239 @@ +'use strict'; +const getScopes = require('./utils/get-scopes.js'); + +const MESSAGE_ID = 'no-unused-properties'; +const messages = { + [MESSAGE_ID]: 'Property `{{name}}` is defined but never used.', +}; + +const getDeclaratorOrPropertyValue = declaratorOrProperty => + declaratorOrProperty.init + || declaratorOrProperty.value; + +const isMemberExpressionCall = memberExpression => + memberExpression.parent.type === 'CallExpression' + && memberExpression.parent.callee === memberExpression; + +const isMemberExpressionAssignment = memberExpression => + memberExpression.parent.type === 'AssignmentExpression'; + +const isMemberExpressionComputedBeyondPrediction = memberExpression => + memberExpression.computed + && memberExpression.property.type !== 'Literal'; + +const specialProtoPropertyKey = { + type: 'Identifier', + name: '__proto__', +}; + +const propertyKeysEqual = (keyA, keyB) => { + if (keyA.type === 'Identifier') { + if (keyB.type === 'Identifier') { + return keyA.name === keyB.name; + } + + if (keyB.type === 'Literal') { + return keyA.name === keyB.value; + } + } + + if (keyA.type === 'Literal') { + if (keyB.type === 'Identifier') { + return keyA.value === keyB.name; + } + + if (keyB.type === 'Literal') { + return keyA.value === keyB.value; + } + } + + return false; +}; + +const objectPatternMatchesObjectExprPropertyKey = (pattern, key) => + pattern.properties.some(property => { + if (property.type === 'RestElement') { + return true; + } + + return propertyKeysEqual(property.key, key); + }); + +const isLeafDeclaratorOrProperty = declaratorOrProperty => { + const value = getDeclaratorOrPropertyValue(declaratorOrProperty); + + if (!value) { + return true; + } + + if (value.type !== 'ObjectExpression') { + return true; + } + + return false; +}; + +const isUnusedVariable = variable => { + const hasReadReference = variable.references.some(reference => reference.isRead()); + return !hasReadReference; +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + const getPropertyDisplayName = property => { + if (property.key.type === 'Identifier') { + return property.key.name; + } + + if (property.key.type === 'Literal') { + return property.key.value; + } + + return sourceCode.getText(property.key); + }; + + const checkProperty = (property, references, path) => { + if (references.length === 0) { + context.report({ + node: property, + messageId: MESSAGE_ID, + data: { + name: getPropertyDisplayName(property), + }, + }); + return; + } + + checkObject(property, references, path); + }; + + const checkProperties = (objectExpression, references, path = []) => { + for (const property of objectExpression.properties) { + const {key} = property; + + if (!key) { + continue; + } + + if (propertyKeysEqual(key, specialProtoPropertyKey)) { + continue; + } + + const nextPath = [...path, key]; + + const nextReferences = references + .map(reference => { + const {parent} = reference.identifier; + + if (reference.init) { + if ( + parent.type === 'VariableDeclarator' + && parent.parent.type === 'VariableDeclaration' + && parent.parent.parent.type === 'ExportNamedDeclaration' + ) { + return {identifier: parent}; + } + + return; + } + + if (parent.type === 'MemberExpression') { + if ( + isMemberExpressionAssignment(parent) + || isMemberExpressionCall(parent) + || isMemberExpressionComputedBeyondPrediction(parent) + || propertyKeysEqual(parent.property, key) + ) { + return {identifier: parent}; + } + + return; + } + + if ( + parent.type === 'VariableDeclarator' + && parent.id.type === 'ObjectPattern' + ) { + if (objectPatternMatchesObjectExprPropertyKey(parent.id, key)) { + return {identifier: parent}; + } + + return; + } + + if ( + parent.type === 'AssignmentExpression' + && parent.left.type === 'ObjectPattern' + ) { + if (objectPatternMatchesObjectExprPropertyKey(parent.left, key)) { + return {identifier: parent}; + } + + return; + } + + return reference; + }) + .filter(Boolean); + + checkProperty(property, nextReferences, nextPath); + } + }; + + const checkObject = (declaratorOrProperty, references, path) => { + if (isLeafDeclaratorOrProperty(declaratorOrProperty)) { + return; + } + + const value = getDeclaratorOrPropertyValue(declaratorOrProperty); + + checkProperties(value, references, path); + }; + + const checkVariable = variable => { + if (variable.defs.length !== 1) { + return; + } + + if (isUnusedVariable(variable)) { + return; + } + + const [definition] = variable.defs; + + checkObject(definition.node, variable.references); + }; + + const checkVariables = scope => { + for (const variable of scope.variables) { + checkVariable(variable); + } + }; + + return { + 'Program:exit'(program) { + const scopes = getScopes(sourceCode.getScope(program)); + for (const scope of scopes) { + if (scope.type === 'global') { + continue; + } + + checkVariables(scope); + } + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow unused object properties.', + recommended: false, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-fallback-in-spread.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-fallback-in-spread.js new file mode 100644 index 0000000000000000000000000000000000000000..1598173f656da584590e59925c5b03ecfe965806 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-fallback-in-spread.js @@ -0,0 +1,68 @@ +'use strict'; +const { + isParenthesized, + getParenthesizedRange, +} = require('./utils/parentheses.js'); +const {removeParentheses} = require('./fix/index.js'); + +const MESSAGE_ID = 'no-useless-fallback-in-spread'; +const messages = { + [MESSAGE_ID]: 'The empty object is useless.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + ObjectExpression(node) { + if (!( + node.properties.length === 0 + && node.parent.type === 'LogicalExpression' + && node.parent.right === node + && (node.parent.operator === '||' || node.parent.operator === '??') + && node.parent.parent.type === 'SpreadElement' + && node.parent.parent.argument === node.parent + && node.parent.parent.parent.type === 'ObjectExpression' + && node.parent.parent.parent.properties.includes(node.parent.parent) + )) { + return; + } + + return { + node, + messageId: MESSAGE_ID, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + * fix(fixer) { + const {sourceCode} = context; + const logicalExpression = node.parent; + const {left} = logicalExpression; + const isLeftObjectParenthesized = isParenthesized(left, sourceCode); + const [, start] = isLeftObjectParenthesized + ? getParenthesizedRange(left, sourceCode) + : left.range; + const [, end] = logicalExpression.range; + + yield fixer.removeRange([start, end]); + + if ( + isLeftObjectParenthesized + || left.type !== 'SequenceExpression' + ) { + yield * removeParentheses(logicalExpression, fixer, sourceCode); + } + }, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow useless fallback when spreading in object literals.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-length-check.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-length-check.js new file mode 100644 index 0000000000000000000000000000000000000000..d2fc8aedf1dc8dff60616224e66c5510f7892393 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-length-check.js @@ -0,0 +1,153 @@ +'use strict'; +const {isMethodCall, isMemberExpression} = require('./ast/index.js'); +const { + getParenthesizedRange, + isSameReference, + isLogicalExpression, +} = require('./utils/index.js'); + +const messages = { + 'non-zero': 'The non-empty check is useless as `Array#some()` returns `false` for an empty array.', + zero: 'The empty check is useless as `Array#every()` returns `true` for an empty array.', +}; + +// We assume the user already follows `unicorn/explicit-length-check`. These are allowed in that rule. +const isLengthCompareZero = node => + node.type === 'BinaryExpression' + && node.right.type === 'Literal' + && node.right.raw === '0' + && isMemberExpression(node.left, {property: 'length', optional: false}) + && isLogicalExpression(node.parent); + +function flatLogicalExpression(node) { + return [node.left, node.right].flatMap(child => + child.type === 'LogicalExpression' && child.operator === node.operator + ? flatLogicalExpression(child) + : [child], + ); +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const logicalExpressions = []; + const zeroLengthChecks = new Set(); + const nonZeroLengthChecks = new Set(); + const arraySomeCalls = new Set(); + const arrayEveryCalls = new Set(); + + function isUselessLengthCheckNode({node, operator, siblings}) { + return ( + ( + operator === '||' + && zeroLengthChecks.has(node) + && siblings.some(condition => + arrayEveryCalls.has(condition) + && isSameReference(node.left.object, condition.callee.object), + ) + ) + || ( + operator === '&&' + && nonZeroLengthChecks.has(node) + && siblings.some(condition => + arraySomeCalls.has(condition) + && isSameReference(node.left.object, condition.callee.object), + ) + ) + ); + } + + function getUselessLengthCheckNode(logicalExpression) { + const {operator} = logicalExpression; + return flatLogicalExpression(logicalExpression) + .filter((node, index, conditions) => isUselessLengthCheckNode({ + node, + operator, + siblings: [ + conditions[index - 1], + conditions[index + 1], + ].filter(Boolean), + })); + } + + return { + BinaryExpression(node) { + if (isLengthCompareZero(node)) { + const {operator} = node; + if (operator === '===') { + zeroLengthChecks.add(node); + } else if (operator === '>' || operator === '!==') { + nonZeroLengthChecks.add(node); + } + } + }, + CallExpression(node) { + if ( + isMethodCall(node, { + optionalCall: false, + optionalMember: false, + computed: false, + }) + && node.callee.property.type === 'Identifier' + ) { + if (node.callee.property.name === 'some') { + arraySomeCalls.add(node); + } else if (node.callee.property.name === 'every') { + arrayEveryCalls.add(node); + } + } + }, + LogicalExpression(node) { + if (isLogicalExpression(node)) { + logicalExpressions.push(node); + } + }, + * 'Program:exit'() { + const nodes = new Set( + logicalExpressions.flatMap(logicalExpression => + getUselessLengthCheckNode(logicalExpression), + ), + ); + + for (const node of nodes) { + yield { + loc: { + start: node.left.property.loc.start, + end: node.loc.end, + }, + messageId: zeroLengthChecks.has(node) ? 'zero' : 'non-zero', + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix(fixer) { + const {sourceCode} = context; + const {left, right} = node.parent; + const leftRange = getParenthesizedRange(left, sourceCode); + const rightRange = getParenthesizedRange(right, sourceCode); + const range = []; + if (left === node) { + range[0] = leftRange[0]; + range[1] = rightRange[0]; + } else { + range[0] = leftRange[1]; + range[1] = rightRange[1]; + } + + return fixer.removeRange(range); + }, + }; + } + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow useless array length check.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-promise-resolve-reject.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-promise-resolve-reject.js new file mode 100644 index 0000000000000000000000000000000000000000..f99afbba688c5bd765b7de6ef6c05508b9ccf59c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-promise-resolve-reject.js @@ -0,0 +1,213 @@ +'use strict'; +const {getParenthesizedRange} = require('./utils/index.js'); +const {isFunction, isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID_RESOLVE = 'resolve'; +const MESSAGE_ID_REJECT = 'reject'; +const messages = { + [MESSAGE_ID_RESOLVE]: 'Prefer `{{type}} value` over `{{type}} Promise.resolve(value)`.', + [MESSAGE_ID_REJECT]: 'Prefer `throw error` over `{{type}} Promise.reject(error)`.', +}; + +function getFunctionNode(node) { + let isInTryStatement = false; + let functionNode; + for (; node; node = node.parent) { + if (isFunction(node)) { + functionNode = node; + break; + } + + if (node.type === 'TryStatement') { + isInTryStatement = true; + } + } + + return { + functionNode, + isInTryStatement, + }; +} + +function isPromiseCallback(node) { + if ( + node.parent.type === 'CallExpression' + && node.parent.callee.type === 'MemberExpression' + && !node.parent.callee.computed + && node.parent.callee.property.type === 'Identifier' + ) { + const {callee: {property}, arguments: arguments_} = node.parent; + + if ( + arguments_.length === 1 + && ( + property.name === 'then' + || property.name === 'catch' + || property.name === 'finally' + ) + && arguments_[0] === node + ) { + return true; + } + + if ( + arguments_.length === 2 + && property.name === 'then' + && ( + arguments_[0] === node + || (arguments_[0].type !== 'SpreadElement' && arguments_[1] === node) + ) + ) { + return true; + } + } + + return false; +} + +function createProblem(callExpression, fix) { + const {callee, parent} = callExpression; + const method = callee.property.name; + const type = parent.type === 'YieldExpression' ? 'yield' : 'return'; + + return { + node: callee, + messageId: method, + data: {type}, + fix, + }; +} + +function fix(callExpression, isInTryStatement, sourceCode) { + if (callExpression.arguments.length > 1) { + return; + } + + const {callee, parent, arguments: [errorOrValue]} = callExpression; + if (errorOrValue?.type === 'SpreadElement') { + return; + } + + const isReject = callee.property.name === 'reject'; + const isYieldExpression = parent.type === 'YieldExpression'; + if ( + isReject + && ( + isInTryStatement + || (isYieldExpression && parent.parent.type !== 'ExpressionStatement') + ) + ) { + return; + } + + return function (fixer) { + const isArrowFunctionBody = parent.type === 'ArrowFunctionExpression'; + + let text = errorOrValue ? sourceCode.getText(errorOrValue) : ''; + + if (errorOrValue?.type === 'SequenceExpression') { + text = `(${text})`; + } + + if (isReject) { + // `return Promise.reject()` -> `throw undefined` + text ||= 'undefined'; + text = `throw ${text}`; + + if (isYieldExpression) { + return fixer.replaceTextRange( + getParenthesizedRange(parent, sourceCode), + text, + ); + } + + text += ';'; + + // `=> Promise.reject(error)` -> `=> { throw error; }` + if (isArrowFunctionBody) { + text = `{ ${text} }`; + return fixer.replaceTextRange( + getParenthesizedRange(callExpression, sourceCode), + text, + ); + } + } else { + // eslint-disable-next-line no-lonely-if + if (isYieldExpression) { + text = `yield${text ? ' ' : ''}${text}`; + } else if (parent.type === 'ReturnStatement') { + text = `return${text ? ' ' : ''}${text};`; + } else { + if (errorOrValue?.type === 'ObjectExpression') { + text = `(${text})`; + } + + // `=> Promise.resolve()` -> `=> {}` + text ||= '{}'; + } + } + + return fixer.replaceText( + isArrowFunctionBody ? callExpression : parent, + text, + ); + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + return { + CallExpression(callExpression) { + if (!( + isMethodCall(callExpression, { + object: 'Promise', + methods: ['resolve', 'reject'], + optionalCall: false, + optionalMember: false, + }) + && ( + ( + callExpression.parent.type === 'ArrowFunctionExpression' + && callExpression.parent.body === callExpression + ) + || ( + callExpression.parent.type === 'ReturnStatement' + && callExpression.parent.argument === callExpression + ) + || ( + callExpression.parent.type === 'YieldExpression' + && !callExpression.parent.delegate && callExpression.parent.argument === callExpression + ) + ) + )) { + return; + } + + const {functionNode, isInTryStatement} = getFunctionNode(callExpression); + if (!functionNode || !(functionNode.async || isPromiseCallback(functionNode))) { + return; + } + + return createProblem( + callExpression, + fix(callExpression, isInTryStatement, sourceCode), + ); + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-spread.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-spread.js new file mode 100644 index 0000000000000000000000000000000000000000..ef43965a757d571dc7a8ac9d20a689e05e1bde6b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-spread.js @@ -0,0 +1,382 @@ +'use strict'; +const {isCommaToken} = require('@eslint-community/eslint-utils'); +const typedArray = require('./shared/typed-array.js'); +const { + removeParentheses, + fixSpaceAroundKeyword, + addParenthesizesToReturnOrThrowExpression, +} = require('./fix/index.js'); +const { + isParenthesized, + isOnSameLine, +} = require('./utils/index.js'); +const {isNewExpression, isMethodCall, isCallOrNewExpression} = require('./ast/index.js'); + +const SPREAD_IN_LIST = 'spread-in-list'; +const ITERABLE_TO_ARRAY = 'iterable-to-array'; +const ITERABLE_TO_ARRAY_IN_FOR_OF = 'iterable-to-array-in-for-of'; +const ITERABLE_TO_ARRAY_IN_YIELD_STAR = 'iterable-to-array-in-yield-star'; +const CLONE_ARRAY = 'clone-array'; +const messages = { + [SPREAD_IN_LIST]: 'Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.', + [ITERABLE_TO_ARRAY]: '`{{parentDescription}}` accepts iterable as argument, it\'s unnecessary to convert to an array.', + [ITERABLE_TO_ARRAY_IN_FOR_OF]: '`for…of` can iterate over iterable, it\'s unnecessary to convert to an array.', + [ITERABLE_TO_ARRAY_IN_YIELD_STAR]: '`yield*` can delegate iterable, it\'s unnecessary to convert to an array.', + [CLONE_ARRAY]: 'Unnecessarily cloning an array.', +}; + +const isSingleArraySpread = node => + node.type === 'ArrayExpression' + && node.elements.length === 1 + && node.elements[0]?.type === 'SpreadElement'; + +const parentDescriptions = { + ArrayExpression: 'array literal', + ObjectExpression: 'object literal', + CallExpression: 'arguments', + NewExpression: 'arguments', +}; + +function getCommaTokens(arrayExpression, sourceCode) { + let startToken = sourceCode.getFirstToken(arrayExpression); + + return arrayExpression.elements.map((element, index, elements) => { + if (index === elements.length - 1) { + const penultimateToken = sourceCode.getLastToken(arrayExpression, {skip: 1}); + if (isCommaToken(penultimateToken)) { + return penultimateToken; + } + + return; + } + + const commaToken = sourceCode.getTokenAfter(element || startToken, isCommaToken); + startToken = commaToken; + return commaToken; + }); +} + +function * unwrapSingleArraySpread(fixer, arrayExpression, sourceCode) { + const [ + openingBracketToken, + spreadToken, + thirdToken, + ] = sourceCode.getFirstTokens(arrayExpression, 3); + + // `[...value]` + // ^ + yield fixer.remove(openingBracketToken); + + // `[...value]` + // ^^^ + yield fixer.remove(spreadToken); + + const [ + commaToken, + closingBracketToken, + ] = sourceCode.getLastTokens(arrayExpression, 2); + + // `[...value]` + // ^ + yield fixer.remove(closingBracketToken); + + // `[...value,]` + // ^ + if (isCommaToken(commaToken)) { + yield fixer.remove(commaToken); + } + + /* + ```js + function foo() { + return [ + ...value, + ]; + } + ``` + */ + const {parent} = arrayExpression; + if ( + (parent.type === 'ReturnStatement' || parent.type === 'ThrowStatement') + && parent.argument === arrayExpression + && !isOnSameLine(openingBracketToken, thirdToken) + && !isParenthesized(arrayExpression, sourceCode) + ) { + yield * addParenthesizesToReturnOrThrowExpression(fixer, parent, sourceCode); + return; + } + + yield * fixSpaceAroundKeyword(fixer, arrayExpression, sourceCode); +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + // Useless spread in list + context.on(['ArrayExpression', 'ObjectExpression'], node => { + if (!( + node.parent.type === 'SpreadElement' + && node.parent.argument === node + && ( + ( + node.type === 'ObjectExpression' + && node.parent.parent.type === 'ObjectExpression' + && node.parent.parent.properties.includes(node.parent) + ) + || ( + node.type === 'ArrayExpression' + && ( + ( + node.parent.parent.type === 'ArrayExpression' + && node.parent.parent.elements.includes(node.parent) + ) + || ( + isCallOrNewExpression(node.parent.parent) + && node.parent.parent.arguments.includes(node.parent) + ) + ) + ) + ) + )) { + return; + } + + const spreadObject = node; + const spreadElement = spreadObject.parent; + const spreadToken = sourceCode.getFirstToken(spreadElement); + const parentType = spreadElement.parent.type; + + return { + node: spreadToken, + messageId: SPREAD_IN_LIST, + data: { + argumentType: spreadObject.type === 'ArrayExpression' ? 'array' : 'object', + parentDescription: parentDescriptions[parentType], + }, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + * fix(fixer) { + // `[...[foo]]` + // ^^^ + yield fixer.remove(spreadToken); + + // `[...(( [foo] ))]` + // ^^ ^^ + yield * removeParentheses(spreadObject, fixer, sourceCode); + + // `[...[foo]]` + // ^ + const firstToken = sourceCode.getFirstToken(spreadObject); + yield fixer.remove(firstToken); + + const [ + penultimateToken, + lastToken, + ] = sourceCode.getLastTokens(spreadObject, 2); + + // `[...[foo]]` + // ^ + yield fixer.remove(lastToken); + + // `[...[foo,]]` + // ^ + if (isCommaToken(penultimateToken)) { + yield fixer.remove(penultimateToken); + } + + if (parentType !== 'CallExpression' && parentType !== 'NewExpression') { + return; + } + + const commaTokens = getCommaTokens(spreadObject, sourceCode); + for (const [index, commaToken] of commaTokens.entries()) { + if (spreadObject.elements[index]) { + continue; + } + + // `call(...[foo, , bar])` + // ^ Replace holes with `undefined` + yield fixer.insertTextBefore(commaToken, 'undefined'); + } + }, + }; + }); + + // Useless iterable to array + context.on('ArrayExpression', arrayExpression => { + if (!isSingleArraySpread(arrayExpression)) { + return; + } + + const {parent} = arrayExpression; + if (!( + (parent.type === 'ForOfStatement' && parent.right === arrayExpression) + || (parent.type === 'YieldExpression' && parent.delegate && parent.argument === arrayExpression) + || ( + ( + isNewExpression(parent, {names: ['Map', 'WeakMap', 'Set', 'WeakSet'], argumentsLength: 1}) + || isNewExpression(parent, {names: typedArray, minimumArguments: 1}) + || isMethodCall(parent, { + object: 'Promise', + methods: ['all', 'allSettled', 'any', 'race'], + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + || isMethodCall(parent, { + objects: ['Array', ...typedArray], + method: 'from', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + || isMethodCall(parent, { + object: 'Object', + method: 'fromEntries', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + ) + && parent.arguments[0] === arrayExpression + ) + )) { + return; + } + + let parentDescription = ''; + let messageId = ITERABLE_TO_ARRAY; + switch (parent.type) { + case 'ForOfStatement': { + messageId = ITERABLE_TO_ARRAY_IN_FOR_OF; + break; + } + + case 'YieldExpression': { + messageId = ITERABLE_TO_ARRAY_IN_YIELD_STAR; + break; + } + + case 'NewExpression': { + parentDescription = `new ${parent.callee.name}(…)`; + break; + } + + case 'CallExpression': { + parentDescription = `${parent.callee.object.name}.${parent.callee.property.name}(…)`; + break; + } + // No default + } + + return { + node: arrayExpression, + messageId, + data: {parentDescription}, + fix: fixer => unwrapSingleArraySpread(fixer, arrayExpression, sourceCode), + }; + }); + + // Useless array clone + context.on('ArrayExpression', arrayExpression => { + if (!isSingleArraySpread(arrayExpression)) { + return; + } + + const node = arrayExpression.elements[0].argument; + if (!( + // Array methods returns a new array + isMethodCall(node, { + methods: [ + 'concat', + 'copyWithin', + 'filter', + 'flat', + 'flatMap', + 'map', + 'slice', + 'splice', + 'toReversed', + 'toSorted', + 'toSpliced', + 'with', + ], + optionalCall: false, + optionalMember: false, + }) + // `String#split()` + || isMethodCall(node, { + method: 'split', + optionalCall: false, + optionalMember: false, + }) + // `Object.keys()` and `Object.values()` + || isMethodCall(node, { + object: 'Object', + methods: ['keys', 'values'], + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + // `await Promise.all()` and `await Promise.allSettled` + || ( + node.type === 'AwaitExpression' + && isMethodCall(node.argument, { + object: 'Promise', + methods: ['all', 'allSettled'], + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + ) + // `Array.from()`, `Array.of()` + || isMethodCall(node, { + object: 'Array', + methods: ['from', 'of'], + optionalCall: false, + optionalMember: false, + }) + // `new Array()` + || isNewExpression(node, {name: 'Array'}) + )) { + return; + } + + const problem = { + node: arrayExpression, + messageId: CLONE_ARRAY, + }; + + if ( + // `[...new Array(1)]` -> `new Array(1)` is not safe to fix since there are holes + isNewExpression(node, {name: 'Array'}) + // `[...foo.slice(1)]` -> `foo.slice(1)` is not safe to fix since `foo` can be a string + || ( + node.type === 'CallExpression' + && node.callee.type === 'MemberExpression' + && node.callee.property.type === 'Identifier' + && node.callee.property.name === 'slice' + ) + ) { + return problem; + } + + return Object.assign(problem, { + fix: fixer => unwrapSingleArraySpread(fixer, arrayExpression, sourceCode), + }); + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow unnecessary spread.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-switch-case.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-switch-case.js new file mode 100644 index 0000000000000000000000000000000000000000..84d622f030611c455b25b3d64560e23620e1bdae --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-switch-case.js @@ -0,0 +1,58 @@ +'use strict'; +const {isEmptyNode} = require('./ast/index.js'); +const getSwitchCaseHeadLocation = require('./utils/get-switch-case-head-location.js'); + +const MESSAGE_ID_ERROR = 'no-useless-switch-case/error'; +const MESSAGE_ID_SUGGESTION = 'no-useless-switch-case/suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Useless case in switch statement.', + [MESSAGE_ID_SUGGESTION]: 'Remove this case.', +}; + +const isEmptySwitchCase = node => node.consequent.every(node => isEmptyNode(node)); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + * SwitchStatement(switchStatement) { + const {cases} = switchStatement; + + // We only check cases where the last case is the `default` case + if (cases.length < 2 || cases.at(-1).test !== null) { + return; + } + + for (let index = cases.length - 2; index >= 0; index--) { + const node = cases[index]; + if (!isEmptySwitchCase(node)) { + break; + } + + yield { + node, + loc: getSwitchCaseHeadLocation(node, context.sourceCode), + messageId: MESSAGE_ID_ERROR, + suggest: [ + { + messageId: MESSAGE_ID_SUGGESTION, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix: fixer => fixer.remove(node), + }, + ], + }; + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow useless case in switch statements.', + recommended: true, + }, + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-undefined.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..8239bcba9fcf09714b269bb41069840d1cb263af --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-useless-undefined.js @@ -0,0 +1,304 @@ +'use strict'; +const {isCommaToken} = require('@eslint-community/eslint-utils'); +const {replaceNodeOrTokenAndSpacesBefore} = require('./fix/index.js'); +const {isUndefined, isFunction} = require('./ast/index.js'); + +const messageId = 'no-useless-undefined'; +const messages = { + [messageId]: 'Do not use useless `undefined`.', +}; + +const compareFunctionNames = new Set([ + 'is', + 'equal', + 'notEqual', + 'strictEqual', + 'notStrictEqual', + 'propertyVal', + 'notPropertyVal', + 'not', + 'include', + 'property', + 'toBe', + 'toHaveBeenCalledWith', + 'toContain', + 'toContainEqual', + 'toEqual', + 'same', + 'notSame', + 'strictSame', + 'strictNotSame', +]); +const shouldIgnore = node => { + let name; + + if (node.type === 'Identifier') { + name = node.name; + } else if ( + node.type === 'MemberExpression' + && node.computed === false + && node.property.type === 'Identifier' + ) { + name = node.property.name; + } + + return compareFunctionNames.has(name) + // `array.push(undefined)` + || name === 'push' + // `array.unshift(undefined)` + || name === 'unshift' + // `array.includes(undefined)` + || name === 'includes' + + // `set.add(undefined)` + || name === 'add' + // `set.has(undefined)` + || name === 'has' + + // `map.set(foo, undefined)` + || name === 'set' + + // `React.createContext(undefined)` + || name === 'createContext' + // `setState(undefined)` + || /^set[A-Z]/.test(name) + // React 19 useRef + || name === 'useRef' + + // https://vuejs.org/api/reactivity-core.html#ref + || name === 'ref'; +}; + +const getFunction = scope => { + for (; scope; scope = scope.upper) { + if (scope.type === 'function') { + return scope.block; + } + } +}; + +const isFunctionBindCall = node => + !node.optional + && node.callee.type === 'MemberExpression' + && !node.callee.computed + && node.callee.property.type === 'Identifier' + && node.callee.property.name === 'bind'; + +const isTypeScriptFile = context => + /\.(?:ts|mts|cts|tsx)$/i.test(context.physicalFilename); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + const getProblem = (node, fix, checkFunctionReturnType) => { + if (checkFunctionReturnType) { + const functionNode = getFunction(sourceCode.getScope(node)); + if (functionNode?.returnType) { + return; + } + } + + return { + node, + messageId, + fix, + }; + }; + + const options = { + checkArguments: true, + checkArrowFunctionBody: true, + ...context.options[0], + }; + + const removeNodeAndLeadingSpace = (node, fixer) => + replaceNodeOrTokenAndSpacesBefore(node, '', fixer, sourceCode); + + // `return undefined` + context.on('Identifier', node => { + if ( + isUndefined(node) + && node.parent.type === 'ReturnStatement' + && node.parent.argument === node + ) { + return getProblem( + node, + fixer => removeNodeAndLeadingSpace(node, fixer), + /* CheckFunctionReturnType */ true, + ); + } + }); + + // `yield undefined` + context.on('Identifier', node => { + if ( + isUndefined(node) + && node.parent.type === 'YieldExpression' + && !node.parent.delegate + && node.parent.argument === node + ) { + return getProblem( + node, + fixer => removeNodeAndLeadingSpace(node, fixer), + ); + } + }); + + // `() => undefined` + if (options.checkArrowFunctionBody) { + context.on('Identifier', node => { + if ( + isUndefined(node) + && node.parent.type === 'ArrowFunctionExpression' + && node.parent.body === node + ) { + return getProblem( + node, + fixer => replaceNodeOrTokenAndSpacesBefore(node, ' {}', fixer, sourceCode), + /* CheckFunctionReturnType */ true, + ); + } + }); + } + + // `let foo = undefined` / `var foo = undefined` + context.on('Identifier', node => { + if ( + isUndefined(node) + && node.parent.type === 'VariableDeclarator' + && node.parent.init === node + && node.parent.parent.type === 'VariableDeclaration' + && node.parent.parent.kind !== 'const' + && node.parent.parent.declarations.includes(node.parent) + ) { + return getProblem( + node, + fixer => fixer.removeRange([node.parent.id.range[1], node.range[1]]), + /* CheckFunctionReturnType */ true, + ); + } + }); + + // `const {foo = undefined} = {}` + context.on('Identifier', node => { + if ( + isUndefined(node) + && node.parent.type === 'AssignmentPattern' + && node.parent.right === node + ) { + return getProblem( + node, + function * (fixer) { + const assignmentPattern = node.parent; + const {left} = assignmentPattern; + + yield fixer.removeRange([left.range[1], node.range[1]]); + if ( + (left.typeAnnotation || isTypeScriptFile(context)) + && !left.optional + && isFunction(assignmentPattern.parent) + && assignmentPattern.parent.params.includes(assignmentPattern) + ) { + yield ( + left.typeAnnotation + ? fixer.insertTextBefore(left.typeAnnotation, '?') + : fixer.insertTextAfter(left, '?') + ); + } + }, + /* CheckFunctionReturnType */ true, + ); + } + }); + + if (!options.checkArguments) { + return; + } + + context.on('CallExpression', node => { + if (shouldIgnore(node.callee)) { + return; + } + + const argumentNodes = node.arguments; + + // Ignore arguments in `Function#bind()`, but not `this` argument + if (isFunctionBindCall(node) && argumentNodes.length !== 1) { + return; + } + + const undefinedArguments = []; + for (let index = argumentNodes.length - 1; index >= 0; index--) { + const node = argumentNodes[index]; + if (isUndefined(node)) { + undefinedArguments.unshift(node); + } else { + break; + } + } + + if (undefinedArguments.length === 0) { + return; + } + + const firstUndefined = undefinedArguments[0]; + const lastUndefined = undefinedArguments.at(-1); + + return { + messageId, + loc: { + start: firstUndefined.loc.start, + end: lastUndefined.loc.end, + }, + fix(fixer) { + let start = firstUndefined.range[0]; + let end = lastUndefined.range[1]; + + const previousArgument = argumentNodes[argumentNodes.length - undefinedArguments.length - 1]; + + if (previousArgument) { + start = previousArgument.range[1]; + } else { + // If all arguments removed, and there is trailing comma, we need remove it. + const tokenAfter = sourceCode.getTokenAfter(lastUndefined); + if (isCommaToken(tokenAfter)) { + end = tokenAfter.range[1]; + } + } + + return fixer.removeRange([start, end]); + }, + }; + }); +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + checkArguments: { + type: 'boolean', + }, + checkArrowFunctionBody: { + type: 'boolean', + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow useless `undefined`.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-zero-fractions.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-zero-fractions.js new file mode 100644 index 0000000000000000000000000000000000000000..185a0239047167bac454bf7065c36350b3c4fa72 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/no-zero-fractions.js @@ -0,0 +1,80 @@ +'use strict'; +const {isParenthesized} = require('@eslint-community/eslint-utils'); +const needsSemicolon = require('./utils/needs-semicolon.js'); +const {isDecimalInteger} = require('./utils/numeric.js'); +const toLocation = require('./utils/to-location.js'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); +const {isNumberLiteral} = require('./ast/index.js'); + +const MESSAGE_ZERO_FRACTION = 'zero-fraction'; +const MESSAGE_DANGLING_DOT = 'dangling-dot'; +const messages = { + [MESSAGE_ZERO_FRACTION]: 'Don\'t use a zero fraction in the number.', + [MESSAGE_DANGLING_DOT]: 'Don\'t use a dangling dot in the number.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + Literal(node) { + if (!isNumberLiteral(node)) { + return; + } + + // Legacy octal number `0777` and prefixed number `0o1234` cannot have a dot. + const {raw} = node; + const match = raw.match(/^(?[\d_]*)(?\.[\d_]*)(?.*)$/); + if (!match) { + return; + } + + const {before, dotAndFractions, after} = match.groups; + const fixedDotAndFractions = dotAndFractions.replaceAll(/[.0_]+$/g, ''); + const formatted = ((before + fixedDotAndFractions) || '0') + after; + + if (formatted === raw) { + return; + } + + const isDanglingDot = dotAndFractions === '.'; + // End of fractions + const end = node.range[0] + before.length + dotAndFractions.length; + const start = end - (raw.length - formatted.length); + const {sourceCode} = context; + return { + loc: toLocation([start, end], sourceCode), + messageId: isDanglingDot ? MESSAGE_DANGLING_DOT : MESSAGE_ZERO_FRACTION, + * fix(fixer) { + let fixed = formatted; + if ( + node.parent.type === 'MemberExpression' + && node.parent.object === node + && isDecimalInteger(formatted) + && !isParenthesized(node, sourceCode) + ) { + fixed = `(${fixed})`; + + if (needsSemicolon(sourceCode.getTokenBefore(node), sourceCode, fixed)) { + fixed = `;${fixed}`; + } + } + + yield fixer.replaceText(node, fixed); + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + }, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Disallow number literals with zero fractions or dangling dots.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/number-literal-case.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/number-literal-case.js new file mode 100644 index 0000000000000000000000000000000000000000..6d93da187c2645c9fb3167fd27332b12a9188a2a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/number-literal-case.js @@ -0,0 +1,53 @@ +'use strict'; +const {checkVueTemplate} = require('./utils/rule.js'); +const {isNumberLiteral, isBigIntLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'number-literal-case'; +const messages = { + [MESSAGE_ID]: 'Invalid number literal casing.', +}; + +const fix = raw => { + let fixed = raw.toLowerCase(); + if (fixed.startsWith('0x')) { + fixed = '0x' + fixed.slice(2).toUpperCase(); + } + + return fixed; +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + Literal(node) { + const {raw} = node; + + let fixed = raw; + if (isNumberLiteral(node)) { + fixed = fix(raw); + } else if (isBigIntLiteral(node)) { + fixed = fix(raw.slice(0, -1)) + 'n'; + } + + if (raw !== fixed) { + return { + node, + messageId: MESSAGE_ID, + fix: fixer => fixer.replaceText(node, fixed), + }; + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create: checkVueTemplate(create), + meta: { + type: 'suggestion', + docs: { + description: 'Enforce proper case for numeric literals.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/numeric-separators-style.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/numeric-separators-style.js new file mode 100644 index 0000000000000000000000000000000000000000..7b713c1cf90c9acdc8fc2aadb149605693d6e53f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/numeric-separators-style.js @@ -0,0 +1,182 @@ +'use strict'; +const numeric = require('./utils/numeric.js'); +const {isBigIntLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'numeric-separators-style'; +const messages = { + [MESSAGE_ID]: 'Invalid group length in numeric value.', +}; + +function addSeparator(value, {minimumDigits, groupLength}, fromLeft) { + const {length} = value; + + if (length < minimumDigits) { + return value; + } + + const parts = []; + if (fromLeft) { + for (let start = 0; start < length; start += groupLength) { + const end = Math.min(start + groupLength, length); + parts.push(value.slice(start, end)); + } + } else { + for (let end = length; end > 0; end -= groupLength) { + const start = Math.max(end - groupLength, 0); + parts.unshift(value.slice(start, end)); + } + } + + return parts.join('_'); +} + +function addSeparatorFromLeft(value, options) { + return addSeparator(value, options, true); +} + +function formatNumber(value, options) { + const {integer, dot, fractional} = numeric.parseFloatNumber(value); + return addSeparator(integer, options) + dot + addSeparatorFromLeft(fractional, options); +} + +function format(value, {prefix, data}, options) { + const formatOption = options[prefix.toLowerCase()]; + + if (prefix) { + return prefix + addSeparator(data, formatOption); + } + + const { + number, + mark, + sign, + power, + } = numeric.parseNumber(value); + + return formatNumber(number, formatOption) + mark + sign + addSeparator(power, options['']); +} + +const defaultOptions = { + binary: {minimumDigits: 0, groupLength: 4}, + octal: {minimumDigits: 0, groupLength: 4}, + hexadecimal: {minimumDigits: 0, groupLength: 2}, + number: {minimumDigits: 5, groupLength: 3}, +}; +const create = context => { + const { + onlyIfContainsSeparator, + binary, + octal, + hexadecimal, + number, + } = { + onlyIfContainsSeparator: false, + ...context.options[0], + }; + + const options = { + '0b': { + onlyIfContainsSeparator, + ...defaultOptions.binary, + ...binary, + }, + '0o': { + onlyIfContainsSeparator, + ...defaultOptions.octal, + ...octal, + }, + '0x': { + onlyIfContainsSeparator, + ...defaultOptions.hexadecimal, + ...hexadecimal, + }, + '': { + onlyIfContainsSeparator, + ...defaultOptions.number, + ...number, + }, + }; + + return { + Literal(node) { + if (!numeric.isNumeric(node) || numeric.isLegacyOctal(node)) { + return; + } + + const {raw} = node; + let number = raw; + let suffix = ''; + if (isBigIntLiteral(node)) { + number = raw.slice(0, -1); + suffix = 'n'; + } + + const strippedNumber = number.replaceAll('_', ''); + const {prefix, data} = numeric.getPrefix(strippedNumber); + + const {onlyIfContainsSeparator} = options[prefix.toLowerCase()]; + if (onlyIfContainsSeparator && !raw.includes('_')) { + return; + } + + const formatted = format(strippedNumber, {prefix, data}, options) + suffix; + + if (raw !== formatted) { + return { + node, + messageId: MESSAGE_ID, + fix: fixer => fixer.replaceText(node, formatted), + }; + } + }, + }; +}; + +const formatOptionsSchema = ({minimumDigits, groupLength}) => ({ + type: 'object', + additionalProperties: false, + properties: { + onlyIfContainsSeparator: { + type: 'boolean', + }, + minimumDigits: { + type: 'integer', + minimum: 0, + default: minimumDigits, + }, + groupLength: { + type: 'integer', + minimum: 1, + default: groupLength, + }, + }, +}); + +const schema = [{ + type: 'object', + additionalProperties: false, + properties: { + ...Object.fromEntries( + Object.entries(defaultOptions).map(([type, options]) => [type, formatOptionsSchema(options)]), + ), + onlyIfContainsSeparator: { + type: 'boolean', + default: false, + }, + }, +}]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce the style of numeric separators by correctly grouping digits.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-add-event-listener.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-add-event-listener.js new file mode 100644 index 0000000000000000000000000000000000000000..f40b8545b0c98a0d68e755ae5083688c424538bc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-add-event-listener.js @@ -0,0 +1,189 @@ +'use strict'; +const {isParenthesized} = require('@eslint-community/eslint-utils'); +const eventTypes = require('./shared/dom-events.js'); +const {isUndefined, isNullLiteral, isStaticRequire} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-add-event-listener'; +const messages = { + [MESSAGE_ID]: 'Prefer `{{replacement}}` over `{{method}}`.{{extra}}', +}; +const extraMessages = { + beforeunload: 'Use `event.preventDefault(); event.returnValue = \'foo\'` to trigger the prompt.', + message: 'Note that there is difference between `SharedWorker#onmessage` and `SharedWorker#addEventListener(\'message\')`.', + error: 'Note that there is difference between `{window,element}.onerror` and `{window,element}.addEventListener(\'error\')`.', +}; + +const getEventMethodName = memberExpression => memberExpression.property.name; +const getEventTypeName = eventMethodName => eventMethodName.slice('on'.length); + +const fixCode = (fixer, sourceCode, assignmentNode, memberExpression) => { + const eventTypeName = getEventTypeName(getEventMethodName(memberExpression)); + let eventObjectCode = sourceCode.getText(memberExpression.object); + if (isParenthesized(memberExpression.object, sourceCode)) { + eventObjectCode = `(${eventObjectCode})`; + } + + let fncCode = sourceCode.getText(assignmentNode.right); + if (isParenthesized(assignmentNode.right, sourceCode)) { + fncCode = `(${fncCode})`; + } + + const fixedCodeStatement = `${eventObjectCode}.addEventListener('${eventTypeName}', ${fncCode})`; + return fixer.replaceText(assignmentNode, fixedCodeStatement); +}; + +const shouldFixBeforeUnload = (assignedExpression, nodeReturnsSomething) => { + if ( + assignedExpression.type !== 'ArrowFunctionExpression' + && assignedExpression.type !== 'FunctionExpression' + ) { + return false; + } + + if (assignedExpression.body.type !== 'BlockStatement') { + return false; + } + + return !nodeReturnsSomething.get(assignedExpression); +}; + +const isClearing = node => isUndefined(node) || isNullLiteral(node); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const options = context.options[0] || {}; + const excludedPackages = new Set(options.excludedPackages || ['koa', 'sax']); + let isDisabled; + + const nodeReturnsSomething = new WeakMap(); + let codePathInfo; + + return { + onCodePathStart(codePath, node) { + codePathInfo = { + node, + upper: codePathInfo, + returnsSomething: false, + }; + }, + + onCodePathEnd() { + nodeReturnsSomething.set(codePathInfo.node, codePathInfo.returnsSomething); + codePathInfo = codePathInfo.upper; + }, + + CallExpression(node) { + if (!isStaticRequire(node)) { + return; + } + + if (!isDisabled && excludedPackages.has(node.arguments[0].value)) { + isDisabled = true; + } + }, + + Literal(node) { + if (node.parent.type === 'ImportDeclaration' && !isDisabled && excludedPackages.has(node.value)) { + isDisabled = true; + } + }, + + ReturnStatement(node) { + codePathInfo.returnsSomething ||= Boolean(node.argument); + }, + + 'AssignmentExpression:exit'(node) { + if (isDisabled) { + return; + } + + const {left: memberExpression, right: assignedExpression, operator} = node; + + if ( + memberExpression.type !== 'MemberExpression' + || memberExpression.computed + ) { + return; + } + + const eventMethodName = getEventMethodName(memberExpression); + + if (!eventMethodName || !eventMethodName.startsWith('on')) { + return; + } + + const eventTypeName = getEventTypeName(eventMethodName); + + if (!eventTypes.has(eventTypeName)) { + return; + } + + let replacement = 'addEventListener'; + let extra = ''; + let fix; + + if (isClearing(assignedExpression)) { + replacement = 'removeEventListener'; + } else if ( + eventTypeName === 'beforeunload' + && !shouldFixBeforeUnload(assignedExpression, nodeReturnsSomething) + ) { + extra = extraMessages.beforeunload; + } else if (eventTypeName === 'message') { + // Disable `onmessage` fix, see #537 + extra = extraMessages.message; + } else if (eventTypeName === 'error') { + // Disable `onerror` fix, see #1493 + extra = extraMessages.error; + } else if ( + operator === '=' + && node.parent.type === 'ExpressionStatement' + && node.parent.expression === node + ) { + fix = fixer => fixCode(fixer, context.sourceCode, node, memberExpression); + } + + return { + node: memberExpression.property, + messageId: MESSAGE_ID, + data: { + replacement, + method: eventMethodName, + extra: extra ? ` ${extra}` : '', + }, + fix, + }; + }, + }; +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + excludedPackages: { + type: 'array', + items: { + type: 'string', + }, + uniqueItems: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-find.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-find.js new file mode 100644 index 0000000000000000000000000000000000000000..85ff943cf1c587dae1c5a59cb7fc990ae8a8b4bd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-find.js @@ -0,0 +1,452 @@ +'use strict'; +const {isParenthesized, findVariable} = require('@eslint-community/eslint-utils'); +const { + extendFixRange, + removeMemberExpressionProperty, + removeMethodCall, + renameVariable, +} = require('./fix/index.js'); +const { + isLeftHandSide, + singular, + getScopes, + avoidCapture, + getVariableIdentifiers, +} = require('./utils/index.js'); +const {isMethodCall} = require('./ast/index.js'); + +const ERROR_ZERO_INDEX = 'error-zero-index'; +const ERROR_SHIFT = 'error-shift'; +const ERROR_POP = 'error-pop'; +const ERROR_AT_ZERO = 'error-at-zero'; +const ERROR_AT_MINUS_ONE = 'error-at-minus-one'; +const ERROR_DESTRUCTURING_DECLARATION = 'error-destructuring-declaration'; +const ERROR_DESTRUCTURING_ASSIGNMENT = 'error-destructuring-assignment'; +const ERROR_DECLARATION = 'error-variable'; +const SUGGESTION_NULLISH_COALESCING_OPERATOR = 'suggest-nullish-coalescing-operator'; +const SUGGESTION_LOGICAL_OR_OPERATOR = 'suggest-logical-or-operator'; +const messages = { + [ERROR_DECLARATION]: 'Prefer `.find(…)` over `.filter(…)`.', + [ERROR_ZERO_INDEX]: 'Prefer `.find(…)` over `.filter(…)[0]`.', + [ERROR_AT_ZERO]: 'Prefer `.find(…)` over `.filter(…).at(0)`.', + [ERROR_SHIFT]: 'Prefer `.find(…)` over `.filter(…).shift()`.', + [ERROR_POP]: 'Prefer `.findLast(…)` over `.filter(…).pop()`.', + [ERROR_AT_MINUS_ONE]: 'Prefer `.findLast(…)` over `.filter(…).at(-1)`.', + [ERROR_DESTRUCTURING_DECLARATION]: 'Prefer `.find(…)` over destructuring `.filter(…)`.', + // Same message as `ERROR_DESTRUCTURING_DECLARATION`, but different case + [ERROR_DESTRUCTURING_ASSIGNMENT]: 'Prefer `.find(…)` over destructuring `.filter(…)`.', + [SUGGESTION_NULLISH_COALESCING_OPERATOR]: 'Replace `.filter(…)` with `.find(…) ?? …`.', + [SUGGESTION_LOGICAL_OR_OPERATOR]: 'Replace `.filter(…)` with `.find(…) || …`.', +}; + +const isArrayFilterCall = node => isMethodCall(node, { + method: 'filter', + minimumArguments: 1, + maximumArguments: 2, + optionalCall: false, + optionalMember: false, +}); + +// Need add `()` to the `AssignmentExpression` +// - `ObjectExpression`: `[{foo}] = array.filter(bar)` fix to `{foo} = array.find(bar)` +// - `ObjectPattern`: `[{foo = baz}] = array.filter(bar)` +const assignmentNeedParenthesize = (node, sourceCode) => { + const isAssign = node.type === 'AssignmentExpression'; + + if (!isAssign || isParenthesized(node, sourceCode)) { + return false; + } + + const {left} = getDestructuringLeftAndRight(node); + const [element] = left.elements; + const {type} = element.type === 'AssignmentPattern' ? element.left : element; + return type === 'ObjectExpression' || type === 'ObjectPattern'; +}; + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table +const hasLowerPrecedence = (node, operator) => ( + (node.type === 'LogicalExpression' && ( + node.operator === operator + // https://tc39.es/proposal-nullish-coalescing/ says + // `??` has lower precedence than `||` + // But MDN says + // `??` has higher precedence than `||` + || (operator === '||' && node.operator === '??') + || (operator === '??' && (node.operator === '||' || node.operator === '&&')) + )) + || node.type === 'ConditionalExpression' + // Lower than `assignment`, should already parenthesized + /* c8 ignore next */ + || node.type === 'AssignmentExpression' + || node.type === 'YieldExpression' + || node.type === 'SequenceExpression' +); + +const getDestructuringLeftAndRight = node => { + /* c8 ignore next 3 */ + if (!node) { + return {}; + } + + if (node.type === 'AssignmentExpression') { + return node; + } + + if (node.type === 'VariableDeclarator') { + return {left: node.id, right: node.init}; + } + + return {}; +}; + +function * fixDestructuring(node, sourceCode, fixer) { + const {left} = getDestructuringLeftAndRight(node); + const [element] = left.elements; + + const leftText = sourceCode.getText(element.type === 'AssignmentPattern' ? element.left : element); + yield fixer.replaceText(left, leftText); + + // `AssignmentExpression` always starts with `[` or `(`, so we don't need check ASI + if (assignmentNeedParenthesize(node, sourceCode)) { + yield fixer.insertTextBefore(node, '('); + yield fixer.insertTextAfter(node, ')'); + } +} + +const hasDefaultValue = node => getDestructuringLeftAndRight(node).left.elements[0].type === 'AssignmentPattern'; + +const fixDestructuringDefaultValue = (node, sourceCode, fixer, operator) => { + const {left, right} = getDestructuringLeftAndRight(node); + const [element] = left.elements; + const defaultValue = element.right; + let defaultValueText = sourceCode.getText(defaultValue); + + if (isParenthesized(defaultValue, sourceCode) || hasLowerPrecedence(defaultValue, operator)) { + defaultValueText = `(${defaultValueText})`; + } + + return fixer.insertTextAfter(right, ` ${operator} ${defaultValueText}`); +}; + +const fixDestructuringAndReplaceFilter = (sourceCode, node) => { + const {property} = getDestructuringLeftAndRight(node).right.callee; + + let suggest; + let fix; + + if (hasDefaultValue(node)) { + suggest = [ + {operator: '??', messageId: SUGGESTION_NULLISH_COALESCING_OPERATOR}, + {operator: '||', messageId: SUGGESTION_LOGICAL_OR_OPERATOR}, + ].map(({messageId, operator}) => ({ + messageId, + * fix(fixer) { + yield fixer.replaceText(property, 'find'); + yield fixDestructuringDefaultValue(node, sourceCode, fixer, operator); + yield * fixDestructuring(node, sourceCode, fixer); + }, + })); + } else { + fix = function * (fixer) { + yield fixer.replaceText(property, 'find'); + yield * fixDestructuring(node, sourceCode, fixer); + }; + } + + return {fix, suggest}; +}; + +const isAccessingZeroIndex = node => + node.parent.type === 'MemberExpression' + && node.parent.computed === true + && node.parent.object === node + && node.parent.property.type === 'Literal' + && node.parent.property.raw === '0'; + +const isDestructuringFirstElement = node => { + const {left, right} = getDestructuringLeftAndRight(node.parent); + return left + && right + && right === node + && left.type === 'ArrayPattern' + && left.elements.length === 1 + && left.elements[0] + && left.elements[0].type !== 'RestElement'; +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + const { + checkFromLast, + } = { + checkFromLast: true, + ...context.options[0], + }; + + // Zero index access + context.on('MemberExpression', node => { + if (!( + node.computed + && node.property.type === 'Literal' + && node.property.raw === '0' + && isArrayFilterCall(node.object) + && !isLeftHandSide(node) + )) { + return; + } + + return { + node: node.object.callee.property, + messageId: ERROR_ZERO_INDEX, + fix: fixer => [ + fixer.replaceText(node.object.callee.property, 'find'), + removeMemberExpressionProperty(fixer, node, sourceCode), + ], + }; + }); + + // `array.filter().shift()` + context.on('CallExpression', node => { + if (!( + isMethodCall(node, { + method: 'shift', + argumentsLength: 0, + optionalCall: false, + optionalMember: false, + }) + && isArrayFilterCall(node.callee.object) + )) { + return; + } + + return { + node: node.callee.object.callee.property, + messageId: ERROR_SHIFT, + fix: fixer => [ + fixer.replaceText(node.callee.object.callee.property, 'find'), + ...removeMethodCall(fixer, node, sourceCode), + ], + }; + }); + + // `const [foo] = array.filter()` + context.on('VariableDeclarator', node => { + if (!( + node.id.type === 'ArrayPattern' + && node.id.elements.length === 1 + && node.id.elements[0] + && node.id.elements[0].type !== 'RestElement' + && isArrayFilterCall(node.init) + )) { + return; + } + + return { + node: node.init.callee.property, + messageId: ERROR_DESTRUCTURING_DECLARATION, + ...fixDestructuringAndReplaceFilter(sourceCode, node), + }; + }); + + // `[foo] = array.filter()` + context.on('AssignmentExpression', node => { + if (!( + node.left.type === 'ArrayPattern' + && node.left.elements.length === 1 + && node.left.elements[0] + && node.left.elements[0].type !== 'RestElement' + && isArrayFilterCall(node.right) + )) { + return; + } + + return { + node: node.right.callee.property, + messageId: ERROR_DESTRUCTURING_ASSIGNMENT, + ...fixDestructuringAndReplaceFilter(sourceCode, node), + }; + }); + + // `const foo = array.filter(); foo[0]; [bar] = foo` + context.on('VariableDeclarator', node => { + if (!( + node.id.type === 'Identifier' + && isArrayFilterCall(node.init) + && node.parent.type === 'VariableDeclaration' + && node.parent.declarations.includes(node) + // Exclude `export const foo = [];` + && !( + node.parent.parent.type === 'ExportNamedDeclaration' + && node.parent.parent.declaration === node.parent + ) + )) { + return; + } + + const scope = sourceCode.getScope(node); + const variable = findVariable(scope, node.id); + const identifiers = getVariableIdentifiers(variable).filter(identifier => identifier !== node.id); + + if (identifiers.length === 0) { + return; + } + + const zeroIndexNodes = []; + const destructuringNodes = []; + for (const identifier of identifiers) { + if (isAccessingZeroIndex(identifier)) { + zeroIndexNodes.push(identifier.parent); + } else if (isDestructuringFirstElement(identifier)) { + destructuringNodes.push(identifier.parent); + } else { + return; + } + } + + const problem = { + node: node.init.callee.property, + messageId: ERROR_DECLARATION, + }; + + // `const [foo = bar] = baz` is not fixable + if (!destructuringNodes.some(node => hasDefaultValue(node))) { + problem.fix = function * (fixer) { + yield fixer.replaceText(node.init.callee.property, 'find'); + + const singularName = singular(node.id.name); + if (singularName) { + // Rename variable to be singularized now that it refers to a single item in the array instead of the entire array. + const singularizedName = avoidCapture(singularName, getScopes(scope)); + yield * renameVariable(variable, singularizedName, fixer); + + // Prevent possible variable conflicts + yield * extendFixRange(fixer, sourceCode.ast.range); + } + + for (const node of zeroIndexNodes) { + yield removeMemberExpressionProperty(fixer, node, sourceCode); + } + + for (const node of destructuringNodes) { + yield * fixDestructuring(node, sourceCode, fixer); + } + }; + } + + return problem; + }); + + // `array.filter().at(0)` + context.on('CallExpression', node => { + if (!( + isMethodCall(node, { + method: 'at', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && node.arguments[0].type === 'Literal' + && node.arguments[0].raw === '0' + && isArrayFilterCall(node.callee.object) + )) { + return; + } + + return { + node: node.callee.object.callee.property, + messageId: ERROR_AT_ZERO, + fix: fixer => [ + fixer.replaceText(node.callee.object.callee.property, 'find'), + ...removeMethodCall(fixer, node, sourceCode), + ], + }; + }); + + if (!checkFromLast) { + return; + } + + // `array.filter().pop()` + context.on('CallExpression', node => { + if (!( + isMethodCall(node, { + method: 'pop', + argumentsLength: 0, + optionalCall: false, + optionalMember: false, + }) + && isArrayFilterCall(node.callee.object) + )) { + return; + } + + return { + node: node.callee.object.callee.property, + messageId: ERROR_POP, + fix: fixer => [ + fixer.replaceText(node.callee.object.callee.property, 'findLast'), + ...removeMethodCall(fixer, node, sourceCode), + ], + }; + }); + + // `array.filter().at(-1)` + context.on('CallExpression', node => { + if (!( + isMethodCall(node, { + method: 'at', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && node.arguments[0].type === 'UnaryExpression' + && node.arguments[0].operator === '-' + && node.arguments[0].prefix + && node.arguments[0].argument.type === 'Literal' + && node.arguments[0].argument.raw === '1' + && isArrayFilterCall(node.callee.object) + )) { + return; + } + + return { + node: node.callee.object.callee.property, + messageId: ERROR_AT_MINUS_ONE, + fix: fixer => [ + fixer.replaceText(node.callee.object.callee.property, 'findLast'), + ...removeMethodCall(fixer, node, sourceCode), + ], + }; + }); +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + checkFromLast: { + type: 'boolean', + // TODO: Remove the option at some point. + default: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat-map.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat-map.js new file mode 100644 index 0000000000000000000000000000000000000000..5b4e444f3d4370e2b73db0f3aca35656b250c92d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat-map.js @@ -0,0 +1,83 @@ +'use strict'; +const {isNodeMatches} = require('./utils/is-node-matches.js'); +const {isMethodCall} = require('./ast/index.js'); +const {removeMethodCall} = require('./fix/index.js'); + +const MESSAGE_ID = 'prefer-array-flat-map'; +const messages = { + [MESSAGE_ID]: 'Prefer `.flatMap(…)` over `.map(…).flat()`.', +}; + +const ignored = ['React.Children', 'Children']; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(callExpression) { + if (!( + isMethodCall(callExpression, { + method: 'flat', + optionalCall: false, + optionalMember: false, + }) + && ( + callExpression.arguments.length === 0 + || ( + callExpression.arguments.length === 1 + && callExpression.arguments[0].type === 'Literal' + && callExpression.arguments[0].raw === '1' + ) + ) + && isMethodCall(callExpression.callee.object, { + method: 'map', + optionalCall: false, + optionalMember: false, + }) + )) { + return; + } + + const flatCallExpression = callExpression; + const mapCallExpression = flatCallExpression.callee.object; + if (isNodeMatches(mapCallExpression.callee.object, ignored)) { + return; + } + + const {sourceCode} = context; + const mapProperty = mapCallExpression.callee.property; + + return { + node: flatCallExpression, + loc: {start: mapProperty.loc.start, end: flatCallExpression.loc.end}, + messageId: MESSAGE_ID, + * fix(fixer) { + // Removes: + // map(…).flat(); + // ^^^^^^^ + // (map(…)).flat(); + // ^^^^^^^ + yield * removeMethodCall(fixer, flatCallExpression, sourceCode); + + // Renames: + // map(…).flat(); + // ^^^ + // (map(…)).flat(); + // ^^^ + yield fixer.replaceText(mapProperty, 'flatMap'); + }, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `.flatMap(…)` over `.map(…).flat()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat.js new file mode 100644 index 0000000000000000000000000000000000000000..854ff24a80baabe5d820e17d7b3b189e3e4aad8e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat.js @@ -0,0 +1,280 @@ +'use strict'; +const { + getParenthesizedText, + isArrayPrototypeProperty, + isNodeMatches, + isNodeMatchesNameOrPath, + isParenthesized, + isSameIdentifier, + needsSemicolon, + shouldAddParenthesesToMemberExpressionObject, +} = require('./utils/index.js'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); +const { + isMethodCall, + isCallExpression, +} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-array-flat'; +const messages = { + [MESSAGE_ID]: 'Prefer `Array#flat()` over `{{description}}` to flatten an array.', +}; + +const isEmptyArrayExpression = node => + node.type === 'ArrayExpression' + && node.elements.length === 0; + +// `array.flatMap(x => x)` +const arrayFlatMap = { + testFunction(node) { + if (!isMethodCall(node, { + method: 'flatMap', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + })) { + return false; + } + + const [firstArgument] = node.arguments; + return ( + firstArgument.type === 'ArrowFunctionExpression' + && !firstArgument.async + && firstArgument.params.length === 1 + && isSameIdentifier(firstArgument.params[0], firstArgument.body) + ); + }, + getArrayNode: node => node.callee.object, + description: 'Array#flatMap()', +}; + +// `array.reduce((a, b) => a.concat(b), [])` +// `array.reduce((a, b) => [...a, ...b], [])` +const arrayReduce = { + testFunction(node) { + if (!isMethodCall(node, { + method: 'reduce', + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + })) { + return false; + } + + const [firstArgument, secondArgument] = node.arguments; + if (!( + firstArgument.type === 'ArrowFunctionExpression' + && !firstArgument.async + && firstArgument.params.length === 2 + && isEmptyArrayExpression(secondArgument) + )) { + return false; + } + + const firstArgumentBody = firstArgument.body; + const [firstParameter, secondParameter] = firstArgument.params; + return ( + // `(a, b) => a.concat(b)` + ( + isMethodCall(firstArgumentBody, { + method: 'concat', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && isSameIdentifier(firstParameter, firstArgumentBody.callee.object) + && isSameIdentifier(secondParameter, firstArgumentBody.arguments[0]) + ) + // `(a, b) => [...a, ...b]` + || ( + firstArgumentBody.type === 'ArrayExpression' + && firstArgumentBody.elements.length === 2 + && firstArgumentBody.elements.every((node, index) => + node?.type === 'SpreadElement' + && node.argument.type === 'Identifier' + && isSameIdentifier(firstArgument.params[index], node.argument), + ) + ) + ); + }, + getArrayNode: node => node.callee.object, + description: 'Array#reduce()', +}; + +// `[].concat(maybeArray)` +// `[].concat(...array)` +const emptyArrayConcat = { + testFunction(node) { + return isMethodCall(node, { + method: 'concat', + argumentsLength: 1, + allowSpreadElement: true, + optionalCall: false, + optionalMember: false, + }) + && isEmptyArrayExpression(node.callee.object); + }, + getArrayNode(node) { + const argumentNode = node.arguments[0]; + return argumentNode.type === 'SpreadElement' ? argumentNode.argument : argumentNode; + }, + description: '[].concat()', + shouldSwitchToArray: node => node.arguments[0].type !== 'SpreadElement', +}; + +// - `[].concat.apply([], array)` and `Array.prototype.concat.apply([], array)` +// - `[].concat.call([], maybeArray)` and `Array.prototype.concat.call([], maybeArray)` +// - `[].concat.call([], ...array)` and `Array.prototype.concat.call([], ...array)` +const arrayPrototypeConcat = { + testFunction(node) { + if (!( + isMethodCall(node, { + methods: ['apply', 'call'], + argumentsLength: 2, + allowSpreadElement: true, + optionalCall: false, + optionalMember: false, + }) + && isArrayPrototypeProperty(node.callee.object, { + property: 'concat', + }) + )) { + return false; + } + + const [firstArgument, secondArgument] = node.arguments; + return isEmptyArrayExpression(firstArgument) + && ( + node.callee.property.name === 'call' + || secondArgument.type !== 'SpreadElement' + ); + }, + getArrayNode(node) { + const argumentNode = node.arguments[1]; + return argumentNode.type === 'SpreadElement' ? argumentNode.argument : argumentNode; + }, + description: 'Array.prototype.concat()', + shouldSwitchToArray: node => node.arguments[1].type !== 'SpreadElement' && node.callee.property.name === 'call', +}; + +const lodashFlattenFunctions = [ + '_.flatten', + 'lodash.flatten', + 'underscore.flatten', +]; + +function fix(node, array, sourceCode, shouldSwitchToArray) { + if (typeof shouldSwitchToArray === 'function') { + shouldSwitchToArray = shouldSwitchToArray(node); + } + + return function * (fixer) { + let fixed = getParenthesizedText(array, sourceCode); + if (shouldSwitchToArray) { + // `array` is an argument, when it changes to `array[]`, we don't need add extra parentheses + fixed = `[${fixed}]`; + // And we don't need to add parentheses to the new array to call `.flat()` + } else if ( + !isParenthesized(array, sourceCode) + && shouldAddParenthesesToMemberExpressionObject(array, sourceCode) + ) { + fixed = `(${fixed})`; + } + + fixed = `${fixed}.flat()`; + + const tokenBefore = sourceCode.getTokenBefore(node); + if (needsSemicolon(tokenBefore, sourceCode, fixed)) { + fixed = `;${fixed}`; + } + + yield fixer.replaceText(node, fixed); + + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + }; +} + +function create(context) { + const {functions: configFunctions} = { + functions: [], + ...context.options[0], + }; + const functions = [...configFunctions, ...lodashFlattenFunctions]; + + const cases = [ + arrayFlatMap, + arrayReduce, + emptyArrayConcat, + arrayPrototypeConcat, + { + testFunction: node => isCallExpression(node, { + argumentsLength: 1, + optional: false, + }) && isNodeMatches(node.callee, functions), + getArrayNode: node => node.arguments[0], + description: node => `${functions.find(nameOrPath => isNodeMatchesNameOrPath(node.callee, nameOrPath)).trim()}()`, + }, + ]; + + return { + * CallExpression(node) { + for (const {testFunction, description, getArrayNode, shouldSwitchToArray} of cases) { + if (!testFunction(node)) { + continue; + } + + const array = getArrayNode(node); + + const data = { + description: typeof description === 'string' ? description : description(node), + }; + + const problem = { + node, + messageId: MESSAGE_ID, + data, + }; + + const {sourceCode} = context; + + // Don't fix if it has comments. + if ( + sourceCode.getCommentsInside(node).length + === sourceCode.getCommentsInside(array).length + ) { + problem.fix = fix(node, array, sourceCode, shouldSwitchToArray); + } + + yield problem; + } + }, + }; +} + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + functions: { + type: 'array', + uniqueItems: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `Array#flat()` over legacy techniques to flatten arrays.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-index-of.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-index-of.js new file mode 100644 index 0000000000000000000000000000000000000000..f211e3c5be332ddd83ba1f56502f9cff9e1aae3d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-index-of.js @@ -0,0 +1,33 @@ +'use strict'; +const simpleArraySearchRule = require('./shared/simple-array-search-rule.js'); + +const indexOfOverFindIndexRule = simpleArraySearchRule({ + method: 'findIndex', + replacement: 'indexOf', +}); + +const lastIndexOfOverFindLastIndexRule = simpleArraySearchRule({ + method: 'findLastIndex', + replacement: 'lastIndexOf', +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create(context) { + indexOfOverFindIndexRule.listen(context); + lastIndexOfOverFindLastIndexRule.listen(context); + }, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages: { + ...indexOfOverFindIndexRule.messages, + ...lastIndexOfOverFindLastIndexRule.messages, + }, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-some.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-some.js new file mode 100644 index 0000000000000000000000000000000000000000..3da1cf540983c7a16b99531f8a8ee56fe060b0ea --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-array-some.js @@ -0,0 +1,215 @@ +'use strict'; +const {checkVueTemplate} = require('./utils/rule.js'); +const { + isBooleanNode, + getParenthesizedRange, + isNodeValueNotFunction, +} = require('./utils/index.js'); +const {removeMemberExpressionProperty} = require('./fix/index.js'); +const {isLiteral, isUndefined, isMethodCall, isMemberExpression} = require('./ast/index.js'); + +const ERROR_ID_ARRAY_SOME = 'some'; +const SUGGESTION_ID_ARRAY_SOME = 'some-suggestion'; +const ERROR_ID_ARRAY_FILTER = 'filter'; +const messages = { + [ERROR_ID_ARRAY_SOME]: 'Prefer `.some(…)` over `.{{method}}(…)`.', + [SUGGESTION_ID_ARRAY_SOME]: 'Replace `.{{method}}(…)` with `.some(…)`.', + [ERROR_ID_ARRAY_FILTER]: 'Prefer `.some(…)` over non-zero length check from `.filter(…)`.', +}; + +const isCheckingUndefined = node => + node.parent.type === 'BinaryExpression' + // Not checking yoda expression `null != foo.find()` and `undefined !== foo.find() + && node.parent.left === node + && ( + ( + ( + node.parent.operator === '!=' + || node.parent.operator === '==' + || node.parent.operator === '===' + || node.parent.operator === '!==' + ) + && isUndefined(node.parent.right) + ) + || ( + ( + node.parent.operator === '!=' + || node.parent.operator === '==' + ) + // eslint-disable-next-line unicorn/no-null + && isLiteral(node.parent.right, null) + ) + ); +const isNegativeOne = node => node.type === 'UnaryExpression' && node.operator === '-' && node.argument && node.argument.type === 'Literal' && node.argument.value === 1; +const isLiteralZero = node => isLiteral(node, 0); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + // `.find(…)` + // `.findLast(…)` + context.on('CallExpression', callExpression => { + if (!isMethodCall(callExpression, { + methods: ['find', 'findLast'], + minimumArguments: 1, + maximumArguments: 2, + optionalCall: false, + optionalMember: false, + })) { + return; + } + + const isCompare = isCheckingUndefined(callExpression); + if (!isCompare && !isBooleanNode(callExpression)) { + return; + } + + const methodNode = callExpression.callee.property; + return { + node: methodNode, + messageId: ERROR_ID_ARRAY_SOME, + data: {method: methodNode.name}, + suggest: [ + { + messageId: SUGGESTION_ID_ARRAY_SOME, + * fix(fixer) { + yield fixer.replaceText(methodNode, 'some'); + + if (!isCompare) { + return; + } + + const parenthesizedRange = getParenthesizedRange(callExpression, context.sourceCode); + yield fixer.replaceTextRange([parenthesizedRange[1], callExpression.parent.range[1]], ''); + + if (callExpression.parent.operator === '!=' || callExpression.parent.operator === '!==') { + return; + } + + yield fixer.insertTextBeforeRange(parenthesizedRange, '!'); + }, + }, + ], + }; + }); + + // These operators also used in `prefer-includes`, try to reuse the code in future + // `.{findIndex,findLastIndex}(…) !== -1` + // `.{findIndex,findLastIndex}(…) != -1` + // `.{findIndex,findLastIndex}(…) > -1` + // `.{findIndex,findLastIndex}(…) === -1` + // `.{findIndex,findLastIndex}(…) == -1` + // `.{findIndex,findLastIndex}(…) >= 0` + // `.{findIndex,findLastIndex}(…) < 0` + context.on('BinaryExpression', binaryExpression => { + const {left, right, operator} = binaryExpression; + + if (!( + isMethodCall(left, { + methods: ['findIndex', 'findLastIndex'], + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && ( + (['!==', '!=', '>', '===', '=='].includes(operator) && isNegativeOne(right)) + || (['>=', '<'].includes(operator) && isLiteralZero(right)) + ) + )) { + return; + } + + const methodNode = left.callee.property; + return { + node: methodNode, + messageId: ERROR_ID_ARRAY_SOME, + data: {method: methodNode.name}, + * fix(fixer) { + if (['===', '==', '<'].includes(operator)) { + yield fixer.insertTextBefore(binaryExpression, '!'); + } + + yield fixer.replaceText(methodNode, 'some'); + + const operatorToken = context.sourceCode.getTokenAfter( + left, + token => token.type === 'Punctuator' && token.value === operator, + ); + const [start] = operatorToken.range; + const [, end] = binaryExpression.range; + + yield fixer.removeRange([start, end]); + }, + }; + }); + + // `.filter(…).length > 0` + // `.filter(…).length !== 0` + context.on('BinaryExpression', binaryExpression => { + if (!( + // We assume the user already follows `unicorn/explicit-length-check`. These are allowed in that rule. + (binaryExpression.operator === '>' || binaryExpression.operator === '!==') + && binaryExpression.right.type === 'Literal' + && binaryExpression.right.raw === '0' + && isMemberExpression(binaryExpression.left, {property: 'length', optional: false}) + && isMethodCall(binaryExpression.left.object, { + method: 'filter', + optionalCall: false, + optionalMember: false, + }) + )) { + return; + } + + const filterCall = binaryExpression.left.object; + const [firstArgument] = filterCall.arguments; + if (!firstArgument || isNodeValueNotFunction(firstArgument)) { + return; + } + + const filterProperty = filterCall.callee.property; + return { + node: filterProperty, + messageId: ERROR_ID_ARRAY_FILTER, + * fix(fixer) { + // `.filter` to `.some` + yield fixer.replaceText(filterProperty, 'some'); + + const {sourceCode} = context; + const lengthNode = binaryExpression.left; + /* + Remove `.length` + `(( (( array.filter() )).length )) > (( 0 ))` + ------------------------^^^^^^^ + */ + yield removeMemberExpressionProperty(fixer, lengthNode, sourceCode); + + /* + Remove `> 0` + `(( (( array.filter() )).length )) > (( 0 ))` + ----------------------------------^^^^^^^^^^ + */ + yield fixer.removeRange([ + getParenthesizedRange(lengthNode, sourceCode)[1], + binaryExpression.range[1], + ]); + + // The `BinaryExpression` always ends with a number or `)`, no need check for ASI + }, + }; + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create: checkVueTemplate(create), + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast,findIndex,findLastIndex}(…)`.', + recommended: true, + }, + fixable: 'code', + messages, + hasSuggestions: true, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-at.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-at.js new file mode 100644 index 0000000000000000000000000000000000000000..9986a8e10d7cc8019aebea875ae41dd1d8328785 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-at.js @@ -0,0 +1,375 @@ +'use strict'; +const {isOpeningBracketToken, isClosingBracketToken, getStaticValue} = require('@eslint-community/eslint-utils'); +const { + isParenthesized, + getParenthesizedRange, + getParenthesizedText, + isNodeMatchesNameOrPath, + needsSemicolon, + shouldAddParenthesesToMemberExpressionObject, + isLeftHandSide, +} = require('./utils/index.js'); +const { + getNegativeIndexLengthNode, + removeLengthNode, +} = require('./shared/negative-index.js'); +const {removeMemberExpressionProperty, removeMethodCall} = require('./fix/index.js'); +const {isLiteral, isCallExpression, isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID_NEGATIVE_INDEX = 'negative-index'; +const MESSAGE_ID_INDEX = 'index'; +const MESSAGE_ID_STRING_CHAR_AT_NEGATIVE = 'string-char-at-negative'; +const MESSAGE_ID_STRING_CHAR_AT = 'string-char-at'; +const MESSAGE_ID_SLICE = 'slice'; +const MESSAGE_ID_GET_LAST_FUNCTION = 'get-last-function'; +const SUGGESTION_ID = 'use-at'; +const messages = { + [MESSAGE_ID_NEGATIVE_INDEX]: 'Prefer `.at(…)` over `[….length - index]`.', + [MESSAGE_ID_INDEX]: 'Prefer `.at(…)` over index access.', + [MESSAGE_ID_STRING_CHAR_AT_NEGATIVE]: 'Prefer `String#at(…)` over `String#charAt(….length - index)`.', + [MESSAGE_ID_STRING_CHAR_AT]: 'Prefer `String#at(…)` over `String#charAt(…)`.', + [MESSAGE_ID_SLICE]: 'Prefer `.at(…)` over the first element from `.slice(…)`.', + [MESSAGE_ID_GET_LAST_FUNCTION]: 'Prefer `.at(-1)` over `{{description}}(…)` to get the last element.', + [SUGGESTION_ID]: 'Use `.at(…)`.', +}; + +const isArguments = node => node.type === 'Identifier' && node.name === 'arguments'; + +const isLiteralNegativeInteger = node => + node.type === 'UnaryExpression' + && node.prefix + && node.operator === '-' + && node.argument.type === 'Literal' + && Number.isInteger(node.argument.value) + && node.argument.value > 0; +const isZeroIndexAccess = node => { + const {parent} = node; + return parent.type === 'MemberExpression' + && !parent.optional + && parent.computed + && parent.object === node + && isLiteral(parent.property, 0); +}; + +const isArrayPopOrShiftCall = (node, method) => { + const {parent} = node; + return parent.type === 'MemberExpression' + && !parent.optional + && !parent.computed + && parent.object === node + && parent.property.type === 'Identifier' + && parent.property.name === method + && parent.parent.type === 'CallExpression' + && parent.parent.callee === parent + && !parent.parent.optional + && parent.parent.arguments.length === 0; +}; + +const isArrayPopCall = node => isArrayPopOrShiftCall(node, 'pop'); +const isArrayShiftCall = node => isArrayPopOrShiftCall(node, 'shift'); + +function checkSliceCall(node) { + const sliceArgumentsLength = node.arguments.length; + const [startIndexNode, endIndexNode] = node.arguments; + + if (!isLiteralNegativeInteger(startIndexNode)) { + return; + } + + let firstElementGetMethod = ''; + if (isZeroIndexAccess(node)) { + if (isLeftHandSide(node.parent)) { + return; + } + + firstElementGetMethod = 'zero-index'; + } else if (isArrayShiftCall(node)) { + firstElementGetMethod = 'shift'; + } else if (isArrayPopCall(node)) { + firstElementGetMethod = 'pop'; + } + + if (!firstElementGetMethod) { + return; + } + + const startIndex = -startIndexNode.argument.value; + if (sliceArgumentsLength === 1) { + if ( + firstElementGetMethod === 'zero-index' + || firstElementGetMethod === 'shift' + || (startIndex === -1 && firstElementGetMethod === 'pop') + ) { + return {safeToFix: true, firstElementGetMethod}; + } + + return; + } + + if ( + isLiteralNegativeInteger(endIndexNode) + && -endIndexNode.argument.value === startIndex + 1 + ) { + return {safeToFix: true, firstElementGetMethod}; + } + + if (firstElementGetMethod === 'pop') { + return; + } + + return {safeToFix: false, firstElementGetMethod}; +} + +const lodashLastFunctions = [ + '_.last', + 'lodash.last', + 'underscore.last', +]; + +/** @param {import('eslint').Rule.RuleContext} context */ +function create(context) { + const { + getLastElementFunctions, + checkAllIndexAccess, + } = { + getLastElementFunctions: [], + checkAllIndexAccess: false, + ...context.options[0], + }; + const getLastFunctions = [...getLastElementFunctions, ...lodashLastFunctions]; + const {sourceCode} = context; + + // Index access + context.on('MemberExpression', node => { + if ( + node.optional + || !node.computed + || isLeftHandSide(node) + ) { + return; + } + + const indexNode = node.property; + const lengthNode = getNegativeIndexLengthNode(indexNode, node.object); + + if (!lengthNode) { + if (!checkAllIndexAccess) { + return; + } + + // Only if we are sure it's an positive integer + const staticValue = getStaticValue(indexNode, sourceCode.getScope(indexNode)); + if (!staticValue || !Number.isInteger(staticValue.value) || staticValue.value < 0) { + return; + } + } + + const problem = { + node: indexNode, + messageId: lengthNode ? MESSAGE_ID_NEGATIVE_INDEX : MESSAGE_ID_INDEX, + }; + + if (isArguments(node.object)) { + return problem; + } + + problem.fix = function * (fixer) { + if (lengthNode) { + yield removeLengthNode(lengthNode, fixer, sourceCode); + } + + // Only remove space for `foo[foo.length - 1]` + if ( + indexNode.type === 'BinaryExpression' + && indexNode.operator === '-' + && indexNode.left === lengthNode + && indexNode.right.type === 'Literal' + && /^\d+$/.test(indexNode.right.raw) + ) { + const numberNode = indexNode.right; + const tokenBefore = sourceCode.getTokenBefore(numberNode); + if ( + tokenBefore.type === 'Punctuator' + && tokenBefore.value === '-' + && /^\s+$/.test(sourceCode.text.slice(tokenBefore.range[1], numberNode.range[0])) + ) { + yield fixer.removeRange([tokenBefore.range[1], numberNode.range[0]]); + } + } + + const openingBracketToken = sourceCode.getTokenBefore(indexNode, isOpeningBracketToken); + yield fixer.replaceText(openingBracketToken, '.at('); + + const closingBracketToken = sourceCode.getTokenAfter(indexNode, isClosingBracketToken); + yield fixer.replaceText(closingBracketToken, ')'); + }; + + return problem; + }); + + // `string.charAt` + context.on('CallExpression', node => { + if (!isMethodCall(node, { + method: 'charAt', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + })) { + return; + } + + const [indexNode] = node.arguments; + const lengthNode = getNegativeIndexLengthNode(indexNode, node.callee.object); + + // `String#charAt` don't care about index value, we assume it's always number + if (!lengthNode && !checkAllIndexAccess) { + return; + } + + return { + node: indexNode, + messageId: lengthNode ? MESSAGE_ID_STRING_CHAR_AT_NEGATIVE : MESSAGE_ID_STRING_CHAR_AT, + suggest: [{ + messageId: SUGGESTION_ID, + * fix(fixer) { + if (lengthNode) { + yield removeLengthNode(lengthNode, fixer, sourceCode); + } + + yield fixer.replaceText(node.callee.property, 'at'); + }, + }], + }; + }); + + // `.slice()` + context.on('CallExpression', sliceCall => { + if (!isMethodCall(sliceCall, { + method: 'slice', + minimumArguments: 1, + maximumArguments: 2, + optionalCall: false, + optionalMember: false, + })) { + return; + } + + const result = checkSliceCall(sliceCall); + if (!result) { + return; + } + + const {safeToFix, firstElementGetMethod} = result; + + /** @param {import('eslint').Rule.RuleFixer} fixer */ + function * fix(fixer) { + // `.slice` to `.at` + yield fixer.replaceText(sliceCall.callee.property, 'at'); + + // Remove extra arguments + if (sliceCall.arguments.length !== 1) { + const [, start] = getParenthesizedRange(sliceCall.arguments[0], sourceCode); + const [end] = sourceCode.getLastToken(sliceCall).range; + yield fixer.removeRange([start, end]); + } + + // Remove `[0]`, `.shift()`, or `.pop()` + if (firstElementGetMethod === 'zero-index') { + yield removeMemberExpressionProperty(fixer, sliceCall.parent, sourceCode); + } else { + yield * removeMethodCall(fixer, sliceCall.parent.parent, sourceCode); + } + } + + const problem = { + node: sliceCall.callee.property, + messageId: MESSAGE_ID_SLICE, + }; + + if (safeToFix) { + problem.fix = fix; + } else { + problem.suggest = [{messageId: SUGGESTION_ID, fix}]; + } + + return problem; + }); + + context.on('CallExpression', node => { + if (!isCallExpression(node, {argumentsLength: 1, optional: false})) { + return; + } + + const matchedFunction = getLastFunctions.find(nameOrPath => isNodeMatchesNameOrPath(node.callee, nameOrPath)); + if (!matchedFunction) { + return; + } + + const problem = { + node: node.callee, + messageId: MESSAGE_ID_GET_LAST_FUNCTION, + data: {description: matchedFunction.trim()}, + }; + + const [array] = node.arguments; + + if (isArguments(array)) { + return problem; + } + + problem.fix = function (fixer) { + let fixed = getParenthesizedText(array, sourceCode); + + if ( + !isParenthesized(array, sourceCode) + && shouldAddParenthesesToMemberExpressionObject(array, sourceCode) + ) { + fixed = `(${fixed})`; + } + + fixed = `${fixed}.at(-1)`; + + const tokenBefore = sourceCode.getTokenBefore(node); + if (needsSemicolon(tokenBefore, sourceCode, fixed)) { + fixed = `;${fixed}`; + } + + return fixer.replaceText(node, fixed); + }; + + return problem; + }); +} + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + getLastElementFunctions: { + type: 'array', + uniqueItems: true, + }, + checkAllIndexAccess: { + type: 'boolean', + default: false, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `.at()` method for index access and `String#charAt()`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-blob-reading-methods.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-blob-reading-methods.js new file mode 100644 index 0000000000000000000000000000000000000000..e7a892b7631bba3f3aa70d4242552e0f23cf2819 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-blob-reading-methods.js @@ -0,0 +1,46 @@ +'use strict'; +const {isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID = 'error'; +const messages = { + [MESSAGE_ID]: 'Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + CallExpression(node) { + if (!isMethodCall(node, { + methods: ['readAsText', 'readAsArrayBuffer'], + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + })) { + return; + } + + const method = node.callee.property; + const methodName = method.name; + + return { + node: method, + messageId: MESSAGE_ID, + data: { + method: methodName, + replacement: methodName === 'readAsArrayBuffer' ? 'arrayBuffer' : 'text', + }, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-code-point.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-code-point.js new file mode 100644 index 0000000000000000000000000000000000000000..3d72bf82ca2eb55c5be7f61aeec66c9956276396 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-code-point.js @@ -0,0 +1,68 @@ +'use strict'; +const {isMethodCall} = require('./ast/index.js'); + +const messages = { + 'error/charCodeAt': 'Prefer `String#codePointAt()` over `String#charCodeAt()`.', + 'error/fromCharCode': 'Prefer `String.fromCodePoint()` over `String.fromCharCode()`.', + 'suggestion/codePointAt': 'Use `String#codePointAt()`.', + 'suggestion/fromCodePoint': 'Use `String.fromCodePoint()`.', +}; + +const getReplacement = node => { + if (isMethodCall(node, { + method: 'charCodeAt', + optionalCall: false, + optionalMember: false, + })) { + return 'codePointAt'; + } + + if (isMethodCall(node, { + object: 'String', + method: 'fromCharCode', + optionalCall: false, + optionalMember: false, + })) { + return 'fromCodePoint'; + } +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + CallExpression(node) { + const replacement = getReplacement(node); + + if (!replacement) { + return; + } + + const method = node.callee.property; + const methodName = method.name; + const fix = fixer => fixer.replaceText(method, replacement); + + return { + node: method, + messageId: `error/${methodName}`, + suggest: [ + { + messageId: `suggestion/${replacement}`, + fix, + }, + ], + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.', + recommended: true, + }, + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-date-now.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-date-now.js new file mode 100644 index 0000000000000000000000000000000000000000..b9cbc008cfd79a65e94bb42b169b81ea5c361787 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-date-now.js @@ -0,0 +1,136 @@ +'use strict'; +const { + isMethodCall, + isCallExpression, + isNewExpression, +} = require('./ast/index.js'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); + +const MESSAGE_ID_DEFAULT = 'prefer-date'; +const MESSAGE_ID_METHOD = 'prefer-date-now-over-methods'; +const MESSAGE_ID_NUMBER = 'prefer-date-now-over-number-data-object'; +const messages = { + [MESSAGE_ID_DEFAULT]: 'Prefer `Date.now()` over `new Date()`.', + [MESSAGE_ID_METHOD]: 'Prefer `Date.now()` over `Date#{{method}}()`.', + [MESSAGE_ID_NUMBER]: 'Prefer `Date.now()` over `Number(new Date())`.', +}; + +const isNewDate = node => isNewExpression(node, {name: 'Date', argumentsLength: 0}); + +const getProblem = (node, problem, sourceCode) => ({ + node, + messageId: MESSAGE_ID_DEFAULT, + * fix(fixer) { + yield fixer.replaceText(node, 'Date.now()'); + + if (node.type === 'UnaryExpression') { + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + } + }, + ...problem, +}); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(callExpression) { + // `new Date().{getTime,valueOf}()` + if ( + isMethodCall(callExpression, { + methods: ['getTime', 'valueOf'], + argumentsLength: 0, + optionalCall: false, + optionalMember: false, + }) + && isNewDate(callExpression.callee.object) + ) { + const method = callExpression.callee.property; + return getProblem(callExpression, { + node: method, + messageId: MESSAGE_ID_METHOD, + data: {method: method.name}, + }); + } + + // `{Number,BigInt}(new Date())` + if ( + isCallExpression(callExpression, { + names: ['Number', 'BigInt'], + argumentsLength: 1, + optional: false, + }) + && isNewDate(callExpression.arguments[0]) + ) { + const {name} = callExpression.callee; + if (name === 'Number') { + return getProblem(callExpression, { + messageId: MESSAGE_ID_NUMBER, + }); + } + + return getProblem(callExpression.arguments[0]); + } + }, + UnaryExpression(unaryExpression) { + // https://github.com/estree/estree/blob/master/es5.md#unaryoperator + if ( + unaryExpression.operator !== '+' + && unaryExpression.operator !== '-' + ) { + return; + } + + if (isNewDate(unaryExpression.argument)) { + return getProblem( + unaryExpression.operator === '-' ? unaryExpression.argument : unaryExpression, + {}, + context.sourceCode, + ); + } + }, + AssignmentExpression(assignmentExpression) { + if ( + assignmentExpression.operator !== '-=' + && assignmentExpression.operator !== '*=' + && assignmentExpression.operator !== '/=' + && assignmentExpression.operator !== '%=' + && assignmentExpression.operator !== '**=' + ) { + return; + } + + if (isNewDate(assignmentExpression.right)) { + return getProblem(assignmentExpression.right); + } + }, + * BinaryExpression(binaryExpression) { + if ( + binaryExpression.operator !== '-' + && binaryExpression.operator !== '*' + && binaryExpression.operator !== '/' + && binaryExpression.operator !== '%' + && binaryExpression.operator !== '**' + ) { + return; + } + + for (const node of [binaryExpression.left, binaryExpression.right]) { + if (isNewDate(node)) { + yield getProblem(node); + } + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-default-parameters.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-default-parameters.js new file mode 100644 index 0000000000000000000000000000000000000000..c5bb54b73f00e7ee305b12c11bd74601ecd15caa --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-default-parameters.js @@ -0,0 +1,220 @@ +'use strict'; +const {findVariable} = require('@eslint-community/eslint-utils'); +const {functionTypes} = require('./ast/index.js'); + +const MESSAGE_ID = 'preferDefaultParameters'; +const MESSAGE_ID_SUGGEST = 'preferDefaultParametersSuggest'; + +const isDefaultExpression = (left, right) => + left + && right + && left.type === 'Identifier' + && right.type === 'LogicalExpression' + && (right.operator === '||' || right.operator === '??') + && right.left.type === 'Identifier' + && right.right.type === 'Literal'; + +const containsCallExpression = (sourceCode, node) => { + if (!node) { + return false; + } + + if (node.type === 'CallExpression') { + return true; + } + + const keys = sourceCode.visitorKeys[node.type]; + + for (const key of keys) { + const value = node[key]; + + if (Array.isArray(value)) { + for (const element of value) { + if (containsCallExpression(sourceCode, element)) { + return true; + } + } + } else if (containsCallExpression(sourceCode, value)) { + return true; + } + } + + return false; +}; + +const hasSideEffects = (sourceCode, function_, node) => { + for (const element of function_.body.body) { + if (element === node) { + break; + } + + // Function call before default-assignment + if (containsCallExpression(sourceCode, element)) { + return true; + } + } + + return false; +}; + +const hasExtraReferences = (assignment, references, left) => { + // Parameter is referenced prior to default-assignment + if (assignment && references[0].identifier !== left) { + return true; + } + + // Old parameter is still referenced somewhere else + if (!assignment && references.length > 1) { + return true; + } + + return false; +}; + +const isLastParameter = (parameters, parameter) => { + const lastParameter = parameters.at(-1); + + // See 'default-param-last' rule + return parameter && parameter === lastParameter; +}; + +const needsParentheses = (sourceCode, function_) => { + if (function_.type !== 'ArrowFunctionExpression' || function_.params.length > 1) { + return false; + } + + const [parameter] = function_.params; + const before = sourceCode.getTokenBefore(parameter); + const after = sourceCode.getTokenAfter(parameter); + + return !after || !before || before.value !== '(' || after.value !== ')'; +}; + +/** @param {import('eslint').Rule.RuleFixer} fixer */ +const fixDefaultExpression = (fixer, sourceCode, node) => { + const {line} = node.loc.start; + const {column} = node.loc.end; + const nodeText = sourceCode.getText(node); + const lineText = sourceCode.lines[line - 1]; + const isOnlyNodeOnLine = lineText.trim() === nodeText; + const endsWithWhitespace = lineText[column] === ' '; + + if (isOnlyNodeOnLine) { + return fixer.removeRange([ + sourceCode.getIndexFromLoc({line, column: 0}), + sourceCode.getIndexFromLoc({line: line + 1, column: 0}), + ]); + } + + if (endsWithWhitespace) { + return fixer.removeRange([ + node.range[0], + node.range[1] + 1, + ]); + } + + return fixer.remove(node); +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + const functionStack = []; + + const checkExpression = (node, left, right, assignment) => { + const currentFunction = functionStack.at(-1); + + if (!currentFunction || !isDefaultExpression(left, right)) { + return; + } + + const {name: firstId} = left; + const { + left: {name: secondId}, + right: {raw: literal}, + } = right; + + // Parameter is reassigned to a different identifier + if (assignment && firstId !== secondId) { + return; + } + + const variable = findVariable(sourceCode.getScope(node), secondId); + + // This was reported https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1122 + // But can't reproduce, just ignore this case + /* c8 ignore next 3 */ + if (!variable) { + return; + } + + const {references} = variable; + const {params} = currentFunction; + const parameter = params.find(parameter => + parameter.type === 'Identifier' + && parameter.name === secondId, + ); + + if ( + hasSideEffects(sourceCode, currentFunction, node) + || hasExtraReferences(assignment, references, left) + || !isLastParameter(params, parameter) + ) { + return; + } + + const replacement = needsParentheses(sourceCode, currentFunction) + ? `(${firstId} = ${literal})` + : `${firstId} = ${literal}`; + + return { + node, + messageId: MESSAGE_ID, + suggest: [{ + messageId: MESSAGE_ID_SUGGEST, + fix: fixer => [ + fixer.replaceText(parameter, replacement), + fixDefaultExpression(fixer, sourceCode, node), + ], + }], + }; + }; + + context.on(functionTypes, node => { + functionStack.push(node); + }); + + context.onExit(functionTypes, () => { + functionStack.pop(); + }); + + context.on('AssignmentExpression', node => { + if (node.parent.type === 'ExpressionStatement' && node.parent.expression === node) { + return checkExpression(node.parent, node.left, node.right, true); + } + }); + + context.on('VariableDeclarator', node => { + if (node.parent.type === 'VariableDeclaration' && node.parent.declarations[0] === node) { + return checkExpression(node.parent, node.id, node.init, false); + } + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer default parameters over reassignment.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages: { + [MESSAGE_ID]: 'Prefer default parameters over reassignment.', + [MESSAGE_ID_SUGGEST]: 'Replace reassignment with default parameter.', + }, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-append.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-append.js new file mode 100644 index 0000000000000000000000000000000000000000..ea3634e350b2423ad67907955ec43b5c1164eb0c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-append.js @@ -0,0 +1,49 @@ +'use strict'; +const {isMethodCall} = require('./ast/index.js'); +const {isNodeValueNotDomNode, isValueNotUsable} = require('./utils/index.js'); + +const MESSAGE_ID = 'prefer-dom-node-append'; +const messages = { + [MESSAGE_ID]: 'Prefer `Node#append()` over `Node#appendChild()`.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + CallExpression(node) { + if ( + !isMethodCall(node, { + method: 'appendChild', + argumentsLength: 1, + optionalCall: false, + }) + || isNodeValueNotDomNode(node.callee.object) + || isNodeValueNotDomNode(node.arguments[0]) + ) { + return; + } + + const fix = isValueNotUsable(node) + ? fixer => fixer.replaceText(node.callee.property, 'append') + : undefined; + + return { + node, + messageId: MESSAGE_ID, + fix, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `Node#append()` over `Node#appendChild()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-dataset.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-dataset.js new file mode 100644 index 0000000000000000000000000000000000000000..abc6456a4fa5abf02993d3841232c4619acf5db9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-dataset.js @@ -0,0 +1,132 @@ +'use strict'; +const {isIdentifierName} = require('@babel/helper-validator-identifier'); +const { + escapeString, + hasOptionalChainElement, + isValueNotUsable, +} = require('./utils/index.js'); +const {isMethodCall, isStringLiteral, isExpressionStatement} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-dom-node-dataset'; +const messages = { + [MESSAGE_ID]: 'Prefer `.dataset` over `{{method}}(…)`.', +}; + +const dashToCamelCase = string => string.replaceAll(/-[a-z]/g, s => s[1].toUpperCase()); + +function getFix(callExpression, context) { + const method = callExpression.callee.property.name; + + // `foo?.bar = ''` is invalid + // TODO: Remove this restriction if https://github.com/nicolo-ribaudo/ecma262/pull/4 get merged + if (method === 'setAttribute' && hasOptionalChainElement(callExpression.callee)) { + return; + } + + // `element.setAttribute(…)` returns `undefined`, but `AssignmentExpression` returns value of RHS + if (method === 'setAttribute' && !isValueNotUsable(callExpression)) { + return; + } + + if (method === 'removeAttribute' && !isExpressionStatement(callExpression.parent)) { + return; + } + + return fixer => { + const [nameNode] = callExpression.arguments; + const name = dashToCamelCase(nameNode.value.toLowerCase().slice(5)); + const {sourceCode} = context; + let text = ''; + const datasetText = `${sourceCode.getText(callExpression.callee.object)}.dataset`; + switch (method) { + case 'setAttribute': + case 'getAttribute': + case 'removeAttribute': { + text = isIdentifierName(name) ? `.${name}` : `[${escapeString(name, nameNode.raw.charAt(0))}]`; + text = `${datasetText}${text}`; + if (method === 'setAttribute') { + text += ` = ${sourceCode.getText(callExpression.arguments[1])}`; + } else if (method === 'removeAttribute') { + text = `delete ${text}`; + } + + /* + For non-exists attribute, `element.getAttribute('data-foo')` returns `null`, + but `element.dataset.foo` returns `undefined`, switch to suggestions if necessary + */ + break; + } + + case 'hasAttribute': { + text = `Object.hasOwn(${datasetText}, ${escapeString(name, nameNode.raw.charAt(0))})`; + break; + } + // No default + } + + return fixer.replaceText(callExpression, text); + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(callExpression) { + if (!( + ( + isMethodCall(callExpression, { + method: 'setAttribute', + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + }) + || isMethodCall(callExpression, { + methods: ['getAttribute', 'removeAttribute', 'hasAttribute'], + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + ) + && isStringLiteral(callExpression.arguments[0]) + )) { + return; + } + + const method = callExpression.callee.property.name; + // Playwright's `Locator#getAttribute()` returns a promise. + // https://playwright.dev/docs/api/class-locator#locator-get-attribute + if ( + callExpression.parent.type === 'AwaitExpression' + && callExpression.parent.argument === callExpression + && method === 'getAttribute' + ) { + return; + } + + const attributeName = callExpression.arguments[0].value.toLowerCase(); + + if (!attributeName.startsWith('data-')) { + return; + } + + return { + node: callExpression, + messageId: MESSAGE_ID, + data: {method: callExpression.callee.property.name}, + fix: getFix(callExpression, context), + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer using `.dataset` on DOM elements over calling attribute methods.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-remove.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-remove.js new file mode 100644 index 0000000000000000000000000000000000000000..3b64ac6b0ffbdf043586e7658dace3866338774e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-remove.js @@ -0,0 +1,123 @@ +'use strict'; +const {isParenthesized, hasSideEffect} = require('@eslint-community/eslint-utils'); +const {isMethodCall} = require('./ast/index.js'); +const { + getParenthesizedText, + isNodeValueNotDomNode, + isValueNotUsable, + needsSemicolon, + shouldAddParenthesesToMemberExpressionObject, +} = require('./utils/index.js'); + +const ERROR_MESSAGE_ID = 'error'; +const SUGGESTION_MESSAGE_ID = 'suggestion'; +const messages = { + [ERROR_MESSAGE_ID]: 'Prefer `childNode.remove()` over `parentNode.removeChild(childNode)`.', + [SUGGESTION_MESSAGE_ID]: 'Replace `parentNode.removeChild(childNode)` with `childNode{{dotOrQuestionDot}}remove()`.', +}; + +// TODO: Don't check node.type twice +const isMemberExpressionOptionalObject = node => + node.parent.type === 'MemberExpression' + && node.parent.object === node + && ( + node.parent.optional + || (node.type === 'MemberExpression' && isMemberExpressionOptionalObject(node.object)) + ); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + return { + CallExpression(node) { + if ( + !isMethodCall(node, { + method: 'removeChild', + argumentsLength: 1, + optionalCall: false, + }) + || isNodeValueNotDomNode(node.callee.object) + || isNodeValueNotDomNode(node.arguments[0]) + ) { + return; + } + + const parentNode = node.callee.object; + const childNode = node.arguments[0]; + + const problem = { + node, + messageId: ERROR_MESSAGE_ID, + }; + + const isOptionalParentNode = isMemberExpressionOptionalObject(parentNode); + + const createFix = (optional = false) => fixer => { + let childNodeText = getParenthesizedText(childNode, sourceCode); + if ( + !isParenthesized(childNode, sourceCode) + && shouldAddParenthesesToMemberExpressionObject(childNode, sourceCode) + ) { + childNodeText = `(${childNodeText})`; + } + + if (needsSemicolon(sourceCode.getTokenBefore(node), sourceCode, childNodeText)) { + childNodeText = `;${childNodeText}`; + } + + return fixer.replaceText(node, `${childNodeText}${optional ? '?' : ''}.remove()`); + }; + + if (!hasSideEffect(parentNode, sourceCode) && isValueNotUsable(node)) { + if (!isOptionalParentNode) { + problem.fix = createFix(false); + return problem; + } + + // The most common case `foo?.parentNode.remove(foo)` + // TODO: Allow case like `foo.bar?.parentNode.remove(foo.bar)` + if ( + node.callee.type === 'MemberExpression' + && !node.callee.optional + && parentNode.type === 'MemberExpression' + && parentNode.optional + && !parentNode.computed + && parentNode.property.type === 'Identifier' + && parentNode.property.name === 'parentNode' + && parentNode.object.type === 'Identifier' + && childNode.type === 'Identifier' + && parentNode.object.name === childNode.name + ) { + problem.fix = createFix(true); + return problem; + } + } + + problem.suggest = ( + isOptionalParentNode ? [true, false] : [false] + ).map(optional => ({ + messageId: SUGGESTION_MESSAGE_ID, + data: {dotOrQuestionDot: optional ? '?.' : '.'}, + fix: createFix(optional), + })); + + return problem; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `childNode.remove()` over `parentNode.removeChild(childNode)`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-text-content.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-text-content.js new file mode 100644 index 0000000000000000000000000000000000000000..72ff9758561845fd904e9ddfe1aae631246efe3a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-text-content.js @@ -0,0 +1,76 @@ +'use strict'; +const {isMemberExpression} = require('./ast/index.js'); + +const ERROR = 'error'; +const SUGGESTION = 'suggestion'; +const messages = { + [ERROR]: 'Prefer `.textContent` over `.innerText`.', + [SUGGESTION]: 'Switch to `.textContent`.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + MemberExpression(memberExpression) { + if ( + !isMemberExpression(memberExpression, { + property: 'innerText', + }) + ) { + return; + } + + const node = memberExpression.property; + + return { + node, + messageId: ERROR, + suggest: [ + { + messageId: SUGGESTION, + fix: fixer => fixer.replaceText(node, 'textContent'), + }, + ], + }; + }, + Identifier(node) { + if (!( + node.name === 'innerText' + && node.parent.type === 'Property' + && node.parent.key === node + && !node.parent.computed + && node.parent.kind === 'init' + && node.parent.parent.type === 'ObjectPattern' + && node.parent.parent.properties.includes(node.parent) + )) { + return; + } + + return { + node, + messageId: ERROR, + suggest: [ + { + messageId: SUGGESTION, + fix: fixer => fixer.replaceText( + node, + node.parent.shorthand ? 'textContent: innerText' : 'textContent', + ), + }, + ], + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `.textContent` over `.innerText`.', + recommended: true, + }, + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-event-target.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-event-target.js new file mode 100644 index 0000000000000000000000000000000000000000..68a4b0b691285184272a66d1e5a93647b1591798 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-event-target.js @@ -0,0 +1,118 @@ +'use strict'; +const {findVariable} = require('@eslint-community/eslint-utils'); +const {getAncestor} = require('./utils/index.js'); +const {isStaticRequire, isStringLiteral, isMemberExpression} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-event-target'; +const messages = { + [MESSAGE_ID]: 'Prefer `EventTarget` over `EventEmitter`.', +}; + +const packagesShouldBeIgnored = new Set([ + '@angular/core', + 'eventemitter3', +]); + +const isConstVariableDeclarationId = node => + node.parent.type === 'VariableDeclarator' + && node.parent.id === node + && node.parent.parent.type === 'VariableDeclaration' + && node.parent.parent.kind === 'const' + && node.parent.parent.declarations.includes(node.parent); + +function isAwaitImportOrRequireFromIgnoredPackages(node) { + if (!node) { + return false; + } + + let source; + if (isStaticRequire(node)) { + [source] = node.arguments; + } else if (node.type === 'AwaitExpression' && node.argument.type === 'ImportExpression') { + ({source} = node.argument); + } + + if (isStringLiteral(source) && packagesShouldBeIgnored.has(source.value)) { + return true; + } + + return false; +} + +function isFromIgnoredPackage(node) { + if (!node) { + return false; + } + + const importDeclaration = getAncestor(node, 'ImportDeclaration'); + if (packagesShouldBeIgnored.has(importDeclaration?.source.value)) { + return true; + } + + // `const {EventEmitter} = ...` + if ( + node.parent.type === 'Property' + && node.parent.value === node + && node.parent.key.type === 'Identifier' + && node.parent.key.name === 'EventEmitter' + && node.parent.parent.type === 'ObjectPattern' + && node.parent.parent.properties.includes(node.parent) + && isConstVariableDeclarationId(node.parent.parent) + && isAwaitImportOrRequireFromIgnoredPackages(node.parent.parent.parent.init) + ) { + return true; + } + + // `const EventEmitter = (...).EventEmitter` + if ( + isConstVariableDeclarationId(node) + && isMemberExpression(node.parent.init, {property: 'EventEmitter', optional: false, computed: false}) + && isAwaitImportOrRequireFromIgnoredPackages(node.parent.init.object) + ) { + return true; + } + + return false; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + Identifier(node) { + if (!( + node.name === 'EventEmitter' + && ( + ( + (node.parent.type === 'ClassDeclaration' || node.parent.type === 'ClassExpression') + && node.parent.superClass === node + ) + || (node.parent.type === 'NewExpression' && node.parent.callee === node) + ) + )) { + return; + } + + const scope = context.sourceCode.getScope(node); + const variableNode = findVariable(scope, node)?.defs[0]?.name; + if (isFromIgnoredPackage(variableNode)) { + return; + } + + return { + node, + messageId: MESSAGE_ID, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `EventTarget` over `EventEmitter`.', + recommended: true, + }, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-export-from.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-export-from.js new file mode 100644 index 0000000000000000000000000000000000000000..5dec4345aec4f063011e7c83b860e56fb292f08e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-export-from.js @@ -0,0 +1,412 @@ +'use strict'; +const { + isCommaToken, + isOpeningBraceToken, + isClosingBraceToken, +} = require('@eslint-community/eslint-utils'); +const { + isStringLiteral, +} = require('./ast/index.js'); + +const MESSAGE_ID_ERROR = 'error'; +const MESSAGE_ID_SUGGESTION = 'suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Use `export…from` to re-export `{{exported}}`.', + [MESSAGE_ID_SUGGESTION]: 'Switch to `export…from`.', +}; + +// Default import/export can be `Identifier`, have to use `Symbol.for` +const DEFAULT_SPECIFIER_NAME = Symbol.for('default'); +const NAMESPACE_SPECIFIER_NAME = Symbol('NAMESPACE_SPECIFIER_NAME'); + +const getSpecifierName = node => { + switch (node.type) { + case 'Identifier': { + return Symbol.for(node.name); + } + + case 'Literal': { + return node.value; + } + // No default + } +}; + +const isTypeExport = specifier => specifier.exportKind === 'type' || specifier.parent.exportKind === 'type'; + +const isTypeImport = specifier => specifier.importKind === 'type' || specifier.parent.importKind === 'type'; + +function * removeSpecifier(node, fixer, sourceCode) { + const {parent} = node; + const {specifiers} = parent; + + if (specifiers.length === 1) { + yield * removeImportOrExport(parent, fixer, sourceCode); + return; + } + + switch (node.type) { + case 'ImportSpecifier': { + const hasOtherSpecifiers = specifiers.some(specifier => specifier !== node && specifier.type === node.type); + if (!hasOtherSpecifiers) { + const closingBraceToken = sourceCode.getTokenAfter(node, isClosingBraceToken); + + // If there are other specifiers, they have to be the default import specifier + // And the default import has to write before the named import specifiers + // So there must be a comma before + const commaToken = sourceCode.getTokenBefore(node, isCommaToken); + yield fixer.replaceTextRange([commaToken.range[0], closingBraceToken.range[1]], ''); + return; + } + // Fallthrough + } + + case 'ExportSpecifier': + case 'ImportNamespaceSpecifier': + case 'ImportDefaultSpecifier': { + yield fixer.remove(node); + + const tokenAfter = sourceCode.getTokenAfter(node); + if (isCommaToken(tokenAfter)) { + yield fixer.remove(tokenAfter); + } + + break; + } + + // No default + } +} + +function * removeImportOrExport(node, fixer, sourceCode) { + switch (node.type) { + case 'ImportSpecifier': + case 'ExportSpecifier': + case 'ImportDefaultSpecifier': + case 'ImportNamespaceSpecifier': { + yield * removeSpecifier(node, fixer, sourceCode); + return; + } + + case 'ImportDeclaration': + case 'ExportDefaultDeclaration': + case 'ExportNamedDeclaration': { + yield fixer.remove(node); + } + + // No default + } +} + +function getSourceAndAssertionsText(declaration, sourceCode) { + const keywordFromToken = sourceCode.getTokenBefore( + declaration.source, + token => token.type === 'Identifier' && token.value === 'from', + ); + const [start] = keywordFromToken.range; + const [, end] = declaration.range; + return sourceCode.text.slice(start, end); +} + +function getFixFunction({ + sourceCode, + imported, + exported, + exportDeclarations, + program, +}) { + const importDeclaration = imported.declaration; + const sourceNode = importDeclaration.source; + const sourceValue = sourceNode.value; + const shouldExportAsType = imported.isTypeImport || exported.isTypeExport; + + let exportDeclaration; + if (shouldExportAsType) { + // If a type export declaration already exists, reuse it, else use a value export declaration with an inline type specifier. + exportDeclaration = exportDeclarations.find(({source, exportKind}) => source.value === sourceValue && exportKind === 'type'); + } + + exportDeclaration ||= exportDeclarations.find(({source, exportKind}) => source.value === sourceValue && exportKind !== 'type'); + + /** @param {import('eslint').Rule.RuleFixer} fixer */ + return function * (fixer) { + if (imported.name === NAMESPACE_SPECIFIER_NAME) { + yield fixer.insertTextAfter( + program, + `\nexport * as ${exported.text} ${getSourceAndAssertionsText(importDeclaration, sourceCode)}`, + ); + } else { + let specifierText = exported.name === imported.name + ? exported.text + : `${imported.text} as ${exported.text}`; + + // Add an inline type specifier if the value is a type and the export deceleration is a value deceleration + if (shouldExportAsType && (!exportDeclaration || exportDeclaration.exportKind !== 'type')) { + specifierText = `type ${specifierText}`; + } + + if (exportDeclaration) { + const lastSpecifier = exportDeclaration.specifiers.at(-1); + + // `export {} from 'foo';` + if (lastSpecifier) { + yield fixer.insertTextAfter(lastSpecifier, `, ${specifierText}`); + } else { + const openingBraceToken = sourceCode.getFirstToken(exportDeclaration, isOpeningBraceToken); + yield fixer.insertTextAfter(openingBraceToken, specifierText); + } + } else { + yield fixer.insertTextAfter( + program, + `\nexport {${specifierText}} ${getSourceAndAssertionsText(importDeclaration, sourceCode)}`, + ); + } + } + + if (imported.variable.references.length === 1) { + yield * removeImportOrExport(imported.node, fixer, sourceCode); + } + + yield * removeImportOrExport(exported.node, fixer, sourceCode); + }; +} + +function getExported(identifier, sourceCode) { + const {parent} = identifier; + switch (parent.type) { + case 'ExportDefaultDeclaration': { + return { + node: parent, + name: DEFAULT_SPECIFIER_NAME, + text: 'default', + isTypeExport: isTypeExport(parent), + }; + } + + case 'ExportSpecifier': { + return { + node: parent, + name: getSpecifierName(parent.exported), + text: sourceCode.getText(parent.exported), + isTypeExport: isTypeExport(parent), + }; + } + + case 'VariableDeclarator': { + if ( + parent.init === identifier + && parent.id.type === 'Identifier' + && !parent.id.typeAnnotation + && parent.parent.type === 'VariableDeclaration' + && parent.parent.kind === 'const' + && parent.parent.declarations.length === 1 + && parent.parent.declarations[0] === parent + && parent.parent.parent.type === 'ExportNamedDeclaration' + && isVariableUnused(parent, sourceCode) + ) { + return { + node: parent.parent.parent, + name: Symbol.for(parent.id.name), + text: sourceCode.getText(parent.id), + }; + } + + break; + } + + // No default + } +} + +function isVariableUnused(node, sourceCode) { + const variables = sourceCode.getDeclaredVariables(node); + + /* c8 ignore next 3 */ + if (variables.length !== 1) { + return false; + } + + const [{identifiers, references}] = variables; + return identifiers.length === 1 + && identifiers[0] === node.id + && references.length === 1 + && references[0].identifier === node.id; +} + +function getImported(variable, sourceCode) { + const specifier = variable.defs[0].node; + const result = { + node: specifier, + declaration: specifier.parent, + variable, + isTypeImport: isTypeImport(specifier), + }; + + switch (specifier.type) { + case 'ImportDefaultSpecifier': { + return { + name: DEFAULT_SPECIFIER_NAME, + text: 'default', + ...result, + }; + } + + case 'ImportSpecifier': { + return { + name: getSpecifierName(specifier.imported), + text: sourceCode.getText(specifier.imported), + ...result, + }; + } + + case 'ImportNamespaceSpecifier': { + return { + name: NAMESPACE_SPECIFIER_NAME, + text: '*', + ...result, + }; + } + + // No default + } +} + +function getExports(imported, sourceCode) { + const exports = []; + for (const {identifier} of imported.variable.references) { + const exported = getExported(identifier, sourceCode); + + if (!exported) { + continue; + } + + /* + There is no substitution for: + + ```js + import * as foo from 'foo'; + export default foo; + ``` + */ + if (imported.name === NAMESPACE_SPECIFIER_NAME && exported.name === DEFAULT_SPECIFIER_NAME) { + continue; + } + + exports.push(exported); + } + + return exports; +} + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + ignoreUsedVariables: { + type: 'boolean', + default: false, + }, + }, + }, +]; + +/** @param {import('eslint').Rule.RuleContext} context */ +function create(context) { + const {sourceCode} = context; + const {ignoreUsedVariables} = {ignoreUsedVariables: false, ...context.options[0]}; + const importDeclarations = new Set(); + const exportDeclarations = []; + + return { + ImportDeclaration(node) { + if (node.specifiers.length > 0) { + importDeclarations.add(node); + } + }, + // `ExportAllDeclaration` and `ExportDefaultDeclaration` can't be reused + ExportNamedDeclaration(node) { + if (isStringLiteral(node.source)) { + exportDeclarations.push(node); + } + }, + * 'Program:exit'(program) { + for (const importDeclaration of importDeclarations) { + let variables = sourceCode.getDeclaredVariables(importDeclaration); + + if (variables.some(variable => variable.defs.length !== 1 || variable.defs[0].parent !== importDeclaration)) { + continue; + } + + variables = variables.map(variable => { + const imported = getImported(variable, sourceCode); + const exports = getExports(imported, sourceCode); + + return { + variable, + imported, + exports, + }; + }); + + if ( + ignoreUsedVariables + && variables.some(({variable, exports}) => variable.references.length !== exports.length) + ) { + continue; + } + + const shouldUseSuggestion = ignoreUsedVariables + && variables.some(({variable}) => variable.references.length === 0); + + for (const {imported, exports} of variables) { + for (const exported of exports) { + const problem = { + node: exported.node, + messageId: MESSAGE_ID_ERROR, + data: { + exported: exported.text, + }, + }; + const fix = getFixFunction({ + sourceCode, + imported, + exported, + exportDeclarations, + program, + }); + + if (shouldUseSuggestion) { + problem.suggest = [ + { + messageId: MESSAGE_ID_SUGGESTION, + fix, + }, + ]; + } else { + problem.fix = fix; + } + + yield problem; + } + } + } + }, + }; +} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `export…from` when re-exporting.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-global-this.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-global-this.js new file mode 100644 index 0000000000000000000000000000000000000000..ce1104e3e667e9db7c711f2a25f9a78c170f408b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-global-this.js @@ -0,0 +1,210 @@ +'use strict'; + +const MESSAGE_ID_ERROR = 'prefer-global-this/error'; +const messages = { + [MESSAGE_ID_ERROR]: 'Prefer `globalThis` over `{{value}}`.', +}; + +const globalIdentifier = new Set(['window', 'self', 'global']); + +const windowSpecificEvents = new Set([ + 'resize', + 'blur', + 'focus', + 'load', + 'scroll', + 'scrollend', + 'wheel', + 'beforeunload', // Browsers might have specific behaviors on exactly `window.onbeforeunload =` + 'message', + 'messageerror', + 'pagehide', + 'pagereveal', + 'pageshow', + 'pageswap', + 'unload', +]); + +/** +Note: What kind of API should be a windows-specific interface? + +1. It's directly related to window (✅ window.close()) +2. It does NOT work well as globalThis.x or x (✅ window.frames, window.top) + +Some constructors are occasionally related to window (like Element !== iframe.contentWindow.Element), but they don't need to mention window anyway. + +Please use these criteria to decide whether an API should be added here. Context: https://github.com/sindresorhus/eslint-plugin-unicorn/pull/2410#discussion_r1695312427 +*/ +const windowSpecificAPIs = new Set([ + // Properties and methods + // https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-window-object + 'name', + 'locationbar', + 'menubar', + 'personalbar', + 'scrollbars', + 'statusbar', + 'toolbar', + 'status', + 'close', + 'closed', + 'stop', + 'focus', + 'blur', + 'frames', + 'length', + 'top', + 'opener', + 'parent', + 'frameElement', + 'open', + 'originAgentCluster', + 'postMessage', + + // Events commonly associated with "window" + ...[...windowSpecificEvents].map(event => `on${event}`), + + // To add/remove/dispatch events that are commonly associated with "window" + // https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow + 'addEventListener', + 'removeEventListener', + 'dispatchEvent', + + // https://dom.spec.whatwg.org/#idl-index + 'event', // Deprecated and quirky, best left untouched + + // https://drafts.csswg.org/cssom-view/#idl-index + 'screen', + 'visualViewport', + 'moveTo', + 'moveBy', + 'resizeTo', + 'resizeBy', + 'innerWidth', + 'innerHeight', + 'scrollX', + 'pageXOffset', + 'scrollY', + 'pageYOffset', + 'scroll', + 'scrollTo', + 'scrollBy', + 'screenX', + 'screenLeft', + 'screenY', + 'screenTop', + 'screenWidth', + 'screenHeight', + 'devicePixelRatio', +]); + +const webWorkerSpecificAPIs = new Set([ + // https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface + 'addEventListener', + 'removeEventListener', + 'dispatchEvent', + + 'self', + 'location', + 'navigator', + 'onerror', + 'onlanguagechange', + 'onoffline', + 'ononline', + 'onrejectionhandled', + 'onunhandledrejection', + + // https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-dedicatedworkerglobalscope-interface + 'name', + 'postMessage', + 'onconnect', +]); + +/** +Check if the node is a window-specific API. + +@param {import('estree').MemberExpression} node +@returns {boolean} +*/ +const isWindowSpecificAPI = node => { + if (node.type !== 'MemberExpression') { + return false; + } + + if (node.object.name !== 'window' || node.property.type !== 'Identifier') { + return false; + } + + if (windowSpecificAPIs.has(node.property.name)) { + if (['addEventListener', 'removeEventListener', 'dispatchEvent'].includes(node.property.name) && node.parent.type === 'CallExpression' && node.parent.callee === node) { + const argument = node.parent.arguments[0]; + return argument && argument.type === 'Literal' && windowSpecificEvents.has(argument.value); + } + + return true; + } + + return false; +}; + +/** +@param {import('estree').Identifier} identifier +@returns {boolean} +*/ +function isComputedMemberExpressionObject(identifier) { + return identifier.parent.type === 'MemberExpression' && identifier.parent.computed && identifier.parent.object === identifier; +} + +/** +Check if the node is a web worker specific API. + +@param {import('estree').MemberExpression} node +@returns {boolean} +*/ +const isWebWorkerSpecificAPI = node => node.type === 'MemberExpression' && node.object.name === 'self' && node.property.type === 'Identifier' && webWorkerSpecificAPIs.has(node.property.name); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + * Program(program) { + const scope = context.sourceCode.getScope(program); + + const references = [ + // Variables declared at globals options + ...scope.variables.flatMap(variable => globalIdentifier.has(variable.name) ? variable.references : []), + // Variables not declared at globals options + ...scope.through.filter(reference => globalIdentifier.has(reference.identifier.name)), + ]; + + for (const {identifier} of references) { + if ( + isComputedMemberExpressionObject(identifier) + || isWindowSpecificAPI(identifier.parent) + || isWebWorkerSpecificAPI(identifier.parent) + ) { + continue; + } + + yield { + node: identifier, + messageId: MESSAGE_ID_ERROR, + data: {value: identifier.name}, + fix: fixer => fixer.replaceText(identifier, 'globalThis'), + }; + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `globalThis` over `window`, `self`, and `global`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: false, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-includes.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-includes.js new file mode 100644 index 0000000000000000000000000000000000000000..01095c74f29cbe513adeb1a3a16025be316b0b2d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-includes.js @@ -0,0 +1,101 @@ +'use strict'; +const isMethodNamed = require('./utils/is-method-named.js'); +const simpleArraySearchRule = require('./shared/simple-array-search-rule.js'); +const {isLiteral, isNegativeOne} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-includes'; +const messages = { + [MESSAGE_ID]: 'Use `.includes()`, rather than `.{{method}}()`, when checking for existence.', +}; +// Ignore `{_,lodash,underscore}.{indexOf,lastIndexOf}` +const ignoredVariables = new Set(['_', 'lodash', 'underscore']); +const isIgnoredTarget = node => node.type === 'Identifier' && ignoredVariables.has(node.name); +const isLiteralZero = node => isLiteral(node, 0); +const isNegativeResult = node => ['===', '==', '<'].includes(node.operator); + +const getProblem = (context, node, target, argumentsNodes) => { + const {sourceCode} = context; + const memberExpressionNode = target.parent; + const dotToken = sourceCode.getTokenBefore(memberExpressionNode.property); + const targetSource = sourceCode.getText().slice(memberExpressionNode.range[0], dotToken.range[0]); + + // Strip default `fromIndex` + if (isLiteralZero(argumentsNodes[1])) { + argumentsNodes = argumentsNodes.slice(0, 1); + } + + const argumentsSource = argumentsNodes.map(argument => sourceCode.getText(argument)); + + return { + node: memberExpressionNode.property, + messageId: MESSAGE_ID, + data: { + method: node.left.callee.property.name, + }, + fix(fixer) { + const replacement = `${isNegativeResult(node) ? '!' : ''}${targetSource}.includes(${argumentsSource.join(', ')})`; + return fixer.replaceText(node, replacement); + }, + }; +}; + +const includesOverSomeRule = simpleArraySearchRule({ + method: 'some', + replacement: 'includes', +}); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + includesOverSomeRule.listen(context); + + context.on('BinaryExpression', node => { + const {left, right, operator} = node; + + if (!isMethodNamed(left, 'indexOf') && !isMethodNamed(left, 'lastIndexOf')) { + return; + } + + const target = left.callee.object; + + if (isIgnoredTarget(target)) { + return; + } + + const {arguments: argumentsNodes} = left; + + // Ignore something.indexOf(foo, 0, another) + if (argumentsNodes.length > 2) { + return; + } + + if ( + (['!==', '!=', '>', '===', '=='].includes(operator) && isNegativeOne(right)) + || (['>=', '<'].includes(operator) && isLiteralZero(right)) + ) { + return getProblem( + context, + node, + target, + argumentsNodes, + ); + } + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `.includes()` over `.indexOf()`, `.lastIndexOf()`, and `Array#some()` when checking for existence or non-existence.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages: { + ...messages, + ...includesOverSomeRule.messages, + }, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-json-parse-buffer.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-json-parse-buffer.js new file mode 100644 index 0000000000000000000000000000000000000000..585b1737941896bda56b37762053d12d37117fd2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-json-parse-buffer.js @@ -0,0 +1,160 @@ +'use strict'; +const {findVariable, getStaticValue, getPropertyName} = require('@eslint-community/eslint-utils'); +const {isMethodCall} = require('./ast/index.js'); +const {removeArgument} = require('./fix/index.js'); + +const MESSAGE_ID = 'prefer-json-parse-buffer'; +const messages = { + [MESSAGE_ID]: 'Prefer reading the JSON file as a buffer.', +}; + +const getAwaitExpressionArgument = node => { + while (node.type === 'AwaitExpression') { + node = node.argument; + } + + return node; +}; + +function getIdentifierDeclaration(node, scope) { + if (!node) { + return; + } + + node = getAwaitExpressionArgument(node); + + if (!node || node.type !== 'Identifier') { + return node; + } + + const variable = findVariable(scope, node); + if (!variable) { + return; + } + + const {identifiers, references} = variable; + + if (identifiers.length !== 1 || references.length !== 2) { + return; + } + + const [identifier] = identifiers; + + if ( + identifier.parent.type !== 'VariableDeclarator' + || identifier.parent.id !== identifier + ) { + return; + } + + return getIdentifierDeclaration(identifier.parent.init, variable.scope); +} + +const isUtf8EncodingStringNode = (node, scope) => + isUtf8EncodingString(getStaticValue(node, scope)?.value); + +const isUtf8EncodingString = value => { + if (typeof value !== 'string') { + return false; + } + + value = value.toLowerCase(); + + // eslint-disable-next-line unicorn/text-encoding-identifier-case + return value === 'utf8' || value === 'utf-8'; +}; + +function isUtf8Encoding(node, scope) { + if ( + node.type === 'ObjectExpression' + && node.properties.length === 1 + && node.properties[0].type === 'Property' + && getPropertyName(node.properties[0], scope) === 'encoding' + && isUtf8EncodingStringNode(node.properties[0].value, scope) + ) { + return true; + } + + if (isUtf8EncodingStringNode(node, scope)) { + return true; + } + + const staticValue = getStaticValue(node, scope); + if (!staticValue) { + return false; + } + + const {value} = staticValue; + if ( + typeof value === 'object' + && Object.keys(value).length === 1 + && isUtf8EncodingString(value.encoding) + ) { + return true; + } + + return false; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(callExpression) { + if (!(isMethodCall(callExpression, { + object: 'JSON', + method: 'parse', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }))) { + return; + } + + let [node] = callExpression.arguments; + const {sourceCode} = context; + const scope = sourceCode.getScope(node); + node = getIdentifierDeclaration(node, scope); + if ( + !( + node + && node.type === 'CallExpression' + && !node.optional + && node.arguments.length === 2 + && !node.arguments.some(node => node.type === 'SpreadElement') + && node.callee.type === 'MemberExpression' + && !node.callee.optional + ) + ) { + return; + } + + const method = getPropertyName(node.callee, scope); + if (method !== 'readFile' && method !== 'readFileSync') { + return; + } + + const [, charsetNode] = node.arguments; + if (!isUtf8Encoding(charsetNode, scope)) { + return; + } + + return { + node: charsetNode, + messageId: MESSAGE_ID, + fix: fixer => removeArgument(fixer, charsetNode, sourceCode), + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer reading a JSON file as a buffer.', + recommended: false, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-keyboard-event-key.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-keyboard-event-key.js new file mode 100644 index 0000000000000000000000000000000000000000..8230de582c6f80b95525b323e98eeac6f5e989fe --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-keyboard-event-key.js @@ -0,0 +1,187 @@ +'use strict'; +const escapeString = require('./utils/escape-string.js'); +const translateToKey = require('./shared/event-keys.js'); +const {isNumberLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-keyboard-event-key'; +const messages = { + [MESSAGE_ID]: 'Use `.key` instead of `.{{name}}`.', +}; + +const keys = new Set([ + 'keyCode', + 'charCode', + 'which', +]); + +const isPropertyNamedAddEventListener = node => + node?.type === 'CallExpression' + && node.callee.type === 'MemberExpression' + && node.callee.property.name === 'addEventListener'; + +const getEventNodeAndReferences = (context, node) => { + const eventListener = getMatchingAncestorOfType(node, 'CallExpression', isPropertyNamedAddEventListener); + const callback = eventListener?.arguments[1]; + switch (callback?.type) { + case 'ArrowFunctionExpression': + case 'FunctionExpression': { + const eventVariable = context.sourceCode.getDeclaredVariables(callback)[0]; + const references = eventVariable?.references; + return { + event: callback.params[0], + references, + }; + } + + default: { + return {}; + } + } +}; + +const isPropertyOf = (node, eventNode) => + node?.parent?.type === 'MemberExpression' + && node.parent.object === eventNode; + +// The third argument is a condition function, as one passed to `Array#filter()` +// Helpful if nearest node of type also needs to have some other property +const getMatchingAncestorOfType = (node, type, testFunction = () => true) => { + let current = node; + while (current) { + if (current.type === type && testFunction(current)) { + return current; + } + + current = current.parent; + } +}; + +const getParentByLevel = (node, level) => { + let current = node; + while (current && level) { + level--; + current = current.parent; + } + + /* c8 ignore next 3 */ + if (level === 0) { + return current; + } +}; + +const fix = node => fixer => { + // Since we're only fixing direct property access usages, like `event.keyCode` + const nearestIf = getParentByLevel(node, 3); + if (!nearestIf || nearestIf.type !== 'IfStatement') { + return; + } + + const {type, operator, right} = nearestIf.test; + if ( + !( + type === 'BinaryExpression' + && (operator === '==' || operator === '===') + && isNumberLiteral(right) + ) + ) { + return; + } + + // Either a meta key or a printable character + const key = translateToKey[right.value] || String.fromCodePoint(right.value); + // And if we recognize the `.keyCode` + if (!key) { + return; + } + + // Apply fixes + return [ + fixer.replaceText(node, 'key'), + fixer.replaceText(right, escapeString(key)), + ]; +}; + +const getProblem = node => ({ + messageId: MESSAGE_ID, + data: {name: node.name}, + node, + fix: fix(node), +}); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + Identifier(node) { + if ( + node.name !== 'keyCode' + && node.name !== 'charCode' + && node.name !== 'which' + ) { + return; + } + + // Normal case when usage is direct -> `event.keyCode` + const {event, references} = getEventNodeAndReferences(context, node); + if (!event) { + return; + } + + if ( + references + && references.some(reference => isPropertyOf(node, reference.identifier)) + ) { + return getProblem(node); + } + }, + + Property(node) { + // Destructured case + const propertyName = node.value.name; + if (!keys.has(propertyName)) { + return; + } + + const {event, references} = getEventNodeAndReferences(context, node); + if (!event) { + return; + } + + const nearestVariableDeclarator = getMatchingAncestorOfType( + node, + 'VariableDeclarator', + ); + const initObject = nearestVariableDeclarator?.init; + + // Make sure initObject is a reference of eventVariable + if ( + references + && references.some(reference => reference.identifier === initObject) + ) { + return getProblem(node.value); + } + + // When the event parameter itself is destructured directly + const isEventParameterDestructured = event.type === 'ObjectPattern'; + if (isEventParameterDestructured) { + // Check for properties + for (const property of event.properties) { + if (property === node) { + return getProblem(node.value); + } + } + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-logical-operator-over-ternary.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-logical-operator-over-ternary.js new file mode 100644 index 0000000000000000000000000000000000000000..240855c93b45c32cc911e984068fe65c8e3b11e4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-logical-operator-over-ternary.js @@ -0,0 +1,160 @@ +'use strict'; +const {isParenthesized, getParenthesizedText} = require('./utils/parentheses.js'); +const isSameReference = require('./utils/is-same-reference.js'); +const shouldAddParenthesesToLogicalExpressionChild = require('./utils/should-add-parentheses-to-logical-expression-child.js'); +const needsSemicolon = require('./utils/needs-semicolon.js'); + +const MESSAGE_ID_ERROR = 'prefer-logical-operator-over-ternary/error'; +const MESSAGE_ID_SUGGESTION = 'prefer-logical-operator-over-ternary/suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Prefer using a logical operator over a ternary.', + [MESSAGE_ID_SUGGESTION]: 'Switch to `{{operator}}` operator.', +}; + +function isSameNode(left, right, sourceCode) { + if (isSameReference(left, right)) { + return true; + } + + if (left.type !== right.type) { + return false; + } + + switch (left.type) { + case 'AwaitExpression': { + return isSameNode(left.argument, right.argument, sourceCode); + } + + case 'LogicalExpression': { + return ( + left.operator === right.operator + && isSameNode(left.left, right.left, sourceCode) + && isSameNode(left.right, right.right, sourceCode) + ); + } + + case 'UnaryExpression': { + return ( + left.operator === right.operator + && left.prefix === right.prefix + && isSameNode(left.argument, right.argument, sourceCode) + ); + } + + case 'UpdateExpression': { + return false; + } + + // No default + } + + return sourceCode.getText(left) === sourceCode.getText(right); +} + +function fix({ + fixer, + sourceCode, + conditionalExpression, + left, + right, + operator, +}) { + let text = [left, right].map((node, index) => { + const isNodeParenthesized = isParenthesized(node, sourceCode); + let text = isNodeParenthesized ? getParenthesizedText(node, sourceCode) : sourceCode.getText(node); + + if ( + !isNodeParenthesized + && shouldAddParenthesesToLogicalExpressionChild(node, {operator, property: index === 0 ? 'left' : 'right'}) + ) { + text = `(${text})`; + } + + return text; + }).join(` ${operator} `); + + // According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#table + // There should be no cases need add parentheses when switching ternary to logical expression + + // ASI + if (needsSemicolon(sourceCode.getTokenBefore(conditionalExpression), sourceCode, text)) { + text = `;${text}`; + } + + return fixer.replaceText(conditionalExpression, text); +} + +function getProblem({ + sourceCode, + conditionalExpression, + left, + right, +}) { + return { + node: conditionalExpression, + messageId: MESSAGE_ID_ERROR, + suggest: ['??', '||'].map(operator => ({ + messageId: MESSAGE_ID_SUGGESTION, + data: {operator}, + fix: fixer => fix({ + fixer, + sourceCode, + conditionalExpression, + left, + right, + operator, + }), + })), + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + return { + ConditionalExpression(conditionalExpression) { + const {test, consequent, alternate} = conditionalExpression; + + // `foo ? foo : bar` + if (isSameNode(test, consequent, sourceCode)) { + return getProblem({ + sourceCode, + conditionalExpression, + left: test, + right: alternate, + }); + } + + // `!bar ? foo : bar` + if ( + test.type === 'UnaryExpression' + && test.operator === '!' + && test.prefix + && isSameNode(test.argument, alternate, sourceCode) + ) { + return getProblem({ + sourceCode, + conditionalExpression, + left: test.argument, + right: consequent, + }); + } + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer using a logical operator over a ternary.', + recommended: true, + }, + + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-math-min-max.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-math-min-max.js new file mode 100644 index 0000000000000000000000000000000000000000..fdad464fa44c9e8622a1598eaa2c297c07af253d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-math-min-max.js @@ -0,0 +1,80 @@ +'use strict'; +const {fixSpaceAroundKeyword} = require('./fix/index.js'); + +const MESSAGE_ID = 'prefer-math-min-max'; +const messages = { + [MESSAGE_ID]: 'Prefer `Math.{{method}}()` to simplify ternary expressions.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + /** @param {import('estree').ConditionalExpression} conditionalExpression */ + ConditionalExpression(conditionalExpression) { + const {test, consequent, alternate} = conditionalExpression; + + if (test.type !== 'BinaryExpression') { + return; + } + + const {operator, left, right} = test; + const [leftText, rightText, alternateText, consequentText] = [left, right, alternate, consequent].map(node => context.sourceCode.getText(node)); + + const isGreaterOrEqual = operator === '>' || operator === '>='; + const isLessOrEqual = operator === '<' || operator === '<='; + + let method; + + // Prefer `Math.min()` + if ( + // `height > 50 ? 50 : height` + (isGreaterOrEqual && leftText === alternateText && rightText === consequentText) + // `height < 50 ? height : 50` + || (isLessOrEqual && leftText === consequentText && rightText === alternateText) + ) { + method = 'min'; + } else if ( + // `height > 50 ? height : 50` + (isGreaterOrEqual && leftText === consequentText && rightText === alternateText) + // `height < 50 ? 50 : height` + || (isLessOrEqual && leftText === alternateText && rightText === consequentText) + ) { + method = 'max'; + } + + if (!method) { + return; + } + + return { + node: conditionalExpression, + messageId: MESSAGE_ID, + data: {method}, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + * fix(fixer) { + const {sourceCode} = context; + + yield * fixSpaceAroundKeyword(fixer, conditionalExpression, sourceCode); + + const argumentsText = [left, right] + .map(node => node.type === 'SequenceExpression' ? `(${sourceCode.getText(node)})` : sourceCode.getText(node)) + .join(', '); + + yield fixer.replaceText(conditionalExpression, `Math.${method}(${argumentsText})`); + }, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Prefer `Math.min()` and `Math.max()` over ternaries for simple comparisons.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-math-trunc.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-math-trunc.js new file mode 100644 index 0000000000000000000000000000000000000000..a90e4e414869bee77e73bd4ea049228c733eaa76 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-math-trunc.js @@ -0,0 +1,110 @@ +'use strict'; +const {hasSideEffect} = require('@eslint-community/eslint-utils'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); +const {isLiteral} = require('./ast/index.js'); + +const ERROR_BITWISE = 'error-bitwise'; +const ERROR_BITWISE_NOT = 'error-bitwise-not'; +const SUGGESTION_BITWISE = 'suggestion-bitwise'; +const messages = { + [ERROR_BITWISE]: 'Use `Math.trunc` instead of `{{operator}} {{value}}`.', + [ERROR_BITWISE_NOT]: 'Use `Math.trunc` instead of `~~`.', + [SUGGESTION_BITWISE]: 'Replace `{{operator}} {{value}}` with `Math.trunc`.', +}; + +// Bitwise operators +const bitwiseOperators = new Set(['|', '>>', '<<', '^']); +const isBitwiseNot = node => + node.type === 'UnaryExpression' + && node.operator === '~'; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + const mathTruncFunctionCall = node => { + const text = sourceCode.getText(node); + const parenthesized = node.type === 'SequenceExpression' ? `(${text})` : text; + return `Math.trunc(${parenthesized})`; + }; + + context.on(['BinaryExpression', 'AssignmentExpression'], node => { + const {type, operator, right, left} = node; + const isAssignment = type === 'AssignmentExpression'; + if ( + !isLiteral(right, 0) + || !bitwiseOperators.has(isAssignment ? operator.slice(0, -1) : operator) + ) { + return; + } + + const problem = { + node, + messageId: ERROR_BITWISE, + data: { + operator, + value: right.raw, + }, + }; + + if (!isAssignment || !hasSideEffect(left, sourceCode)) { + const fix = function * (fixer) { + const fixed = mathTruncFunctionCall(left); + if (isAssignment) { + const operatorToken = sourceCode.getTokenAfter(left, token => token.type === 'Punctuator' && token.value === operator); + yield fixer.replaceText(operatorToken, '='); + yield fixer.replaceText(right, fixed); + } else { + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + yield fixer.replaceText(node, fixed); + } + }; + + if (operator === '|') { + problem.suggest = [ + { + messageId: SUGGESTION_BITWISE, + fix, + }, + ]; + } else { + problem.fix = fix; + } + } + + return problem; + }); + + // Unary Expression Selector: Inner-most 2 bitwise NOT + context.on('UnaryExpression', node => { + if ( + isBitwiseNot(node) + && isBitwiseNot(node.argument) + && !isBitwiseNot(node.argument.argument) + ) { + return { + node, + messageId: ERROR_BITWISE_NOT, + * fix(fixer) { + yield fixer.replaceText(node, mathTruncFunctionCall(node.argument.argument)); + yield * fixSpaceAroundKeyword(fixer, node, sourceCode); + }, + }; + } + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce the use of `Math.trunc` instead of bitwise operators.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-modern-dom-apis.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-modern-dom-apis.js new file mode 100644 index 0000000000000000000000000000000000000000..b06e502663b98885d51b65c0cf12ca0070225f6f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-modern-dom-apis.js @@ -0,0 +1,142 @@ +'use strict'; +const {isValueNotUsable} = require('./utils/index.js'); +const {isMethodCall} = require('./ast/index.js'); + +const messages = { + replaceChildOrInsertBefore: + 'Prefer `{{oldChildNode}}.{{preferredMethod}}({{newChildNode}})` over `{{parentNode}}.{{method}}({{newChildNode}}, {{oldChildNode}})`.', + insertAdjacentTextOrInsertAdjacentElement: + 'Prefer `{{reference}}.{{preferredMethod}}({{content}})` over `{{reference}}.{{method}}({{position}}, {{content}})`.', +}; + +const disallowedMethods = new Map([ + ['replaceChild', 'replaceWith'], + ['insertBefore', 'before'], +]); + +const checkForReplaceChildOrInsertBefore = (context, node) => { + const method = node.callee.property.name; + const parentNode = node.callee.object.name; + const [newChildNode, oldChildNode] = node.arguments.map(({name}) => name); + const preferredMethod = disallowedMethods.get(method); + + const fix = isValueNotUsable(node) + ? fixer => fixer.replaceText( + node, + `${oldChildNode}.${preferredMethod}(${newChildNode})`, + ) + : undefined; + + return { + node, + messageId: 'replaceChildOrInsertBefore', + data: { + parentNode, + method, + preferredMethod, + newChildNode, + oldChildNode, + }, + fix, + }; +}; + +const positionReplacers = new Map([ + ['beforebegin', 'before'], + ['afterbegin', 'prepend'], + ['beforeend', 'append'], + ['afterend', 'after'], +]); + +const checkForInsertAdjacentTextOrInsertAdjacentElement = (context, node) => { + const method = node.callee.property.name; + const [positionNode, contentNode] = node.arguments; + + const position = positionNode.value; + // Return early when specified position value of first argument is not a recognized value. + if (!positionReplacers.has(position)) { + return; + } + + const preferredMethod = positionReplacers.get(position); + const {sourceCode} = context; + const content = sourceCode.getText(contentNode); + const reference = sourceCode.getText(node.callee.object); + + const fix = method === 'insertAdjacentElement' && !isValueNotUsable(node) + ? undefined + // TODO: make a better fix, don't touch reference + : fixer => fixer.replaceText( + node, + `${reference}.${preferredMethod}(${content})`, + ); + + return { + node, + messageId: 'insertAdjacentTextOrInsertAdjacentElement', + data: { + reference, + method, + preferredMethod, + position: sourceCode.getText(positionNode), + content, + }, + fix, + }; +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on('CallExpression', node => { + if ( + isMethodCall(node, { + methods: ['replaceChild', 'insertBefore'], + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + }) + // We only allow Identifier for now + && node.arguments.every(node => node.type === 'Identifier' && node.name !== 'undefined') + // This check makes sure that only the first method of chained methods with same identifier name e.g: parentNode.insertBefore(alfa, beta).insertBefore(charlie, delta); gets reported + && node.callee.object.type === 'Identifier' + ) { + return checkForReplaceChildOrInsertBefore(context, node); + } + }); + + context.on('CallExpression', node => { + if ( + isMethodCall(node, { + methods: ['insertAdjacentText', 'insertAdjacentElement'], + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + }) + // Position argument should be `string` + && node.arguments[0].type === 'Literal' + // TODO: remove this limits on second argument + && ( + node.arguments[1].type === 'Literal' + || node.arguments[1].type === 'Identifier' + ) + // TODO: remove this limits on callee + && node.callee.object.type === 'Identifier' + ) { + return checkForInsertAdjacentTextOrInsertAdjacentElement(context, node); + } + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `.before()` over `.insertBefore()`, `.replaceWith()` over `.replaceChild()`, prefer one of `.before()`, `.after()`, `.append()` or `.prepend()` over `insertAdjacentText()` and `insertAdjacentElement()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-modern-math-apis.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-modern-math-apis.js new file mode 100644 index 0000000000000000000000000000000000000000..1cb6fb605bae4024250a4f2ce347dc04ce12214c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-modern-math-apis.js @@ -0,0 +1,213 @@ +'use strict'; +const { + getParenthesizedText, + getParenthesizedRange, + isSameReference, +} = require('./utils/index.js'); +const {isLiteral, isMethodCall} = require('./ast/index.js'); +const {replaceNodeOrTokenAndSpacesBefore, removeParentheses} = require('./fix/index.js'); + +const MESSAGE_ID = 'prefer-modern-math-apis'; +const messages = { + [MESSAGE_ID]: 'Prefer `{{replacement}}` over `{{description}}`.', +}; + +const isMathProperty = (node, property) => + node.type === 'MemberExpression' + && !node.optional + && !node.computed + && node.object.type === 'Identifier' + && node.object.name === 'Math' + && node.property.type === 'Identifier' + && node.property.name === property; + +const isMathMethodCall = (node, method) => + node.type === 'CallExpression' + && !node.optional + && isMathProperty(node.callee, method) + && node.arguments.length === 1 + && node.arguments[0].type !== 'SpreadElement'; + +// `Math.log(x) * Math.LOG10E` -> `Math.log10(x)` +// `Math.LOG10E * Math.log(x)` -> `Math.log10(x)` +// `Math.log(x) * Math.LOG2E` -> `Math.log2(x)` +// `Math.LOG2E * Math.log(x)` -> `Math.log2(x)` +function createLogCallTimesConstantCheck({constantName, replacementMethod}) { + const replacement = `Math.${replacementMethod}(…)`; + + return function (node, context) { + if (!(node.type === 'BinaryExpression' && node.operator === '*')) { + return; + } + + let mathLogCall; + let description; + if (isMathMethodCall(node.left, 'log') && isMathProperty(node.right, constantName)) { + mathLogCall = node.left; + description = `Math.log(…) * Math.${constantName}`; + } else if (isMathMethodCall(node.right, 'log') && isMathProperty(node.left, constantName)) { + mathLogCall = node.right; + description = `Math.${constantName} * Math.log(…)`; + } + + if (!mathLogCall) { + return; + } + + const [valueNode] = mathLogCall.arguments; + + return { + node, + messageId: MESSAGE_ID, + data: { + replacement, + description, + }, + fix: fixer => fixer.replaceText(node, `Math.${replacementMethod}(${getParenthesizedText(valueNode, context.sourceCode)})`), + }; + }; +} + +// `Math.log(x) / Math.LN10` -> `Math.log10(x)` +// `Math.log(x) / Math.LN2` -> `Math.log2(x)` +function createLogCallDivideConstantCheck({constantName, replacementMethod}) { + const message = { + messageId: MESSAGE_ID, + data: { + replacement: `Math.${replacementMethod}(…)`, + description: `Math.log(…) / Math.${constantName}`, + }, + }; + + return function (node, context) { + if ( + !( + node.type === 'BinaryExpression' + && node.operator === '/' + && isMathMethodCall(node.left, 'log') + && isMathProperty(node.right, constantName) + ) + ) { + return; + } + + const [valueNode] = node.left.arguments; + + return { + ...message, + node, + fix: fixer => fixer.replaceText(node, `Math.${replacementMethod}(${getParenthesizedText(valueNode, context.sourceCode)})`), + }; + }; +} + +const checkFunctions = [ + createLogCallTimesConstantCheck({constantName: 'LOG10E', replacementMethod: 'log10'}), + createLogCallTimesConstantCheck({constantName: 'LOG2E', replacementMethod: 'log2'}), + createLogCallDivideConstantCheck({constantName: 'LN10', replacementMethod: 'log10'}), + createLogCallDivideConstantCheck({constantName: 'LN2', replacementMethod: 'log2'}), +]; + +const isPlusExpression = node => node.type === 'BinaryExpression' && node.operator === '+'; + +const isPow2Expression = node => + node.type === 'BinaryExpression' + && ( + // `x * x` + (node.operator === '*' && isSameReference(node.left, node.right)) + // `x ** 2` + || (node.operator === '**' && isLiteral(node.right, 2)) + ); + +const flatPlusExpression = node => + isPlusExpression(node) + ? [node.left, node.right].flatMap(child => flatPlusExpression(child)) + : [node]; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const nodes = []; + + return { + CallExpression(callExpression) { + if (!isMethodCall(callExpression, { + object: 'Math', + method: 'sqrt', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + })) { + return; + } + + const expressions = flatPlusExpression(callExpression.arguments[0]); + if (expressions.some(expression => !isPow2Expression(expression))) { + return; + } + + const replacementMethod = expressions.length === 1 ? 'abs' : 'hypot'; + const plusExpressions = new Set(expressions.length === 1 ? [] : expressions.map(expression => expression.parent)); + + return { + node: callExpression.callee.property, + messageId: MESSAGE_ID, + data: { + replacement: `Math.${replacementMethod}(…)`, + description: 'Math.sqrt(…)', + }, + * fix(fixer) { + const {sourceCode} = context; + + // `Math.sqrt` -> `Math.{hypot,abs}` + yield fixer.replaceText(callExpression.callee.property, replacementMethod); + + // `a ** 2 + b ** 2` -> `a, b` + for (const expression of plusExpressions) { + const plusToken = sourceCode.getTokenAfter(expression.left, token => token.type === 'Punctuator' && token.value === '+'); + + yield * replaceNodeOrTokenAndSpacesBefore(plusToken, ',', fixer, sourceCode); + yield * removeParentheses(expression, fixer, sourceCode); + } + + // `x ** 2` => `x` + // `x * a` => `x` + for (const expression of expressions) { + yield fixer.removeRange([ + getParenthesizedRange(expression.left, sourceCode)[1], + expression.range[1], + ]); + } + }, + }; + }, + + BinaryExpression(node) { + nodes.push(node); + }, + * 'Program:exit'() { + for (const node of nodes) { + for (const getProblem of checkFunctions) { + const problem = getProblem(node, context); + + if (problem) { + yield problem; + } + } + } + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer modern `Math` APIs over legacy patterns.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-module.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-module.js new file mode 100644 index 0000000000000000000000000000000000000000..a1f3bdee3784643955a3bf3befabba3f31da65d6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-module.js @@ -0,0 +1,381 @@ +'use strict'; +const isShadowed = require('./utils/is-shadowed.js'); +const assertToken = require('./utils/assert-token.js'); +const {getCallExpressionTokens} = require('./utils/index.js'); +const {isStaticRequire, isReferenceIdentifier, isFunction} = require('./ast/index.js'); +const { + removeParentheses, + replaceReferenceIdentifier, + removeSpacesAfter, +} = require('./fix/index.js'); + +const ERROR_USE_STRICT_DIRECTIVE = 'error/use-strict-directive'; +const ERROR_GLOBAL_RETURN = 'error/global-return'; +const ERROR_IDENTIFIER = 'error/identifier'; +const SUGGESTION_USE_STRICT_DIRECTIVE = 'suggestion/use-strict-directive'; +const SUGGESTION_IMPORT_META_DIRNAME = 'suggestion/import-meta-dirname'; +const SUGGESTION_IMPORT_META_URL_TO_DIRNAME = 'suggestion/import-meta-url-to-dirname'; +const SUGGESTION_IMPORT_META_FILENAME = 'suggestion/import-meta-filename'; +const SUGGESTION_IMPORT_META_URL_TO_FILENAME = 'suggestion/import-meta-url-to-filename'; +const SUGGESTION_IMPORT = 'suggestion/import'; +const SUGGESTION_EXPORT = 'suggestion/export'; +const messages = { + [ERROR_USE_STRICT_DIRECTIVE]: 'Do not use "use strict" directive.', + [ERROR_GLOBAL_RETURN]: '"return" should be used inside a function.', + [ERROR_IDENTIFIER]: 'Do not use "{{name}}".', + [SUGGESTION_USE_STRICT_DIRECTIVE]: 'Remove "use strict" directive.', + [SUGGESTION_IMPORT_META_DIRNAME]: 'Replace `__dirname` with `import.meta.dirname`.', + [SUGGESTION_IMPORT_META_URL_TO_DIRNAME]: 'Replace `__dirname` with `…(import.meta.url)`.', + [SUGGESTION_IMPORT_META_FILENAME]: 'Replace `__filename` with `import.meta.filename`.', + [SUGGESTION_IMPORT_META_URL_TO_FILENAME]: 'Replace `__filename` with `…(import.meta.url)`.', + [SUGGESTION_IMPORT]: 'Switch to `import`.', + [SUGGESTION_EXPORT]: 'Switch to `export`.', +}; + +const suggestions = new Map([ + [ + '__dirname', + [ + { + messageId: SUGGESTION_IMPORT_META_DIRNAME, + replacement: 'import.meta.dirname', + }, + { + messageId: SUGGESTION_IMPORT_META_URL_TO_DIRNAME, + replacement: 'path.dirname(url.fileURLToPath(import.meta.url))', + }, + ], + ], + [ + '__filename', + [ + { + messageId: SUGGESTION_IMPORT_META_FILENAME, + replacement: 'import.meta.filename', + }, + { + messageId: SUGGESTION_IMPORT_META_URL_TO_FILENAME, + replacement: 'url.fileURLToPath(import.meta.url)', + }, + ], + ], +]); + +function fixRequireCall(node, sourceCode) { + if (!isStaticRequire(node.parent) || node.parent.callee !== node) { + return; + } + + const requireCall = node.parent; + const { + parent, + callee, + arguments: [source], + } = requireCall; + + // `require("foo")` + if (parent.type === 'ExpressionStatement' && parent.parent.type === 'Program') { + return function * (fixer) { + yield fixer.replaceText(callee, 'import'); + + const { + openingParenthesisToken, + closingParenthesisToken, + } = getCallExpressionTokens(sourceCode, requireCall); + yield fixer.replaceText(openingParenthesisToken, ' '); + yield fixer.remove(closingParenthesisToken); + + for (const node of [callee, requireCall, source]) { + yield * removeParentheses(node, fixer, sourceCode); + } + }; + } + + // `const foo = require("foo")` + // `const {foo} = require("foo")` + if ( + parent.type === 'VariableDeclarator' + && parent.init === requireCall + && ( + parent.id.type === 'Identifier' + || ( + parent.id.type === 'ObjectPattern' + && parent.id.properties.every( + ({type, key, value, computed}) => + type === 'Property' + && !computed + && value.type === 'Identifier' + && key.type === 'Identifier', + ) + ) + ) + && parent.parent.type === 'VariableDeclaration' + && parent.parent.kind === 'const' + && parent.parent.declarations.length === 1 + && parent.parent.declarations[0] === parent + && parent.parent.parent.type === 'Program' + ) { + const declarator = parent; + const declaration = declarator.parent; + const {id} = declarator; + + return function * (fixer) { + const constToken = sourceCode.getFirstToken(declaration); + assertToken(constToken, { + expected: {type: 'Keyword', value: 'const'}, + ruleId: 'prefer-module', + }); + yield fixer.replaceText(constToken, 'import'); + + const equalToken = sourceCode.getTokenAfter(id); + assertToken(equalToken, { + expected: {type: 'Punctuator', value: '='}, + ruleId: 'prefer-module', + }); + yield removeSpacesAfter(id, sourceCode, fixer); + yield removeSpacesAfter(equalToken, sourceCode, fixer); + yield fixer.replaceText(equalToken, ' from '); + + yield fixer.remove(callee); + + const { + openingParenthesisToken, + closingParenthesisToken, + } = getCallExpressionTokens(sourceCode, requireCall); + yield fixer.remove(openingParenthesisToken); + yield fixer.remove(closingParenthesisToken); + + for (const node of [callee, requireCall, source]) { + yield * removeParentheses(node, fixer, sourceCode); + } + + if (id.type === 'Identifier') { + return; + } + + const {properties} = id; + + for (const property of properties) { + const {key, shorthand} = property; + if (!shorthand) { + const commaToken = sourceCode.getTokenAfter(key); + assertToken(commaToken, { + expected: {type: 'Punctuator', value: ':'}, + ruleId: 'prefer-module', + }); + yield removeSpacesAfter(key, sourceCode, fixer); + yield removeSpacesAfter(commaToken, sourceCode, fixer); + yield fixer.replaceText(commaToken, ' as '); + } + } + }; + } +} + +const isTopLevelAssignment = node => + node.parent.type === 'AssignmentExpression' + && node.parent.operator === '=' + && node.parent.left === node + && node.parent.parent.type === 'ExpressionStatement' + && node.parent.parent.parent.type === 'Program'; +const isNamedExport = node => + node.parent.type === 'MemberExpression' + && !node.parent.optional + && !node.parent.computed + && node.parent.object === node + && node.parent.property.type === 'Identifier' + && isTopLevelAssignment(node.parent) + && node.parent.parent.right.type === 'Identifier'; +const isModuleExports = node => + node.parent.type === 'MemberExpression' + && !node.parent.optional + && !node.parent.computed + && node.parent.object === node + && node.parent.property.type === 'Identifier' + && node.parent.property.name === 'exports'; +const isTopLevelReturnStatement = node => { + for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) { + if (isFunction(ancestor)) { + return false; + } + } + + return true; +}; + +function fixDefaultExport(node, sourceCode) { + return function * (fixer) { + yield fixer.replaceText(node, 'export default '); + yield removeSpacesAfter(node, sourceCode, fixer); + + const equalToken = sourceCode.getTokenAfter(node, token => token.type === 'Punctuator' && token.value === '='); + yield fixer.remove(equalToken); + yield removeSpacesAfter(equalToken, sourceCode, fixer); + + for (const currentNode of [node.parent, node]) { + yield * removeParentheses(currentNode, fixer, sourceCode); + } + }; +} + +function fixNamedExport(node, sourceCode) { + return function * (fixer) { + const assignmentExpression = node.parent.parent; + const exported = node.parent.property.name; + const local = assignmentExpression.right.name; + yield fixer.replaceText(assignmentExpression, `export {${local} as ${exported}}`); + + yield * removeParentheses(assignmentExpression, fixer, sourceCode); + }; +} + +function fixExports(node, sourceCode) { + // `exports = bar` + if (isTopLevelAssignment(node)) { + return fixDefaultExport(node, sourceCode); + } + + // `exports.foo = bar` + if (isNamedExport(node)) { + return fixNamedExport(node, sourceCode); + } +} + +function fixModuleExports(node, sourceCode) { + if (isModuleExports(node)) { + return fixExports(node.parent, sourceCode); + } +} + +function create(context) { + const filename = context.filename.toLowerCase(); + + if (filename.endsWith('.cjs')) { + return; + } + + const {sourceCode} = context; + + context.on('ExpressionStatement', node => { + if (node.directive !== 'use strict') { + return; + } + + const problem = {node, messageId: ERROR_USE_STRICT_DIRECTIVE}; + const fix = function * (fixer) { + yield fixer.remove(node); + yield removeSpacesAfter(node, sourceCode, fixer); + }; + + if (filename.endsWith('.mjs')) { + problem.fix = fix; + } else { + problem.suggest = [{messageId: SUGGESTION_USE_STRICT_DIRECTIVE, fix}]; + } + + return problem; + }); + + context.on('ReturnStatement', node => { + if (isTopLevelReturnStatement(node)) { + return { + node: sourceCode.getFirstToken(node), + messageId: ERROR_GLOBAL_RETURN, + }; + } + }); + + context.on('Identifier', node => { + if ( + !isReferenceIdentifier(node, [ + 'exports', + 'require', + 'module', + '__filename', + '__dirname', + ]) + || isShadowed(sourceCode.getScope(node), node) + ) { + return; + } + + const {name} = node; + + const problem = { + node, + messageId: ERROR_IDENTIFIER, + data: {name}, + }; + + switch (name) { + case '__filename': + case '__dirname': { + problem.suggest = suggestions.get(node.name) + .map(({messageId, replacement}) => ({ + messageId, + fix: fixer => replaceReferenceIdentifier(node, replacement, fixer), + })); + + return problem; + } + + case 'require': { + const fix = fixRequireCall(node, sourceCode); + if (fix) { + problem.suggest = [{ + messageId: SUGGESTION_IMPORT, + fix, + }]; + return problem; + } + + break; + } + + case 'exports': { + const fix = fixExports(node, sourceCode); + if (fix) { + problem.suggest = [{ + messageId: SUGGESTION_EXPORT, + fix, + }]; + return problem; + } + + break; + } + + case 'module': { + const fix = fixModuleExports(node, sourceCode); + if (fix) { + problem.suggest = [{ + messageId: SUGGESTION_EXPORT, + fix, + }]; + return problem; + } + + break; + } + + default: + } + + return problem; + }); +} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer JavaScript modules (ESM) over CommonJS.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-native-coercion-functions.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-native-coercion-functions.js new file mode 100644 index 0000000000000000000000000000000000000000..deb9a1808554f61487c3b341e7787924b753f01c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-native-coercion-functions.js @@ -0,0 +1,186 @@ +'use strict'; +const {getFunctionHeadLocation, getFunctionNameWithKind} = require('@eslint-community/eslint-utils'); +const {functionTypes} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-native-coercion-functions'; +const messages = { + [MESSAGE_ID]: '{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly.', +}; + +const nativeCoercionFunctionNames = new Set(['String', 'Number', 'BigInt', 'Boolean', 'Symbol']); +const arrayMethodsWithBooleanCallback = new Set(['every', 'filter', 'find', 'findLast', 'findIndex', 'findLastIndex', 'some']); + +const isNativeCoercionFunctionCall = (node, firstArgumentName) => + node?.type === 'CallExpression' + && !node.optional + && node.callee.type === 'Identifier' + && nativeCoercionFunctionNames.has(node.callee.name) + && node.arguments[0]?.type === 'Identifier' + && node.arguments[0].name === firstArgumentName; + +const isIdentityFunction = node => + ( + // `v => v` + node.type === 'ArrowFunctionExpression' + && node.body.type === 'Identifier' + && node.body.name === node.params[0].name + ) + || ( + // `(v) => {return v;}` + // `function (v) {return v;}` + node.body.type === 'BlockStatement' + && node.body.body.length === 1 + && node.body.body[0].type === 'ReturnStatement' + && node.body.body[0].argument?.type === 'Identifier' + && node.body.body[0].argument.name === node.params[0].name + ); + +const isArrayIdentityCallback = node => + isIdentityFunction(node) + && node.parent.type === 'CallExpression' + && !node.parent.optional + && node.parent.arguments[0] === node + && node.parent.callee.type === 'MemberExpression' + && !node.parent.callee.computed + && !node.parent.callee.optional + && node.parent.callee.property.type === 'Identifier' + && arrayMethodsWithBooleanCallback.has(node.parent.callee.property.name); + +function getCallExpression(node) { + const firstParameterName = node.params[0].name; + + // `(v) => String(v)` + if ( + node.type === 'ArrowFunctionExpression' + && isNativeCoercionFunctionCall(node.body, firstParameterName) + ) { + return node.body; + } + + // `(v) => {return String(v);}` + // `function (v) {return String(v);}` + if ( + node.body.type === 'BlockStatement' + && node.body.body.length === 1 + && node.body.body[0].type === 'ReturnStatement' + && isNativeCoercionFunctionCall(node.body.body[0].argument, firstParameterName) + ) { + return node.body.body[0].argument; + } +} + +function getArrayCallbackProblem(node) { + if (!isArrayIdentityCallback(node)) { + return; + } + + return { + replacementFunction: 'Boolean', + fix: fixer => fixer.replaceText(node, 'Boolean'), + }; +} + +function getCoercionFunctionProblem(node) { + const callExpression = getCallExpression(node); + + if (!callExpression) { + return; + } + + const {name} = callExpression.callee; + + const problem = {replacementFunction: name}; + + if (node.type === 'FunctionDeclaration' || callExpression.arguments.length !== 1) { + return problem; + } + + /** @param {import('eslint').Rule.RuleFixer} fixer */ + problem.fix = fixer => { + let text = name; + + if ( + node.parent.type === 'Property' + && node.parent.method + && node.parent.value === node + ) { + text = `: ${text}`; + } else if (node.parent.type === 'MethodDefinition') { + text = ` = ${text};`; + } + + return fixer.replaceText(node, text); + }; + + return problem; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on(functionTypes, node => { + if ( + node.async + || node.generator + || node.params.length === 0 + || node.params[0].type !== 'Identifier' + || ( + ( + ( + node.parent.type === 'MethodDefinition' + && (node.parent.kind === 'constructor' || node.parent.kind === 'set') + ) + || (node.parent.type === 'Property' && node.parent.kind === 'set') + ) + && node.parent.value === node + ) + ) { + return; + } + + let problem = getArrayCallbackProblem(node) || getCoercionFunctionProblem(node); + + if (!problem) { + return; + } + + const {sourceCode} = context; + const {replacementFunction, fix} = problem; + + problem = { + node, + loc: getFunctionHeadLocation(node, sourceCode), + messageId: MESSAGE_ID, + data: { + functionNameWithKind: getFunctionNameWithKind(node, sourceCode), + replacementFunction, + }, + }; + + /* + We do not fix if there are: + - Comments: No proper place to put them. + - Extra parameters: Removing them may break types. + */ + if (!fix || node.params.length !== 1 || sourceCode.getCommentsInside(node).length > 0) { + return problem; + } + + problem.fix = fix; + + return problem; + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-negative-index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-negative-index.js new file mode 100644 index 0000000000000000000000000000000000000000..5d528d3e5764d72abd0e25aa3f4d201febaf6e0c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-negative-index.js @@ -0,0 +1,214 @@ +'use strict'; +const { + getNegativeIndexLengthNode, + removeLengthNode, +} = require('./shared/negative-index.js'); +const typedArray = require('./shared/typed-array.js'); +const {isLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-negative-index'; +const messages = { + [MESSAGE_ID]: 'Prefer negative index over length minus index for `{{method}}`.', +}; + +const methods = new Map([ + [ + 'slice', + { + argumentsIndexes: [0, 1], + supportObjects: new Set([ + 'Array', + 'String', + 'ArrayBuffer', + ...typedArray, + // `{Blob,File}#slice()` are not generally used + // 'Blob' + // 'File' + ]), + }, + ], + [ + 'subarray', + { + argumentsIndexes: [0, 1], + supportObjects: new Set(typedArray), + }, + ], + [ + 'splice', + { + argumentsIndexes: [0], + supportObjects: new Set([ + 'Array', + ]), + }, + ], + [ + 'toSpliced', + { + argumentsIndexes: [0], + supportObjects: new Set([ + 'Array', + ]), + }, + ], + [ + 'at', + { + argumentsIndexes: [0], + supportObjects: new Set([ + 'Array', + 'String', + ...typedArray, + ]), + }, + ], + [ + 'with', + { + argumentsIndexes: [0], + supportObjects: new Set([ + 'Array', + ...typedArray, + ]), + }, + ], +]); + +const getMemberName = node => { + const {type, property} = node; + + if ( + type === 'MemberExpression' + && property.type === 'Identifier' + ) { + return property.name; + } +}; + +function parse(node) { + const {callee, arguments: originalArguments} = node; + + let method = callee.property.name; + let target = callee.object; + let argumentsNodes = originalArguments; + + if (methods.has(method)) { + return { + method, + target, + argumentsNodes, + }; + } + + if (method !== 'call' && method !== 'apply') { + return; + } + + const isApply = method === 'apply'; + + method = getMemberName(callee.object); + + if (!methods.has(method)) { + return; + } + + const {supportObjects} = methods.get(method); + + const parentCallee = callee.object.object; + + if ( + // `[].{slice,splice,toSpliced,at,with}` + ( + parentCallee.type === 'ArrayExpression' + && parentCallee.elements.length === 0 + ) + // `''.slice` + || ( + method === 'slice' + && isLiteral(parentCallee, '') + ) + // {Array,String...}.prototype.slice + // Array.prototype.splice + || ( + getMemberName(parentCallee) === 'prototype' + && parentCallee.object.type === 'Identifier' + && supportObjects.has(parentCallee.object.name) + ) + ) { + [target] = originalArguments; + + if (isApply) { + const [, secondArgument] = originalArguments; + if (!secondArgument || secondArgument.type !== 'ArrayExpression') { + return; + } + + argumentsNodes = secondArgument.elements; + } else { + argumentsNodes = originalArguments.slice(1); + } + + return { + method, + target, + argumentsNodes, + }; + } +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(node) { + if (node.callee.type !== 'MemberExpression') { + return; + } + + const parsed = parse(node); + + if (!parsed) { + return; + } + + const { + method, + target, + argumentsNodes, + } = parsed; + + const {argumentsIndexes} = methods.get(method); + const removableNodes = argumentsIndexes + .map(index => getNegativeIndexLengthNode(argumentsNodes[index], target)) + .filter(Boolean); + + if (removableNodes.length === 0) { + return; + } + + return { + node, + messageId: MESSAGE_ID, + data: {method}, + * fix(fixer) { + const {sourceCode} = context; + for (const node of removableNodes) { + yield removeLengthNode(node, fixer, sourceCode); + } + }, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer negative index over `.length - index` when possible.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-node-protocol.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-node-protocol.js new file mode 100644 index 0000000000000000000000000000000000000000..398d5684afedd01c866d912cb5b55d8e73cd14fe --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-node-protocol.js @@ -0,0 +1,63 @@ +'use strict'; +const isBuiltinModule = require('is-builtin-module'); +const {replaceStringLiteral} = require('./fix/index.js'); +const isStaticRequire = require('./ast/is-static-require.js'); + +const MESSAGE_ID = 'prefer-node-protocol'; +const messages = { + [MESSAGE_ID]: 'Prefer `node:{{moduleName}}` over `{{moduleName}}`.', +}; + +const create = () => ({ + Literal(node) { + if (!( + ( + ( + node.parent.type === 'ImportDeclaration' + || node.parent.type === 'ExportNamedDeclaration' + || node.parent.type === 'ImportExpression' + ) + && node.parent.source === node + ) + || ( + isStaticRequire(node.parent) + && node.parent.arguments[0] === node + ) + )) { + return; + } + + const {value} = node; + + if ( + typeof value !== 'string' + || value.startsWith('node:') + || /^bun(?::|$)/.test(value) + || !isBuiltinModule(value) + ) { + return; + } + + return { + node, + messageId: MESSAGE_ID, + data: {moduleName: value}, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix: fixer => replaceStringLiteral(fixer, node, 'node:', 0, 0), + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer using the `node:` protocol when importing Node.js builtin modules.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-number-properties.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-number-properties.js new file mode 100644 index 0000000000000000000000000000000000000000..3c9e641ca29aeca7e253643b9cb306c56a1cc342 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-number-properties.js @@ -0,0 +1,140 @@ +'use strict'; +const {GlobalReferenceTracker} = require('./utils/global-reference-tracker.js'); +const {replaceReferenceIdentifier} = require('./fix/index.js'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); +const isLeftHandSide = require('./utils/is-left-hand-side.js'); + +const MESSAGE_ID_ERROR = 'error'; +const MESSAGE_ID_SUGGESTION = 'suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Prefer `Number.{{property}}` over `{{description}}`.', + [MESSAGE_ID_SUGGESTION]: 'Replace `{{description}}` with `Number.{{property}}`.', +}; + +const globalObjects = { + // Safe to replace with `Number` properties + parseInt: true, + parseFloat: true, + NaN: true, + Infinity: true, + + // Unsafe to replace with `Number` properties + isNaN: false, + isFinite: false, +}; + +const isNegative = node => { + const {parent} = node; + return parent.type === 'UnaryExpression' && parent.operator === '-' && parent.argument === node; +}; + +function checkProperty({node, path: [name]}, sourceCode) { + const {parent} = node; + + let property = name; + if (name === 'Infinity') { + property = isNegative(node) ? 'NEGATIVE_INFINITY' : 'POSITIVE_INFINITY'; + } + + const problem = { + node, + messageId: MESSAGE_ID_ERROR, + data: { + description: name, + property, + }, + }; + + if (property === 'NEGATIVE_INFINITY') { + problem.node = parent; + problem.data.description = '-Infinity'; + problem.fix = function * (fixer) { + yield fixer.replaceText(parent, 'Number.NEGATIVE_INFINITY'); + yield * fixSpaceAroundKeyword(fixer, parent, sourceCode); + }; + + return problem; + } + + const fix = fixer => replaceReferenceIdentifier(node, `Number.${property}`, fixer, sourceCode); + const isSafeToFix = globalObjects[name]; + + if (isSafeToFix) { + problem.fix = fix; + } else { + problem.suggest = [ + { + messageId: MESSAGE_ID_SUGGESTION, + fix, + }, + ]; + } + + return problem; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const { + checkInfinity, + checkNaN, + } = { + checkInfinity: false, + checkNaN: true, + ...context.options[0], + }; + const {sourceCode} = context; + + const objects = Object.keys(globalObjects).filter(name => { + if (!checkInfinity && name === 'Infinity') { + return false; + } + + if (!checkNaN && name === 'NaN') { + return false; + } + + return true; + }); + + const tracker = new GlobalReferenceTracker({ + objects, + handle: reference => checkProperty(reference, sourceCode), + filter: ({node}) => !isLeftHandSide(node), + }); + + return tracker.createListeners(context); +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + checkInfinity: { + type: 'boolean', + default: false, + }, + checkNaN: { + type: 'boolean', + default: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `Number` static properties over global ones.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-object-from-entries.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-object-from-entries.js new file mode 100644 index 0000000000000000000000000000000000000000..6c5c46aae2bf3a1c824291d7c3a9c4479607facc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-object-from-entries.js @@ -0,0 +1,253 @@ +'use strict'; +const {isCommaToken, isArrowToken, isClosingParenToken} = require('@eslint-community/eslint-utils'); +const {isMethodCall, isLiteral} = require('./ast/index.js'); +const {removeParentheses} = require('./fix/index.js'); +const { + getParentheses, + getParenthesizedText, + isNodeMatchesNameOrPath, + isSameIdentifier, +} = require('./utils/index.js'); +const {isCallExpression} = require('./ast/call-or-new-expression.js'); + +const MESSAGE_ID_REDUCE = 'reduce'; +const MESSAGE_ID_FUNCTION = 'function'; +const messages = { + [MESSAGE_ID_REDUCE]: 'Prefer `Object.fromEntries()` over `Array#reduce()`.', + [MESSAGE_ID_FUNCTION]: 'Prefer `Object.fromEntries()` over `{{functionName}}()`.', +}; + +const isEmptyObject = node => + // `{}` + (node.type === 'ObjectExpression' && node.properties.length === 0) + // `Object.create(null)` + || ( + isMethodCall(node, { + object: 'Object', + method: 'create', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + // eslint-disable-next-line unicorn/no-null + && isLiteral(node.arguments[0], null) + ); + +const isArrowFunctionCallback = node => + node.type === 'ArrowFunctionExpression' + && !node.async + && node.params.length > 0 + && node.params[0].type === 'Identifier'; + +const isProperty = node => + node.type === 'Property' + && node.kind === 'init' + && !node.method; + +// - `pairs.reduce(…, {})` +// - `pairs.reduce(…, Object.create(null))` +const isArrayReduceWithEmptyObject = node => + isMethodCall(node, { + method: 'reduce', + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + }) + && isEmptyObject(node.arguments[1]); + +const fixableArrayReduceCases = [ + { + test: callExpression => + isArrayReduceWithEmptyObject(callExpression) + // `() => Object.assign(object, {key})` + && isArrowFunctionCallback(callExpression.arguments[0]) + && isMethodCall(callExpression.arguments[0].body, { + object: 'Object', + method: 'assign', + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + }) + && callExpression.arguments[0].body.arguments[1].type === 'ObjectExpression' + && callExpression.arguments[0].body.arguments[1].properties.length === 1 + && isProperty(callExpression.arguments[0].body.arguments[1].properties[0]) + && isSameIdentifier(callExpression.arguments[0].params[0], callExpression.arguments[0].body.arguments[0]), + getProperty: callback => callback.body.arguments[1].properties[0], + }, + { + test: callExpression => + isArrayReduceWithEmptyObject(callExpression) + // `() => ({...object, key})` + && isArrowFunctionCallback(callExpression.arguments[0]) + && callExpression.arguments[0].body.type === 'ObjectExpression' + && callExpression.arguments[0].body.properties.length === 2 + && callExpression.arguments[0].body.properties[0].type === 'SpreadElement' + && isProperty(callExpression.arguments[0].body.properties[1]) + && isSameIdentifier(callExpression.arguments[0].params[0], callExpression.arguments[0].body.properties[0].argument), + getProperty: callback => callback.body.properties[1], + }, +]; + +// `_.flatten(array)` +const lodashFromPairsFunctions = [ + '_.fromPairs', + 'lodash.fromPairs', +]; + +function fixReduceAssignOrSpread({sourceCode, callExpression, property}) { + const removeInitObject = fixer => { + const initObject = callExpression.arguments[1]; + const parentheses = getParentheses(initObject, sourceCode); + const firstToken = parentheses[0] || initObject; + const lastToken = parentheses.at(-1) || initObject; + const startToken = sourceCode.getTokenBefore(firstToken); + const [start] = startToken.range; + const [, end] = lastToken.range; + return fixer.replaceTextRange([start, end], ''); + }; + + function * removeFirstParameter(fixer) { + const parameters = callExpression.arguments[0].params; + const [firstParameter] = parameters; + const tokenAfter = sourceCode.getTokenAfter(firstParameter); + + if (isCommaToken(tokenAfter)) { + yield fixer.remove(tokenAfter); + } + + let shouldAddParentheses = false; + if (parameters.length === 1) { + const arrowToken = sourceCode.getTokenAfter(firstParameter, isArrowToken); + const tokenBeforeArrowToken = sourceCode.getTokenBefore(arrowToken); + + if (!isClosingParenToken(tokenBeforeArrowToken)) { + shouldAddParentheses = true; + } + } + + yield fixer.replaceText(firstParameter, shouldAddParentheses ? '()' : ''); + } + + const getKeyValueText = () => { + const {key, value} = property; + let keyText = getParenthesizedText(key, sourceCode); + const valueText = getParenthesizedText(value, sourceCode); + + if (!property.computed && key.type === 'Identifier') { + keyText = `'${keyText}'`; + } + + return {keyText, valueText}; + }; + + function * replaceFunctionBody(fixer) { + const functionBody = callExpression.arguments[0].body; + const {keyText, valueText} = getKeyValueText(); + yield fixer.replaceText(functionBody, `[${keyText}, ${valueText}]`); + yield * removeParentheses(functionBody, fixer, sourceCode); + } + + return function * (fixer) { + // Wrap `array.reduce()` with `Object.fromEntries()` + yield fixer.insertTextBefore(callExpression, 'Object.fromEntries('); + yield fixer.insertTextAfter(callExpression, ')'); + + // Switch `.reduce` to `.map` + yield fixer.replaceText(callExpression.callee.property, 'map'); + + // Remove empty object + yield removeInitObject(fixer); + + // Remove the first parameter + yield * removeFirstParameter(fixer); + + // Replace function body + yield * replaceFunctionBody(fixer); + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +function create(context) { + const {sourceCode} = context; + const {functions: configFunctions} = { + functions: [], + ...context.options[0], + }; + const functions = [...configFunctions, ...lodashFromPairsFunctions]; + + return { + * CallExpression(callExpression) { + for (const {test, getProperty} of fixableArrayReduceCases) { + if (!test(callExpression)) { + continue; + } + + const [callbackFunction] = callExpression.arguments; + const [firstParameter] = callbackFunction.params; + const variables = sourceCode.getDeclaredVariables(callbackFunction); + const firstParameterVariable = variables.find(variable => variable.identifiers.length === 1 && variable.identifiers[0] === firstParameter); + if (!firstParameterVariable || firstParameterVariable.references.length !== 1) { + continue; + } + + yield { + node: callExpression.callee.property, + messageId: MESSAGE_ID_REDUCE, + fix: fixReduceAssignOrSpread({ + sourceCode, + callExpression, + property: getProperty(callbackFunction), + }), + }; + } + + if (!isCallExpression(callExpression, { + argumentsLength: 1, + optional: false, + })) { + return; + } + + const functionNode = callExpression.callee; + for (const nameOrPath of functions) { + const functionName = nameOrPath.trim(); + if (isNodeMatchesNameOrPath(functionNode, functionName)) { + yield { + node: functionNode, + messageId: MESSAGE_ID_FUNCTION, + data: {functionName}, + fix: fixer => fixer.replaceText(functionNode, 'Object.fromEntries'), + }; + } + } + }, + }; +} + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + functions: { + type: 'array', + uniqueItems: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer using `Object.fromEntries(…)` to transform a list of key-value pairs into an object.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-optional-catch-binding.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-optional-catch-binding.js new file mode 100644 index 0000000000000000000000000000000000000000..c0a94680a5afb6eb460cfe35db8ac79b45ee16a5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-optional-catch-binding.js @@ -0,0 +1,76 @@ +'use strict'; +const {isOpeningParenToken, isClosingParenToken} = require('@eslint-community/eslint-utils'); +const assertToken = require('./utils/assert-token.js'); + +const MESSAGE_ID_WITH_NAME = 'with-name'; +const MESSAGE_ID_WITHOUT_NAME = 'without-name'; +const messages = { + [MESSAGE_ID_WITH_NAME]: 'Remove unused catch binding `{{name}}`.', + [MESSAGE_ID_WITHOUT_NAME]: 'Remove unused catch binding.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CatchClause(catchClause) { + const node = catchClause.param; + if (!node) { + return; + } + + const {sourceCode} = context; + const variables = sourceCode.getDeclaredVariables(node.parent); + + if (variables.some(variable => variable.references.length > 0)) { + return; + } + + const {type, name, parent} = node; + + return { + node, + messageId: type === 'Identifier' ? MESSAGE_ID_WITH_NAME : MESSAGE_ID_WITHOUT_NAME, + data: {name}, + * fix(fixer) { + const tokenBefore = sourceCode.getTokenBefore(node); + assertToken(tokenBefore, { + test: isOpeningParenToken, + expected: '(', + ruleId: 'prefer-optional-catch-binding', + }); + + const tokenAfter = sourceCode.getTokenAfter(node); + assertToken(tokenAfter, { + test: isClosingParenToken, + expected: ')', + ruleId: 'prefer-optional-catch-binding', + }); + + yield fixer.remove(tokenBefore); + yield fixer.remove(node); + yield fixer.remove(tokenAfter); + + const [, endOfClosingParenthesis] = tokenAfter.range; + const [startOfCatchClauseBody] = parent.body.range; + const text = sourceCode.text.slice(endOfClosingParenthesis, startOfCatchClauseBody); + const leadingSpacesLength = text.length - text.trimStart().length; + if (leadingSpacesLength !== 0) { + yield fixer.removeRange([endOfClosingParenthesis, endOfClosingParenthesis + leadingSpacesLength]); + } + }, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer omitting the `catch` binding parameter.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-prototype-methods.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-prototype-methods.js new file mode 100644 index 0000000000000000000000000000000000000000..7aeccc5b741c715c26f1b2a7d1916e6a40276ccc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-prototype-methods.js @@ -0,0 +1,161 @@ +'use strict'; +const {getPropertyName, ReferenceTracker} = require('@eslint-community/eslint-utils'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); +const {isMemberExpression, isMethodCall} = require('./ast/index.js'); + +const messages = { + 'known-method': 'Prefer using `{{constructorName}}.prototype.{{methodName}}`.', + 'unknown-method': 'Prefer using method from `{{constructorName}}.prototype`.', +}; + +const OBJECT_PROTOTYPE_METHODS = [ + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toLocaleString', + 'toString', + 'valueOf', +]; + +function getConstructorAndMethodName(methodNode, {sourceCode, globalReferences}) { + if (!methodNode) { + return; + } + + const isGlobalReference = globalReferences.has(methodNode); + if (isGlobalReference) { + const path = globalReferences.get(methodNode); + return { + isGlobalReference: true, + constructorName: 'Object', + methodName: path.at(-1), + }; + } + + if (!isMemberExpression(methodNode, {optional: false})) { + return; + } + + const objectNode = methodNode.object; + + if (!( + (objectNode.type === 'ArrayExpression' && objectNode.elements.length === 0) + || (objectNode.type === 'ObjectExpression' && objectNode.properties.length === 0) + )) { + return; + } + + const constructorName = objectNode.type === 'ArrayExpression' ? 'Array' : 'Object'; + const methodName = getPropertyName(methodNode, sourceCode.getScope(methodNode)); + + return { + constructorName, + methodName, + }; +} + +function getProblem(callExpression, {sourceCode, globalReferences}) { + let methodNode; + + if ( + // `Reflect.apply([].foo, …)` + // `Reflect.apply({}.foo, …)` + isMethodCall(callExpression, { + object: 'Reflect', + method: 'apply', + minimumArguments: 1, + optionalCall: false, + optionalMember: false, + }) + ) { + methodNode = callExpression.arguments[0]; + } else if ( + // `[].foo.{apply,bind,call}(…)` + // `({}).foo.{apply,bind,call}(…)` + isMethodCall(callExpression, { + methods: ['apply', 'bind', 'call'], + optionalCall: false, + optionalMember: false, + }) + ) { + methodNode = callExpression.callee.object; + } + + const { + isGlobalReference, + constructorName, + methodName, + } = getConstructorAndMethodName(methodNode, {sourceCode, globalReferences}) ?? {}; + + if (!constructorName) { + return; + } + + return { + node: methodNode, + messageId: methodName ? 'known-method' : 'unknown-method', + data: {constructorName, methodName}, + * fix(fixer) { + if (isGlobalReference) { + yield fixer.replaceText(methodNode, `${constructorName}.prototype.${methodName}`); + return; + } + + if (isMemberExpression(methodNode)) { + const objectNode = methodNode.object; + + yield fixer.replaceText(objectNode, `${constructorName}.prototype`); + + if ( + objectNode.type === 'ArrayExpression' + || objectNode.type === 'ObjectExpression' + ) { + yield * fixSpaceAroundKeyword(fixer, callExpression, sourceCode); + } + } + }, + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +function create(context) { + const {sourceCode} = context; + const callExpressions = []; + + context.on('CallExpression', callExpression => { + callExpressions.push(callExpression); + }); + + context.on('Program:exit', function * (program) { + const globalReferences = new WeakMap(); + + const tracker = new ReferenceTracker(sourceCode.getScope(program)); + + for (const {node, path} of tracker.iterateGlobalReferences( + Object.fromEntries(OBJECT_PROTOTYPE_METHODS.map(method => [method, {[ReferenceTracker.READ]: true}])), + )) { + globalReferences.set(node, path); + } + + for (const callExpression of callExpressions) { + yield getProblem(callExpression, { + sourceCode, + globalReferences, + }); + } + }); +} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer borrowing methods from the prototype instead of the instance.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-query-selector.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-query-selector.js new file mode 100644 index 0000000000000000000000000000000000000000..5a6fe695c142f1be9b9bcd69d9170e61c2d6ca3d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-query-selector.js @@ -0,0 +1,169 @@ +'use strict'; +const {isNodeValueNotDomNode} = require('./utils/index.js'); +const {isMethodCall, isStringLiteral, isNullLiteral} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-query-selector'; +const messages = { + [MESSAGE_ID]: 'Prefer `.{{replacement}}()` over `.{{method}}()`.', +}; + +const disallowedIdentifierNames = new Map([ + ['getElementById', 'querySelector'], + ['getElementsByClassName', 'querySelectorAll'], + ['getElementsByTagName', 'querySelectorAll'], + ['getElementsByName', 'querySelectorAll'], +]); + +const getReplacementForId = value => `#${value}`; +const getReplacementForClass = value => value.match(/\S+/g).map(className => `.${className}`).join(''); +const getReplacementForName = (value, originQuote) => `[name=${wrapQuoted(value, originQuote)}]`; + +const getQuotedReplacement = (node, value) => { + const leftQuote = node.raw.charAt(0); + const rightQuote = node.raw.at(-1); + return `${leftQuote}${value}${rightQuote}`; +}; + +const wrapQuoted = (value, originalQuote) => { + switch (originalQuote) { + case '\'': { + return `"${value}"`; + } + + case '"': { + return `'${value}'`; + } + + case '`': { + return `'${value}'`; + } + + // No default + } +}; + +function * getLiteralFix(fixer, node, identifierName) { + let replacement = node.raw; + if (identifierName === 'getElementById') { + replacement = getQuotedReplacement(node, getReplacementForId(node.value)); + } + + if (identifierName === 'getElementsByClassName') { + replacement = getQuotedReplacement(node, getReplacementForClass(node.value)); + } + + if (identifierName === 'getElementsByName') { + const quoted = node.raw.charAt(0); + replacement = getQuotedReplacement(node, getReplacementForName(node.value, quoted)); + } + + yield fixer.replaceText(node, replacement); +} + +function * getTemplateLiteralFix(fixer, node, identifierName) { + yield fixer.insertTextAfter(node, '`'); + yield fixer.insertTextBefore(node, '`'); + + for (const templateElement of node.quasis) { + if (identifierName === 'getElementById') { + yield fixer.replaceText( + templateElement, + getReplacementForId(templateElement.value.cooked), + ); + } + + if (identifierName === 'getElementsByClassName') { + yield fixer.replaceText( + templateElement, + getReplacementForClass(templateElement.value.cooked), + ); + } + + if (identifierName === 'getElementsByName') { + const quoted = node.raw ? node.raw.charAt(0) : '"'; + yield fixer.replaceText( + templateElement, + getReplacementForName(templateElement.value.cooked, quoted), + ); + } + } +} + +const canBeFixed = node => + isNullLiteral(node) + || (isStringLiteral(node) && Boolean(node.value.trim())) + || ( + node.type === 'TemplateLiteral' + && node.expressions.length === 0 + && node.quasis.some(templateElement => templateElement.value.cooked.trim()) + ); + +const hasValue = node => { + if (node.type === 'Literal') { + return node.value; + } + + return true; +}; + +const fix = (node, identifierName, preferredSelector) => { + const nodeToBeFixed = node.arguments[0]; + if (identifierName === 'getElementsByTagName' || !hasValue(nodeToBeFixed)) { + return fixer => fixer.replaceText(node.callee.property, preferredSelector); + } + + const getArgumentFix = nodeToBeFixed.type === 'Literal' ? getLiteralFix : getTemplateLiteralFix; + return function * (fixer) { + yield * getArgumentFix(fixer, nodeToBeFixed, identifierName); + yield fixer.replaceText(node.callee.property, preferredSelector); + }; +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + CallExpression(node) { + if ( + !isMethodCall(node, { + methods: ['getElementById', 'getElementsByClassName', 'getElementsByTagName', 'getElementsByName'], + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + || isNodeValueNotDomNode(node.callee.object) + ) { + return; + } + + const method = node.callee.property.name; + const preferredSelector = disallowedIdentifierNames.get(method); + + const problem = { + node: node.callee.property, + messageId: MESSAGE_ID, + data: { + replacement: preferredSelector, + method, + }, + }; + + if (canBeFixed(node.arguments[0])) { + problem.fix = fix(node, method, preferredSelector); + } + + return problem; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `.querySelector()` over `.getElementById()`, `.querySelectorAll()` over `.getElementsByClassName()` and `.getElementsByTagName()` and `.getElementsByName()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-reflect-apply.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-reflect-apply.js new file mode 100644 index 0000000000000000000000000000000000000000..5aec914039a7c8605bf2afe8915173dc27158f90 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-reflect-apply.js @@ -0,0 +1,98 @@ +'use strict'; +const {getPropertyName} = require('@eslint-community/eslint-utils'); +const {isNullLiteral, isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-reflect-apply'; +const messages = { + [MESSAGE_ID]: 'Prefer `Reflect.apply()` over `Function#apply()`.', +}; + +const isApplySignature = (argument1, argument2) => ( + ( + isNullLiteral(argument1) + || argument1.type === 'ThisExpression' + ) + && ( + argument2.type === 'ArrayExpression' + || (argument2.type === 'Identifier' && argument2.name === 'arguments') + ) +); + +const getReflectApplyCall = (sourceCode, target, receiver, argumentsList) => ( + `Reflect.apply(${sourceCode.getText(target)}, ${sourceCode.getText(receiver)}, ${sourceCode.getText(argumentsList)})` +); + +const fixDirectApplyCall = (node, sourceCode) => { + if ( + getPropertyName(node.callee) === 'apply' + && node.arguments.length === 2 + && isApplySignature(node.arguments[0], node.arguments[1]) + ) { + return fixer => ( + fixer.replaceText( + node, + getReflectApplyCall(sourceCode, node.callee.object, node.arguments[0], node.arguments[1]), + ) + ); + } +}; + +const fixFunctionPrototypeCall = (node, sourceCode) => { + if ( + getPropertyName(node.callee) === 'call' + && getPropertyName(node.callee.object) === 'apply' + && getPropertyName(node.callee.object.object) === 'prototype' + && node.callee.object.object.object?.type === 'Identifier' + && node.callee.object.object.object.name === 'Function' + && node.arguments.length === 3 + && isApplySignature(node.arguments[1], node.arguments[2]) + ) { + return fixer => ( + fixer.replaceText( + node, + getReflectApplyCall(sourceCode, node.arguments[0], node.arguments[1], node.arguments[2]), + ) + ); + } +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(node) { + if ( + !isMethodCall(node, { + optionalCall: false, + optionalMember: false, + }) + || node.callee.object.type === 'Literal' + || node.callee.object.type === 'ArrayExpression' + || node.callee.object.type === 'ObjectExpression' + ) { + return; + } + + const {sourceCode} = context; + const fix = fixDirectApplyCall(node, sourceCode) || fixFunctionPrototypeCall(node, sourceCode); + if (fix) { + return { + node, + messageId: MESSAGE_ID, + fix, + }; + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `Reflect.apply()` over `Function#apply()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-regexp-test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-regexp-test.js new file mode 100644 index 0000000000000000000000000000000000000000..f0ccd0ddaa3119fe16bbc9e11f20ca4866982b15 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-regexp-test.js @@ -0,0 +1,157 @@ +'use strict'; +const {isParenthesized, getStaticValue} = require('@eslint-community/eslint-utils'); +const {checkVueTemplate} = require('./utils/rule.js'); +const {isRegexLiteral, isNewExpression, isMethodCall} = require('./ast/index.js'); +const { + isBooleanNode, + shouldAddParenthesesToMemberExpressionObject, +} = require('./utils/index.js'); + +const REGEXP_EXEC = 'regexp-exec'; +const STRING_MATCH = 'string-match'; +const SUGGESTION = 'suggestion'; +const messages = { + [REGEXP_EXEC]: 'Prefer `.test(…)` over `.exec(…)`.', + [STRING_MATCH]: 'Prefer `RegExp#test(…)` over `String#match(…)`.', + [SUGGESTION]: 'Switch to `RegExp#test(…)`.', +}; + +const cases = [ + { + type: REGEXP_EXEC, + test: node => isMethodCall(node, { + method: 'exec', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }), + getNodes: node => ({ + stringNode: node.arguments[0], + methodNode: node.callee.property, + regexpNode: node.callee.object, + }), + fix: (fixer, {methodNode}) => fixer.replaceText(methodNode, 'test'), + }, + { + type: STRING_MATCH, + test: node => isMethodCall(node, { + method: 'match', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }), + getNodes: node => ({ + stringNode: node.callee.object, + methodNode: node.callee.property, + regexpNode: node.arguments[0], + }), + * fix(fixer, {stringNode, methodNode, regexpNode}, sourceCode) { + yield fixer.replaceText(methodNode, 'test'); + + let stringText = sourceCode.getText(stringNode); + if ( + !isParenthesized(regexpNode, sourceCode) + // Only `SequenceExpression` need add parentheses + && stringNode.type === 'SequenceExpression' + ) { + stringText = `(${stringText})`; + } + + yield fixer.replaceText(regexpNode, stringText); + + let regexpText = sourceCode.getText(regexpNode); + if ( + !isParenthesized(stringNode, sourceCode) + && shouldAddParenthesesToMemberExpressionObject(regexpNode, sourceCode) + ) { + regexpText = `(${regexpText})`; + } + + // The nodes that pass `isBooleanNode` cannot have an ASI problem. + + yield fixer.replaceText(stringNode, regexpText); + }, + }, +]; + +const isRegExpNode = node => isRegexLiteral(node) || isNewExpression(node, {name: 'RegExp'}); + +const isRegExpWithoutGlobalFlag = (node, scope) => { + if (isRegexLiteral(node)) { + return !node.regex.flags.includes('g'); + } + + const staticResult = getStaticValue(node, scope); + + // Don't know if there is `g` flag + if (!staticResult) { + return false; + } + + const {value} = staticResult; + return ( + Object.prototype.toString.call(value) === '[object RegExp]' + && !value.global + ); +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + * CallExpression(node) { + if (!isBooleanNode(node)) { + return; + } + + for (const {type, test, getNodes, fix} of cases) { + if (!test(node)) { + continue; + } + + const nodes = getNodes(node); + const {methodNode, regexpNode} = nodes; + + if (regexpNode.type === 'Literal' && !regexpNode.regex) { + continue; + } + + const problem = { + node: type === REGEXP_EXEC ? methodNode : node, + messageId: type, + }; + + const {sourceCode} = context; + const fixFunction = fixer => fix(fixer, nodes, sourceCode); + + if ( + isRegExpNode(regexpNode) + || isRegExpWithoutGlobalFlag(regexpNode, sourceCode.getScope(regexpNode)) + ) { + problem.fix = fixFunction; + } else { + problem.suggest = [ + { + messageId: SUGGESTION, + fix: fixFunction, + }, + ]; + } + + yield problem; + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create: checkVueTemplate(create), + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-set-has.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-set-has.js new file mode 100644 index 0000000000000000000000000000000000000000..3015ccce808527fa5e785898945c9bfa10ce43ab --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-set-has.js @@ -0,0 +1,187 @@ +'use strict'; +const {findVariable} = require('@eslint-community/eslint-utils'); +const {getVariableIdentifiers} = require('./utils/index.js'); +const {isCallOrNewExpression, isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID_ERROR = 'error'; +const MESSAGE_ID_SUGGESTION = 'suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: '`{{name}}` should be a `Set`, and use `{{name}}.has()` to check existence or non-existence.', + [MESSAGE_ID_SUGGESTION]: 'Switch `{{name}}` to `Set`.', +}; + +const arrayMethodsReturnsArray = [ + 'concat', + 'copyWithin', + 'fill', + 'filter', + 'flat', + 'flatMap', + 'map', + 'reverse', + 'slice', + 'sort', + 'splice', + 'toReversed', + 'toSorted', + 'toSpliced', + 'with', +]; + +const isIncludesCall = node => { + const {type, optional, callee, arguments: includesArguments} = node.parent.parent ?? {}; + return ( + type === 'CallExpression' + && !optional + && callee.type === 'MemberExpression' + && !callee.computed + && !callee.optional + && callee.object === node + && callee.property.type === 'Identifier' + && callee.property.name === 'includes' + && includesArguments.length === 1 + && includesArguments[0].type !== 'SpreadElement' + ); +}; + +const multipleCallNodeTypes = new Set([ + 'ForOfStatement', + 'ForStatement', + 'ForInStatement', + 'WhileStatement', + 'DoWhileStatement', + 'FunctionDeclaration', + 'FunctionExpression', + 'ArrowFunctionExpression', +]); + +const isMultipleCall = (identifier, node) => { + const root = node.parent.parent.parent; + let {parent} = identifier.parent; // `.include()` callExpression + while ( + parent + && parent !== root + ) { + if (multipleCallNodeTypes.has(parent.type)) { + return true; + } + + parent = parent.parent; + } + + return false; +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + Identifier(node) { + const {parent} = node; + + if (!( + parent.type === 'VariableDeclarator' + && parent.id === node + && Boolean(parent.init) + && parent.parent.type === 'VariableDeclaration' + && parent.parent.declarations.includes(parent) + // Exclude `export const foo = [];` + && !( + parent.parent.parent.type === 'ExportNamedDeclaration' + && parent.parent.parent.declaration === parent.parent + ) + && ( + // `[]` + parent.init.type === 'ArrayExpression' + // `Array()` and `new Array()` + || isCallOrNewExpression(parent.init, { + name: 'Array', + optional: false, + }) + // `Array.from()` and `Array.of()` + || isMethodCall(parent.init, { + object: 'Array', + methods: ['from', 'of'], + optionalCall: false, + optionalMember: false, + }) + // Array methods that return an array + || isMethodCall(parent.init, { + methods: arrayMethodsReturnsArray, + optionalCall: false, + optionalMember: false, + }) + ) + )) { + return; + } + + const variable = findVariable(context.sourceCode.getScope(node), node); + + // This was reported https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1075#issuecomment-768073342 + // But can't reproduce, just ignore this case + /* c8 ignore next 3 */ + if (!variable) { + return; + } + + const identifiers = getVariableIdentifiers(variable).filter(identifier => identifier !== node); + + if ( + identifiers.length === 0 + || identifiers.some(identifier => !isIncludesCall(identifier)) + ) { + return; + } + + if ( + identifiers.length === 1 + && identifiers.every(identifier => !isMultipleCall(identifier, node)) + ) { + return; + } + + const problem = { + node, + messageId: MESSAGE_ID_ERROR, + data: { + name: node.name, + }, + }; + + const fix = function * (fixer) { + yield fixer.insertTextBefore(node.parent.init, 'new Set('); + yield fixer.insertTextAfter(node.parent.init, ')'); + + for (const identifier of identifiers) { + yield fixer.replaceText(identifier.parent.property, 'has'); + } + }; + + if (node.typeAnnotation) { + problem.suggest = [ + { + messageId: MESSAGE_ID_SUGGESTION, + fix, + }, + ]; + } else { + problem.fix = fix; + } + + return problem; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-set-size.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-set-size.js new file mode 100644 index 0000000000000000000000000000000000000000..4ad0892c1e349cde41f8822b74532eabcc0848f2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-set-size.js @@ -0,0 +1,104 @@ +'use strict'; +const {findVariable} = require('@eslint-community/eslint-utils'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); +const {isNewExpression, isMemberExpression} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-set-size'; +const messages = { + [MESSAGE_ID]: 'Prefer using `Set#size` instead of `Array#length`.', +}; + +const isNewSet = node => isNewExpression(node, {name: 'Set'}); + +function isSet(node, scope) { + if (isNewSet(node)) { + return true; + } + + if (node.type !== 'Identifier') { + return false; + } + + const variable = findVariable(scope, node); + + if (!variable || variable.defs.length !== 1) { + return false; + } + + const [definition] = variable.defs; + + if (definition.type !== 'Variable' || definition.kind !== 'const') { + return false; + } + + const declarator = definition.node; + return declarator.type === 'VariableDeclarator' + && declarator.id.type === 'Identifier' + && isNewSet(definition.node.init); +} + +// `[...set].length` -> `set.size` +function fix(sourceCode, lengthAccessNodes) { + const { + object: arrayExpression, + property, + } = lengthAccessNodes; + const set = arrayExpression.elements[0].argument; + + if (sourceCode.getCommentsInside(arrayExpression).length > sourceCode.getCommentsInside(set).length) { + return; + } + + /** @param {import('eslint').Rule.RuleFixer} fixer */ + return function * (fixer) { + yield fixer.replaceText(property, 'size'); + yield fixer.replaceText(arrayExpression, sourceCode.getText(set)); + yield * fixSpaceAroundKeyword(fixer, lengthAccessNodes, sourceCode); + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + return { + MemberExpression(node) { + if ( + !isMemberExpression(node, { + property: 'length', + optional: false, + }) + || node.object.type !== 'ArrayExpression' + || node.object.elements.length !== 1 + || node.object.elements[0]?.type !== 'SpreadElement' + ) { + return; + } + + const maybeSet = node.object.elements[0].argument; + if (!isSet(maybeSet, sourceCode.getScope(maybeSet))) { + return; + } + + return { + node: node.property, + messageId: MESSAGE_ID, + fix: fix(sourceCode, node), + }; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer using `Set#size` instead of `Array#length`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-spread.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-spread.js new file mode 100644 index 0000000000000000000000000000000000000000..afe661322d5efe845c5ddf274e6f25455e343c7e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-spread.js @@ -0,0 +1,517 @@ +'use strict'; +const {getStaticValue, isCommaToken, hasSideEffect} = require('@eslint-community/eslint-utils'); +const { + getParenthesizedRange, + getParenthesizedText, + needsSemicolon, + isNodeMatches, + isMethodNamed, + hasOptionalChainElement, +} = require('./utils/index.js'); +const {removeMethodCall} = require('./fix/index.js'); +const {isLiteral, isMethodCall} = require('./ast/index.js'); + +const ERROR_ARRAY_FROM = 'array-from'; +const ERROR_ARRAY_CONCAT = 'array-concat'; +const ERROR_ARRAY_SLICE = 'array-slice'; +const ERROR_ARRAY_TO_SPLICED = 'array-to-spliced'; +const ERROR_STRING_SPLIT = 'string-split'; +const SUGGESTION_CONCAT_ARGUMENT_IS_SPREADABLE = 'argument-is-spreadable'; +const SUGGESTION_CONCAT_ARGUMENT_IS_NOT_SPREADABLE = 'argument-is-not-spreadable'; +const SUGGESTION_CONCAT_TEST_ARGUMENT = 'test-argument'; +const SUGGESTION_CONCAT_SPREAD_ALL_ARGUMENTS = 'spread-all-arguments'; +const SUGGESTION_USE_SPREAD = 'use-spread'; +const messages = { + [ERROR_ARRAY_FROM]: 'Prefer the spread operator over `Array.from(…)`.', + [ERROR_ARRAY_CONCAT]: 'Prefer the spread operator over `Array#concat(…)`.', + [ERROR_ARRAY_SLICE]: 'Prefer the spread operator over `Array#slice()`.', + [ERROR_ARRAY_TO_SPLICED]: 'Prefer the spread operator over `Array#toSpliced()`.', + [ERROR_STRING_SPLIT]: 'Prefer the spread operator over `String#split(\'\')`.', + [SUGGESTION_CONCAT_ARGUMENT_IS_SPREADABLE]: 'First argument is an `array`.', + [SUGGESTION_CONCAT_ARGUMENT_IS_NOT_SPREADABLE]: 'First argument is not an `array`.', + [SUGGESTION_CONCAT_TEST_ARGUMENT]: 'Test first argument with `Array.isArray(…)`.', + [SUGGESTION_CONCAT_SPREAD_ALL_ARGUMENTS]: 'Spread all unknown arguments`.', + [SUGGESTION_USE_SPREAD]: 'Use `...` operator.', +}; + +const ignoredSliceCallee = [ + 'arrayBuffer', + 'blob', + 'buffer', + 'file', + 'this', +]; + +const isArrayLiteral = node => node.type === 'ArrayExpression'; +const isArrayLiteralHasTrailingComma = (node, sourceCode) => { + if (node.elements.length === 0) { + return false; + } + + return isCommaToken(sourceCode.getLastToken(node, 1)); +}; + +function fixConcat(node, sourceCode, fixableArguments) { + const array = node.callee.object; + const concatCallArguments = node.arguments; + const arrayParenthesizedRange = getParenthesizedRange(array, sourceCode); + const arrayIsArrayLiteral = isArrayLiteral(array); + const arrayHasTrailingComma = arrayIsArrayLiteral && isArrayLiteralHasTrailingComma(array, sourceCode); + + const getArrayLiteralElementsText = (node, keepTrailingComma) => { + if ( + !keepTrailingComma + && isArrayLiteralHasTrailingComma(node, sourceCode) + ) { + const start = node.range[0] + 1; + const end = sourceCode.getLastToken(node, 1).range[0]; + return sourceCode.text.slice(start, end); + } + + return sourceCode.getText(node, -1, -1); + }; + + const getFixedText = () => { + const nonEmptyArguments = fixableArguments + .filter(({node, isArrayLiteral}) => (!isArrayLiteral || node.elements.length > 0)); + const lastArgument = nonEmptyArguments.at(-1); + + let text = nonEmptyArguments + .map(({node, isArrayLiteral, isSpreadable, testArgument}) => { + if (isArrayLiteral) { + return getArrayLiteralElementsText(node, node === lastArgument.node); + } + + let text = getParenthesizedText(node, sourceCode); + + if (testArgument) { + return `...(Array.isArray(${text}) ? ${text} : [${text}])`; + } + + if (isSpreadable) { + text = `...${text}`; + } + + return text || ' '; + }) + .join(', '); + + if (!text) { + return ''; + } + + if (arrayIsArrayLiteral) { + if (array.elements.length > 0) { + text = ` ${text}`; + + if (!arrayHasTrailingComma) { + text = `,${text}`; + } + + if ( + arrayHasTrailingComma + && (!lastArgument.isArrayLiteral || !isArrayLiteralHasTrailingComma(lastArgument.node, sourceCode)) + ) { + text = `${text},`; + } + } + } else { + text = `, ${text}`; + } + + return text; + }; + + function removeArguments(fixer) { + const [firstArgument] = concatCallArguments; + const lastArgument = concatCallArguments[fixableArguments.length - 1]; + + const [start] = getParenthesizedRange(firstArgument, sourceCode); + let [, end] = sourceCode.getTokenAfter(lastArgument, isCommaToken).range; + + const textAfter = sourceCode.text.slice(end); + const [leadingSpaces] = textAfter.match(/^\s*/); + end += leadingSpaces.length; + + return fixer.replaceTextRange([start, end], ''); + } + + return function * (fixer) { + // Fixed code always starts with `[` + if ( + !arrayIsArrayLiteral + && needsSemicolon(sourceCode.getTokenBefore(node), sourceCode, '[') + ) { + yield fixer.insertTextBefore(node, ';'); + } + + if (concatCallArguments.length - fixableArguments.length === 0) { + yield * removeMethodCall(fixer, node, sourceCode); + } else { + yield removeArguments(fixer); + } + + const text = getFixedText(); + + if (arrayIsArrayLiteral) { + const closingBracketToken = sourceCode.getLastToken(array); + yield fixer.insertTextBefore(closingBracketToken, text); + } else { + // The array is already accessing `.concat`, there should not any case need add extra `()` + yield fixer.insertTextBeforeRange(arrayParenthesizedRange, '[...'); + yield fixer.insertTextAfterRange(arrayParenthesizedRange, text); + yield fixer.insertTextAfterRange(arrayParenthesizedRange, ']'); + } + }; +} + +const getConcatArgumentSpreadable = (node, scope) => { + if (node.type === 'SpreadElement') { + return; + } + + if (isArrayLiteral(node)) { + return {node, isArrayLiteral: true}; + } + + const result = getStaticValue(node, scope); + + if (!result) { + return; + } + + const isSpreadable = Array.isArray(result.value); + + return {node, isSpreadable}; +}; + +function getConcatFixableArguments(argumentsList, scope) { + const fixableArguments = []; + + for (const node of argumentsList) { + const result = getConcatArgumentSpreadable(node, scope); + + if (result) { + fixableArguments.push(result); + } else { + break; + } + } + + return fixableArguments; +} + +function fixArrayFrom(node, sourceCode) { + const [object] = node.arguments; + + function getObjectText() { + if (isArrayLiteral(object)) { + return sourceCode.getText(object); + } + + const [start, end] = getParenthesizedRange(object, sourceCode); + const text = sourceCode.text.slice(start, end); + + return `[...${text}]`; + } + + return function * (fixer) { + // Fixed code always starts with `[` + if (needsSemicolon(sourceCode.getTokenBefore(node), sourceCode, '[')) { + yield fixer.insertTextBefore(node, ';'); + } + + const objectText = getObjectText(); + + yield fixer.replaceText(node, objectText); + }; +} + +function methodCallToSpread(node, sourceCode) { + return function * (fixer) { + // Fixed code always starts with `[` + if (needsSemicolon(sourceCode.getTokenBefore(node), sourceCode, '[')) { + yield fixer.insertTextBefore(node, ';'); + } + + yield fixer.insertTextBefore(node, '[...'); + yield fixer.insertTextAfter(node, ']'); + + // The array is already accessing `.slice` or `.split`, there should not any case need add extra `()` + + yield * removeMethodCall(fixer, node, sourceCode); + }; +} + +function isClassName(node) { + if (node.type === 'MemberExpression') { + node = node.property; + } + + if (node.type !== 'Identifier') { + return false; + } + + const {name} = node; + + return /^[A-Z]./.test(name) && name.toUpperCase() !== name; +} + +function isNotArray(node, scope) { + if ( + node.type === 'TemplateLiteral' + || node.type === 'Literal' + || node.type === 'BinaryExpression' + || isClassName(node) + // `foo.join()` + || (isMethodNamed(node, 'join') && node.arguments.length <= 1) + ) { + return true; + } + + const staticValue = getStaticValue(node, scope); + if (staticValue && !Array.isArray(staticValue.value)) { + return true; + } + + return false; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + // `Array.from()` + context.on('CallExpression', node => { + if ( + isMethodCall(node, { + object: 'Array', + method: 'from', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + // Allow `Array.from({length})` + && node.arguments[0].type !== 'ObjectExpression' + ) { + return { + node, + messageId: ERROR_ARRAY_FROM, + fix: fixArrayFrom(node, sourceCode), + }; + } + }); + + // `array.concat()` + context.on('CallExpression', node => { + if (!isMethodCall(node, { + method: 'concat', + optionalCall: false, + optionalMember: false, + })) { + return; + } + + const {object} = node.callee; + const scope = sourceCode.getScope(object); + + if (isNotArray(object, scope)) { + return; + } + + const staticResult = getStaticValue(object, scope); + if (staticResult && !Array.isArray(staticResult.value)) { + return; + } + + const problem = { + node: node.callee.property, + messageId: ERROR_ARRAY_CONCAT, + }; + + const fixableArguments = getConcatFixableArguments(node.arguments, scope); + + if (fixableArguments.length > 0 || node.arguments.length === 0) { + problem.fix = fixConcat(node, sourceCode, fixableArguments); + return problem; + } + + const [firstArgument, ...restArguments] = node.arguments; + if (firstArgument.type === 'SpreadElement') { + return problem; + } + + const fixableArgumentsAfterFirstArgument = getConcatFixableArguments(restArguments, scope); + const suggestions = [ + { + messageId: SUGGESTION_CONCAT_ARGUMENT_IS_SPREADABLE, + isSpreadable: true, + }, + { + messageId: SUGGESTION_CONCAT_ARGUMENT_IS_NOT_SPREADABLE, + isSpreadable: false, + }, + ]; + + if (!hasSideEffect(firstArgument, sourceCode)) { + suggestions.push({ + messageId: SUGGESTION_CONCAT_TEST_ARGUMENT, + testArgument: true, + }); + } + + problem.suggest = suggestions.map(({messageId, isSpreadable, testArgument}) => ({ + messageId, + fix: fixConcat( + node, + sourceCode, + // When apply suggestion, we also merge fixable arguments after the first one + [ + { + node: firstArgument, + isSpreadable, + testArgument, + }, + ...fixableArgumentsAfterFirstArgument, + ], + ), + })); + + if ( + fixableArgumentsAfterFirstArgument.length < restArguments.length + && restArguments.every(({type}) => type !== 'SpreadElement') + ) { + problem.suggest.push({ + messageId: SUGGESTION_CONCAT_SPREAD_ALL_ARGUMENTS, + fix: fixConcat( + node, + sourceCode, + node.arguments.map(node => getConcatArgumentSpreadable(node, scope) || {node, isSpreadable: true}), + ), + }); + } + + return problem; + }); + + // `array.slice()` + context.on('CallExpression', node => { + if (!( + isMethodCall(node, { + method: 'slice', + minimumArguments: 0, + maximumArguments: 1, + optionalCall: false, + optionalMember: false, + }) + && !isArrayLiteral(node.callee.object) + && !hasOptionalChainElement(node.callee.object) + )) { + return; + } + + if (isNodeMatches(node.callee.object, ignoredSliceCallee)) { + return; + } + + const [firstArgument] = node.arguments; + if (firstArgument && !isLiteral(firstArgument, 0)) { + return; + } + + return { + node: node.callee.property, + messageId: ERROR_ARRAY_SLICE, + fix: methodCallToSpread(node, sourceCode), + }; + }); + + // `array.toSpliced()` + context.on('CallExpression', node => { + if (!( + isMethodCall(node, { + method: 'toSpliced', + argumentsLength: 0, + optionalCall: false, + optionalMember: false, + }) + && node.callee.object.type !== 'ArrayExpression' + )) { + return; + } + + return { + node: node.callee.property, + messageId: ERROR_ARRAY_TO_SPLICED, + fix: methodCallToSpread(node, sourceCode), + }; + }); + + // `string.split()` + context.on('CallExpression', node => { + if (!isMethodCall(node, { + method: 'split', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + })) { + return; + } + + const [separator] = node.arguments; + if (!isLiteral(separator, '')) { + return; + } + + const string = node.callee.object; + const staticValue = getStaticValue(string, sourceCode.getScope(string)); + let hasSameResult = false; + if (staticValue) { + const {value} = staticValue; + + if (typeof value !== 'string') { + return; + } + + // eslint-disable-next-line unicorn/prefer-spread + const resultBySplit = value.split(''); + const resultBySpread = [...value]; + + hasSameResult = resultBySplit.length === resultBySpread.length + && resultBySplit.every((character, index) => character === resultBySpread[index]); + } + + const problem = { + node: node.callee.property, + messageId: ERROR_STRING_SPLIT, + }; + + if (hasSameResult) { + problem.fix = methodCallToSpread(node, sourceCode); + } else { + problem.suggest = [ + { + messageId: SUGGESTION_USE_SPREAD, + fix: methodCallToSpread(node, sourceCode), + }, + ]; + } + + return problem; + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer the spread operator over `Array.from(…)`, `Array#concat(…)`, `Array#{slice,toSpliced}()` and `String#split(\'\')`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-raw.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-raw.js new file mode 100644 index 0000000000000000000000000000000000000000..134e0e5d0206b87bfdaa58c6ba85092112a4d3bc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-raw.js @@ -0,0 +1,94 @@ +'use strict'; +const {isStringLiteral, isDirective} = require('./ast/index.js'); +const {fixSpaceAroundKeyword} = require('./fix/index.js'); + +const MESSAGE_ID = 'prefer-string-raw'; +const messages = { + [MESSAGE_ID]: '`String.raw` should be used to avoid escaping `\\`.', +}; + +const BACKSLASH = '\\'; + +function unescapeBackslash(raw) { + const quote = raw.charAt(0); + + raw = raw.slice(1, -1); + + let result = ''; + for (let position = 0; position < raw.length; position++) { + const character = raw[position]; + if (character === BACKSLASH) { + const nextCharacter = raw[position + 1]; + if (nextCharacter === BACKSLASH || nextCharacter === quote) { + result += nextCharacter; + position++; + continue; + } + } + + result += character; + } + + return result; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + context.on('Literal', node => { + if ( + !isStringLiteral(node) + || isDirective(node.parent) + || ( + ( + node.parent.type === 'ImportDeclaration' + || node.parent.type === 'ExportNamedDeclaration' + || node.parent.type === 'ExportAllDeclaration' + ) && node.parent.source === node + ) + || (node.parent.type === 'Property' && !node.parent.computed && node.parent.key === node) + || (node.parent.type === 'JSXAttribute' && node.parent.value === node) + || (node.parent.type === 'TSEnumMember' && (node.parent.initializer === node || node.parent.id === node)) + ) { + return; + } + + const {raw} = node; + if ( + raw.at(-2) === BACKSLASH + || !raw.includes(BACKSLASH + BACKSLASH) + || raw.includes('`') + || raw.includes('${') + || node.loc.start.line !== node.loc.end.line + ) { + return; + } + + const unescaped = unescapeBackslash(raw); + if (unescaped !== node.value) { + return; + } + + return { + node, + messageId: MESSAGE_ID, + * fix(fixer) { + yield fixer.replaceText(node, `String.raw\`${unescaped}\``); + yield * fixSpaceAroundKeyword(fixer, node, context.sourceCode); + }, + }; + }); +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer using the `String.raw` tag to avoid escaping `\\`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-replace-all.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-replace-all.js new file mode 100644 index 0000000000000000000000000000000000000000..9c223a50b26e66d7760f142122dbb404b048891a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-replace-all.js @@ -0,0 +1,146 @@ +'use strict'; +const {getStaticValue} = require('@eslint-community/eslint-utils'); +const {parse: parseRegExp} = require('regjsparser'); +const escapeString = require('./utils/escape-string.js'); +const {isRegexLiteral, isNewExpression, isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID_USE_REPLACE_ALL = 'method'; +const MESSAGE_ID_USE_STRING = 'pattern'; +const messages = { + [MESSAGE_ID_USE_REPLACE_ALL]: 'Prefer `String#replaceAll()` over `String#replace()`.', + [MESSAGE_ID_USE_STRING]: 'This pattern can be replaced with {{replacement}}.', +}; + +function getPatternReplacement(node) { + if (!isRegexLiteral(node)) { + return; + } + + const {pattern, flags} = node.regex; + if (flags.replace('u', '').replace('v', '') !== 'g') { + return; + } + + let tree; + + try { + tree = parseRegExp(pattern, flags, { + unicodePropertyEscape: flags.includes('u'), + unicodeSet: flags.includes('v'), + namedGroups: true, + lookbehind: true, + }); + } catch { + return; + } + + const parts = tree.type === 'alternative' ? tree.body : [tree]; + if (parts.some(part => part.type !== 'value')) { + return; + } + + // TODO: Preserve escape + const string = String.fromCodePoint(...parts.map(part => part.codePoint)); + + return escapeString(string); +} + +const isRegExpWithGlobalFlag = (node, scope) => { + if (isRegexLiteral(node)) { + return node.regex.flags.includes('g'); + } + + if ( + isNewExpression(node, {name: 'RegExp'}) + && node.arguments[0]?.type !== 'SpreadElement' + && node.arguments[1]?.type === 'Literal' + && typeof node.arguments[1].value === 'string' + ) { + return node.arguments[1].value.includes('g'); + } + + const staticResult = getStaticValue(node, scope); + + // Don't know if there is `g` flag + if (!staticResult) { + return false; + } + + const {value} = staticResult; + return ( + Object.prototype.toString.call(value) === '[object RegExp]' + && value.global + ); +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(node) { + if (!isMethodCall(node, { + methods: ['replace', 'replaceAll'], + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + })) { + return; + } + + const { + arguments: [pattern], + callee: {property}, + } = node; + + if (!isRegExpWithGlobalFlag(pattern, context.sourceCode.getScope(pattern))) { + return; + } + + const methodName = property.name; + const patternReplacement = getPatternReplacement(pattern); + + if (methodName === 'replaceAll') { + if (!patternReplacement) { + return; + } + + return { + node: pattern, + messageId: MESSAGE_ID_USE_STRING, + data: { + // Show `This pattern can be replaced with a string literal.` for long strings + replacement: patternReplacement.length < 20 ? patternReplacement : 'a string literal', + }, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix: fixer => fixer.replaceText(pattern, patternReplacement), + }; + } + + return { + node: property, + messageId: MESSAGE_ID_USE_REPLACE_ALL, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + * fix(fixer) { + yield fixer.insertTextAfter(property, 'All'); + + if (!patternReplacement) { + return; + } + + yield fixer.replaceText(pattern, patternReplacement); + }, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `String#replaceAll()` over regex searches with the global flag.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-slice.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-slice.js new file mode 100644 index 0000000000000000000000000000000000000000..422c0c5c11e3cc37a9a6cef07fdd9f01cf30ad16 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-slice.js @@ -0,0 +1,180 @@ +'use strict'; +const {getStaticValue} = require('@eslint-community/eslint-utils'); +const {getParenthesizedText, getParenthesizedRange} = require('./utils/parentheses.js'); +const {replaceArgument} = require('./fix/index.js'); +const {isNumberLiteral, isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID_SUBSTR = 'substr'; +const MESSAGE_ID_SUBSTRING = 'substring'; +const messages = { + [MESSAGE_ID_SUBSTR]: 'Prefer `String#slice()` over `String#substr()`.', + [MESSAGE_ID_SUBSTRING]: 'Prefer `String#slice()` over `String#substring()`.', +}; + +const getNumericValue = node => { + if (isNumberLiteral(node)) { + return node.value; + } + + if (node.type === 'UnaryExpression' && node.operator === '-') { + return -getNumericValue(node.argument); + } +}; + +// This handles cases where the argument is very likely to be a number, such as `.substring('foo'.length)`. +const isLengthProperty = node => ( + node?.type === 'MemberExpression' + && node.computed === false + && node.property.type === 'Identifier' + && node.property.name === 'length' +); + +function * fixSubstrArguments({node, fixer, context, abort}) { + const argumentNodes = node.arguments; + const [firstArgument, secondArgument] = argumentNodes; + + if (!secondArgument) { + return; + } + + const {sourceCode} = context; + const scope = sourceCode.getScope(node); + const firstArgumentStaticResult = getStaticValue(firstArgument, scope); + const secondArgumentRange = getParenthesizedRange(secondArgument, sourceCode); + const replaceSecondArgument = text => replaceArgument(fixer, secondArgument, text, sourceCode); + + if (firstArgumentStaticResult?.value === 0) { + if (isNumberLiteral(secondArgument) || isLengthProperty(secondArgument)) { + return; + } + + if (typeof getNumericValue(secondArgument) === 'number') { + yield replaceSecondArgument(Math.max(0, getNumericValue(secondArgument))); + return; + } + + yield fixer.insertTextBeforeRange(secondArgumentRange, 'Math.max(0, '); + yield fixer.insertTextAfterRange(secondArgumentRange, ')'); + return; + } + + if (argumentNodes.every(node => isNumberLiteral(node))) { + yield replaceSecondArgument(firstArgument.value + secondArgument.value); + return; + } + + return abort(); +} + +function * fixSubstringArguments({node, fixer, context, abort}) { + const {sourceCode} = context; + const [firstArgument, secondArgument] = node.arguments; + + const firstNumber = firstArgument ? getNumericValue(firstArgument) : undefined; + const firstArgumentText = getParenthesizedText(firstArgument, sourceCode); + const replaceFirstArgument = text => replaceArgument(fixer, firstArgument, text, sourceCode); + + if (!secondArgument) { + if (isLengthProperty(firstArgument)) { + return; + } + + if (firstNumber !== undefined) { + yield replaceFirstArgument(Math.max(0, firstNumber)); + return; + } + + const firstArgumentRange = getParenthesizedRange(firstArgument, sourceCode); + yield fixer.insertTextBeforeRange(firstArgumentRange, 'Math.max(0, '); + yield fixer.insertTextAfterRange(firstArgumentRange, ')'); + return; + } + + const secondNumber = getNumericValue(secondArgument); + const secondArgumentText = getParenthesizedText(secondArgument, sourceCode); + const replaceSecondArgument = text => replaceArgument(fixer, secondArgument, text, sourceCode); + + if (firstNumber !== undefined && secondNumber !== undefined) { + const argumentsValue = [Math.max(0, firstNumber), Math.max(0, secondNumber)]; + if (firstNumber > secondNumber) { + argumentsValue.reverse(); + } + + if (argumentsValue[0] !== firstNumber) { + yield replaceFirstArgument(argumentsValue[0]); + } + + if (argumentsValue[1] !== secondNumber) { + yield replaceSecondArgument(argumentsValue[1]); + } + + return; + } + + if (firstNumber === 0 || secondNumber === 0) { + yield replaceFirstArgument(0); + yield replaceSecondArgument(`Math.max(0, ${firstNumber === 0 ? secondArgumentText : firstArgumentText})`); + return; + } + + // As values aren't Literal, we can not know whether secondArgument will become smaller than the first or not, causing an issue: + // .substring(0, 2) and .substring(2, 0) returns the same result + // .slice(0, 2) and .slice(2, 0) doesn't return the same result + // There's also an issue with us now knowing whether the value will be negative or not, due to: + // .substring() treats a negative number the same as it treats a zero. + // The latter issue could be solved by wrapping all dynamic numbers in Math.max(0, ), but the resulting code would not be nice + + return abort(); +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(node) { + if (!isMethodCall(node, {methods: ['substr', 'substring']})) { + return; + } + + const method = node.callee.property.name; + + return { + node, + messageId: method, + * fix(fixer, {abort}) { + yield fixer.replaceText(node.callee.property, 'slice'); + + if (node.arguments.length === 0) { + return; + } + + if ( + node.arguments.length > 2 + || node.arguments.some(node => node.type === 'SpreadElement') + ) { + return abort(); + } + + const fixArguments = method === 'substr' ? fixSubstrArguments : fixSubstringArguments; + yield * fixArguments({ + node, + fixer, + context, + abort, + }); + }, + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `String#slice()` over `String#substr()` and `String#substring()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-starts-ends-with.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-starts-ends-with.js new file mode 100644 index 0000000000000000000000000000000000000000..a05a34c0d69b1d3efcbe12a1e67f3d8037ad162e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-starts-ends-with.js @@ -0,0 +1,200 @@ +'use strict'; +const {isParenthesized, getStaticValue} = require('@eslint-community/eslint-utils'); +const escapeString = require('./utils/escape-string.js'); +const shouldAddParenthesesToMemberExpressionObject = require('./utils/should-add-parentheses-to-member-expression-object.js'); +const shouldAddParenthesesToLogicalExpressionChild = require('./utils/should-add-parentheses-to-logical-expression-child.js'); +const {getParenthesizedText, getParenthesizedRange} = require('./utils/parentheses.js'); +const {isMethodCall, isRegexLiteral} = require('./ast/index.js'); + +const MESSAGE_STARTS_WITH = 'prefer-starts-with'; +const MESSAGE_ENDS_WITH = 'prefer-ends-with'; +const FIX_TYPE_STRING_CASTING = 'useStringCasting'; +const FIX_TYPE_OPTIONAL_CHAINING = 'useOptionalChaining'; +const FIX_TYPE_NULLISH_COALESCING = 'useNullishCoalescing'; +const messages = { + [MESSAGE_STARTS_WITH]: 'Prefer `String#startsWith()` over a regex with `^`.', + [MESSAGE_ENDS_WITH]: 'Prefer `String#endsWith()` over a regex with `$`.', + [FIX_TYPE_STRING_CASTING]: 'Convert to string `String(…).{{method}}()`.', + [FIX_TYPE_OPTIONAL_CHAINING]: 'Use optional chaining `…?.{{method}}()`.', + [FIX_TYPE_NULLISH_COALESCING]: 'Use nullish coalescing `(… ?? \'\').{{method}}()`.', +}; + +const doesNotContain = (string, characters) => characters.every(character => !string.includes(character)); +const isSimpleString = string => doesNotContain( + string, + ['^', '$', '+', '[', '{', '(', '\\', '.', '?', '*', '|'], +); +const addParentheses = text => `(${text})`; + +const checkRegex = ({pattern, flags}) => { + if (flags.includes('i') || flags.includes('m')) { + return; + } + + if (pattern.startsWith('^')) { + const string = pattern.slice(1); + + if (isSimpleString(string)) { + return { + messageId: MESSAGE_STARTS_WITH, + string, + }; + } + } + + if (pattern.endsWith('$')) { + const string = pattern.slice(0, -1); + + if (isSimpleString(string)) { + return { + messageId: MESSAGE_ENDS_WITH, + string, + }; + } + } +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + return { + CallExpression(node) { + if ( + !isMethodCall(node, { + method: 'test', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + || !isRegexLiteral(node.callee.object) + ) { + return; + } + + const regexNode = node.callee.object; + const {regex} = regexNode; + const result = checkRegex(regex); + if (!result) { + return; + } + + const [target] = node.arguments; + const method = result.messageId === MESSAGE_STARTS_WITH ? 'startsWith' : 'endsWith'; + + let isString = target.type === 'TemplateLiteral' + || ( + target.type === 'CallExpression' + && target.callee.type === 'Identifier' + && target.callee.name === 'String' + ); + let isNonString = false; + if (!isString) { + const staticValue = getStaticValue(target, sourceCode.getScope(target)); + + if (staticValue) { + isString = typeof staticValue.value === 'string'; + isNonString = !isString; + } + } + + const problem = { + node, + messageId: result.messageId, + }; + + function * fix(fixer, fixType) { + let targetText = getParenthesizedText(target, sourceCode); + const isRegexParenthesized = isParenthesized(regexNode, sourceCode); + const isTargetParenthesized = isParenthesized(target, sourceCode); + + switch (fixType) { + // Goal: `(target ?? '').startsWith(pattern)` + case FIX_TYPE_NULLISH_COALESCING: { + if ( + !isTargetParenthesized + && shouldAddParenthesesToLogicalExpressionChild(target, {operator: '??', property: 'left'}) + ) { + targetText = addParentheses(targetText); + } + + targetText += ' ?? \'\''; + + // `LogicalExpression` need add parentheses to call `.startsWith()`, + // but if regex is parenthesized, we can reuse it + if (!isRegexParenthesized) { + targetText = addParentheses(targetText); + } + + break; + } + + // Goal: `String(target).startsWith(pattern)` + case FIX_TYPE_STRING_CASTING: { + // `target` was a call argument, don't need check parentheses + targetText = `String(${targetText})`; + // `CallExpression` don't need add parentheses to call `.startsWith()` + break; + } + + // Goal: `target.startsWith(pattern)` or `target?.startsWith(pattern)` + case FIX_TYPE_OPTIONAL_CHAINING: { + // Optional chaining: `target.startsWith` => `target?.startsWith` + yield fixer.replaceText(sourceCode.getTokenBefore(node.callee.property), '?.'); + } + + // Fallthrough + default: { + if ( + !isRegexParenthesized + && !isTargetParenthesized + && shouldAddParenthesesToMemberExpressionObject(target, sourceCode) + ) { + targetText = addParentheses(targetText); + } + } + } + + // The regex literal always starts with `/` or `(`, so we don't need check ASI + + // Replace regex with string + yield fixer.replaceText(regexNode, targetText); + + // `.test` => `.startsWith` / `.endsWith` + yield fixer.replaceText(node.callee.property, method); + + // Replace argument with result.string + yield fixer.replaceTextRange(getParenthesizedRange(target, sourceCode), escapeString(result.string)); + } + + if (isString || !isNonString) { + problem.fix = fix; + } + + if (!isString) { + problem.suggest = [ + FIX_TYPE_STRING_CASTING, + FIX_TYPE_OPTIONAL_CHAINING, + FIX_TYPE_NULLISH_COALESCING, + ].map(type => ({messageId: type, data: {method}, fix: fixer => fix(fixer, type)})); + } + + return problem; + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `String#startsWith()` & `String#endsWith()` over `RegExp#test()`.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-trim-start-end.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-trim-start-end.js new file mode 100644 index 0000000000000000000000000000000000000000..d24bb72dc4f87de656156acf27b7dda03aef8025 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-string-trim-start-end.js @@ -0,0 +1,45 @@ +'use strict'; +const {isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-string-trim-start-end'; +const messages = { + [MESSAGE_ID]: 'Prefer `String#{{replacement}}()` over `String#{{method}}()`.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + CallExpression(callExpression) { + if (!isMethodCall(callExpression, { + methods: ['trimLeft', 'trimRight'], + argumentsLength: 0, + optionalCall: false, + })) { + return; + } + + const node = callExpression.callee.property; + const method = node.name; + const replacement = method === 'trimLeft' ? 'trimStart' : 'trimEnd'; + + return { + node, + messageId: MESSAGE_ID, + data: {method, replacement}, + fix: fixer => fixer.replaceText(node, replacement), + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-structured-clone.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-structured-clone.js new file mode 100644 index 0000000000000000000000000000000000000000..70b7768c42b71cb8000138ca6880a560c21a98b2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-structured-clone.js @@ -0,0 +1,151 @@ +'use strict'; +const {isCallExpression, isMethodCall} = require('./ast/index.js'); +const {removeParentheses} = require('./fix/index.js'); +const { + isNodeMatchesNameOrPath, + getCallExpressionTokens, +} = require('./utils/index.js'); + +const MESSAGE_ID_ERROR = 'prefer-structured-clone/error'; +const MESSAGE_ID_SUGGESTION = 'prefer-structured-clone/suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Prefer `structuredClone(…)` over `{{description}}` to create a deep clone.', + [MESSAGE_ID_SUGGESTION]: 'Switch to `structuredClone(…)`.', +}; + +const lodashCloneDeepFunctions = [ + '_.cloneDeep', + 'lodash.cloneDeep', +]; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {functions: configFunctions} = { + functions: [], + ...context.options[0], + }; + const functions = [...configFunctions, ...lodashCloneDeepFunctions]; + + // `JSON.parse(JSON.stringify(…))` + context.on('CallExpression', callExpression => { + if (!( + // `JSON.stringify()` + isMethodCall(callExpression, { + object: 'JSON', + method: 'parse', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + // `JSON.parse()` + && isMethodCall(callExpression.arguments[0], { + object: 'JSON', + method: 'stringify', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + )) { + return; + } + + const jsonParse = callExpression; + const jsonStringify = callExpression.arguments[0]; + + return { + node: jsonParse, + loc: { + start: jsonParse.loc.start, + end: jsonStringify.callee.loc.end, + }, + messageId: MESSAGE_ID_ERROR, + data: { + description: 'JSON.parse(JSON.stringify(…))', + }, + suggest: [ + { + messageId: MESSAGE_ID_SUGGESTION, + * fix(fixer) { + yield fixer.replaceText(jsonParse.callee, 'structuredClone'); + + const {sourceCode} = context; + + yield fixer.remove(jsonStringify.callee); + yield * removeParentheses(jsonStringify.callee, fixer, sourceCode); + + const { + openingParenthesisToken, + closingParenthesisToken, + trailingCommaToken, + } = getCallExpressionTokens(sourceCode, jsonStringify); + + yield fixer.remove(openingParenthesisToken); + yield fixer.remove(closingParenthesisToken); + if (trailingCommaToken) { + yield fixer.remove(trailingCommaToken); + } + }, + }, + ], + }; + }); + + // `_.cloneDeep(foo)` + context.on('CallExpression', callExpression => { + if (!isCallExpression(callExpression, { + argumentsLength: 1, + optional: false, + })) { + return; + } + + const {callee} = callExpression; + const matchedFunction = functions.find(nameOrPath => isNodeMatchesNameOrPath(callee, nameOrPath)); + + if (!matchedFunction) { + return; + } + + return { + node: callee, + messageId: MESSAGE_ID_ERROR, + data: { + description: `${matchedFunction.trim()}(…)`, + }, + suggest: [ + { + messageId: MESSAGE_ID_SUGGESTION, + fix: fixer => fixer.replaceText(callee, 'structuredClone'), + }, + ], + }; + }); +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + functions: { + type: 'array', + uniqueItems: true, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer using `structuredClone` to create a deep clone.', + recommended: true, + }, + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-switch.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-switch.js new file mode 100644 index 0000000000000000000000000000000000000000..57662b98647b01df2c211b4c722798d044a17694 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-switch.js @@ -0,0 +1,345 @@ +'use strict'; +const {hasSideEffect} = require('@eslint-community/eslint-utils'); +const isSameReference = require('./utils/is-same-reference.js'); +const getIndentString = require('./utils/get-indent-string.js'); + +const MESSAGE_ID = 'prefer-switch'; +const messages = { + [MESSAGE_ID]: 'Use `switch` instead of multiple `else-if`.', +}; + +const isSame = (nodeA, nodeB) => nodeA === nodeB || isSameReference(nodeA, nodeB); + +function getEqualityComparisons(node) { + const nodes = [node]; + const compareExpressions = []; + while (nodes.length > 0) { + node = nodes.pop(); + + if (node.type === 'LogicalExpression' && node.operator === '||') { + nodes.push(node.right, node.left); + continue; + } + + if (node.type !== 'BinaryExpression' || node.operator !== '===') { + return []; + } + + compareExpressions.push(node); + } + + return compareExpressions; +} + +function getCommonReferences(expressions, candidates) { + for (const {left, right} of expressions) { + candidates = candidates.filter(node => isSame(node, left) || isSame(node, right)); + + if (candidates.length === 0) { + break; + } + } + + return candidates; +} + +function getStatements(statement) { + let discriminantCandidates; + const ifStatements = []; + for (; statement && statement.type === 'IfStatement'; statement = statement.alternate) { + const {test} = statement; + const compareExpressions = getEqualityComparisons(test); + + if (compareExpressions.length === 0) { + break; + } + + if (!discriminantCandidates) { + const [{left, right}] = compareExpressions; + discriminantCandidates = [left, right]; + } + + const candidates = getCommonReferences( + compareExpressions, + discriminantCandidates, + ); + + if (candidates.length === 0) { + break; + } + + discriminantCandidates = candidates; + + ifStatements.push({ + statement, + compareExpressions, + }); + } + + return { + ifStatements, + discriminant: discriminantCandidates && discriminantCandidates[0], + }; +} + +const breakAbleNodeTypes = new Set([ + 'WhileStatement', + 'DoWhileStatement', + 'ForStatement', + 'ForOfStatement', + 'ForInStatement', + 'SwitchStatement', +]); +const getBreakTarget = node => { + for (;node.parent; node = node.parent) { + if (breakAbleNodeTypes.has(node.type)) { + return node; + } + } +}; + +const isNodeInsideNode = (inner, outer) => + inner.range[0] >= outer.range[0] && inner.range[1] <= outer.range[1]; +function hasBreakInside(breakStatements, node) { + for (const breakStatement of breakStatements) { + if (!isNodeInsideNode(breakStatement, node)) { + continue; + } + + const breakTarget = getBreakTarget(breakStatement); + + if (!breakTarget) { + return true; + } + + if (isNodeInsideNode(node, breakTarget)) { + return true; + } + } + + return false; +} + +function * insertBracesIfNotBlockStatement(node, fixer, indent) { + if (!node || node.type === 'BlockStatement') { + return; + } + + yield fixer.insertTextBefore(node, `{\n${indent}`); + yield fixer.insertTextAfter(node, `\n${indent}}`); +} + +function * insertBreakStatement(node, fixer, sourceCode, indent) { + if (node.type === 'BlockStatement') { + const lastToken = sourceCode.getLastToken(node); + yield fixer.insertTextBefore(lastToken, `\n${indent}break;\n${indent}`); + } else { + yield fixer.insertTextAfter(node, `\n${indent}break;`); + } +} + +function getBlockStatementLastNode(blockStatement) { + const {body} = blockStatement; + for (let index = body.length - 1; index >= 0; index--) { + const node = body[index]; + if (node.type === 'FunctionDeclaration' || node.type === 'EmptyStatement') { + continue; + } + + if (node.type === 'BlockStatement') { + const last = getBlockStatementLastNode(node); + if (last) { + return last; + } + + continue; + } + + return node; + } +} + +function shouldInsertBreakStatement(node) { + switch (node.type) { + case 'ReturnStatement': + case 'ThrowStatement': { + return false; + } + + case 'IfStatement': { + return !node.alternate + || shouldInsertBreakStatement(node.consequent) + || shouldInsertBreakStatement(node.alternate); + } + + case 'BlockStatement': { + const lastNode = getBlockStatementLastNode(node); + return !lastNode || shouldInsertBreakStatement(lastNode); + } + + default: { + return true; + } + } +} + +function fix({discriminant, ifStatements}, sourceCode, options) { + const discriminantText = sourceCode.getText(discriminant); + + return function * (fixer) { + const firstStatement = ifStatements[0].statement; + const indent = getIndentString(firstStatement, sourceCode); + yield fixer.insertTextBefore(firstStatement, `switch (${discriminantText}) {`); + + const lastStatement = ifStatements.at(-1).statement; + if (lastStatement.alternate) { + const {alternate} = lastStatement; + yield fixer.insertTextBefore(alternate, `\n${indent}default: `); + /* + Technically, we should insert braces for the following case, + but who writes like this? And using `let`/`const` is invalid. + + ```js + if (foo === 1) {} + else if (foo === 2) {} + else if (foo === 3) {} + else var a = 1; + ``` + */ + } else { + switch (options.emptyDefaultCase) { + case 'no-default-comment': { + yield fixer.insertTextAfter(firstStatement, `\n${indent}// No default`); + break; + } + + case 'do-nothing-comment': { + yield fixer.insertTextAfter(firstStatement, `\n${indent}default:\n${indent}// Do nothing`); + break; + } + // No default + } + } + + yield fixer.insertTextAfter(firstStatement, `\n${indent}}`); + + for (const {statement, compareExpressions} of ifStatements) { + const {consequent, alternate, range} = statement; + const headRange = [range[0], consequent.range[0]]; + + if (alternate) { + const [, start] = consequent.range; + const [end] = alternate.range; + yield fixer.replaceTextRange([start, end], ''); + } + + yield fixer.replaceTextRange(headRange, ''); + for (const {left, right} of compareExpressions) { + const node = isSame(left, discriminant) ? right : left; + const text = sourceCode.getText(node); + yield fixer.insertTextBefore(consequent, `\n${indent}case ${text}: `); + } + + if (shouldInsertBreakStatement(consequent)) { + yield * insertBreakStatement(consequent, fixer, sourceCode, indent); + yield * insertBracesIfNotBlockStatement(consequent, fixer, indent); + } + } + }; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const options = { + minimumCases: 3, + emptyDefaultCase: 'no-default-comment', + insertBreakInDefaultCase: false, + ...context.options[0], + }; + const {sourceCode} = context; + const ifStatements = new Set(); + const breakStatements = []; + const checked = new Set(); + + return { + IfStatement(node) { + ifStatements.add(node); + }, + BreakStatement(node) { + if (!node.label) { + breakStatements.push(node); + } + }, + * 'Program:exit'() { + for (const node of ifStatements) { + if (checked.has(node)) { + continue; + } + + const {discriminant, ifStatements} = getStatements(node); + + if (!discriminant || ifStatements.length < options.minimumCases) { + continue; + } + + for (const {statement} of ifStatements) { + checked.add(statement); + } + + const problem = { + loc: { + start: node.loc.start, + end: node.consequent.loc.start, + }, + messageId: MESSAGE_ID, + }; + + if ( + !hasSideEffect(discriminant, sourceCode) + && !ifStatements.some(({statement}) => hasBreakInside(breakStatements, statement)) + ) { + problem.fix = fix({discriminant, ifStatements}, sourceCode, options); + } + + yield problem; + } + }, + }; +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + minimumCases: { + type: 'integer', + minimum: 2, + default: 3, + }, + emptyDefaultCase: { + enum: [ + 'no-default-comment', + 'do-nothing-comment', + 'no-default-case', + ], + default: 'no-default-comment', + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer `switch` over multiple `else-if`.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-ternary.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-ternary.js new file mode 100644 index 0000000000000000000000000000000000000000..934af8a5e5d2c72deba6ba3d7f506f6f8f71f6fc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-ternary.js @@ -0,0 +1,283 @@ +'use strict'; +const {isParenthesized} = require('@eslint-community/eslint-utils'); +const avoidCapture = require('./utils/avoid-capture.js'); +const needsSemicolon = require('./utils/needs-semicolon.js'); +const isSameReference = require('./utils/is-same-reference.js'); +const getIndentString = require('./utils/get-indent-string.js'); +const {getParenthesizedText} = require('./utils/parentheses.js'); +const shouldAddParenthesesToConditionalExpressionChild = require('./utils/should-add-parentheses-to-conditional-expression-child.js'); +const {extendFixRange} = require('./fix/index.js'); +const getScopes = require('./utils/get-scopes.js'); + +const messageId = 'prefer-ternary'; + +const isTernary = node => node?.type === 'ConditionalExpression'; + +function getNodeBody(node) { + /* c8 ignore next 3 */ + if (!node) { + return; + } + + if (node.type === 'ExpressionStatement') { + return getNodeBody(node.expression); + } + + if (node.type === 'BlockStatement') { + const body = node.body.filter(({type}) => type !== 'EmptyStatement'); + if (body.length === 1) { + return getNodeBody(body[0]); + } + } + + return node; +} + +const isSingleLineNode = node => node.loc.start.line === node.loc.end.line; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const onlySingleLine = context.options[0] === 'only-single-line'; + const {sourceCode} = context; + const scopeToNamesGeneratedByFixer = new WeakMap(); + const isSafeName = (name, scopes) => scopes.every(scope => { + const generatedNames = scopeToNamesGeneratedByFixer.get(scope); + return !generatedNames || !generatedNames.has(name); + }); + + const getText = node => { + let text = getParenthesizedText(node, sourceCode); + if ( + !isParenthesized(node, sourceCode) + && shouldAddParenthesesToConditionalExpressionChild(node) + ) { + text = `(${text})`; + } + + return text; + }; + + function merge(options, mergeOptions) { + const { + before = '', + after = ';', + consequent, + alternate, + node, + } = options; + + const { + checkThrowStatement, + returnFalseIfNotMergeable, + } = { + checkThrowStatement: false, + returnFalseIfNotMergeable: false, + ...mergeOptions, + }; + + if (!consequent || !alternate || consequent.type !== alternate.type) { + return returnFalseIfNotMergeable ? false : options; + } + + const {type, argument, delegate, left, right, operator} = consequent; + + if ( + type === 'ReturnStatement' + && !isTernary(argument) + && !isTernary(alternate.argument) + ) { + return merge({ + before: `${before}return `, + after, + consequent: argument === null ? 'undefined' : argument, + alternate: alternate.argument === null ? 'undefined' : alternate.argument, + node, + }); + } + + if ( + type === 'YieldExpression' + && delegate === alternate.delegate + && !isTernary(argument) + && !isTernary(alternate.argument) + ) { + return merge({ + before: `${before}yield${delegate ? '*' : ''} (`, + after: `)${after}`, + consequent: argument === null ? 'undefined' : argument, + alternate: alternate.argument === null ? 'undefined' : alternate.argument, + node, + }); + } + + if ( + type === 'AwaitExpression' + && !isTernary(argument) + && !isTernary(alternate.argument) + ) { + return merge({ + before: `${before}await (`, + after: `)${after}`, + consequent: argument, + alternate: alternate.argument, + node, + }); + } + + if ( + checkThrowStatement + && type === 'ThrowStatement' + && !isTernary(argument) + && !isTernary(alternate.argument) + ) { + // `ThrowStatement` don't check nested + + // If `IfStatement` is not a `BlockStatement`, need add `{}` + const {parent} = node; + const needBraces = parent && parent.type !== 'BlockStatement'; + return { + type, + before: `${before}${needBraces ? '{\n{{INDENT_STRING}}' : ''}const {{ERROR_NAME}} = `, + after: `;\n{{INDENT_STRING}}throw {{ERROR_NAME}};${needBraces ? '\n}' : ''}`, + consequent: argument, + alternate: alternate.argument, + }; + } + + if ( + type === 'AssignmentExpression' + && operator === alternate.operator + && !isTernary(left) + && !isTernary(alternate.left) + && !isTernary(right) + && !isTernary(alternate.right) + && isSameReference(left, alternate.left) + ) { + return merge({ + before: `${before}${sourceCode.getText(left)} ${operator} `, + after, + consequent: right, + alternate: alternate.right, + node, + }); + } + + return returnFalseIfNotMergeable ? false : options; + } + + return { + IfStatement(node) { + if ( + (node.parent.type === 'IfStatement' && node.parent.alternate === node) + || node.test.type === 'ConditionalExpression' + || !node.consequent + || !node.alternate + ) { + return; + } + + const consequent = getNodeBody(node.consequent); + const alternate = getNodeBody(node.alternate); + + if ( + onlySingleLine + && [consequent, alternate, node.test].some(node => !isSingleLineNode(node)) + ) { + return; + } + + const result = merge({node, consequent, alternate}, { + checkThrowStatement: true, + returnFalseIfNotMergeable: true, + }); + + if (!result) { + return; + } + + const problem = {node, messageId}; + + // Don't fix if there are comments + if (sourceCode.getCommentsInside(node).length > 0) { + return problem; + } + + const scope = sourceCode.getScope(node); + problem.fix = function * (fixer) { + const testText = getText(node.test); + const consequentText = typeof result.consequent === 'string' + ? result.consequent + : getText(result.consequent); + const alternateText = typeof result.alternate === 'string' + ? result.alternate + : getText(result.alternate); + + let {type, before, after} = result; + + let generateNewVariables = false; + if (type === 'ThrowStatement') { + const scopes = getScopes(scope); + const errorName = avoidCapture('error', scopes, isSafeName); + + for (const scope of scopes) { + if (!scopeToNamesGeneratedByFixer.has(scope)) { + scopeToNamesGeneratedByFixer.set(scope, new Set()); + } + + const generatedNames = scopeToNamesGeneratedByFixer.get(scope); + generatedNames.add(errorName); + } + + const indentString = getIndentString(node, sourceCode); + + after = after + .replace('{{INDENT_STRING}}', indentString) + .replace('{{ERROR_NAME}}', errorName); + before = before + .replace('{{INDENT_STRING}}', indentString) + .replace('{{ERROR_NAME}}', errorName); + generateNewVariables = true; + } + + let fixed = `${before}${testText} ? ${consequentText} : ${alternateText}${after}`; + const tokenBefore = sourceCode.getTokenBefore(node); + const shouldAddSemicolonBefore = needsSemicolon(tokenBefore, sourceCode, fixed); + if (shouldAddSemicolonBefore) { + fixed = `;${fixed}`; + } + + yield fixer.replaceText(node, fixed); + + if (generateNewVariables) { + yield * extendFixRange(fixer, sourceCode.ast.range); + } + }; + + return problem; + }, + }; +}; + +const schema = [ + { + enum: ['always', 'only-single-line'], + default: 'always', + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer ternary expressions over simple `if-else` statements.', + recommended: true, + }, + fixable: 'code', + schema, + messages: { + [messageId]: 'This `if` statement can be replaced by a ternary expression.', + }, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-top-level-await.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-top-level-await.js new file mode 100644 index 0000000000000000000000000000000000000000..3505f1c6fa5d408d371d5687c23d474f178a9428 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-top-level-await.js @@ -0,0 +1,153 @@ +'use strict'; +const {findVariable, getFunctionHeadLocation} = require('@eslint-community/eslint-utils'); +const {isFunction, isMemberExpression, isMethodCall} = require('./ast/index.js'); + +const ERROR_PROMISE = 'promise'; +const ERROR_IIFE = 'iife'; +const ERROR_IDENTIFIER = 'identifier'; +const SUGGESTION_ADD_AWAIT = 'add-await'; +const messages = { + [ERROR_PROMISE]: 'Prefer top-level await over using a promise chain.', + [ERROR_IIFE]: 'Prefer top-level await over an async IIFE.', + [ERROR_IDENTIFIER]: 'Prefer top-level await over an async function `{{name}}` call.', + [SUGGESTION_ADD_AWAIT]: 'Insert `await`.', +}; + +const promisePrototypeMethods = ['then', 'catch', 'finally']; +const isTopLevelCallExpression = node => { + if (node.type !== 'CallExpression') { + return false; + } + + for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) { + if ( + isFunction(ancestor) + || ancestor.type === 'ClassDeclaration' + || ancestor.type === 'ClassExpression' + ) { + return false; + } + } + + return true; +}; + +const isPromiseMethodCalleeObject = node => + node.parent.type === 'MemberExpression' + && node.parent.object === node + && !node.parent.computed + && node.parent.property.type === 'Identifier' + && promisePrototypeMethods.includes(node.parent.property.name) + && node.parent.parent.type === 'CallExpression' + && node.parent.parent.callee === node.parent; +const isAwaitExpressionArgument = node => { + if (node.parent.type === 'ChainExpression') { + node = node.parent; + } + + return node.parent.type === 'AwaitExpression' && node.parent.argument === node; +}; + +// `Promise.{all,allSettled,any,race}([foo()])` +const isInPromiseMethods = node => + node.parent.type === 'ArrayExpression' + && node.parent.elements.includes(node) + && isMethodCall(node.parent.parent, { + object: 'Promise', + methods: ['all', 'allSettled', 'any', 'race'], + argumentsLength: 1, + }) + && node.parent.parent.arguments[0] === node.parent; + +/** @param {import('eslint').Rule.RuleContext} context */ +function create(context) { + if (context.filename.toLowerCase().endsWith('.cjs')) { + return; + } + + return { + CallExpression(node) { + if ( + !isTopLevelCallExpression(node) + || isPromiseMethodCalleeObject(node) + || isAwaitExpressionArgument(node) + || isInPromiseMethods(node) + ) { + return; + } + + // Promises + if (isMemberExpression(node.callee, { + properties: promisePrototypeMethods, + computed: false, + })) { + return { + node: node.callee.property, + messageId: ERROR_PROMISE, + }; + } + + const {sourceCode} = context; + + // IIFE + if ( + (node.callee.type === 'FunctionExpression' || node.callee.type === 'ArrowFunctionExpression') + && node.callee.async + && !node.callee.generator + ) { + return { + node, + loc: getFunctionHeadLocation(node.callee, sourceCode), + messageId: ERROR_IIFE, + }; + } + + // Identifier + if (node.callee.type !== 'Identifier') { + return; + } + + const variable = findVariable(sourceCode.getScope(node), node.callee); + if (!variable || variable.defs.length !== 1) { + return; + } + + const [definition] = variable.defs; + const value = definition.type === 'Variable' && definition.kind === 'const' + ? definition.node.init + : definition.node; + if ( + !value + || !(isFunction(value) && !value.generator && value.async) + ) { + return; + } + + return { + node, + messageId: ERROR_IDENTIFIER, + data: {name: node.callee.name}, + suggest: [ + { + messageId: SUGGESTION_ADD_AWAIT, + fix: fixer => fixer.insertTextBefore(node, 'await '), + }, + ], + }; + }, + }; +} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prefer top-level await over top-level promises and async function calls.', + recommended: true, + }, + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-type-error.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-type-error.js new file mode 100644 index 0000000000000000000000000000000000000000..b08ae4dcef4897bc73511397ba8e663fcd246788 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prefer-type-error.js @@ -0,0 +1,152 @@ +'use strict'; +const {isNewExpression} = require('./ast/index.js'); + +const MESSAGE_ID = 'prefer-type-error'; +const messages = { + [MESSAGE_ID]: '`new Error()` is too unspecific for a type check. Use `new TypeError()` instead.', +}; + +const typeCheckIdentifiers = new Set([ + 'isArguments', + 'isArray', + 'isArrayBuffer', + 'isArrayLike', + 'isArrayLikeObject', + 'isBigInt', + 'isBoolean', + 'isBuffer', + 'isDate', + 'isElement', + 'isError', + 'isFinite', + 'isFunction', + 'isInteger', + 'isLength', + 'isMap', + 'isNaN', + 'isNative', + 'isNil', + 'isNull', + 'isNumber', + 'isObject', + 'isObjectLike', + 'isPlainObject', + 'isPrototypeOf', + 'isRegExp', + 'isSafeInteger', + 'isSet', + 'isString', + 'isSymbol', + 'isTypedArray', + 'isUndefined', + 'isView', + 'isWeakMap', + 'isWeakSet', + 'isWindow', + 'isXMLDoc', +]); + +const typeCheckGlobalIdentifiers = new Set([ + 'isNaN', + 'isFinite', +]); + +const isTypecheckingIdentifier = (node, callExpression, isMemberExpression) => + callExpression !== undefined + && callExpression.arguments.length > 0 + && node.type === 'Identifier' + && ( + (isMemberExpression === true && typeCheckIdentifiers.has(node.name)) + || (isMemberExpression === false && typeCheckGlobalIdentifiers.has(node.name)) + ); + +const isLone = node => node.parent && node.parent.body && node.parent.body.length === 1; + +const isTypecheckingMemberExpression = (node, callExpression) => { + if (isTypecheckingIdentifier(node.property, callExpression, true)) { + return true; + } + + if (node.object.type === 'MemberExpression') { + return isTypecheckingMemberExpression(node.object, callExpression); + } + + return false; +}; + +const isTypecheckingExpression = (node, callExpression) => { + switch (node.type) { + case 'Identifier': { + return isTypecheckingIdentifier(node, callExpression, false); + } + + case 'MemberExpression': { + return isTypecheckingMemberExpression(node, callExpression); + } + + case 'CallExpression': { + return isTypecheckingExpression(node.callee, node); + } + + case 'UnaryExpression': { + return ( + node.operator === 'typeof' + || (node.operator === '!' && isTypecheckingExpression(node.argument)) + ); + } + + case 'BinaryExpression': { + return ( + node.operator === 'instanceof' + || isTypecheckingExpression(node.left, callExpression) + || isTypecheckingExpression(node.right, callExpression) + ); + } + + case 'LogicalExpression': { + return ( + isTypecheckingExpression(node.left, callExpression) + && isTypecheckingExpression(node.right, callExpression) + ); + } + + default: { + return false; + } + } +}; + +const isTypechecking = node => node.type === 'IfStatement' && isTypecheckingExpression(node.test); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + ThrowStatement(node) { + if ( + isNewExpression(node.argument, {name: 'Error'}) + && isLone(node) + && node.parent.parent + && isTypechecking(node.parent.parent) + ) { + const errorConstructor = node.argument.callee; + return { + node: errorConstructor, + messageId: MESSAGE_ID, + fix: fixer => fixer.insertTextBefore(errorConstructor, 'Type'), + }; + } + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce throwing `TypeError` in type checking conditions.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js new file mode 100644 index 0000000000000000000000000000000000000000..cb10e1324d762ec1fd50fab2739729782c4c1109 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js @@ -0,0 +1,646 @@ +'use strict'; +const path = require('node:path'); +const {defaultsDeep, upperFirst, lowerFirst} = require('./utils/lodash.js'); +const avoidCapture = require('./utils/avoid-capture.js'); +const cartesianProductSamples = require('./utils/cartesian-product-samples.js'); +const isShorthandPropertyValue = require('./utils/is-shorthand-property-value.js'); +const isShorthandImportLocal = require('./utils/is-shorthand-import-local.js'); +const getVariableIdentifiers = require('./utils/get-variable-identifiers.js'); +const {defaultReplacements, defaultAllowList, defaultIgnore} = require('./shared/abbreviations.js'); +const {renameVariable} = require('./fix/index.js'); +const getScopes = require('./utils/get-scopes.js'); +const {isStaticRequire} = require('./ast/index.js'); + +const MESSAGE_ID_REPLACE = 'replace'; +const MESSAGE_ID_SUGGESTION = 'suggestion'; +const anotherNameMessage = 'A more descriptive name will do too.'; +const messages = { + [MESSAGE_ID_REPLACE]: `The {{nameTypeText}} \`{{discouragedName}}\` should be named \`{{replacement}}\`. ${anotherNameMessage}`, + [MESSAGE_ID_SUGGESTION]: `Please rename the {{nameTypeText}} \`{{discouragedName}}\`. Suggested names are: {{replacementsText}}. ${anotherNameMessage}`, +}; + +const isUpperCase = string => string === string.toUpperCase(); +const isUpperFirst = string => isUpperCase(string[0]); + +const prepareOptions = ({ + checkProperties = false, + checkVariables = true, + + checkDefaultAndNamespaceImports = 'internal', + checkShorthandImports = 'internal', + checkShorthandProperties = false, + + checkFilenames = true, + + extendDefaultReplacements = true, + replacements = {}, + + extendDefaultAllowList = true, + allowList = {}, + + ignore = [], +} = {}) => { + const mergedReplacements = extendDefaultReplacements + ? defaultsDeep({}, replacements, defaultReplacements) + : replacements; + + const mergedAllowList = extendDefaultAllowList + ? defaultsDeep({}, allowList, defaultAllowList) + : allowList; + + ignore = [...defaultIgnore, ...ignore]; + + ignore = ignore.map( + pattern => pattern instanceof RegExp ? pattern : new RegExp(pattern, 'u'), + ); + + return { + checkProperties, + checkVariables, + + checkDefaultAndNamespaceImports, + checkShorthandImports, + checkShorthandProperties, + + checkFilenames, + + replacements: new Map( + Object.entries(mergedReplacements).map( + ([discouragedName, replacements]) => + [discouragedName, new Map(Object.entries(replacements))], + ), + ), + allowList: new Map(Object.entries(mergedAllowList)), + + ignore, + }; +}; + +const getWordReplacements = (word, {replacements, allowList}) => { + // Skip constants and allowList + if (isUpperCase(word) || allowList.get(word)) { + return []; + } + + const replacement = replacements.get(lowerFirst(word)) + || replacements.get(word) + || replacements.get(upperFirst(word)); + + let wordReplacement = []; + if (replacement) { + const transform = isUpperFirst(word) ? upperFirst : lowerFirst; + wordReplacement = [...replacement.keys()] + .filter(name => replacement.get(name)) + .map(name => transform(name)); + } + + return wordReplacement.length > 0 ? wordReplacement.sort() : []; +}; + +const getNameReplacements = (name, options, limit = 3) => { + const {allowList, ignore} = options; + + // Skip constants and allowList + if (isUpperCase(name) || allowList.get(name) || ignore.some(regexp => regexp.test(name))) { + return {total: 0}; + } + + // Find exact replacements + const exactReplacements = getWordReplacements(name, options); + + if (exactReplacements.length > 0) { + return { + total: exactReplacements.length, + samples: exactReplacements.slice(0, limit), + }; + } + + // Split words + const words = name.split(/(?=\P{Lowercase_Letter})|(?<=\P{Letter})/u).filter(Boolean); + + let hasReplacements = false; + const combinations = words.map(word => { + const wordReplacements = getWordReplacements(word, options); + + if (wordReplacements.length > 0) { + hasReplacements = true; + return wordReplacements; + } + + return [word]; + }); + + // No replacements for any word + if (!hasReplacements) { + return {total: 0}; + } + + const { + total, + samples, + } = cartesianProductSamples(combinations, limit); + + // `retVal` -> `['returnValue', 'Value']` -> `['returnValue']` + for (const parts of samples) { + for (let index = parts.length - 1; index > 0; index--) { + const word = parts[index]; + if (/^[A-Za-z]+$/.test(word) && parts[index - 1].endsWith(parts[index])) { + parts.splice(index, 1); + } + } + } + + return { + total, + samples: samples.map(words => words.join('')), + }; +}; + +const getMessage = (discouragedName, replacements, nameTypeText) => { + const {total, samples = []} = replacements; + + if (total === 1) { + return { + messageId: MESSAGE_ID_REPLACE, + data: { + nameTypeText, + discouragedName, + replacement: samples[0], + }, + }; + } + + let replacementsText = samples + .map(replacement => `\`${replacement}\``) + .join(', '); + + const omittedReplacementsCount = total - samples.length; + if (omittedReplacementsCount > 0) { + replacementsText += `, ... (${omittedReplacementsCount > 99 ? '99+' : omittedReplacementsCount} more omitted)`; + } + + return { + messageId: MESSAGE_ID_SUGGESTION, + data: { + nameTypeText, + discouragedName, + replacementsText, + }, + }; +}; + +const isExportedIdentifier = identifier => { + if ( + identifier.parent.type === 'VariableDeclarator' + && identifier.parent.id === identifier + ) { + return ( + identifier.parent.parent.type === 'VariableDeclaration' + && identifier.parent.parent.parent.type === 'ExportNamedDeclaration' + ); + } + + if ( + identifier.parent.type === 'FunctionDeclaration' + && identifier.parent.id === identifier + ) { + return identifier.parent.parent.type === 'ExportNamedDeclaration'; + } + + if ( + identifier.parent.type === 'ClassDeclaration' + && identifier.parent.id === identifier + ) { + return identifier.parent.parent.type === 'ExportNamedDeclaration'; + } + + if ( + identifier.parent.type === 'TSTypeAliasDeclaration' + && identifier.parent.id === identifier + ) { + return identifier.parent.parent.type === 'ExportNamedDeclaration'; + } + + return false; +}; + +const shouldFix = variable => getVariableIdentifiers(variable) + .every(identifier => + !isExportedIdentifier(identifier) + // In typescript parser, only `JSXOpeningElement` is added to variable + // `` -> `` will cause parse error + && identifier.type !== 'JSXIdentifier', + ); + +const isDefaultOrNamespaceImportName = identifier => { + if ( + identifier.parent.type === 'ImportDefaultSpecifier' + && identifier.parent.local === identifier + ) { + return true; + } + + if ( + identifier.parent.type === 'ImportNamespaceSpecifier' + && identifier.parent.local === identifier + ) { + return true; + } + + if ( + identifier.parent.type === 'ImportSpecifier' + && identifier.parent.local === identifier + && identifier.parent.imported.type === 'Identifier' + && identifier.parent.imported.name === 'default' + ) { + return true; + } + + if ( + identifier.parent.type === 'VariableDeclarator' + && identifier.parent.id === identifier + && isStaticRequire(identifier.parent.init) + ) { + return true; + } + + return false; +}; + +const isClassVariable = variable => { + if (variable.defs.length !== 1) { + return false; + } + + const [definition] = variable.defs; + + return definition.type === 'ClassName'; +}; + +const shouldReportIdentifierAsProperty = identifier => { + if ( + identifier.parent.type === 'MemberExpression' + && identifier.parent.property === identifier + && !identifier.parent.computed + && identifier.parent.parent.type === 'AssignmentExpression' + && identifier.parent.parent.left === identifier.parent + ) { + return true; + } + + if ( + identifier.parent.type === 'Property' + && identifier.parent.key === identifier + && !identifier.parent.computed + && !identifier.parent.shorthand // Shorthand properties are reported and fixed as variables + && identifier.parent.parent.type === 'ObjectExpression' + ) { + return true; + } + + if ( + identifier.parent.type === 'ExportSpecifier' + && identifier.parent.exported === identifier + && identifier.parent.local !== identifier // Same as shorthand properties above + ) { + return true; + } + + if ( + ( + identifier.parent.type === 'MethodDefinition' + || identifier.parent.type === 'PropertyDefinition' + ) + && identifier.parent.key === identifier + && !identifier.parent.computed + ) { + return true; + } + + return false; +}; + +const isInternalImport = node => { + let source = ''; + + if (node.type === 'Variable') { + source = node.node.init.arguments[0].value; + } else if (node.type === 'ImportBinding') { + source = node.parent.source.value; + } + + return ( + !source.includes('node_modules') + && (source.startsWith('.') || source.startsWith('/')) + ); +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const options = prepareOptions(context.options[0]); + const filenameWithExtension = context.physicalFilename; + + // A `class` declaration produces two variables in two scopes: + // the inner class scope, and the outer one (wherever the class is declared). + // This map holds the outer ones to be later processed when the inner one is encountered. + // For why this is not a eslint issue see https://github.com/eslint/eslint-scope/issues/48#issuecomment-464358754 + const identifierToOuterClassVariable = new WeakMap(); + + const checkPossiblyWeirdClassVariable = variable => { + if (isClassVariable(variable)) { + if (variable.scope.type === 'class') { // The inner class variable + const [definition] = variable.defs; + const outerClassVariable = identifierToOuterClassVariable.get(definition.name); + + if (!outerClassVariable) { + return checkVariable(variable); + } + + // Create a normal-looking variable (like a `var` or a `function`) + // For which a single `variable` holds all references, unlike with a `class` + const combinedReferencesVariable = { + name: variable.name, + scope: variable.scope, + defs: variable.defs, + identifiers: variable.identifiers, + references: [...variable.references, ...outerClassVariable.references], + }; + + // Call the common checker with the newly forged normalized class variable + return checkVariable(combinedReferencesVariable); + } + + // The outer class variable, we save it for later, when it's inner counterpart is encountered + const [definition] = variable.defs; + identifierToOuterClassVariable.set(definition.name, variable); + + return; + } + + return checkVariable(variable); + }; + + // Holds a map from a `Scope` to a `Set` of new variable names generated by our fixer. + // Used to avoid generating duplicate names, see for instance `let errCb, errorCb` test. + const scopeToNamesGeneratedByFixer = new WeakMap(); + const isSafeName = (name, scopes) => scopes.every(scope => { + const generatedNames = scopeToNamesGeneratedByFixer.get(scope); + return !generatedNames || !generatedNames.has(name); + }); + + const checkVariable = variable => { + if (variable.defs.length === 0) { + return; + } + + const [definition] = variable.defs; + + if (isDefaultOrNamespaceImportName(definition.name)) { + if (!options.checkDefaultAndNamespaceImports) { + return; + } + + if ( + options.checkDefaultAndNamespaceImports === 'internal' + && !isInternalImport(definition) + ) { + return; + } + } + + if (isShorthandImportLocal(definition.name)) { + if (!options.checkShorthandImports) { + return; + } + + if ( + options.checkShorthandImports === 'internal' + && !isInternalImport(definition) + ) { + return; + } + } + + if ( + !options.checkShorthandProperties + && isShorthandPropertyValue(definition.name) + ) { + return; + } + + const variableReplacements = getNameReplacements(variable.name, options); + + if (variableReplacements.total === 0) { + return; + } + + const scopes = [ + ...variable.references.map(reference => reference.from), + variable.scope, + ]; + variableReplacements.samples = variableReplacements.samples.map( + name => avoidCapture(name, scopes, isSafeName), + ); + + const problem = { + ...getMessage(definition.name.name, variableReplacements, 'variable'), + node: definition.name, + }; + + if ( + variableReplacements.total === 1 + && shouldFix(variable) + && variableReplacements.samples[0] + && !variable.references.some(reference => reference.vueUsedInTemplate) + ) { + const [replacement] = variableReplacements.samples; + + for (const scope of scopes) { + if (!scopeToNamesGeneratedByFixer.has(scope)) { + scopeToNamesGeneratedByFixer.set(scope, new Set()); + } + + const generatedNames = scopeToNamesGeneratedByFixer.get(scope); + generatedNames.add(replacement); + } + + problem.fix = fixer => renameVariable(variable, replacement, fixer); + } + + context.report(problem); + }; + + const checkVariables = scope => { + for (const variable of scope.variables) { + checkPossiblyWeirdClassVariable(variable); + } + }; + + const checkScope = scope => { + const scopes = getScopes(scope); + for (const scope of scopes) { + checkVariables(scope); + } + }; + + return { + Identifier(node) { + if (!options.checkProperties) { + return; + } + + if (node.name === '__proto__') { + return; + } + + const identifierReplacements = getNameReplacements(node.name, options); + + if (identifierReplacements.total === 0) { + return; + } + + if (!shouldReportIdentifierAsProperty(node)) { + return; + } + + const problem = { + ...getMessage(node.name, identifierReplacements, 'property'), + node, + }; + + context.report(problem); + }, + + Program(node) { + if (!options.checkFilenames) { + return; + } + + if ( + filenameWithExtension === '' + || filenameWithExtension === '' + ) { + return; + } + + const filename = path.basename(filenameWithExtension); + const extension = path.extname(filename); + const filenameReplacements = getNameReplacements(path.basename(filename, extension), options); + + if (filenameReplacements.total === 0) { + return; + } + + filenameReplacements.samples = filenameReplacements.samples.map(replacement => `${replacement}${extension}`); + + context.report({ + ...getMessage(filename, filenameReplacements, 'filename'), + node, + }); + }, + + 'Program:exit'(program) { + if (!options.checkVariables) { + return; + } + + checkScope(context.sourceCode.getScope(program)); + }, + }; +}; + +const schema = { + type: 'array', + additionalItems: false, + items: [ + { + type: 'object', + additionalProperties: false, + properties: { + checkProperties: { + type: 'boolean', + }, + checkVariables: { + type: 'boolean', + }, + checkDefaultAndNamespaceImports: { + type: [ + 'boolean', + 'string', + ], + pattern: 'internal', + }, + checkShorthandImports: { + type: [ + 'boolean', + 'string', + ], + pattern: 'internal', + }, + checkShorthandProperties: { + type: 'boolean', + }, + checkFilenames: { + type: 'boolean', + }, + extendDefaultReplacements: { + type: 'boolean', + }, + replacements: { + $ref: '#/definitions/abbreviations', + }, + extendDefaultAllowList: { + type: 'boolean', + }, + allowList: { + $ref: '#/definitions/booleanObject', + }, + ignore: { + type: 'array', + uniqueItems: true, + }, + }, + }, + ], + definitions: { + abbreviations: { + type: 'object', + additionalProperties: { + $ref: '#/definitions/replacements', + }, + }, + replacements: { + anyOf: [ + { + enum: [ + false, + ], + }, + { + $ref: '#/definitions/booleanObject', + }, + ], + }, + booleanObject: { + type: 'object', + additionalProperties: { + type: 'boolean', + }, + }, + }, +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Prevent abbreviations.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/relative-url-style.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/relative-url-style.js new file mode 100644 index 0000000000000000000000000000000000000000..7236dd28ef3c042ed768ea221a92c110fe735637 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/relative-url-style.js @@ -0,0 +1,169 @@ +'use strict'; +const {getStaticValue} = require('@eslint-community/eslint-utils'); +const {isNewExpression, isStringLiteral} = require('./ast/index.js'); +const {replaceStringLiteral} = require('./fix/index.js'); + +const MESSAGE_ID_NEVER = 'never'; +const MESSAGE_ID_ALWAYS = 'always'; +const MESSAGE_ID_REMOVE = 'remove'; +const messages = { + [MESSAGE_ID_NEVER]: 'Remove the `./` prefix from the relative URL.', + [MESSAGE_ID_ALWAYS]: 'Add a `./` prefix to the relative URL.', + [MESSAGE_ID_REMOVE]: 'Remove leading `./`.', +}; + +const DOT_SLASH = './'; +const TEST_URL_BASES = [ + 'https://example.com/a/b/', + 'https://example.com/a/b.html', +]; +const isSafeToAddDotSlashToUrl = (url, base) => { + try { + return new URL(url, base).href === new URL(DOT_SLASH + url, base).href; + } catch {} + + return false; +}; + +const isSafeToAddDotSlash = (url, bases = TEST_URL_BASES) => bases.every(base => isSafeToAddDotSlashToUrl(url, base)); +const isSafeToRemoveDotSlash = (url, bases = TEST_URL_BASES) => bases.every(base => isSafeToAddDotSlashToUrl(url.slice(DOT_SLASH.length), base)); + +function canAddDotSlash(node, sourceCode) { + const url = node.value; + if (url.startsWith(DOT_SLASH) || url.startsWith('.') || url.startsWith('/')) { + return false; + } + + const baseNode = node.parent.arguments[1]; + const staticValueResult = getStaticValue(baseNode, sourceCode.getScope(node)); + + if ( + typeof staticValueResult?.value === 'string' + && isSafeToAddDotSlash(url, [staticValueResult.value]) + ) { + return true; + } + + return isSafeToAddDotSlash(url); +} + +function canRemoveDotSlash(node, sourceCode) { + const rawValue = node.raw.slice(1, -1); + if (!rawValue.startsWith(DOT_SLASH)) { + return false; + } + + const baseNode = node.parent.arguments[1]; + const staticValueResult = getStaticValue(baseNode, sourceCode.getScope(node)); + + if ( + typeof staticValueResult?.value === 'string' + && isSafeToRemoveDotSlash(node.value, [staticValueResult.value]) + ) { + return true; + } + + return isSafeToRemoveDotSlash(node.value); +} + +function addDotSlash(node, sourceCode) { + if (!canAddDotSlash(node, sourceCode)) { + return; + } + + return fixer => replaceStringLiteral(fixer, node, DOT_SLASH, 0, 0); +} + +function removeDotSlash(node, sourceCode) { + if (!canRemoveDotSlash(node, sourceCode)) { + return; + } + + return fixer => replaceStringLiteral(fixer, node, '', 0, 2); +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const style = context.options[0] || 'never'; + + const listeners = {}; + + // TemplateLiteral are not always safe to remove `./`, but if it's starts with `./` we'll report + if (style === 'never') { + listeners.TemplateLiteral = function (node) { + if (!( + isNewExpression(node.parent, {name: 'URL', argumentsLength: 2}) + && node.parent.arguments[0] === node + )) { + return; + } + + const firstPart = node.quasis[0]; + if (!firstPart.value.raw.startsWith(DOT_SLASH)) { + return; + } + + return { + node, + messageId: style, + suggest: [ + { + messageId: MESSAGE_ID_REMOVE, + fix(fixer) { + const start = firstPart.range[0] + 1; + return fixer.removeRange([start, start + 2]); + }, + }, + ], + }; + }; + } + + listeners.Literal = function (node) { + if (!( + isStringLiteral(node) + && isNewExpression(node.parent, {name: 'URL', argumentsLength: 2}) + && node.parent.arguments[0] === node + )) { + return; + } + + const {sourceCode} = context; + const fix = (style === 'never' ? removeDotSlash : addDotSlash)(node, sourceCode); + + if (!fix) { + return; + } + + return { + node, + messageId: style, + fix, + }; + }; + + return listeners; +}; + +const schema = [ + { + enum: ['never', 'always'], + default: 'never', + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce consistent relative URL style.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/require-array-join-separator.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/require-array-join-separator.js new file mode 100644 index 0000000000000000000000000000000000000000..90f17098c1e65a6ec38fbe756f653d637f5914eb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/require-array-join-separator.js @@ -0,0 +1,64 @@ +'use strict'; +const {appendArgument} = require('./fix/index.js'); +const {isMethodCall} = require('./ast/index.js'); +const {isArrayPrototypeProperty} = require('./utils/index.js'); + +const MESSAGE_ID = 'require-array-join-separator'; +const messages = { + [MESSAGE_ID]: 'Missing the separator argument.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(node) { + if (!( + // `foo.join()` + isMethodCall(node, { + method: 'join', + argumentsLength: 0, + optionalCall: false, + }) + // `[].join.call(foo)` and `Array.prototype.join.call(foo)` + || ( + isMethodCall(node, { + method: 'call', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && isArrayPrototypeProperty(node.callee.object, { + property: 'join', + }) + ) + )) { + return; + } + + const {sourceCode} = context; + const [penultimateToken, lastToken] = sourceCode.getLastTokens(node, 2); + const isPrototypeMethod = node.arguments.length === 1; + return { + loc: { + start: penultimateToken.loc[isPrototypeMethod ? 'end' : 'start'], + end: lastToken.loc.end, + }, + messageId: MESSAGE_ID, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix: fixer => appendArgument(fixer, node, '\',\'', sourceCode), + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce using the separator argument with `Array#join()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/require-number-to-fixed-digits-argument.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/require-number-to-fixed-digits-argument.js new file mode 100644 index 0000000000000000000000000000000000000000..1eb88dbbdd59b22cc2259243df2dcc0267e6e6de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/require-number-to-fixed-digits-argument.js @@ -0,0 +1,55 @@ +'use strict'; +const {appendArgument} = require('./fix/index.js'); +const {isMethodCall} = require('./ast/index.js'); + +const MESSAGE_ID = 'require-number-to-fixed-digits-argument'; +const messages = { + [MESSAGE_ID]: 'Missing the digits argument.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(node) { + if ( + !isMethodCall(node, { + method: 'toFixed', + argumentsLength: 0, + optionalCall: false, + optionalMember: false, + }) + || node.callee.object.type === 'NewExpression' + ) { + return; + } + + const {sourceCode} = context; + const [ + openingParenthesis, + closingParenthesis, + ] = sourceCode.getLastTokens(node, 2); + + return { + loc: { + start: openingParenthesis.loc.start, + end: closingParenthesis.loc.end, + }, + messageId: MESSAGE_ID, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix: fixer => appendArgument(fixer, node, '0', sourceCode), + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce using the digits argument with `Number#toFixed()`.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/require-post-message-target-origin.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/require-post-message-target-origin.js new file mode 100644 index 0000000000000000000000000000000000000000..d43159d66e2bc6873f4cc71c6caf1b6bc60f1513 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/require-post-message-target-origin.js @@ -0,0 +1,74 @@ +'use strict'; +const {isMethodCall} = require('./ast/index.js'); +const {appendArgument} = require('./fix/index.js'); + +const ERROR = 'error'; +const SUGGESTION = 'suggestion'; +const messages = { + [ERROR]: 'Missing the `targetOrigin` argument.', + [SUGGESTION]: 'Use `{{code}}`.', +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +function create(context) { + const {sourceCode} = context; + return { + CallExpression(node) { + if (!isMethodCall(node, { + method: 'postMessage', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + })) { + return; + } + + const [penultimateToken, lastToken] = sourceCode.getLastTokens(node, 2); + const replacements = []; + const target = node.callee.object; + if (target.type === 'Identifier') { + const {name} = target; + + replacements.push(`${name}.location.origin`); + + if (name !== 'self' && name !== 'window' && name !== 'globalThis') { + replacements.push('self.location.origin'); + } + } else { + replacements.push('self.location.origin'); + } + + replacements.push('\'*\''); + + return { + loc: { + start: penultimateToken.loc.end, + end: lastToken.loc.end, + }, + messageId: ERROR, + suggest: replacements.map(code => ({ + messageId: SUGGESTION, + data: {code}, + /** @param {import('eslint').Rule.RuleFixer} fixer */ + fix: fixer => appendArgument(fixer, node, code, sourceCode), + })), + }; + }, + }; +} + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'problem', + docs: { + description: 'Enforce using the `targetOrigin` argument with `window.postMessage()`.', + // Turned off because we can't distinguish `window.postMessage` and `{Worker,MessagePort,Client,BroadcastChannel}#postMessage()` + // See #1396 + recommended: false, + }, + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/abbreviations.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/abbreviations.js new file mode 100644 index 0000000000000000000000000000000000000000..99a02f21e0153b774e04365e5b3a3f8761fa2e10 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/abbreviations.js @@ -0,0 +1,262 @@ +/* eslint sort-keys: ["error", "asc", {"caseSensitive": false}] */ +'use strict'; +module.exports.defaultReplacements = { + acc: { + accumulator: true, + }, + arg: { + argument: true, + }, + args: { + arguments: true, + }, + arr: { + array: true, + }, + attr: { + attribute: true, + }, + attrs: { + attributes: true, + }, + btn: { + button: true, + }, + cb: { + callback: true, + }, + conf: { + config: true, + }, + ctx: { + context: true, + }, + cur: { + current: true, + }, + curr: { + current: true, + }, + db: { + database: true, + }, + def: { + defer: true, + deferred: true, + define: true, + definition: true, + }, + dest: { + destination: true, + }, + dev: { + development: true, + }, + dir: { + direction: true, + directory: true, + }, + dirs: { + directories: true, + }, + dist: { + distribution: true, + }, + doc: { + document: true, + }, + docs: { + documentation: true, + documents: true, + }, + dst: { + daylightSavingTime: true, + destination: true, + distribution: true, + }, + e: { + error: true, + event: true, + }, + el: { + element: true, + }, + elem: { + element: true, + }, + elems: { + elements: true, + }, + env: { + environment: true, + }, + envs: { + environments: true, + }, + err: { + error: true, + }, + ev: { + event: true, + }, + evt: { + event: true, + }, + ext: { + extension: true, + }, + exts: { + extensions: true, + }, + fn: { + function: true, + }, + func: { + function: true, + }, + i: { + index: true, + }, + idx: { + index: true, + }, + j: { + index: true, + }, + len: { + length: true, + }, + lib: { + library: true, + }, + mod: { + module: true, + }, + msg: { + message: true, + }, + num: { + number: true, + }, + obj: { + object: true, + }, + opts: { + options: true, + }, + param: { + parameter: true, + }, + params: { + parameters: true, + }, + pkg: { + package: true, + }, + prev: { + previous: true, + }, + prod: { + production: true, + }, + prop: { + property: true, + }, + props: { + properties: true, + }, + ref: { + reference: true, + }, + refs: { + references: true, + }, + rel: { + related: true, + relationship: true, + relative: true, + }, + req: { + request: true, + }, + res: { + resource: true, + response: true, + result: true, + }, + ret: { + returnValue: true, + }, + retval: { + returnValue: true, + }, + sep: { + separator: true, + }, + src: { + source: true, + }, + stdDev: { + standardDeviation: true, + }, + str: { + string: true, + }, + tbl: { + table: true, + }, + temp: { + temporary: true, + }, + tit: { + title: true, + }, + tmp: { + temporary: true, + }, + val: { + value: true, + }, + var: { + variable: true, + }, + vars: { + variables: true, + }, + ver: { + version: true, + }, +}; + +module.exports.defaultAllowList = { + // React.Component Class property + // https://reactjs.org/docs/react-component.html#defaultprops + defaultProps: true, + // `package.json` field + // https://docs.npmjs.com/specifying-dependencies-and-devdependencies-in-a-package-json-file + devDependencies: true, + // Ember class name + // https://api.emberjs.com/ember/3.10/classes/Ember.EmberENV/properties + EmberENV: true, + // React.Component static method + // https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops + getDerivedStateFromProps: true, + // Next.js function + // https://nextjs.org/learn/basics/fetching-data-for-pages + getInitialProps: true, + getServerSideProps: true, + getStaticProps: true, + // React PropTypes + // https://reactjs.org/docs/typechecking-with-proptypes.html + propTypes: true, + // Jest configuration + // https://jestjs.io/docs/en/configuration#setupfilesafterenv-array + setupFilesAfterEnv: true, +}; + +module.exports.defaultIgnore = [ + // Internationalization and localization + // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1188 + 'i18n', + 'l10n', +]; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/dom-events.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/dom-events.js new file mode 100644 index 0000000000000000000000000000000000000000..3cedad9b0b791122e70cfb24d9066880b0c68f50 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/dom-events.js @@ -0,0 +1,275 @@ +'use strict'; + +const getVendorPrefixedName = eventName => [ + `webkit${eventName}`, + `o${eventName.toLowerCase()}`, + eventName.toLowerCase(), +]; + +// https://github.com/google/closure-library/blob/8782d8ba16ef2dd4a508d2081a6938f054fc60e8/closure/goog/events/eventtype.js#L44 +module.exports = new Set([ + // Mouse events + 'click', + 'rightclick', + 'dblclick', + 'auxclick', + 'mousedown', + 'mouseup', + 'mouseover', + 'mouseout', + 'mousemove', + 'mouseenter', + 'mouseleave', + + // Non-existent event; will never fire. This exists as a mouse counterpart to + // POINTERCANCEL. + 'mousecancel', + + // Selection events. + // https://www.w3.org/TR/selection-api/ + 'selectionchange', + 'selectstart', // IE, Safari, Chrome + + // Wheel events + // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents + 'wheel', + + // Key events + 'keypress', + 'keydown', + 'keyup', + + // Focus + 'blur', + 'focus', + 'deactivate', // IE only + 'focusin', + 'focusout', + + // Forms + 'change', + 'reset', + 'select', + 'submit', + 'input', + 'propertychange', // IE only + + // Drag and drop + 'dragstart', + 'drag', + 'dragenter', + 'dragover', + 'dragleave', + 'drop', + 'dragend', + + // Touch events + // Note that other touch events exist, but we should follow the W3C list here. + // http://www.w3.org/TR/touch-events/#list-of-touchevent-types + 'touchstart', + 'touchmove', + 'touchend', + 'touchcancel', + + // Misc + 'beforeunload', + 'consolemessage', + 'contextmenu', + 'devicechange', + 'devicemotion', + 'deviceorientation', + 'DOMContentLoaded', + 'error', + 'help', + 'load', + 'losecapture', + 'orientationchange', + 'readystatechange', + 'resize', + 'scroll', + 'unload', + + // Media events + 'canplay', + 'canplaythrough', + 'durationchange', + 'emptied', + 'ended', + 'loadeddata', + 'loadedmetadata', + 'pause', + 'play', + 'playing', + 'progress', + 'ratechange', + 'seeked', + 'seeking', + 'stalled', + 'suspend', + 'timeupdate', + 'volumechange', + 'waiting', + + // Media Source Extensions events + // https://www.w3.org/TR/media-source/#mediasource-events + 'sourceopen', + 'sourceended', + 'sourceclosed', + // https://www.w3.org/TR/media-source/#sourcebuffer-events + 'abort', + 'update', + 'updatestart', + 'updateend', + + // HTML 5 History events + // See http://www.w3.org/TR/html5/browsers.html#event-definitions-0 + 'hashchange', + 'pagehide', + 'pageshow', + 'popstate', + + // Copy and Paste + // Support is limited. Make sure it works on your favorite browser + // before using. + // http://www.quirksmode.org/dom/events/cutcopypaste.html + 'copy', + 'paste', + 'cut', + 'beforecopy', + 'beforecut', + 'beforepaste', + + // HTML5 online/offline events. + // http://www.w3.org/TR/offline-webapps/#related + 'online', + 'offline', + + // HTML 5 worker events + 'message', + 'connect', + + // Service Worker Events - ServiceWorkerGlobalScope context + // See https://w3c.github.io/ServiceWorker/#execution-context-events + // message event defined in worker events section + 'install', + 'activate', + 'fetch', + 'foreignfetch', + 'messageerror', + + // Service Worker Events - Document context + // See https://w3c.github.io/ServiceWorker/#document-context-events + 'statechange', + 'updatefound', + 'controllerchange', + + // CSS animation events. + ...getVendorPrefixedName('AnimationStart'), + ...getVendorPrefixedName('AnimationEnd'), + ...getVendorPrefixedName('AnimationIteration'), + + // CSS transition events. Based on the browser support described at: + // https://developer.mozilla.org/en/css/css_transitions#Browser_compatibility + ...getVendorPrefixedName('TransitionEnd'), + + // W3C Pointer Events + // http://www.w3.org/TR/pointerevents/ + 'pointerdown', + 'pointerup', + 'pointercancel', + 'pointermove', + 'pointerover', + 'pointerout', + 'pointerenter', + 'pointerleave', + 'gotpointercapture', + 'lostpointercapture', + + // IE specific events. + // See http://msdn.microsoft.com/en-us/library/ie/hh772103(v=vs.85).aspx + // these events will be supplanted in IE11. + 'MSGestureChange', + 'MSGestureEnd', + 'MSGestureHold', + 'MSGestureStart', + 'MSGestureTap', + 'MSGotPointerCapture', + 'MSInertiaStart', + 'MSLostPointerCapture', + 'MSPointerCancel', + 'MSPointerDown', + 'MSPointerEnter', + 'MSPointerHover', + 'MSPointerLeave', + 'MSPointerMove', + 'MSPointerOut', + 'MSPointerOver', + 'MSPointerUp', + + // Native IMEs/input tools events. + 'text', + // The textInput event is supported in IE9+, but only in lower case. All other + // browsers use the camel-case event name. + 'textinput', + 'textInput', + 'compositionstart', + 'compositionupdate', + 'compositionend', + + // The beforeinput event is initially only supported in Safari. See + // https://bugs.chromium.org/p/chromium/issues/detail?id=342670 for Chrome + // implementation tracking. + 'beforeinput', + + // Webview tag events + // See https://developer.chrome.com/apps/tags/webview + 'exit', + 'loadabort', + 'loadcommit', + 'loadredirect', + 'loadstart', + 'loadstop', + 'responsive', + 'sizechanged', + 'unresponsive', + + // HTML5 Page Visibility API. See details at + // `goog.labs.dom.PageVisibilityMonitor`. + 'visibilitychange', + + // LocalStorage event. + 'storage', + + // DOM Level 2 mutation events (deprecated). + 'DOMSubtreeModified', + 'DOMNodeInserted', + 'DOMNodeRemoved', + 'DOMNodeRemovedFromDocument', + 'DOMNodeInsertedIntoDocument', + 'DOMAttrModified', + 'DOMCharacterDataModified', + + // Print events. + 'beforeprint', + 'afterprint', + + // Web app manifest events. + 'beforeinstallprompt', + 'appinstalled', + + // https://github.com/facebook/react/blob/cae635054e17a6f107a39d328649137b83f25972/packages/react-dom/src/events/DOMEventNames.js#L12 + 'afterblur', + 'beforeblur', + 'cancel', + 'close', + 'dragexit', + 'encrypted', + 'fullscreenchange', + 'invalid', + 'toggle', + + // https://github.com/sindresorhus/eslint-plugin-unicorn/pull/147 + 'search', + 'open', + 'show', +]); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/event-keys.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/event-keys.js new file mode 100644 index 0000000000000000000000000000000000000000..0bea2eb37b22d78d13a8385e8ab320dccd7b03d4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/event-keys.js @@ -0,0 +1,52 @@ +/* eslint sort-keys: ["error", "asc", {natural: true}] */ +'use strict'; +// https://github.com/facebook/react/blob/b87aabd/packages/react-dom/src/events/getEventKey.js#L36 +// Only meta characters which can't be deciphered from `String.fromCharCode()` +module.exports = { + 8: 'Backspace', + 9: 'Tab', + 12: 'Clear', + 13: 'Enter', + 16: 'Shift', + 17: 'Control', + 18: 'Alt', + 19: 'Pause', + 20: 'CapsLock', + 27: 'Escape', + 32: ' ', + 33: 'PageUp', + 34: 'PageDown', + 35: 'End', + 36: 'Home', + 37: 'ArrowLeft', + 38: 'ArrowUp', + 39: 'ArrowRight', + 40: 'ArrowDown', + 45: 'Insert', + 46: 'Delete', + 112: 'F1', + 113: 'F2', + 114: 'F3', + 115: 'F4', + 116: 'F5', + 117: 'F6', + 118: 'F7', + 119: 'F8', + 120: 'F9', + 121: 'F10', + 122: 'F11', + 123: 'F12', + 144: 'NumLock', + 145: 'ScrollLock', + 186: ';', + 187: '=', + 188: ',', + 189: '-', + 190: '.', + 191: '/', + 219: '[', + 220: '\\', + 221: ']', + 222: '\'', + 224: 'Meta', +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/negative-index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/negative-index.js new file mode 100644 index 0000000000000000000000000000000000000000..835d79ed29809efaf6f7aeb19ea63e259e8af7cc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/negative-index.js @@ -0,0 +1,46 @@ +'use strict'; +const isSameReference = require('../utils/is-same-reference.js'); +const {getParenthesizedRange} = require('../utils/parentheses.js'); +const {isNumberLiteral} = require('../ast/index.js'); + +const isLengthMemberExpression = node => + node.type === 'MemberExpression' + && !node.computed + && !node.optional + && node.property.type === 'Identifier' + && node.property.name === 'length'; +const isLiteralPositiveNumber = node => + isNumberLiteral(node) + && node.value > 0; + +function getNegativeIndexLengthNode(node, objectNode) { + if (!node) { + return; + } + + const {type, operator, left, right} = node; + + if (type !== 'BinaryExpression' || operator !== '-' || !isLiteralPositiveNumber(right)) { + return; + } + + if (isLengthMemberExpression(left) && isSameReference(left.object, objectNode)) { + return left; + } + + // Nested BinaryExpression + return getNegativeIndexLengthNode(left, objectNode); +} + +function removeLengthNode(node, fixer, sourceCode) { + const [start, end] = getParenthesizedRange(node, sourceCode); + return fixer.removeRange([ + start, + end + sourceCode.text.slice(end).match(/\S|$/).index, + ]); +} + +module.exports = { + getNegativeIndexLengthNode, + removeLengthNode, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/simple-array-search-rule.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/simple-array-search-rule.js new file mode 100644 index 0000000000000000000000000000000000000000..f0144d3210ae8553cd7b8f4cd71992011daf0d0a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/simple-array-search-rule.js @@ -0,0 +1,128 @@ +'use strict'; + +const {hasSideEffect, isParenthesized, findVariable} = require('@eslint-community/eslint-utils'); +const {isMethodCall} = require('../ast/index.js'); +const {isSameIdentifier, isFunctionSelfUsedInside} = require('../utils/index.js'); + +const isSimpleCompare = (node, compareNode) => + node.type === 'BinaryExpression' + && node.operator === '===' + && ( + isSameIdentifier(node.left, compareNode) + || isSameIdentifier(node.right, compareNode) + ); +const isSimpleCompareCallbackFunction = node => + // Matches `foo.findIndex(bar => bar === baz)` + ( + node.type === 'ArrowFunctionExpression' + && !node.async + && node.params.length === 1 + && isSimpleCompare(node.body, node.params[0]) + ) + // Matches `foo.findIndex(bar => {return bar === baz})` + // Matches `foo.findIndex(function (bar) {return bar === baz})` + || ( + (node.type === 'ArrowFunctionExpression' || node.type === 'FunctionExpression') + && !node.async + && !node.generator + && node.params.length === 1 + && node.body.type === 'BlockStatement' + && node.body.body.length === 1 + && node.body.body[0].type === 'ReturnStatement' + && isSimpleCompare(node.body.body[0].argument, node.params[0]) + ); +const isIdentifierNamed = ({type, name}, expectName) => type === 'Identifier' && name === expectName; + +function simpleArraySearchRule({method, replacement}) { + // Add prefix to avoid conflicts in `prefer-includes` rule + const MESSAGE_ID_PREFIX = `prefer-${replacement}-over-${method}/`; + const ERROR = `${MESSAGE_ID_PREFIX}error`; + const SUGGESTION = `${MESSAGE_ID_PREFIX}suggestion`; + const ERROR_MESSAGES = { + findIndex: 'Use `.indexOf()` instead of `.findIndex()` when looking for the index of an item.', + findLastIndex: 'Use `.lastIndexOf()` instead of `findLastIndex() when looking for the index of an item.`', + some: `Use \`.${replacement}()\` instead of \`.${method}()\` when checking value existence.`, + }; + + const messages = { + [ERROR]: ERROR_MESSAGES[method], + [SUGGESTION]: `Replace \`.${method}()\` with \`.${replacement}()\`.`, + }; + + function listen(context) { + const {sourceCode} = context; + const {scopeManager} = sourceCode; + + context.on('CallExpression', callExpression => { + if ( + !isMethodCall(callExpression, { + method, + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + || !isSimpleCompareCallbackFunction(callExpression.arguments[0]) + ) { + return; + } + + const [callback] = callExpression.arguments; + const binaryExpression = callback.body.type === 'BinaryExpression' + ? callback.body + : callback.body.body[0].argument; + const [parameter] = callback.params; + const {left, right} = binaryExpression; + const {name} = parameter; + + let searchValueNode; + let parameterInBinaryExpression; + if (isIdentifierNamed(left, name)) { + searchValueNode = right; + parameterInBinaryExpression = left; + } else if (isIdentifierNamed(right, name)) { + searchValueNode = left; + parameterInBinaryExpression = right; + } else { + return; + } + + const callbackScope = scopeManager.acquire(callback); + if ( + // `parameter` is used somewhere else + findVariable(callbackScope, parameter).references.some(({identifier}) => identifier !== parameterInBinaryExpression) + || isFunctionSelfUsedInside(callback, callbackScope) + ) { + return; + } + + const methodNode = callExpression.callee.property; + const problem = { + node: methodNode, + messageId: ERROR, + suggest: [], + }; + + const fix = function * (fixer) { + let text = sourceCode.getText(searchValueNode); + if (isParenthesized(searchValueNode, sourceCode) && !isParenthesized(callback, sourceCode)) { + text = `(${text})`; + } + + yield fixer.replaceText(methodNode, replacement); + yield fixer.replaceText(callback, text); + }; + + if (hasSideEffect(searchValueNode, sourceCode)) { + problem.suggest.push({messageId: SUGGESTION, fix}); + } else { + problem.fix = fix; + } + + return problem; + }); + } + + return {messages, listen}; +} + +module.exports = simpleArraySearchRule; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/typed-array.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/typed-array.js new file mode 100644 index 0000000000000000000000000000000000000000..ccadb3a44256e7890980a9a55397e7ad6b9adeb7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/shared/typed-array.js @@ -0,0 +1,16 @@ +'use strict'; + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#description +module.exports = [ + 'Int8Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array', + 'BigInt64Array', + 'BigUint64Array', +]; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/string-content.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/string-content.js new file mode 100644 index 0000000000000000000000000000000000000000..66f998b5658190f1e015380c606588aa64790ae5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/string-content.js @@ -0,0 +1,189 @@ +'use strict'; +const escapeString = require('./utils/escape-string.js'); +const escapeTemplateElementRaw = require('./utils/escape-template-element-raw.js'); +const {replaceTemplateElement} = require('./fix/index.js'); + +const defaultMessage = 'Prefer `{{suggest}}` over `{{match}}`.'; +const SUGGESTION_MESSAGE_ID = 'replace'; +const messages = { + [SUGGESTION_MESSAGE_ID]: 'Replace `{{match}}` with `{{suggest}}`.', +}; + +const ignoredIdentifier = new Set([ + 'gql', + 'html', + 'svg', +]); + +const ignoredMemberExpressionObject = new Set([ + 'styled', +]); + +const isIgnoredTag = node => { + if (!node.parent || !node.parent.parent || !node.parent.parent.tag) { + return false; + } + + const {tag} = node.parent.parent; + + if (tag.type === 'Identifier' && ignoredIdentifier.has(tag.name)) { + return true; + } + + if (tag.type === 'MemberExpression') { + const {object} = tag; + if ( + object.type === 'Identifier' + && ignoredMemberExpressionObject.has(object.name) + ) { + return true; + } + } + + return false; +}; + +function getReplacements(patterns) { + return Object.entries(patterns) + .map(([match, options]) => { + if (typeof options === 'string') { + options = { + suggest: options, + }; + } + + return { + match, + regex: new RegExp(match, 'gu'), + fix: true, + ...options, + }; + }); +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {patterns} = { + patterns: {}, + ...context.options[0], + }; + const replacements = getReplacements(patterns); + + if (replacements.length === 0) { + return; + } + + context.on(['Literal', 'TemplateElement'], node => { + const {type, value, raw} = node; + + let string; + if (type === 'Literal') { + string = value; + } else if (!isIgnoredTag(node)) { + string = value.raw; + } + + if (!string || typeof string !== 'string') { + return; + } + + const replacement = replacements.find(({regex}) => regex.test(string)); + + if (!replacement) { + return; + } + + const {fix: autoFix, message = defaultMessage, match, suggest, regex} = replacement; + const problem = { + node, + message, + data: { + match, + suggest, + }, + }; + + const fixed = string.replace(regex, suggest); + const fix = type === 'Literal' + ? fixer => { + const [quote] = raw; + return fixer.replaceText( + node, + node.parent.type === 'JSXAttribute' ? quote + fixed + quote : escapeString(fixed, quote), + ); + } + : fixer => replaceTemplateElement( + fixer, + node, + escapeTemplateElementRaw(fixed), + ); + + if (autoFix) { + problem.fix = fix; + } else { + problem.suggest = [ + { + messageId: SUGGESTION_MESSAGE_ID, + fix, + }, + ]; + } + + return problem; + }); +}; + +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + patterns: { + type: 'object', + additionalProperties: { + anyOf: [ + { + type: 'string', + }, + { + type: 'object', + required: [ + 'suggest', + ], + properties: { + suggest: { + type: 'string', + }, + fix: { + type: 'boolean', + // Default: true + }, + message: { + type: 'string', + // Default: '' + }, + }, + additionalProperties: false, + }, + ], + }, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce better string content.', + recommended: false, + }, + fixable: 'code', + hasSuggestions: true, + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/switch-case-braces.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/switch-case-braces.js new file mode 100644 index 0000000000000000000000000000000000000000..530bc0e0d7f50ebaa839c46c23117073b68a70ea --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/switch-case-braces.js @@ -0,0 +1,110 @@ +'use strict'; +const {isColonToken} = require('@eslint-community/eslint-utils'); +const getSwitchCaseHeadLocation = require('./utils/get-switch-case-head-location.js'); +const getIndentString = require('./utils/get-indent-string.js'); +const {replaceNodeOrTokenAndSpacesBefore} = require('./fix/index.js'); + +const MESSAGE_ID_EMPTY_CLAUSE = 'switch-case-braces/empty'; +const MESSAGE_ID_MISSING_BRACES = 'switch-case-braces/missing'; +const MESSAGE_ID_UNNECESSARY_BRACES = 'switch-case-braces/unnecessary'; +const messages = { + [MESSAGE_ID_EMPTY_CLAUSE]: 'Unexpected braces in empty case clause.', + [MESSAGE_ID_MISSING_BRACES]: 'Missing braces in case clause.', + [MESSAGE_ID_UNNECESSARY_BRACES]: 'Unnecessary braces in case clause.', +}; + +function * removeBraces(fixer, node, sourceCode) { + const [blockStatement] = node.consequent; + const openingBraceToken = sourceCode.getFirstToken(blockStatement); + yield * replaceNodeOrTokenAndSpacesBefore(openingBraceToken, '', fixer, sourceCode); + + const closingBraceToken = sourceCode.getLastToken(blockStatement); + yield fixer.remove(closingBraceToken); +} + +function * addBraces(fixer, node, sourceCode) { + const colonToken = sourceCode.getTokenAfter( + node.test || sourceCode.getFirstToken(node), + isColonToken, + ); + yield fixer.insertTextAfter(colonToken, ' {'); + + const lastToken = sourceCode.getLastToken(node); + const indent = getIndentString(node, sourceCode); + yield fixer.insertTextAfter(lastToken, `\n${indent}}`); +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const isBracesRequired = context.options[0] !== 'avoid'; + const {sourceCode} = context; + + return { + SwitchCase(node) { + const {consequent} = node; + if (consequent.length === 0) { + return; + } + + if ( + consequent.length === 1 + && consequent[0].type === 'BlockStatement' + && consequent[0].body.length === 0 + ) { + return { + node, + loc: sourceCode.getFirstToken(consequent[0]).loc, + messageId: MESSAGE_ID_EMPTY_CLAUSE, + fix: fixer => removeBraces(fixer, node, sourceCode), + }; + } + + if ( + isBracesRequired + && !( + consequent.length === 1 + && consequent[0].type === 'BlockStatement' + ) + ) { + return { + node, + loc: getSwitchCaseHeadLocation(node, sourceCode), + messageId: MESSAGE_ID_MISSING_BRACES, + fix: fixer => addBraces(fixer, node, sourceCode), + }; + } + + if ( + !isBracesRequired + && consequent.length === 1 + && consequent[0].type === 'BlockStatement' + && consequent[0].body.every(node => + node.type !== 'VariableDeclaration' + && node.type !== 'FunctionDeclaration', + ) + ) { + return { + node, + loc: sourceCode.getFirstToken(consequent[0]).loc, + messageId: MESSAGE_ID_UNNECESSARY_BRACES, + fix: fixer => removeBraces(fixer, node, sourceCode), + }; + } + }, + }; +}; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'layout', + docs: { + description: 'Enforce consistent brace style for `case` clauses.', + recommended: true, + }, + fixable: 'code', + schema: [{enum: ['always', 'avoid']}], + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/template-indent.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/template-indent.js new file mode 100644 index 0000000000000000000000000000000000000000..e70200782037590bedf0ea0b154638f9e63ec7fa --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/template-indent.js @@ -0,0 +1,221 @@ +'use strict'; +const stripIndent = require('strip-indent'); +const indentString = require('indent-string'); +const esquery = require('esquery'); +const {replaceTemplateElement} = require('./fix/index.js'); +const { + isMethodCall, + isCallExpression, + isTaggedTemplateLiteral, +} = require('./ast/index.js'); +const {isNodeMatches} = require('./utils/index.js'); + +const MESSAGE_ID_IMPROPERLY_INDENTED_TEMPLATE = 'template-indent'; +const messages = { + [MESSAGE_ID_IMPROPERLY_INDENTED_TEMPLATE]: 'Templates should be properly indented.', +}; + +const isJestInlineSnapshot = node => + isMethodCall(node.parent, { + method: 'toMatchInlineSnapshot', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }) + && node.parent.arguments[0] === node + && isCallExpression(node.parent.callee.object, { + name: 'expect', + argumentsLength: 1, + optionalCall: false, + optionalMember: false, + }); + +const parsedEsquerySelectors = new Map(); +const parseEsquerySelector = selector => { + if (!parsedEsquerySelectors.has(selector)) { + parsedEsquerySelectors.set(selector, esquery.parse(selector)); + } + + return parsedEsquerySelectors.get(selector); +}; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + const options = { + tags: ['outdent', 'dedent', 'gql', 'sql', 'html', 'styled'], + functions: ['dedent', 'stripIndent'], + selectors: [], + comments: ['HTML', 'indent'], + ...context.options[0], + }; + + options.comments = options.comments.map(comment => comment.toLowerCase()); + + /** @param {import('@babel/core').types.TemplateLiteral} node */ + const getProblem = node => { + const delimiter = '__PLACEHOLDER__' + Math.random(); + const joined = node.quasis + .map(quasi => { + const untrimmedText = sourceCode.getText(quasi); + return untrimmedText.slice(1, quasi.tail ? -1 : -2); + }) + .join(delimiter); + + const eolMatch = joined.match(/\r?\n/); + if (!eolMatch) { + return; + } + + const eol = eolMatch[0]; + + const startLine = sourceCode.lines[node.loc.start.line - 1]; + const marginMatch = startLine.match(/^(\s*)\S/); + const parentMargin = marginMatch ? marginMatch[1] : ''; + + let indent; + if (typeof options.indent === 'string') { + indent = options.indent; + } else if (typeof options.indent === 'number') { + indent = ' '.repeat(options.indent); + } else { + const tabs = parentMargin.startsWith('\t'); + indent = tabs ? '\t' : ' '; + } + + const dedented = stripIndent(joined); + const trimmed = dedented.replaceAll(new RegExp(`^${eol}|${eol}[ \t]*$`, 'g'), ''); + + const fixed + = eol + + indentString(trimmed, 1, {indent: parentMargin + indent}) + + eol + + parentMargin; + + if (fixed === joined) { + return; + } + + return { + node, + messageId: MESSAGE_ID_IMPROPERLY_INDENTED_TEMPLATE, + fix: fixer => fixed + .split(delimiter) + .map((replacement, index) => replaceTemplateElement(fixer, node.quasis[index], replacement)), + }; + }; + + const shouldIndent = node => { + if (options.comments.length > 0) { + const previousToken = sourceCode.getTokenBefore(node, {includeComments: true}); + if (previousToken?.type === 'Block' && options.comments.includes(previousToken.value.trim().toLowerCase())) { + return true; + } + } + + if (isJestInlineSnapshot(node)) { + return true; + } + + if ( + options.tags.length > 0 + && isTaggedTemplateLiteral(node, options.tags) + ) { + return true; + } + + if ( + options.functions.length > 0 + && node.parent.type === 'CallExpression' + && node.parent.arguments.includes(node) + && isNodeMatches(node.parent.callee, options.functions) + ) { + return true; + } + + if (options.selectors.length > 0) { + const ancestors = sourceCode.getAncestors(node).reverse(); + if (options.selectors.some(selector => esquery.matches(node, parseEsquerySelector(selector), ancestors))) { + return true; + } + } + + return false; + }; + + return { + /** @param {import('@babel/core').types.TemplateLiteral} node */ + TemplateLiteral(node) { + if (!shouldIndent(node)) { + return; + } + + return getProblem(node); + }, + }; +}; + +/** @type {import('json-schema').JSONSchema7[]} */ +const schema = [ + { + type: 'object', + additionalProperties: false, + properties: { + indent: { + oneOf: [ + { + type: 'string', + pattern: /^\s+$/.source, + }, + { + type: 'integer', + minimum: 1, + }, + ], + }, + tags: { + type: 'array', + uniqueItems: true, + items: { + type: 'string', + }, + }, + functions: { + type: 'array', + uniqueItems: true, + items: { + type: 'string', + }, + }, + selectors: { + type: 'array', + uniqueItems: true, + items: { + type: 'string', + }, + }, + comments: { + type: 'array', + uniqueItems: true, + items: { + type: 'string', + }, + }, + }, + }, +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Fix whitespace-insensitive template indentation.', + recommended: true, + }, + fixable: 'code', + schema, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/text-encoding-identifier-case.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/text-encoding-identifier-case.js new file mode 100644 index 0000000000000000000000000000000000000000..992c3108598966aae0d0eebb11156ccb1cec3032 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/text-encoding-identifier-case.js @@ -0,0 +1,109 @@ +'use strict'; +const {replaceStringLiteral} = require('./fix/index.js'); + +const MESSAGE_ID_ERROR = 'text-encoding-identifier/error'; +const MESSAGE_ID_SUGGESTION = 'text-encoding-identifier/suggestion'; +const messages = { + [MESSAGE_ID_ERROR]: 'Prefer `{{replacement}}` over `{{value}}`.', + [MESSAGE_ID_SUGGESTION]: 'Replace `{{value}}` with `{{replacement}}`.', +}; + +const getReplacement = encoding => { + switch (encoding.toLowerCase()) { + // eslint-disable-next-line unicorn/text-encoding-identifier-case + case 'utf-8': + case 'utf8': { + return 'utf8'; + } + + case 'ascii': { + return 'ascii'; + } + // No default + } +}; + +// `fs.{readFile,readFileSync}()` +const isFsReadFileEncoding = node => + node.parent.type === 'CallExpression' + && !node.parent.optional + && node.parent.arguments[1] === node + && node.parent.arguments[0].type !== 'SpreadElement' + && node.parent.callee.type === 'MemberExpression' + && !node.parent.callee.optional + && !node.parent.callee.computed + && node.parent.callee.property.type === 'Identifier' + && (node.parent.callee.property.name === 'readFile' || node.parent.callee.property.name === 'readFileSync'); + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = () => ({ + Literal(node) { + if (typeof node.value !== 'string') { + return; + } + + if ( + // eslint-disable-next-line unicorn/text-encoding-identifier-case + node.value === 'utf-8' + && node.parent.type === 'JSXAttribute' + && node.parent.value === node + && node.parent.name.type === 'JSXIdentifier' + && node.parent.name.name.toLowerCase() === 'charset' + && node.parent.parent.type === 'JSXOpeningElement' + && node.parent.parent.attributes.includes(node.parent) + && node.parent.parent.name.type === 'JSXIdentifier' + && node.parent.parent.name.name.toLowerCase() === 'meta' + ) { + return; + } + + const {raw} = node; + const value = raw.slice(1, -1); + + const replacement = getReplacement(value); + if (!replacement || replacement === value) { + return; + } + + /** @param {import('eslint').Rule.RuleFixer} fixer */ + const fix = fixer => replaceStringLiteral(fixer, node, replacement); + + const problem = { + node, + messageId: MESSAGE_ID_ERROR, + data: { + value, + replacement, + }, + }; + + if (isFsReadFileEncoding(node)) { + problem.fix = fix; + return problem; + } + + problem.suggest = [ + { + messageId: MESSAGE_ID_SUGGESTION, + fix: fixer => replaceStringLiteral(fixer, node, replacement), + }, + ]; + + return problem; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Enforce consistent case for text encoding identifiers.', + recommended: true, + }, + fixable: 'code', + hasSuggestions: true, + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/throw-new-error.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/throw-new-error.js new file mode 100644 index 0000000000000000000000000000000000000000..5c509795cbb87052c579c85103c220720f015e2f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/throw-new-error.js @@ -0,0 +1,47 @@ +'use strict'; +const {switchCallExpressionToNewExpression} = require('./fix/index.js'); + +const messageId = 'throw-new-error'; +const messages = { + [messageId]: 'Use `new` when creating an error.', +}; + +const customError = /^(?:[A-Z][\da-z]*)*Error$/; + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => ({ + CallExpression(node) { + const {callee} = node; + if (!( + (callee.type === 'Identifier' && customError.test(callee.name)) + || ( + callee.type === 'MemberExpression' + && !callee.computed + && callee.property.type === 'Identifier' + && customError.test(callee.property.name) + ) + )) { + return; + } + + return { + node, + messageId, + fix: fixer => switchCallExpressionToNewExpression(node, context.sourceCode, fixer), + }; + }, +}); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + create, + meta: { + type: 'suggestion', + docs: { + description: 'Require `new` when creating an error.', + recommended: true, + }, + fixable: 'code', + messages, + }, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/array-or-object-prototype-property.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/array-or-object-prototype-property.js new file mode 100644 index 0000000000000000000000000000000000000000..c42f5f69d74f6fe3939efc9e3a0755c38e373335 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/array-or-object-prototype-property.js @@ -0,0 +1,63 @@ +'use strict'; +const {isMemberExpression} = require('../ast/index.js'); + +/** +@param { + { + object?: string, + method?: string, + methods?: string[], + } +} [options] +@returns {string} +*/ +function isPrototypeProperty(node, options) { + const { + object, + property, + properties, + } = { + property: '', + properties: [], + ...options, + }; + + if (!isMemberExpression(node, { + property, + properties, + optional: false, + })) { + return; + } + + const objectNode = node.object; + + return ( + // `Object.prototype.method` or `Array.prototype.method` + isMemberExpression(objectNode, { + object, + property: 'prototype', + optional: false, + }) + // `[].method` + || ( + object === 'Array' + && objectNode.type === 'ArrayExpression' + && objectNode.elements.length === 0 + ) + // `{}.method` + || ( + object === 'Object' + && objectNode.type === 'ObjectExpression' + && objectNode.properties.length === 0 + ) + ); +} + +const isArrayPrototypeProperty = (node, options) => isPrototypeProperty(node, {...options, object: 'Array'}); +const isObjectPrototypeProperty = (node, options) => isPrototypeProperty(node, {...options, object: 'Object'}); + +module.exports = { + isArrayPrototypeProperty, + isObjectPrototypeProperty, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/assert-token.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/assert-token.js new file mode 100644 index 0000000000000000000000000000000000000000..13d1aa7e5d4dd55bb081a3c1f6acf8a0109a456b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/assert-token.js @@ -0,0 +1,32 @@ +'use strict'; + +const ISSUE_LINK_PREFIX = 'https://github.com/sindresorhus/eslint-plugin-unicorn/issues/new?'; +function assertToken(token, {test, expected, ruleId}) { + if (test?.(token)) { + return; + } + + expected = Array.isArray(expected) ? expected : [expected]; + expected = expected.map(expectedToken => typeof expectedToken === 'string' ? {value: expectedToken} : expectedToken); + + if ( + !test + && expected.some( + expectedToken => + Object.entries(expectedToken) + .every(([key, value]) => token[key] === value), + ) + ) { + return; + } + + const actual = `'${JSON.stringify({value: token.value, type: token.type})}'`; + expected = expected.map(expectedToken => `'${JSON.stringify(expectedToken)}'`).join(' or '); + const title = `\`${ruleId}\`: Unexpected token ${actual}`; + const issueLink = `${ISSUE_LINK_PREFIX}title=${encodeURIComponent(title)}`; + const message = `Expected token ${expected}, got ${actual}.\nPlease open an issue at ${issueLink}.`; + + throw new Error(message); +} + +module.exports = assertToken; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/avoid-capture.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/avoid-capture.js new file mode 100644 index 0000000000000000000000000000000000000000..1de17b16c1bdfae407ccc3f023297940d6605cf8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/avoid-capture.js @@ -0,0 +1,147 @@ +'use strict'; +const { + isIdentifierName, + isStrictReservedWord, + isKeyword, +} = require('@babel/helper-validator-identifier'); +const resolveVariableName = require('./resolve-variable-name.js'); +const getReferences = require('./get-references.js'); + +// https://github.com/microsoft/TypeScript/issues/2536#issuecomment-87194347 +const typescriptReservedWords = new Set([ + 'break', + 'case', + 'catch', + 'class', + 'const', + 'continue', + 'debugger', + 'default', + 'delete', + 'do', + 'else', + 'enum', + 'export', + 'extends', + 'false', + 'finally', + 'for', + 'function', + 'if', + 'import', + 'in', + 'instanceof', + 'new', + 'null', + 'return', + 'super', + 'switch', + 'this', + 'throw', + 'true', + 'try', + 'typeof', + 'var', + 'void', + 'while', + 'with', + 'as', + 'implements', + 'interface', + 'let', + 'package', + 'private', + 'protected', + 'public', + 'static', + 'yield', + 'any', + 'boolean', + 'constructor', + 'declare', + 'get', + 'module', + 'require', + 'number', + 'set', + 'string', + 'symbol', + 'type', + 'from', + 'of', +]); + +// Copied from https://github.com/babel/babel/blob/fce35af69101c6b316557e28abf60bdbf77d6a36/packages/babel-types/src/validators/isValidIdentifier.ts#L7 +// Use this function instead of `require('@babel/types').isIdentifier`, since `@babel/helper-validator-identifier` package is much smaller +const isValidIdentifier = name => + typeof name === 'string' + && !isKeyword(name) + && !isStrictReservedWord(name, true) + && isIdentifierName(name) + && name !== 'arguments' + && !typescriptReservedWords.has(name); + +/* +Unresolved reference is probably from the global scope. We should avoid using that name. + +For example, like `foo` and `bar` below. + +``` +function unicorn() { + return foo; +} + +function unicorn() { + return function() { + return bar; + }; +} +``` +*/ +const isUnresolvedName = (name, scope) => + getReferences(scope).some(({identifier, resolved}) => identifier?.name === name && !resolved); + +const isSafeName = (name, scopes) => + !scopes.some(scope => resolveVariableName(name, scope) || isUnresolvedName(name, scope)); + +const alwaysTrue = () => true; + +/** +Rule-specific name check function. + +@callback isSafe +@param {string} name - The generated candidate name. +@param {Scope[]} scopes - The same list of scopes you pass to `avoidCapture`. +@returns {boolean} - `true` if the `name` is ok. +*/ + +/** +Generates a unique name prefixed with `name` such that: +- it is not defined in any of the `scopes`, +- it is not a reserved word, +- it is not `arguments` in strict scopes (where `arguments` is not allowed), +- it does not collide with the actual `arguments` (which is always defined in function scopes). + +Useful when you want to rename a variable (or create a new variable) while being sure not to shadow any other variables in the code. + +@param {string} name - The desired name for a new variable. +@param {Scope[]} scopes - The list of scopes the new variable will be referenced in. +@param {isSafe} [isSafe] - Rule-specific name check function. +@returns {string} - Either `name` as is, or a string like `${name}_` suffixed with underscores to make the name unique. +*/ +module.exports = function avoidCapture(name, scopes, isSafe = alwaysTrue) { + if (!isValidIdentifier(name)) { + name += '_'; + + if (!isValidIdentifier(name)) { + return; + } + } + + while (!isSafeName(name, scopes) || !isSafe(name, scopes)) { + name += '_'; + } + + return name; +}; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/boolean.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/boolean.js new file mode 100644 index 0000000000000000000000000000000000000000..41ebdaab12dcac97b3b205306486acf6483d16b0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/boolean.js @@ -0,0 +1,92 @@ +'use strict'; + +const isLogicalExpression = require('./is-logical-expression.js'); + +const isLogicNot = node => node?.type === 'UnaryExpression' && node.operator === '!'; +const isLogicNotArgument = node => isLogicNot(node.parent) && node.parent.argument === node; +const isBooleanCallArgument = node => isBooleanCall(node.parent) && node.parent.arguments[0] === node; +const isBooleanCall = node => + node?.type === 'CallExpression' + && node.callee.type === 'Identifier' + && node.callee.name === 'Boolean' + && node.arguments.length === 1; +const isVueBooleanAttributeValue = node => + node?.type === 'VExpressionContainer' + && node.parent.type === 'VAttribute' + && node.parent.directive + && node.parent.value === node + && node.parent.key.type === 'VDirectiveKey' + && node.parent.key.name.type === 'VIdentifier' + && ( + node.parent.key.name.rawName === 'if' + || node.parent.key.name.rawName === 'else-if' + || node.parent.key.name.rawName === 'show' + ); + +/** +Check if the value of node is a `boolean`. + +@param {Node} node +@returns {boolean} +*/ +function isBooleanNode(node) { + if ( + isLogicNot(node) + || isLogicNotArgument(node) + || isBooleanCall(node) + || isBooleanCallArgument(node) + ) { + return true; + } + + const {parent} = node; + if (isVueBooleanAttributeValue(parent)) { + return true; + } + + if ( + ( + parent.type === 'IfStatement' + || parent.type === 'ConditionalExpression' + || parent.type === 'WhileStatement' + || parent.type === 'DoWhileStatement' + || parent.type === 'ForStatement' + ) + && parent.test === node + ) { + return true; + } + + if (isLogicalExpression(parent)) { + return isBooleanNode(parent); + } + + return false; +} + +/** +Get the boolean type-casting ancestor. + +@typedef {{ node: Node, isNegative: boolean }} Result + +@param {Node} node +@returns {Result} +*/ +function getBooleanAncestor(node) { + let isNegative = false; + // eslint-disable-next-line no-constant-condition + while (true) { + if (isLogicNotArgument(node)) { + isNegative = !isNegative; + node = node.parent; + } else if (isBooleanCallArgument(node)) { + node = node.parent; + } else { + break; + } + } + + return {node, isNegative}; +} + +module.exports = {isBooleanNode, getBooleanAncestor}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/builtins.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/builtins.js new file mode 100644 index 0000000000000000000000000000000000000000..14c3dd8b2570ca6f4640e124f9638cd9603cf790 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/builtins.js @@ -0,0 +1,36 @@ +'use strict'; +const typedArray = require('../shared/typed-array.js'); + +const enforceNew = [ + 'Object', + 'Array', + 'ArrayBuffer', + 'DataView', + 'Date', + 'Error', + 'Function', + 'Map', + 'WeakMap', + 'Set', + 'WeakSet', + 'Promise', + 'RegExp', + 'SharedArrayBuffer', + 'Proxy', + 'WeakRef', + 'FinalizationRegistry', + ...typedArray, +]; + +const disallowNew = [ + 'BigInt', + 'Boolean', + 'Number', + 'String', + 'Symbol', +]; + +module.exports = { + enforceNew, + disallowNew, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/cartesian-product-samples.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/cartesian-product-samples.js new file mode 100644 index 0000000000000000000000000000000000000000..e20926b2654859df086e2f571b1f24a693309f0f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/cartesian-product-samples.js @@ -0,0 +1,24 @@ +'use strict'; + +module.exports = function cartesianProductSamples(combinations, length = Number.POSITIVE_INFINITY) { + const total = combinations.reduce((total, {length}) => total * length, 1); + + const samples = Array.from({length: Math.min(total, length)}, (_, sampleIndex) => { + let indexRemaining = sampleIndex; + const combination = []; + for (let combinationIndex = combinations.length - 1; combinationIndex >= 0; combinationIndex--) { + const items = combinations[combinationIndex]; + const {length} = items; + const index = indexRemaining % length; + indexRemaining = (indexRemaining - index) / length; + combination.unshift(items[index]); + } + + return combination; + }); + + return { + total, + samples, + }; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/create-deprecated-rules.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/create-deprecated-rules.js new file mode 100644 index 0000000000000000000000000000000000000000..0505583a9f8707acc9f3b55ca9d899f6483e9378 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/create-deprecated-rules.js @@ -0,0 +1,25 @@ +'use strict'; +const packageJson = require('../../package.json'); + +const repoUrl = 'https://github.com/sindresorhus/eslint-plugin-unicorn'; + +/** @returns {{ [ruleName: string]: import('eslint').Rule.RuleModule }} */ +function createDeprecatedRules(data) { + return Object.fromEntries( + Object.entries(data).map(([ruleId, replacedBy = []]) => [ + ruleId, + { + create: () => ({}), + meta: { + docs: { + url: `${repoUrl}/blob/v${packageJson.version}/docs/deprecated-rules.md#${ruleId}`, + }, + deprecated: true, + replacedBy: Array.isArray(replacedBy) ? replacedBy : [replacedBy], + }, + }, + ]), + ); +} + +module.exports = createDeprecatedRules; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/escape-string.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/escape-string.js new file mode 100644 index 0000000000000000000000000000000000000000..06c4ff04bbad95f769332ab0bf55906524ce3a09 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/escape-string.js @@ -0,0 +1,26 @@ +'use strict'; + +const jsesc = require('jsesc'); + +/** +Escape string and wrap the result in quotes. + +@param {string} string - The string to be quoted. +@param {string} [quote] - The quote character. +@returns {string} - The quoted and escaped string. +*/ +module.exports = function escapeString(string, quote = '\'') { + /* c8 ignore start */ + if (typeof string !== 'string') { + throw new TypeError('Unexpected string.'); + } + /* c8 ignore end */ + + return jsesc(string, { + quotes: quote === '"' ? 'double' : 'single', + wrap: true, + es6: true, + minimal: true, + lowercaseHex: false, + }); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/escape-template-element-raw.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/escape-template-element-raw.js new file mode 100644 index 0000000000000000000000000000000000000000..8612a449fc19d2c58bd894da7a2ce394e53e287d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/escape-template-element-raw.js @@ -0,0 +1,7 @@ +'use strict'; + +const escapeTemplateElementRaw = string => string.replaceAll( + /(?<=(?:^|[^\\])(?:\\\\)*)(?(?:`|\$(?={)))/g, + String.raw`\$`, +); +module.exports = escapeTemplateElementRaw; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-ancestor.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-ancestor.js new file mode 100644 index 0000000000000000000000000000000000000000..fe2fb243a40a22235684a42be161420ee14230e7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-ancestor.js @@ -0,0 +1,20 @@ +'use strict'; + +// TODO: Support more types +function getPredicate(options) { + if (typeof options === 'string') { + return node => node.type === options; + } +} + +function getAncestor(node, options) { + const predicate = getPredicate(options); + + for (;node.parent; node = node.parent) { + if (predicate(node)) { + return node; + } + } +} + +module.exports = getAncestor; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-builtin-rule.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-builtin-rule.js new file mode 100644 index 0000000000000000000000000000000000000000..028674fe9e0d66690e3473a35ac67f412723fdf1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-builtin-rule.js @@ -0,0 +1,7 @@ +'use strict'; + +function getBuiltinRule(id) { + return require('eslint/use-at-your-own-risk').builtinRules.get(id); +} + +module.exports = getBuiltinRule; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-call-expression-arguments-text.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-call-expression-arguments-text.js new file mode 100644 index 0000000000000000000000000000000000000000..b84655be492b75051280211da4e45c8b520b1bf7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-call-expression-arguments-text.js @@ -0,0 +1,26 @@ +'use strict'; +const getCallExpressionTokens = require('./get-call-expression-tokens.js'); + +/** @typedef {import('estree').CallExpression} CallExpression */ + +/** +Get the text of the arguments list of `CallExpression`. + +@param {import('eslint').SourceCode} sourceCode - The source code object. +@param {CallExpression} callExpression - The `CallExpression` node. +@param {SourceCode} sourceCode - The source code object. +@returns {string} +*/ +function getCallExpressionArgumentsText(sourceCode, callExpression) { + const { + openingParenthesisToken, + closingParenthesisToken, + } = getCallExpressionTokens(sourceCode, callExpression); + + return sourceCode.text.slice( + openingParenthesisToken.range[1], + closingParenthesisToken.range[0], + ); +} + +module.exports = getCallExpressionArgumentsText; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-call-expression-tokens.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-call-expression-tokens.js new file mode 100644 index 0000000000000000000000000000000000000000..81b2cb51374f6efd77caaa174b88d93a5bcd6e92 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-call-expression-tokens.js @@ -0,0 +1,37 @@ +'use strict'; + +const { + isOpeningParenToken, + isCommaToken, +} = require('@eslint-community/eslint-utils'); + +/** @typedef {import('estree').CallExpression} CallExpression */ +/** @typedef {import('eslint').AST.Token} Token */ + +/** +Get the `openingParenthesisToken`, `closingParenthesisToken`, and `trailingCommaToken` of `CallExpression`. + +@param {import('eslint').SourceCode} sourceCode - The source code object. +@param {CallExpression} callExpression - The `CallExpression` node. +@returns {{ + openingParenthesisToken: Token, + closingParenthesisToken: Token, + trailingCommaToken: Token | undefined, +}} +*/ +function getCallExpressionTokens(sourceCode, callExpression) { + const openingParenthesisToken = sourceCode.getTokenAfter(callExpression.callee, isOpeningParenToken); + const [ + penultimateToken, + closingParenthesisToken, + ] = sourceCode.getLastTokens(callExpression, 2); + const trailingCommaToken = isCommaToken(penultimateToken) ? penultimateToken : undefined; + + return { + openingParenthesisToken, + closingParenthesisToken, + trailingCommaToken, + }; +} + +module.exports = getCallExpressionTokens; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-class-head-location.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-class-head-location.js new file mode 100644 index 0000000000000000000000000000000000000000..557edf2f16adff4a1fbbb540ac01263253eb30cb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-class-head-location.js @@ -0,0 +1,22 @@ +'use strict'; + +/** +@typedef {line: number, column: number} Position + +Get the location of the given class node for reporting. + +@param {Node} node - The class node to get. +@param {SourceCode} sourceCode - The source code object to get tokens. +@returns {{start: Position, end: Position}} The location of the class node for reporting. +*/ +function getClassHeadLocation(node, sourceCode) { + const {loc, body} = node; + const tokenBeforeBody = sourceCode.getTokenBefore(body); + + const {start} = loc; + const {end} = tokenBeforeBody.loc; + + return {start, end}; +} + +module.exports = getClassHeadLocation; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-documentation-url.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-documentation-url.js new file mode 100644 index 0000000000000000000000000000000000000000..0b1c9738f7379ac0441be2c7e07023b6e65f30d9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-documentation-url.js @@ -0,0 +1,10 @@ +'use strict'; +const path = require('node:path'); +const packageJson = require('../../package.json'); + +const repoUrl = 'https://github.com/sindresorhus/eslint-plugin-unicorn'; + +module.exports = function getDocumentationUrl(filename) { + const ruleName = path.basename(filename, '.js'); + return `${repoUrl}/blob/v${packageJson.version}/docs/rules/${ruleName}.md`; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-indent-string.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-indent-string.js new file mode 100644 index 0000000000000000000000000000000000000000..7f7deb449064e858e3986b220f130cd93c1f4012 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-indent-string.js @@ -0,0 +1,11 @@ +'use strict'; + +function getIndentString(node, sourceCode) { + const {line, column} = sourceCode.getLocFromIndex(node.range[0]); + const lines = sourceCode.getLines(); + const before = lines[line - 1].slice(0, column); + + return before.match(/\s*$/)[0]; +} + +module.exports = getIndentString; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-previous-node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-previous-node.js new file mode 100644 index 0000000000000000000000000000000000000000..2a364b4b16a9335c73b1c9bf68bda7f272847ed7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-previous-node.js @@ -0,0 +1,24 @@ +'use strict'; + +function getPreviousNode(node, sourceCode) { + const {parent} = node; + const visitorKeys = sourceCode.visitorKeys[parent.type] || Object.keys(parent); + + for (const property of visitorKeys) { + const value = parent[property]; + + if (value === node) { + return; + } + + if (Array.isArray(value)) { + const index = value.indexOf(node); + + if (index !== -1) { + return value[index - 1]; + } + } + } +} + +module.exports = getPreviousNode; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-references.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-references.js new file mode 100644 index 0000000000000000000000000000000000000000..4effcfb1e65d2f542e4992f091288e4a60a659a5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-references.js @@ -0,0 +1,9 @@ +'use strict'; + +const getScopes = require('./get-scopes.js'); + +const getReferences = scope => [...new Set( + getScopes(scope).flatMap(({references}) => references), +)]; + +module.exports = getReferences; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-scopes.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-scopes.js new file mode 100644 index 0000000000000000000000000000000000000000..fff2fdca4be5427ab9fddc8feb6e650fb9d9e3c3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-scopes.js @@ -0,0 +1,14 @@ +'use strict'; + +/** +Gather a list of all Scopes starting recursively from the input Scope. + +@param {Scope} scope - The Scope to start checking from. +@returns {Scope[]} - The resulting Scopes. +*/ +const getScopes = scope => [ + scope, + ...scope.childScopes.flatMap(scope => getScopes(scope)), +]; + +module.exports = getScopes; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-switch-case-head-location.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-switch-case-head-location.js new file mode 100644 index 0000000000000000000000000000000000000000..051ee8fb98ad5ce76dfba6c9a3e744d225e4c7ea --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-switch-case-head-location.js @@ -0,0 +1,21 @@ +'use strict'; + +const {isColonToken} = require('@eslint-community/eslint-utils'); + +/** +@typedef {line: number, column: number} Position + +Get the location of the given `SwitchCase` node for reporting. + +@param {Node} node - The `SwitchCase` node to get. +@param {SourceCode} sourceCode - The source code object to get tokens from. +@returns {{start: Position, end: Position}} The location of the class node for reporting. +*/ +function getSwitchCaseHeadLocation(node, sourceCode) { + const startToken = node.test || sourceCode.getFirstToken(node); + const colonToken = sourceCode.getTokenAfter(startToken, isColonToken); + + return {start: node.loc.start, end: colonToken.loc.end}; +} + +module.exports = getSwitchCaseHeadLocation; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-variable-identifiers.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-variable-identifiers.js new file mode 100644 index 0000000000000000000000000000000000000000..816d5e6b40c4a78404d88f716bfa0b180ecaf961 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/get-variable-identifiers.js @@ -0,0 +1,8 @@ +'use strict'; + +// Get identifiers of given variable +const getVariableIdentifiers = ({identifiers, references}) => [...new Set([ + ...identifiers, + ...references.map(({identifier}) => identifier), +])]; +module.exports = getVariableIdentifiers; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/global-reference-tracker.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/global-reference-tracker.js new file mode 100644 index 0000000000000000000000000000000000000000..5b873ef52cb2dfd2814d42a02492617b9fa70aeb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/global-reference-tracker.js @@ -0,0 +1,72 @@ +'use strict'; +const {ReferenceTracker} = require('@eslint-community/eslint-utils'); + +const createTraceMap = (object, type) => { + let map = {[type]: true}; + + const path = object.split('.').reverse(); + for (const name of path) { + map = {[name]: map}; + } + + return map; +}; + +class GlobalReferenceTracker { + #traceMap = {}; + #filter; + #handle; + + constructor({ + object, + objects = [object], + filter, + handle, + type = ReferenceTracker.READ, + }) { + for (const object of objects) { + Object.assign(this.#traceMap, createTraceMap(object, type)); + } + + this.#filter = filter; + this.#handle = handle; + } + + * track(globalScope) { + const tracker = new ReferenceTracker(globalScope); + + for (const reference of tracker.iterateGlobalReferences(this.#traceMap)) { + if (this.#filter && !this.#filter(reference)) { + continue; + } + + const problems = this.#handle(reference); + + if (!problems) { + continue; + } + + if (problems[Symbol.iterator]) { + yield * problems; + } else { + yield problems; + } + } + } + + createListeners(context) { + return { + 'Program:exit': program => this.track(context.sourceCode.getScope(program)), + }; + } +} + +Object.assign(GlobalReferenceTracker, { + READ: ReferenceTracker.READ, + CALL: ReferenceTracker.CALL, + CONSTRUCT: ReferenceTracker.CONSTRUCT, +}); + +module.exports = { + GlobalReferenceTracker, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/has-optional-chain-element.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/has-optional-chain-element.js new file mode 100644 index 0000000000000000000000000000000000000000..4b639d4dde29acf1b040366a956bf516a1608d71 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/has-optional-chain-element.js @@ -0,0 +1,21 @@ +'use strict'; + +const isChainElement = node => node.type === 'MemberExpression' || node.type === 'CallExpression'; + +function hasOptionalChainElement(node) { + if (!isChainElement(node)) { + return false; + } + + if (node.optional) { + return true; + } + + if (node.type === 'MemberExpression') { + return hasOptionalChainElement(node.object); + } + + return false; +} + +module.exports = hasOptionalChainElement; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/has-same-range.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/has-same-range.js new file mode 100644 index 0000000000000000000000000000000000000000..7018ffc159b0221feb61634d36b7530868611920 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/has-same-range.js @@ -0,0 +1,8 @@ +'use strict'; + +const hasSameRange = (node1, node2) => + node1 + && node2 + && node1.range[0] === node2.range[0] + && node1.range[1] === node2.range[1]; +module.exports = hasSameRange; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8ca4f54ff43f67ab9b2982b49dbc836881d2adb8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/index.js @@ -0,0 +1,56 @@ +'use strict'; + +const { + isParenthesized, + getParenthesizedTimes, + getParentheses, + getParenthesizedRange, + getParenthesizedText, +} = require('./parentheses.js'); +const { + isArrayPrototypeProperty, + isObjectPrototypeProperty, +} = require('./array-or-object-prototype-property.js'); +const {isNodeMatches, isNodeMatchesNameOrPath} = require('./is-node-matches.js'); +const {isBooleanNode, getBooleanAncestor} = require('./boolean.js'); + +module.exports = { + avoidCapture: require('./avoid-capture.js'), + escapeString: require('./escape-string.js'), + getBooleanAncestor, + getCallExpressionArgumentsText: require('./get-call-expression-arguments-text.js'), + getCallExpressionTokens: require('./get-call-expression-tokens.js'), + getParentheses, + getParenthesizedRange, + getParenthesizedText, + getParenthesizedTimes, + getReferences: require('./get-references.js'), + getScopes: require('./get-scopes.js'), + getVariableIdentifiers: require('./get-variable-identifiers.js'), + hasOptionalChainElement: require('./has-optional-chain-element.js'), + isArrayPrototypeProperty, + isBooleanNode, + isFunctionSelfUsedInside: require('./is-function-self-used-inside.js'), + isLeftHandSide: require('./is-left-hand-side.js'), + isLogicalExpression: require('./is-logical-expression.js'), + isMethodNamed: require('./is-method-named.js'), + isNodeMatches, + isNodeMatchesNameOrPath, + isNodeValueNotDomNode: require('./is-node-value-not-dom-node.js'), + isNodeValueNotFunction: require('./is-node-value-not-function.js'), + isObjectPrototypeProperty, + isOnSameLine: require('./is-on-same-line.js'), + isParenthesized, + isSameIdentifier: require('./is-same-identifier.js'), + isSameReference: require('./is-same-reference.js'), + isShadowed: require('./is-shadowed.js'), + isValueNotUsable: require('./is-value-not-usable.js'), + needsSemicolon: require('./needs-semicolon.js'), + shouldAddParenthesesToMemberExpressionObject: require('./should-add-parentheses-to-member-expression-object.js'), + shouldAddParenthesesToCallExpressionCallee: require('./should-add-parentheses-to-call-expression-callee.js'), + shouldAddParenthesesToAwaitExpressionArgument: require('./should-add-parentheses-to-await-expression-argument.js'), + singular: require('./singular.js'), + toLocation: require('./to-location.js'), + getAncestor: require('./get-ancestor.js'), +}; + diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-function-self-used-inside.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-function-self-used-inside.js new file mode 100644 index 0000000000000000000000000000000000000000..7b62f5c8e49961f43024e164ff4c1c175a4cf938 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-function-self-used-inside.js @@ -0,0 +1,43 @@ +'use strict'; +const {findVariable} = require('@eslint-community/eslint-utils'); + +const getReferences = (scope, nodeOrName) => { + const {references = []} = findVariable(scope, nodeOrName) || {}; + return references; +}; + +/** +Check if `this`, `arguments`, or the function name is used inside of itself. + +@param {Node} functionNode - The function node. +@param {Scope} functionScope - The scope of the function node. +@returns {boolean} +*/ +function isFunctionSelfUsedInside(functionNode, functionScope) { + /* c8 ignore next 3 */ + if (functionScope.block !== functionNode) { + throw new Error('"functionScope" should be the scope of "functionNode".'); + } + + const {type, id} = functionNode; + + if (type === 'ArrowFunctionExpression') { + return false; + } + + if (functionScope.thisFound) { + return true; + } + + if (getReferences(functionScope, 'arguments').some(({from}) => from === functionScope)) { + return true; + } + + if (id && getReferences(functionScope, id).length > 0) { + return true; + } + + return false; +} + +module.exports = isFunctionSelfUsedInside; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-left-hand-side.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-left-hand-side.js new file mode 100644 index 0000000000000000000000000000000000000000..cc3ddb516c2c3a9e49f4de31ae4f2cee1065ef0c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-left-hand-side.js @@ -0,0 +1,22 @@ +'use strict'; + +const isLeftHandSide = node => + ( + (node.parent.type === 'AssignmentExpression' || node.parent.type === 'AssignmentPattern') + && node.parent.left === node + ) + || (node.parent.type === 'UpdateExpression' && node.parent.argument === node) + || (node.parent.type === 'ArrayPattern' && node.parent.elements.includes(node)) + || ( + node.parent.type === 'Property' + && node.parent.value === node + && node.parent.parent.type === 'ObjectPattern' + && node.parent.parent.properties.includes(node.parent) + ) + || ( + node.parent.type === 'UnaryExpression' + && node.parent.operator === 'delete' + && node.parent.argument === node + ); + +module.exports = isLeftHandSide; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-logical-expression.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-logical-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..a1632a99d1e5a08dc380e1a825bdc873d87d0d4a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-logical-expression.js @@ -0,0 +1,16 @@ +'use strict'; + +/** +Check if the given node is a true logical expression or not. + +The three binary expressions logical-or (`||`), logical-and (`&&`), and coalesce (`??`) are known as `ShortCircuitExpression`, but ESTree represents these by the `LogicalExpression` node type. This function rejects coalesce expressions of `LogicalExpression` node type. + +@param {Node} node - The node to check. +@returns {boolean} `true` if the node is `&&` or `||`. +@see https://tc39.es/ecma262/#prod-ShortCircuitExpression +*/ +const isLogicalExpression = node => + node?.type === 'LogicalExpression' + && (node.operator === '&&' || node.operator === '||'); + +module.exports = isLogicalExpression; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-method-named.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-method-named.js new file mode 100644 index 0000000000000000000000000000000000000000..d525b7c12a3497ec04bdf538122200cb004fb651 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-method-named.js @@ -0,0 +1,9 @@ +'use strict'; + +const isMethodNamed = (node, name) => + node.type === 'CallExpression' + && node.callee.type === 'MemberExpression' + && node.callee.property.type === 'Identifier' + && node.callee.property.name === name; + +module.exports = isMethodNamed; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-new-expression-with-parentheses.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-new-expression-with-parentheses.js new file mode 100644 index 0000000000000000000000000000000000000000..f4a29d3d9451f8d539f4751e5b278569417ef1ba --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-new-expression-with-parentheses.js @@ -0,0 +1,26 @@ +'use strict'; + +const {isOpeningParenToken, isClosingParenToken} = require('@eslint-community/eslint-utils'); + +/** +Determine if a constructor function is newed-up with parens. + +@param {Node} node - The `NewExpression` node to be checked. +@param {SourceCode} sourceCode - The source code object. +@returns {boolean} True if the constructor is called with parens. + +Copied from https://github.com/eslint/eslint/blob/cc4871369645c3409dc56ded7a555af8a9f63d51/lib/rules/no-extra-parens.js#L252 +*/ +function isNewExpressionWithParentheses(node, sourceCode) { + if (node.arguments.length > 0) { + return true; + } + + const [penultimateToken, lastToken] = sourceCode.getLastTokens(node, 2); + // The expression should end with its own parens, for example, `new new Foo()` is not a new expression with parens. + return isOpeningParenToken(penultimateToken) + && isClosingParenToken(lastToken) + && node.callee.range[1] < node.range[1]; +} + +module.exports = isNewExpressionWithParentheses; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-node-matches.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-node-matches.js new file mode 100644 index 0000000000000000000000000000000000000000..d79e355384741bfc9b4709a315045d25ada36c6a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-node-matches.js @@ -0,0 +1,53 @@ +'use strict'; + +/** +Check if node matches object name or key path. + +@param {Node} node - The AST node to check. +@param {string} nameOrPath - The object name or key path. +@returns {boolean} +*/ +function isNodeMatchesNameOrPath(node, nameOrPath) { + const names = nameOrPath.trim().split('.'); + for (let index = names.length - 1; index >= 0; index--) { + const name = names[index]; + if (!name) { + return false; + } + + if (index === 0) { + return ( + (node.type === 'Identifier' && node.name === name) + || (name === 'this' && node.type === 'ThisExpression') + ); + } + + if ( + node.type !== 'MemberExpression' + || node.optional + || node.computed + || node.property.type !== 'Identifier' + || node.property.name !== name + ) { + return false; + } + + node = node.object; + } +} + +/** +Check if node matches any object name or key path. + +@param {Node} node - The AST node to check. +@param {string[]} nameOrPaths - The object name or key paths. +@returns {boolean} +*/ +function isNodeMatches(node, nameOrPaths) { + return nameOrPaths.some(nameOrPath => isNodeMatchesNameOrPath(node, nameOrPath)); +} + +module.exports = { + isNodeMatchesNameOrPath, + isNodeMatches, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-dom-node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-dom-node.js new file mode 100644 index 0000000000000000000000000000000000000000..1e50a41de4ed0f438eb8fa15ed102337e8bd8dc5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-dom-node.js @@ -0,0 +1,21 @@ +'use strict'; +const {isUndefined} = require('../ast/index.js'); + +// AST Types: +// https://github.com/eslint/espree/blob/master/lib/ast-node-types.js#L18 +// Only types possible to be `callee` or `argument` are listed +const impossibleNodeTypes = new Set([ + 'ArrayExpression', + 'ArrowFunctionExpression', + 'ClassExpression', + 'FunctionExpression', + 'Literal', + 'ObjectExpression', + 'TemplateLiteral', +]); + +const isNodeValueNotDomNode = node => + impossibleNodeTypes.has(node.type) + || isUndefined(node); + +module.exports = isNodeValueNotDomNode; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-function.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-function.js new file mode 100644 index 0000000000000000000000000000000000000000..9b144be39a36989c548aee5c52c57d69d6c8239f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-function.js @@ -0,0 +1,41 @@ +'use strict'; +const {isUndefined, isCallExpression, isMethodCall} = require('../ast/index.js'); + +// AST Types: +// https://github.com/eslint/espree/blob/master/lib/ast-node-types.js#L18 +// Only types possible to be `argument` are listed +const impossibleNodeTypes = new Set([ + 'ArrayExpression', + 'BinaryExpression', + 'ClassExpression', + 'Literal', + 'ObjectExpression', + 'TemplateLiteral', + 'UnaryExpression', + 'UpdateExpression', +]); + +// Technically these nodes could be a function, but most likely not +const mostLikelyNotNodeTypes = new Set([ + 'AssignmentExpression', + 'AwaitExpression', + 'NewExpression', + 'TaggedTemplateExpression', + 'ThisExpression', +]); + +const isNodeValueNotFunction = node => ( + impossibleNodeTypes.has(node.type) + || mostLikelyNotNodeTypes.has(node.type) + || isUndefined(node) + || ( + isCallExpression(node) + && !(isMethodCall(node, { + method: 'bind', + optionalCall: false, + optionalMember: false, + })) + ) +); + +module.exports = isNodeValueNotFunction; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-number.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-number.js new file mode 100644 index 0000000000000000000000000000000000000000..2a641935a6d031259a9feeacd1eb155edebb2a04 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-number.js @@ -0,0 +1,224 @@ +'use strict'; +const {getStaticValue} = require('@eslint-community/eslint-utils'); +const {isNumberLiteral} = require('../ast/index.js'); + +const isStaticProperties = (node, object, properties) => + node.type === 'MemberExpression' + && !node.computed + && !node.optional + && node.object.type === 'Identifier' + && node.object.name === object + && node.property.type === 'Identifier' + && properties.has(node.property.name); +const isFunctionCall = (node, functionName) => node.type === 'CallExpression' + && !node.optional + && node.callee.type === 'Identifier' + && node.callee.name === functionName; + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math#static_properties +const mathProperties = new Set([ + 'E', + 'LN2', + 'LN10', + 'LOG2E', + 'LOG10E', + 'PI', + 'SQRT1_2', + 'SQRT2', +]); + +// `Math.{E,LN2,LN10,LOG2E,LOG10E,PI,SQRT1_2,SQRT2}` +const isMathProperty = node => isStaticProperties(node, 'Math', mathProperties); + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math#static_methods +const mathMethods = new Set([ + 'abs', + 'acos', + 'acosh', + 'asin', + 'asinh', + 'atan', + 'atanh', + 'atan2', + 'cbrt', + 'ceil', + 'clz32', + 'cos', + 'cosh', + 'exp', + 'expm1', + 'floor', + 'fround', + 'hypot', + 'imul', + 'log', + 'log1p', + 'log10', + 'log2', + 'max', + 'min', + 'pow', + 'random', + 'round', + 'sign', + 'sin', + 'sinh', + 'sqrt', + 'tan', + 'tanh', + 'trunc', +]); +// `Math.{abs, …, trunc}(…)` +const isMathMethodCall = node => + node.type === 'CallExpression' + && !node.optional + && isStaticProperties(node.callee, 'Math', mathMethods); + +// `Number(…)` +const isNumberCall = node => isFunctionCall(node, 'Number'); + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#static_properties +const numberProperties = new Set([ + 'EPSILON', + 'MAX_SAFE_INTEGER', + 'MAX_VALUE', + 'MIN_SAFE_INTEGER', + 'MIN_VALUE', + 'NaN', + 'NEGATIVE_INFINITY', + 'POSITIVE_INFINITY', +]); +const isNumberProperty = node => isStaticProperties(node, 'Number', numberProperties); + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#static_methods +const numberMethods = new Set([ + 'parseFloat', + 'parseInt', +]); +const isNumberMethodCall = node => + node.type === 'CallExpression' + && !node.optional + && isStaticProperties(node.callee, 'Number', numberMethods); +const isGlobalParseToNumberFunctionCall = node => isFunctionCall(node, 'parseInt') || isFunctionCall(node, 'parseFloat'); + +const isStaticNumber = (node, scope) => + typeof getStaticValue(node, scope)?.value === 'number'; + +const isLengthProperty = node => + node.type === 'MemberExpression' + && !node.computed + && !node.optional + && node.property.type === 'Identifier' + && node.property.name === 'length'; + +// `+` and `>>>` operators are handled separately +const mathOperators = new Set(['-', '*', '/', '%', '**', '<<', '>>', '|', '^', '&']); +function isNumber(node, scope) { + if ( + isNumberLiteral(node) + || isMathProperty(node) + || isMathMethodCall(node) + || isNumberCall(node) + || isNumberProperty(node) + || isNumberMethodCall(node) + || isGlobalParseToNumberFunctionCall(node) + || isLengthProperty(node) + ) { + return true; + } + + switch (node.type) { + case 'AssignmentExpression': { + const {operator} = node; + if (operator === '=' && isNumber(node.right, scope)) { + return true; + } + + // Fall through + } + + case 'BinaryExpression': { + let {operator} = node; + + if (node.type === 'AssignmentExpression') { + operator = operator.slice(0, -1); + } + + if (operator === '+' && isNumber(node.left, scope) && isNumber(node.right, scope)) { + return true; + } + + // `>>>` (zero-fill right shift) can't use on `BigInt` + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#operators + if (operator === '>>>') { + return true; + } + + // `a * b` can be `BigInt`, we need make sure at least one side is number + if (mathOperators.has(operator) && (isNumber(node.left, scope) || isNumber(node.right, scope))) { + return true; + } + + break; + } + + case 'UnaryExpression': { + const {operator} = node; + + // `+` can't use on `BigInt` + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#operators + if (operator === '+') { + return true; + } + + if ((operator === '-' || operator === '~') && isNumber(node.argument, scope)) { + return true; + } + + break; + } + + case 'UpdateExpression': { + if (isNumber(node.argument, scope)) { + return true; + } + + break; + } + + case 'ConditionalExpression': { + const isConsequentNumber = isNumber(node.consequent, scope); + const isAlternateNumber = isNumber(node.alternate, scope); + + if (isConsequentNumber && isAlternateNumber) { + return true; + } + + const testStaticValueResult = getStaticValue(node.test, scope); + if ( + testStaticValueResult !== null + && ( + (testStaticValueResult.value && isConsequentNumber) + || (!testStaticValueResult.value && isAlternateNumber) + ) + ) { + return true; + } + + break; + } + + case 'SequenceExpression': { + if (isNumber(node.expressions.at(-1), scope)) { + return true; + } + + break; + } + // No default + } + + return isStaticNumber(node, scope); +} + +module.exports = isNumber; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-object-method.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-object-method.js new file mode 100644 index 0000000000000000000000000000000000000000..f4df81a2dc431b6fd5b6a246e8ec7060d91f240c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-object-method.js @@ -0,0 +1,11 @@ +'use strict'; +module.exports = function isObjectMethod(node, object, method) { + const {callee} = node; + return ( + callee.type === 'MemberExpression' + && callee.object.type === 'Identifier' + && callee.object.name === object + && callee.property.type === 'Identifier' + && callee.property.name === method + ); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-on-same-line.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-on-same-line.js new file mode 100644 index 0000000000000000000000000000000000000000..4d369e1d336a21512c4d4b4ebbf695db0b2814b6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-on-same-line.js @@ -0,0 +1,7 @@ +'use strict'; + +function isOnSameLine(nodeOrTokenA, nodeOrTokenB) { + return nodeOrTokenA.loc.start.line === nodeOrTokenB.loc.start.line; +} + +module.exports = isOnSameLine; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-same-identifier.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-same-identifier.js new file mode 100644 index 0000000000000000000000000000000000000000..c3feb788b39e04e6a4f55b1833172a2689356f1f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-same-identifier.js @@ -0,0 +1,8 @@ +'use strict'; + +const isSameIdentifier = (nodeA, nodeB) => + nodeA.type === 'Identifier' + && nodeB.type === 'Identifier' + && nodeA.name === nodeB.name; + +module.exports = isSameIdentifier; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-same-reference.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-same-reference.js new file mode 100644 index 0000000000000000000000000000000000000000..e69502271f196cb1f3f96fdbc18463992c0e8cc8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-same-reference.js @@ -0,0 +1,173 @@ +'use strict'; +const {getStaticValue} = require('@eslint-community/eslint-utils'); + +// Copied from https://github.com/eslint/eslint/blob/94ba68d76a6940f68ff82eea7332c6505f93df76/lib/rules/utils/ast-utils.js#L392 + +/** +Gets the property name of a given node. +The node can be a MemberExpression, a Property, or a MethodDefinition. + +If the name is dynamic, this returns `null`. + +For examples: + + a.b // => "b" + a["b"] // => "b" + a['b'] // => "b" + a[`b`] // => "b" + a[100] // => "100" + a[b] // => null + a["a" + "b"] // => null + a[tag`b`] // => null + a[`${b}`] // => null + + let a = {b: 1} // => "b" + let a = {["b"]: 1} // => "b" + let a = {['b']: 1} // => "b" + let a = {[`b`]: 1} // => "b" + let a = {[100]: 1} // => "100" + let a = {[b]: 1} // => null + let a = {["a" + "b"]: 1} // => null + let a = {[tag`b`]: 1} // => null + let a = {[`${b}`]: 1} // => null +@param {ASTNode} node The node to get. +@returns {string|undefined} The property name if static. Otherwise, undefined. +*/ +function getStaticPropertyName(node) { + let property; + + switch (node?.type) { + case 'MemberExpression': { + property = node.property; + break; + } + + /* c8 ignore next 2 */ + case 'ChainExpression': { + return getStaticPropertyName(node.expression); + } + + // Only reachable when use this to get class/object member key + /* c8 ignore next */ + case 'Property': + case 'MethodDefinition': { + /* c8 ignore next 2 */ + property = node.key; + break; + } + + // No default + } + + if (property) { + if (property.type === 'Identifier' && !node.computed) { + return property.name; + } + + const staticResult = getStaticValue(property); + if (!staticResult) { + return; + } + + return String(staticResult.value); + } +} + +/** +Check if two literal nodes are the same value. +@param {ASTNode} left The Literal node to compare. +@param {ASTNode} right The other Literal node to compare. +@returns {boolean} `true` if the two literal nodes are the same value. +*/ +function equalLiteralValue(left, right) { + // RegExp literal. + if (left.regex || right.regex) { + return Boolean( + left.regex + && right.regex + && left.regex.pattern === right.regex.pattern + && left.regex.flags === right.regex.flags, + ); + } + + // BigInt literal. + if (left.bigint || right.bigint) { + return left.bigint === right.bigint; + } + + return left.value === right.value; +} + +/** +Check if two expressions reference the same value. For example: + a = a + a.b = a.b + a[0] = a[0] + a['b'] = a['b'] +@param {ASTNode} left The left side of the comparison. +@param {ASTNode} right The right side of the comparison. +@returns {boolean} `true` if both sides match and reference the same value. +*/ +function isSameReference(left, right) { + if (left.type !== right.type) { + // Handle `a.b` and `a?.b` are samely. + if (left.type === 'ChainExpression') { + return isSameReference(left.expression, right); + } + + if (right.type === 'ChainExpression') { + return isSameReference(left, right.expression); + } + + return false; + } + + switch (left.type) { + case 'Super': + case 'ThisExpression': { + return true; + } + + case 'Identifier': + case 'PrivateIdentifier': { + return left.name === right.name; + } + + case 'Literal': { + return equalLiteralValue(left, right); + } + + case 'ChainExpression': { + return isSameReference(left.expression, right.expression); + } + + case 'MemberExpression': { + const nameA = getStaticPropertyName(left); + + // `x.y = x["y"]` + if (nameA !== undefined) { + return ( + isSameReference(left.object, right.object) + && nameA === getStaticPropertyName(right) + ); + } + + /* + `x[0] = x[0]` + `x[y] = x[y]` + `x.y = x.y` + */ + return ( + left.computed === right.computed + && isSameReference(left.object, right.object) + && isSameReference(left.property, right.property) + ); + } + + default: { + return false; + } + } +} + +module.exports = isSameReference; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shadowed.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shadowed.js new file mode 100644 index 0000000000000000000000000000000000000000..982ab4051cd6a763aede44b6d493b295dc8bf591 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shadowed.js @@ -0,0 +1,33 @@ +'use strict'; + +/** + * Finds the eslint-scope reference in the given scope. + * @param {Object} scope The scope to search. + * @param {ASTNode} node The identifier node. + * @returns {Reference|undefined} Returns the found reference or null if none were found. + */ +function findReference(scope, node) { + const references = scope.references + .filter(reference => reference.identifier === node); + + if (references.length === 1) { + return references[0]; + } +} + +/** + * Checks if the given identifier node is shadowed in the given scope. + * @param {Object} scope The current scope. + * @param {string} node The identifier node to check + * @returns {boolean} Whether or not the name is shadowed. + */ +function isShadowed(scope, node) { + const reference = findReference(scope, node); + + return ( + Boolean(reference?.resolved) + && reference.resolved.defs.length > 0 + ); +} + +module.exports = isShadowed; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-export-local.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-export-local.js new file mode 100644 index 0000000000000000000000000000000000000000..c5d169f720f16e8d448f824547c7542711c70014 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-export-local.js @@ -0,0 +1,9 @@ +'use strict'; +const hasSameRange = require('./has-same-range.js'); + +const isShorthandExportLocal = node => { + const {type, local, exported} = node.parent; + return type === 'ExportSpecifier' && hasSameRange(local, exported) && local === node; +}; + +module.exports = isShorthandExportLocal; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-import-local.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-import-local.js new file mode 100644 index 0000000000000000000000000000000000000000..4983f0a9e88fd2e2ef2223027998fc3db3996c96 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-import-local.js @@ -0,0 +1,9 @@ +'use strict'; +const hasSameRange = require('./has-same-range.js'); + +const isShorthandImportLocal = node => { + const {type, local, imported} = node.parent; + return type === 'ImportSpecifier' && hasSameRange(local, imported) && local === node; +}; + +module.exports = isShorthandImportLocal; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-assignment-pattern-left.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-assignment-pattern-left.js new file mode 100644 index 0000000000000000000000000000000000000000..1fac489e637947c62cfd5d1407b40b575b254900 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-assignment-pattern-left.js @@ -0,0 +1,10 @@ +'use strict'; + +const isShorthandPropertyValue = require('./is-shorthand-property-value.js'); + +const isShorthandPropertyAssignmentPatternLeft = identifier => + identifier.parent.type === 'AssignmentPattern' + && identifier.parent.left === identifier + && isShorthandPropertyValue(identifier.parent); + +module.exports = isShorthandPropertyAssignmentPatternLeft; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-value.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-value.js new file mode 100644 index 0000000000000000000000000000000000000000..6814fff6a7548ce192b8ef2a693e33fe8de8662b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-value.js @@ -0,0 +1,8 @@ +'use strict'; + +const isShorthandPropertyValue = identifier => + identifier.parent.type === 'Property' + && identifier.parent.shorthand + && identifier === identifier.parent.value; + +module.exports = isShorthandPropertyValue; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-value-not-usable.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-value-not-usable.js new file mode 100644 index 0000000000000000000000000000000000000000..88c5df827f18504de6fae38c42a8ce7b5758d862 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/is-value-not-usable.js @@ -0,0 +1,6 @@ +'use strict'; + +const {isExpressionStatement} = require('../ast/index.js'); + +const isValueNotUsable = node => isExpressionStatement(node.parent); +module.exports = isValueNotUsable; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/lodash.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/lodash.js new file mode 100644 index 0000000000000000000000000000000000000000..9b4ba4ab89d5f8b6d009da0aa148ff25539a3666 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/lodash.js @@ -0,0 +1,1589 @@ +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// +var stdin_exports = {}; +__export(stdin_exports, { + camelCase: () => camelCase_default, + defaultsDeep: () => defaultsDeep_default, + kebabCase: () => kebabCase_default, + lowerFirst: () => lowerFirst_default, + snakeCase: () => snakeCase_default, + upperFirst: () => upperFirst_default +}); +module.exports = __toCommonJS(stdin_exports); + +// node_modules/lodash-es/_freeGlobal.js +var freeGlobal = typeof global == "object" && global && global.Object === Object && global; +var freeGlobal_default = freeGlobal; + +// node_modules/lodash-es/_root.js +var freeSelf = typeof self == "object" && self && self.Object === Object && self; +var root = freeGlobal_default || freeSelf || Function("return this")(); +var root_default = root; + +// node_modules/lodash-es/_Symbol.js +var Symbol2 = root_default.Symbol; +var Symbol_default = Symbol2; + +// node_modules/lodash-es/_getRawTag.js +var objectProto = Object.prototype; +var hasOwnProperty = objectProto.hasOwnProperty; +var nativeObjectToString = objectProto.toString; +var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0; +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; + try { + value[symToStringTag] = void 0; + var unmasked = true; + } catch (e) { + } + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} +var getRawTag_default = getRawTag; + +// node_modules/lodash-es/_objectToString.js +var objectProto2 = Object.prototype; +var nativeObjectToString2 = objectProto2.toString; +function objectToString(value) { + return nativeObjectToString2.call(value); +} +var objectToString_default = objectToString; + +// node_modules/lodash-es/_baseGetTag.js +var nullTag = "[object Null]"; +var undefinedTag = "[object Undefined]"; +var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0; +function baseGetTag(value) { + if (value == null) { + return value === void 0 ? undefinedTag : nullTag; + } + return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value); +} +var baseGetTag_default = baseGetTag; + +// node_modules/lodash-es/isObjectLike.js +function isObjectLike(value) { + return value != null && typeof value == "object"; +} +var isObjectLike_default = isObjectLike; + +// node_modules/lodash-es/isSymbol.js +var symbolTag = "[object Symbol]"; +function isSymbol(value) { + return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag; +} +var isSymbol_default = isSymbol; + +// node_modules/lodash-es/_arrayMap.js +function arrayMap(array, iteratee) { + var index = -1, length = array == null ? 0 : array.length, result = Array(length); + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} +var arrayMap_default = arrayMap; + +// node_modules/lodash-es/isArray.js +var isArray = Array.isArray; +var isArray_default = isArray; + +// node_modules/lodash-es/_baseToString.js +var INFINITY = 1 / 0; +var symbolProto = Symbol_default ? Symbol_default.prototype : void 0; +var symbolToString = symbolProto ? symbolProto.toString : void 0; +function baseToString(value) { + if (typeof value == "string") { + return value; + } + if (isArray_default(value)) { + return arrayMap_default(value, baseToString) + ""; + } + if (isSymbol_default(value)) { + return symbolToString ? symbolToString.call(value) : ""; + } + var result = value + ""; + return result == "0" && 1 / value == -INFINITY ? "-0" : result; +} +var baseToString_default = baseToString; + +// node_modules/lodash-es/isObject.js +function isObject(value) { + var type = typeof value; + return value != null && (type == "object" || type == "function"); +} +var isObject_default = isObject; + +// node_modules/lodash-es/identity.js +function identity(value) { + return value; +} +var identity_default = identity; + +// node_modules/lodash-es/isFunction.js +var asyncTag = "[object AsyncFunction]"; +var funcTag = "[object Function]"; +var genTag = "[object GeneratorFunction]"; +var proxyTag = "[object Proxy]"; +function isFunction(value) { + if (!isObject_default(value)) { + return false; + } + var tag = baseGetTag_default(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} +var isFunction_default = isFunction; + +// node_modules/lodash-es/_coreJsData.js +var coreJsData = root_default["__core-js_shared__"]; +var coreJsData_default = coreJsData; + +// node_modules/lodash-es/_isMasked.js +var maskSrcKey = function() { + var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; +}(); +function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; +} +var isMasked_default = isMasked; + +// node_modules/lodash-es/_toSource.js +var funcProto = Function.prototype; +var funcToString = funcProto.toString; +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) { + } + try { + return func + ""; + } catch (e) { + } + } + return ""; +} +var toSource_default = toSource; + +// node_modules/lodash-es/_baseIsNative.js +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +var reIsHostCtor = /^\[object .+?Constructor\]$/; +var funcProto2 = Function.prototype; +var objectProto3 = Object.prototype; +var funcToString2 = funcProto2.toString; +var hasOwnProperty2 = objectProto3.hasOwnProperty; +var reIsNative = RegExp( + "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" +); +function baseIsNative(value) { + if (!isObject_default(value) || isMasked_default(value)) { + return false; + } + var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource_default(value)); +} +var baseIsNative_default = baseIsNative; + +// node_modules/lodash-es/_getValue.js +function getValue(object, key) { + return object == null ? void 0 : object[key]; +} +var getValue_default = getValue; + +// node_modules/lodash-es/_getNative.js +function getNative(object, key) { + var value = getValue_default(object, key); + return baseIsNative_default(value) ? value : void 0; +} +var getNative_default = getNative; + +// node_modules/lodash-es/_baseCreate.js +var objectCreate = Object.create; +var baseCreate = function() { + function object() { + } + return function(proto) { + if (!isObject_default(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object(); + object.prototype = void 0; + return result; + }; +}(); +var baseCreate_default = baseCreate; + +// node_modules/lodash-es/_apply.js +function apply(func, thisArg, args) { + switch (args.length) { + case 0: + return func.call(thisArg); + case 1: + return func.call(thisArg, args[0]); + case 2: + return func.call(thisArg, args[0], args[1]); + case 3: + return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} +var apply_default = apply; + +// node_modules/lodash-es/_copyArray.js +function copyArray(source, array) { + var index = -1, length = source.length; + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} +var copyArray_default = copyArray; + +// node_modules/lodash-es/_shortOut.js +var HOT_COUNT = 800; +var HOT_SPAN = 16; +var nativeNow = Date.now; +function shortOut(func) { + var count = 0, lastCalled = 0; + return function() { + var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(void 0, arguments); + }; +} +var shortOut_default = shortOut; + +// node_modules/lodash-es/constant.js +function constant(value) { + return function() { + return value; + }; +} +var constant_default = constant; + +// node_modules/lodash-es/_defineProperty.js +var defineProperty = function() { + try { + var func = getNative_default(Object, "defineProperty"); + func({}, "", {}); + return func; + } catch (e) { + } +}(); +var defineProperty_default = defineProperty; + +// node_modules/lodash-es/_baseSetToString.js +var baseSetToString = !defineProperty_default ? identity_default : function(func, string) { + return defineProperty_default(func, "toString", { + "configurable": true, + "enumerable": false, + "value": constant_default(string), + "writable": true + }); +}; +var baseSetToString_default = baseSetToString; + +// node_modules/lodash-es/_setToString.js +var setToString = shortOut_default(baseSetToString_default); +var setToString_default = setToString; + +// node_modules/lodash-es/_isIndex.js +var MAX_SAFE_INTEGER = 9007199254740991; +var reIsUint = /^(?:0|[1-9]\d*)$/; +function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); +} +var isIndex_default = isIndex; + +// node_modules/lodash-es/_baseAssignValue.js +function baseAssignValue(object, key, value) { + if (key == "__proto__" && defineProperty_default) { + defineProperty_default(object, key, { + "configurable": true, + "enumerable": true, + "value": value, + "writable": true + }); + } else { + object[key] = value; + } +} +var baseAssignValue_default = baseAssignValue; + +// node_modules/lodash-es/eq.js +function eq(value, other) { + return value === other || value !== value && other !== other; +} +var eq_default = eq; + +// node_modules/lodash-es/_assignValue.js +var objectProto4 = Object.prototype; +var hasOwnProperty3 = objectProto4.hasOwnProperty; +function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty3.call(object, key) && eq_default(objValue, value)) || value === void 0 && !(key in object)) { + baseAssignValue_default(object, key, value); + } +} +var assignValue_default = assignValue; + +// node_modules/lodash-es/_copyObject.js +function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + var index = -1, length = props.length; + while (++index < length) { + var key = props[index]; + var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0; + if (newValue === void 0) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue_default(object, key, newValue); + } else { + assignValue_default(object, key, newValue); + } + } + return object; +} +var copyObject_default = copyObject; + +// node_modules/lodash-es/_overRest.js +var nativeMax = Math.max; +function overRest(func, start, transform) { + start = nativeMax(start === void 0 ? func.length - 1 : start, 0); + return function() { + var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply_default(func, this, otherArgs); + }; +} +var overRest_default = overRest; + +// node_modules/lodash-es/_baseRest.js +function baseRest(func, start) { + return setToString_default(overRest_default(func, start, identity_default), func + ""); +} +var baseRest_default = baseRest; + +// node_modules/lodash-es/isLength.js +var MAX_SAFE_INTEGER2 = 9007199254740991; +function isLength(value) { + return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2; +} +var isLength_default = isLength; + +// node_modules/lodash-es/isArrayLike.js +function isArrayLike(value) { + return value != null && isLength_default(value.length) && !isFunction_default(value); +} +var isArrayLike_default = isArrayLike; + +// node_modules/lodash-es/_isIterateeCall.js +function isIterateeCall(value, index, object) { + if (!isObject_default(object)) { + return false; + } + var type = typeof index; + if (type == "number" ? isArrayLike_default(object) && isIndex_default(index, object.length) : type == "string" && index in object) { + return eq_default(object[index], value); + } + return false; +} +var isIterateeCall_default = isIterateeCall; + +// node_modules/lodash-es/_createAssigner.js +function createAssigner(assigner) { + return baseRest_default(function(object, sources) { + var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0; + customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0; + if (guard && isIterateeCall_default(sources[0], sources[1], guard)) { + customizer = length < 3 ? void 0 : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); +} +var createAssigner_default = createAssigner; + +// node_modules/lodash-es/_isPrototype.js +var objectProto5 = Object.prototype; +function isPrototype(value) { + var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5; + return value === proto; +} +var isPrototype_default = isPrototype; + +// node_modules/lodash-es/_baseTimes.js +function baseTimes(n, iteratee) { + var index = -1, result = Array(n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} +var baseTimes_default = baseTimes; + +// node_modules/lodash-es/_baseIsArguments.js +var argsTag = "[object Arguments]"; +function baseIsArguments(value) { + return isObjectLike_default(value) && baseGetTag_default(value) == argsTag; +} +var baseIsArguments_default = baseIsArguments; + +// node_modules/lodash-es/isArguments.js +var objectProto6 = Object.prototype; +var hasOwnProperty4 = objectProto6.hasOwnProperty; +var propertyIsEnumerable = objectProto6.propertyIsEnumerable; +var isArguments = baseIsArguments_default(function() { + return arguments; +}()) ? baseIsArguments_default : function(value) { + return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); +}; +var isArguments_default = isArguments; + +// node_modules/lodash-es/stubFalse.js +function stubFalse() { + return false; +} +var stubFalse_default = stubFalse; + +// node_modules/lodash-es/isBuffer.js +var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; +var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; +var moduleExports = freeModule && freeModule.exports === freeExports; +var Buffer2 = moduleExports ? root_default.Buffer : void 0; +var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0; +var isBuffer = nativeIsBuffer || stubFalse_default; +var isBuffer_default = isBuffer; + +// node_modules/lodash-es/_baseIsTypedArray.js +var argsTag2 = "[object Arguments]"; +var arrayTag = "[object Array]"; +var boolTag = "[object Boolean]"; +var dateTag = "[object Date]"; +var errorTag = "[object Error]"; +var funcTag2 = "[object Function]"; +var mapTag = "[object Map]"; +var numberTag = "[object Number]"; +var objectTag = "[object Object]"; +var regexpTag = "[object RegExp]"; +var setTag = "[object Set]"; +var stringTag = "[object String]"; +var weakMapTag = "[object WeakMap]"; +var arrayBufferTag = "[object ArrayBuffer]"; +var dataViewTag = "[object DataView]"; +var float32Tag = "[object Float32Array]"; +var float64Tag = "[object Float64Array]"; +var int8Tag = "[object Int8Array]"; +var int16Tag = "[object Int16Array]"; +var int32Tag = "[object Int32Array]"; +var uint8Tag = "[object Uint8Array]"; +var uint8ClampedTag = "[object Uint8ClampedArray]"; +var uint16Tag = "[object Uint16Array]"; +var uint32Tag = "[object Uint32Array]"; +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; +function baseIsTypedArray(value) { + return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)]; +} +var baseIsTypedArray_default = baseIsTypedArray; + +// node_modules/lodash-es/_baseUnary.js +function baseUnary(func) { + return function(value) { + return func(value); + }; +} +var baseUnary_default = baseUnary; + +// node_modules/lodash-es/_nodeUtil.js +var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports; +var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module; +var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2; +var freeProcess = moduleExports2 && freeGlobal_default.process; +var nodeUtil = function() { + try { + var types = freeModule2 && freeModule2.require && freeModule2.require("util").types; + if (types) { + return types; + } + return freeProcess && freeProcess.binding && freeProcess.binding("util"); + } catch (e) { + } +}(); +var nodeUtil_default = nodeUtil; + +// node_modules/lodash-es/isTypedArray.js +var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray; +var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default; +var isTypedArray_default = isTypedArray; + +// node_modules/lodash-es/_arrayLikeKeys.js +var objectProto7 = Object.prototype; +var hasOwnProperty5 = objectProto7.hasOwnProperty; +function arrayLikeKeys(value, inherited) { + var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length; + for (var key in value) { + if ((inherited || hasOwnProperty5.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. + (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. + isIndex_default(key, length)))) { + result.push(key); + } + } + return result; +} +var arrayLikeKeys_default = arrayLikeKeys; + +// node_modules/lodash-es/_overArg.js +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} +var overArg_default = overArg; + +// node_modules/lodash-es/_nativeKeysIn.js +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} +var nativeKeysIn_default = nativeKeysIn; + +// node_modules/lodash-es/_baseKeysIn.js +var objectProto8 = Object.prototype; +var hasOwnProperty6 = objectProto8.hasOwnProperty; +function baseKeysIn(object) { + if (!isObject_default(object)) { + return nativeKeysIn_default(object); + } + var isProto = isPrototype_default(object), result = []; + for (var key in object) { + if (!(key == "constructor" && (isProto || !hasOwnProperty6.call(object, key)))) { + result.push(key); + } + } + return result; +} +var baseKeysIn_default = baseKeysIn; + +// node_modules/lodash-es/keysIn.js +function keysIn(object) { + return isArrayLike_default(object) ? arrayLikeKeys_default(object, true) : baseKeysIn_default(object); +} +var keysIn_default = keysIn; + +// node_modules/lodash-es/_nativeCreate.js +var nativeCreate = getNative_default(Object, "create"); +var nativeCreate_default = nativeCreate; + +// node_modules/lodash-es/_hashClear.js +function hashClear() { + this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {}; + this.size = 0; +} +var hashClear_default = hashClear; + +// node_modules/lodash-es/_hashDelete.js +function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} +var hashDelete_default = hashDelete; + +// node_modules/lodash-es/_hashGet.js +var HASH_UNDEFINED = "__lodash_hash_undefined__"; +var objectProto9 = Object.prototype; +var hasOwnProperty7 = objectProto9.hasOwnProperty; +function hashGet(key) { + var data = this.__data__; + if (nativeCreate_default) { + var result = data[key]; + return result === HASH_UNDEFINED ? void 0 : result; + } + return hasOwnProperty7.call(data, key) ? data[key] : void 0; +} +var hashGet_default = hashGet; + +// node_modules/lodash-es/_hashHas.js +var objectProto10 = Object.prototype; +var hasOwnProperty8 = objectProto10.hasOwnProperty; +function hashHas(key) { + var data = this.__data__; + return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty8.call(data, key); +} +var hashHas_default = hashHas; + +// node_modules/lodash-es/_hashSet.js +var HASH_UNDEFINED2 = "__lodash_hash_undefined__"; +function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value; + return this; +} +var hashSet_default = hashSet; + +// node_modules/lodash-es/_Hash.js +function Hash(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +Hash.prototype.clear = hashClear_default; +Hash.prototype["delete"] = hashDelete_default; +Hash.prototype.get = hashGet_default; +Hash.prototype.has = hashHas_default; +Hash.prototype.set = hashSet_default; +var Hash_default = Hash; + +// node_modules/lodash-es/_listCacheClear.js +function listCacheClear() { + this.__data__ = []; + this.size = 0; +} +var listCacheClear_default = listCacheClear; + +// node_modules/lodash-es/_assocIndexOf.js +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq_default(array[length][0], key)) { + return length; + } + } + return -1; +} +var assocIndexOf_default = assocIndexOf; + +// node_modules/lodash-es/_listCacheDelete.js +var arrayProto = Array.prototype; +var splice = arrayProto.splice; +function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf_default(data, key); + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; +} +var listCacheDelete_default = listCacheDelete; + +// node_modules/lodash-es/_listCacheGet.js +function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf_default(data, key); + return index < 0 ? void 0 : data[index][1]; +} +var listCacheGet_default = listCacheGet; + +// node_modules/lodash-es/_listCacheHas.js +function listCacheHas(key) { + return assocIndexOf_default(this.__data__, key) > -1; +} +var listCacheHas_default = listCacheHas; + +// node_modules/lodash-es/_listCacheSet.js +function listCacheSet(key, value) { + var data = this.__data__, index = assocIndexOf_default(data, key); + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} +var listCacheSet_default = listCacheSet; + +// node_modules/lodash-es/_ListCache.js +function ListCache(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +ListCache.prototype.clear = listCacheClear_default; +ListCache.prototype["delete"] = listCacheDelete_default; +ListCache.prototype.get = listCacheGet_default; +ListCache.prototype.has = listCacheHas_default; +ListCache.prototype.set = listCacheSet_default; +var ListCache_default = ListCache; + +// node_modules/lodash-es/_Map.js +var Map = getNative_default(root_default, "Map"); +var Map_default = Map; + +// node_modules/lodash-es/_mapCacheClear.js +function mapCacheClear() { + this.size = 0; + this.__data__ = { + "hash": new Hash_default(), + "map": new (Map_default || ListCache_default)(), + "string": new Hash_default() + }; +} +var mapCacheClear_default = mapCacheClear; + +// node_modules/lodash-es/_isKeyable.js +function isKeyable(value) { + var type = typeof value; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; +} +var isKeyable_default = isKeyable; + +// node_modules/lodash-es/_getMapData.js +function getMapData(map, key) { + var data = map.__data__; + return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; +} +var getMapData_default = getMapData; + +// node_modules/lodash-es/_mapCacheDelete.js +function mapCacheDelete(key) { + var result = getMapData_default(this, key)["delete"](key); + this.size -= result ? 1 : 0; + return result; +} +var mapCacheDelete_default = mapCacheDelete; + +// node_modules/lodash-es/_mapCacheGet.js +function mapCacheGet(key) { + return getMapData_default(this, key).get(key); +} +var mapCacheGet_default = mapCacheGet; + +// node_modules/lodash-es/_mapCacheHas.js +function mapCacheHas(key) { + return getMapData_default(this, key).has(key); +} +var mapCacheHas_default = mapCacheHas; + +// node_modules/lodash-es/_mapCacheSet.js +function mapCacheSet(key, value) { + var data = getMapData_default(this, key), size = data.size; + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; +} +var mapCacheSet_default = mapCacheSet; + +// node_modules/lodash-es/_MapCache.js +function MapCache(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +MapCache.prototype.clear = mapCacheClear_default; +MapCache.prototype["delete"] = mapCacheDelete_default; +MapCache.prototype.get = mapCacheGet_default; +MapCache.prototype.has = mapCacheHas_default; +MapCache.prototype.set = mapCacheSet_default; +var MapCache_default = MapCache; + +// node_modules/lodash-es/toString.js +function toString(value) { + return value == null ? "" : baseToString_default(value); +} +var toString_default = toString; + +// node_modules/lodash-es/_getPrototype.js +var getPrototype = overArg_default(Object.getPrototypeOf, Object); +var getPrototype_default = getPrototype; + +// node_modules/lodash-es/isPlainObject.js +var objectTag2 = "[object Object]"; +var funcProto3 = Function.prototype; +var objectProto11 = Object.prototype; +var funcToString3 = funcProto3.toString; +var hasOwnProperty9 = objectProto11.hasOwnProperty; +var objectCtorString = funcToString3.call(Object); +function isPlainObject(value) { + if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag2) { + return false; + } + var proto = getPrototype_default(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty9.call(proto, "constructor") && proto.constructor; + return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString; +} +var isPlainObject_default = isPlainObject; + +// node_modules/lodash-es/_baseSlice.js +function baseSlice(array, start, end) { + var index = -1, length = array.length; + if (start < 0) { + start = -start > length ? 0 : length + start; + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : end - start >>> 0; + start >>>= 0; + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} +var baseSlice_default = baseSlice; + +// node_modules/lodash-es/_castSlice.js +function castSlice(array, start, end) { + var length = array.length; + end = end === void 0 ? length : end; + return !start && end >= length ? array : baseSlice_default(array, start, end); +} +var castSlice_default = castSlice; + +// node_modules/lodash-es/_hasUnicode.js +var rsAstralRange = "\\ud800-\\udfff"; +var rsComboMarksRange = "\\u0300-\\u036f"; +var reComboHalfMarksRange = "\\ufe20-\\ufe2f"; +var rsComboSymbolsRange = "\\u20d0-\\u20ff"; +var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; +var rsVarRange = "\\ufe0e\\ufe0f"; +var rsZWJ = "\\u200d"; +var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]"); +function hasUnicode(string) { + return reHasUnicode.test(string); +} +var hasUnicode_default = hasUnicode; + +// node_modules/lodash-es/_asciiToArray.js +function asciiToArray(string) { + return string.split(""); +} +var asciiToArray_default = asciiToArray; + +// node_modules/lodash-es/_unicodeToArray.js +var rsAstralRange2 = "\\ud800-\\udfff"; +var rsComboMarksRange2 = "\\u0300-\\u036f"; +var reComboHalfMarksRange2 = "\\ufe20-\\ufe2f"; +var rsComboSymbolsRange2 = "\\u20d0-\\u20ff"; +var rsComboRange2 = rsComboMarksRange2 + reComboHalfMarksRange2 + rsComboSymbolsRange2; +var rsVarRange2 = "\\ufe0e\\ufe0f"; +var rsAstral = "[" + rsAstralRange2 + "]"; +var rsCombo = "[" + rsComboRange2 + "]"; +var rsFitz = "\\ud83c[\\udffb-\\udfff]"; +var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")"; +var rsNonAstral = "[^" + rsAstralRange2 + "]"; +var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}"; +var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]"; +var rsZWJ2 = "\\u200d"; +var reOptMod = rsModifier + "?"; +var rsOptVar = "[" + rsVarRange2 + "]?"; +var rsOptJoin = "(?:" + rsZWJ2 + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*"; +var rsSeq = rsOptVar + reOptMod + rsOptJoin; +var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; +var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); +function unicodeToArray(string) { + return string.match(reUnicode) || []; +} +var unicodeToArray_default = unicodeToArray; + +// node_modules/lodash-es/_stringToArray.js +function stringToArray(string) { + return hasUnicode_default(string) ? unicodeToArray_default(string) : asciiToArray_default(string); +} +var stringToArray_default = stringToArray; + +// node_modules/lodash-es/_createCaseFirst.js +function createCaseFirst(methodName) { + return function(string) { + string = toString_default(string); + var strSymbols = hasUnicode_default(string) ? stringToArray_default(string) : void 0; + var chr = strSymbols ? strSymbols[0] : string.charAt(0); + var trailing = strSymbols ? castSlice_default(strSymbols, 1).join("") : string.slice(1); + return chr[methodName]() + trailing; + }; +} +var createCaseFirst_default = createCaseFirst; + +// node_modules/lodash-es/upperFirst.js +var upperFirst = createCaseFirst_default("toUpperCase"); +var upperFirst_default = upperFirst; + +// node_modules/lodash-es/capitalize.js +function capitalize(string) { + return upperFirst_default(toString_default(string).toLowerCase()); +} +var capitalize_default = capitalize; + +// node_modules/lodash-es/_arrayReduce.js +function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, length = array == null ? 0 : array.length; + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; +} +var arrayReduce_default = arrayReduce; + +// node_modules/lodash-es/_basePropertyOf.js +function basePropertyOf(object) { + return function(key) { + return object == null ? void 0 : object[key]; + }; +} +var basePropertyOf_default = basePropertyOf; + +// node_modules/lodash-es/_deburrLetter.js +var deburredLetters = { + // Latin-1 Supplement block. + "\xC0": "A", + "\xC1": "A", + "\xC2": "A", + "\xC3": "A", + "\xC4": "A", + "\xC5": "A", + "\xE0": "a", + "\xE1": "a", + "\xE2": "a", + "\xE3": "a", + "\xE4": "a", + "\xE5": "a", + "\xC7": "C", + "\xE7": "c", + "\xD0": "D", + "\xF0": "d", + "\xC8": "E", + "\xC9": "E", + "\xCA": "E", + "\xCB": "E", + "\xE8": "e", + "\xE9": "e", + "\xEA": "e", + "\xEB": "e", + "\xCC": "I", + "\xCD": "I", + "\xCE": "I", + "\xCF": "I", + "\xEC": "i", + "\xED": "i", + "\xEE": "i", + "\xEF": "i", + "\xD1": "N", + "\xF1": "n", + "\xD2": "O", + "\xD3": "O", + "\xD4": "O", + "\xD5": "O", + "\xD6": "O", + "\xD8": "O", + "\xF2": "o", + "\xF3": "o", + "\xF4": "o", + "\xF5": "o", + "\xF6": "o", + "\xF8": "o", + "\xD9": "U", + "\xDA": "U", + "\xDB": "U", + "\xDC": "U", + "\xF9": "u", + "\xFA": "u", + "\xFB": "u", + "\xFC": "u", + "\xDD": "Y", + "\xFD": "y", + "\xFF": "y", + "\xC6": "Ae", + "\xE6": "ae", + "\xDE": "Th", + "\xFE": "th", + "\xDF": "ss", + // Latin Extended-A block. + "\u0100": "A", + "\u0102": "A", + "\u0104": "A", + "\u0101": "a", + "\u0103": "a", + "\u0105": "a", + "\u0106": "C", + "\u0108": "C", + "\u010A": "C", + "\u010C": "C", + "\u0107": "c", + "\u0109": "c", + "\u010B": "c", + "\u010D": "c", + "\u010E": "D", + "\u0110": "D", + "\u010F": "d", + "\u0111": "d", + "\u0112": "E", + "\u0114": "E", + "\u0116": "E", + "\u0118": "E", + "\u011A": "E", + "\u0113": "e", + "\u0115": "e", + "\u0117": "e", + "\u0119": "e", + "\u011B": "e", + "\u011C": "G", + "\u011E": "G", + "\u0120": "G", + "\u0122": "G", + "\u011D": "g", + "\u011F": "g", + "\u0121": "g", + "\u0123": "g", + "\u0124": "H", + "\u0126": "H", + "\u0125": "h", + "\u0127": "h", + "\u0128": "I", + "\u012A": "I", + "\u012C": "I", + "\u012E": "I", + "\u0130": "I", + "\u0129": "i", + "\u012B": "i", + "\u012D": "i", + "\u012F": "i", + "\u0131": "i", + "\u0134": "J", + "\u0135": "j", + "\u0136": "K", + "\u0137": "k", + "\u0138": "k", + "\u0139": "L", + "\u013B": "L", + "\u013D": "L", + "\u013F": "L", + "\u0141": "L", + "\u013A": "l", + "\u013C": "l", + "\u013E": "l", + "\u0140": "l", + "\u0142": "l", + "\u0143": "N", + "\u0145": "N", + "\u0147": "N", + "\u014A": "N", + "\u0144": "n", + "\u0146": "n", + "\u0148": "n", + "\u014B": "n", + "\u014C": "O", + "\u014E": "O", + "\u0150": "O", + "\u014D": "o", + "\u014F": "o", + "\u0151": "o", + "\u0154": "R", + "\u0156": "R", + "\u0158": "R", + "\u0155": "r", + "\u0157": "r", + "\u0159": "r", + "\u015A": "S", + "\u015C": "S", + "\u015E": "S", + "\u0160": "S", + "\u015B": "s", + "\u015D": "s", + "\u015F": "s", + "\u0161": "s", + "\u0162": "T", + "\u0164": "T", + "\u0166": "T", + "\u0163": "t", + "\u0165": "t", + "\u0167": "t", + "\u0168": "U", + "\u016A": "U", + "\u016C": "U", + "\u016E": "U", + "\u0170": "U", + "\u0172": "U", + "\u0169": "u", + "\u016B": "u", + "\u016D": "u", + "\u016F": "u", + "\u0171": "u", + "\u0173": "u", + "\u0174": "W", + "\u0175": "w", + "\u0176": "Y", + "\u0177": "y", + "\u0178": "Y", + "\u0179": "Z", + "\u017B": "Z", + "\u017D": "Z", + "\u017A": "z", + "\u017C": "z", + "\u017E": "z", + "\u0132": "IJ", + "\u0133": "ij", + "\u0152": "Oe", + "\u0153": "oe", + "\u0149": "'n", + "\u017F": "s" +}; +var deburrLetter = basePropertyOf_default(deburredLetters); +var deburrLetter_default = deburrLetter; + +// node_modules/lodash-es/deburr.js +var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; +var rsComboMarksRange3 = "\\u0300-\\u036f"; +var reComboHalfMarksRange3 = "\\ufe20-\\ufe2f"; +var rsComboSymbolsRange3 = "\\u20d0-\\u20ff"; +var rsComboRange3 = rsComboMarksRange3 + reComboHalfMarksRange3 + rsComboSymbolsRange3; +var rsCombo2 = "[" + rsComboRange3 + "]"; +var reComboMark = RegExp(rsCombo2, "g"); +function deburr(string) { + string = toString_default(string); + return string && string.replace(reLatin, deburrLetter_default).replace(reComboMark, ""); +} +var deburr_default = deburr; + +// node_modules/lodash-es/_asciiWords.js +var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; +function asciiWords(string) { + return string.match(reAsciiWord) || []; +} +var asciiWords_default = asciiWords; + +// node_modules/lodash-es/_hasUnicodeWord.js +var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; +function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); +} +var hasUnicodeWord_default = hasUnicodeWord; + +// node_modules/lodash-es/_unicodeWords.js +var rsAstralRange3 = "\\ud800-\\udfff"; +var rsComboMarksRange4 = "\\u0300-\\u036f"; +var reComboHalfMarksRange4 = "\\ufe20-\\ufe2f"; +var rsComboSymbolsRange4 = "\\u20d0-\\u20ff"; +var rsComboRange4 = rsComboMarksRange4 + reComboHalfMarksRange4 + rsComboSymbolsRange4; +var rsDingbatRange = "\\u2700-\\u27bf"; +var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff"; +var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7"; +var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf"; +var rsPunctuationRange = "\\u2000-\\u206f"; +var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000"; +var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde"; +var rsVarRange3 = "\\ufe0e\\ufe0f"; +var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; +var rsApos = "['\u2019]"; +var rsBreak = "[" + rsBreakRange + "]"; +var rsCombo3 = "[" + rsComboRange4 + "]"; +var rsDigits = "\\d+"; +var rsDingbat = "[" + rsDingbatRange + "]"; +var rsLower = "[" + rsLowerRange + "]"; +var rsMisc = "[^" + rsAstralRange3 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]"; +var rsFitz2 = "\\ud83c[\\udffb-\\udfff]"; +var rsModifier2 = "(?:" + rsCombo3 + "|" + rsFitz2 + ")"; +var rsNonAstral2 = "[^" + rsAstralRange3 + "]"; +var rsRegional2 = "(?:\\ud83c[\\udde6-\\uddff]){2}"; +var rsSurrPair2 = "[\\ud800-\\udbff][\\udc00-\\udfff]"; +var rsUpper = "[" + rsUpperRange + "]"; +var rsZWJ3 = "\\u200d"; +var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")"; +var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")"; +var rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?"; +var rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?"; +var reOptMod2 = rsModifier2 + "?"; +var rsOptVar2 = "[" + rsVarRange3 + "]?"; +var rsOptJoin2 = "(?:" + rsZWJ3 + "(?:" + [rsNonAstral2, rsRegional2, rsSurrPair2].join("|") + ")" + rsOptVar2 + reOptMod2 + ")*"; +var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])"; +var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])"; +var rsSeq2 = rsOptVar2 + reOptMod2 + rsOptJoin2; +var rsEmoji = "(?:" + [rsDingbat, rsRegional2, rsSurrPair2].join("|") + ")" + rsSeq2; +var reUnicodeWord = RegExp([ + rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")", + rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")", + rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower, + rsUpper + "+" + rsOptContrUpper, + rsOrdUpper, + rsOrdLower, + rsDigits, + rsEmoji +].join("|"), "g"); +function unicodeWords(string) { + return string.match(reUnicodeWord) || []; +} +var unicodeWords_default = unicodeWords; + +// node_modules/lodash-es/words.js +function words(string, pattern, guard) { + string = toString_default(string); + pattern = guard ? void 0 : pattern; + if (pattern === void 0) { + return hasUnicodeWord_default(string) ? unicodeWords_default(string) : asciiWords_default(string); + } + return string.match(pattern) || []; +} +var words_default = words; + +// node_modules/lodash-es/_createCompounder.js +var rsApos2 = "['\u2019]"; +var reApos = RegExp(rsApos2, "g"); +function createCompounder(callback) { + return function(string) { + return arrayReduce_default(words_default(deburr_default(string).replace(reApos, "")), callback, ""); + }; +} +var createCompounder_default = createCompounder; + +// node_modules/lodash-es/camelCase.js +var camelCase = createCompounder_default(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? capitalize_default(word) : word); +}); +var camelCase_default = camelCase; + +// node_modules/lodash-es/_stackClear.js +function stackClear() { + this.__data__ = new ListCache_default(); + this.size = 0; +} +var stackClear_default = stackClear; + +// node_modules/lodash-es/_stackDelete.js +function stackDelete(key) { + var data = this.__data__, result = data["delete"](key); + this.size = data.size; + return result; +} +var stackDelete_default = stackDelete; + +// node_modules/lodash-es/_stackGet.js +function stackGet(key) { + return this.__data__.get(key); +} +var stackGet_default = stackGet; + +// node_modules/lodash-es/_stackHas.js +function stackHas(key) { + return this.__data__.has(key); +} +var stackHas_default = stackHas; + +// node_modules/lodash-es/_stackSet.js +var LARGE_ARRAY_SIZE = 200; +function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache_default) { + var pairs = data.__data__; + if (!Map_default || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache_default(pairs); + } + data.set(key, value); + this.size = data.size; + return this; +} +var stackSet_default = stackSet; + +// node_modules/lodash-es/_Stack.js +function Stack(entries) { + var data = this.__data__ = new ListCache_default(entries); + this.size = data.size; +} +Stack.prototype.clear = stackClear_default; +Stack.prototype["delete"] = stackDelete_default; +Stack.prototype.get = stackGet_default; +Stack.prototype.has = stackHas_default; +Stack.prototype.set = stackSet_default; +var Stack_default = Stack; + +// node_modules/lodash-es/_cloneBuffer.js +var freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports; +var freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module; +var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3; +var Buffer3 = moduleExports3 ? root_default.Buffer : void 0; +var allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : void 0; +function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); + buffer.copy(result); + return result; +} +var cloneBuffer_default = cloneBuffer; + +// node_modules/lodash-es/_Uint8Array.js +var Uint8Array2 = root_default.Uint8Array; +var Uint8Array_default = Uint8Array2; + +// node_modules/lodash-es/_cloneArrayBuffer.js +function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer)); + return result; +} +var cloneArrayBuffer_default = cloneArrayBuffer; + +// node_modules/lodash-es/_cloneTypedArray.js +function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); +} +var cloneTypedArray_default = cloneTypedArray; + +// node_modules/lodash-es/_initCloneObject.js +function initCloneObject(object) { + return typeof object.constructor == "function" && !isPrototype_default(object) ? baseCreate_default(getPrototype_default(object)) : {}; +} +var initCloneObject_default = initCloneObject; + +// node_modules/lodash-es/_createBaseFor.js +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} +var createBaseFor_default = createBaseFor; + +// node_modules/lodash-es/_baseFor.js +var baseFor = createBaseFor_default(); +var baseFor_default = baseFor; + +// node_modules/lodash-es/_assignMergeValue.js +function assignMergeValue(object, key, value) { + if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) { + baseAssignValue_default(object, key, value); + } +} +var assignMergeValue_default = assignMergeValue; + +// node_modules/lodash-es/isArrayLikeObject.js +function isArrayLikeObject(value) { + return isObjectLike_default(value) && isArrayLike_default(value); +} +var isArrayLikeObject_default = isArrayLikeObject; + +// node_modules/lodash-es/_safeGet.js +function safeGet(object, key) { + if (key === "constructor" && typeof object[key] === "function") { + return; + } + if (key == "__proto__") { + return; + } + return object[key]; +} +var safeGet_default = safeGet; + +// node_modules/lodash-es/toPlainObject.js +function toPlainObject(value) { + return copyObject_default(value, keysIn_default(value)); +} +var toPlainObject_default = toPlainObject; + +// node_modules/lodash-es/_baseMergeDeep.js +function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet_default(object, key), srcValue = safeGet_default(source, key), stacked = stack.get(srcValue); + if (stacked) { + assignMergeValue_default(object, key, stacked); + return; + } + var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0; + var isCommon = newValue === void 0; + if (isCommon) { + var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue); + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray_default(objValue)) { + newValue = objValue; + } else if (isArrayLikeObject_default(objValue)) { + newValue = copyArray_default(objValue); + } else if (isBuff) { + isCommon = false; + newValue = cloneBuffer_default(srcValue, true); + } else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray_default(srcValue, true); + } else { + newValue = []; + } + } else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) { + newValue = objValue; + if (isArguments_default(objValue)) { + newValue = toPlainObject_default(objValue); + } else if (!isObject_default(objValue) || isFunction_default(objValue)) { + newValue = initCloneObject_default(srcValue); + } + } else { + isCommon = false; + } + } + if (isCommon) { + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack["delete"](srcValue); + } + assignMergeValue_default(object, key, newValue); +} +var baseMergeDeep_default = baseMergeDeep; + +// node_modules/lodash-es/_baseMerge.js +function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor_default(source, function(srcValue, key) { + stack || (stack = new Stack_default()); + if (isObject_default(srcValue)) { + baseMergeDeep_default(object, source, key, srcIndex, baseMerge, customizer, stack); + } else { + var newValue = customizer ? customizer(safeGet_default(object, key), srcValue, key + "", object, source, stack) : void 0; + if (newValue === void 0) { + newValue = srcValue; + } + assignMergeValue_default(object, key, newValue); + } + }, keysIn_default); +} +var baseMerge_default = baseMerge; + +// node_modules/lodash-es/_customDefaultsMerge.js +function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { + if (isObject_default(objValue) && isObject_default(srcValue)) { + stack.set(srcValue, objValue); + baseMerge_default(objValue, srcValue, void 0, customDefaultsMerge, stack); + stack["delete"](srcValue); + } + return objValue; +} +var customDefaultsMerge_default = customDefaultsMerge; + +// node_modules/lodash-es/mergeWith.js +var mergeWith = createAssigner_default(function(object, source, srcIndex, customizer) { + baseMerge_default(object, source, srcIndex, customizer); +}); +var mergeWith_default = mergeWith; + +// node_modules/lodash-es/defaultsDeep.js +var defaultsDeep = baseRest_default(function(args) { + args.push(void 0, customDefaultsMerge_default); + return apply_default(mergeWith_default, void 0, args); +}); +var defaultsDeep_default = defaultsDeep; + +// node_modules/lodash-es/kebabCase.js +var kebabCase = createCompounder_default(function(result, word, index) { + return result + (index ? "-" : "") + word.toLowerCase(); +}); +var kebabCase_default = kebabCase; + +// node_modules/lodash-es/lowerFirst.js +var lowerFirst = createCaseFirst_default("toLowerCase"); +var lowerFirst_default = lowerFirst; + +// node_modules/lodash-es/snakeCase.js +var snakeCase = createCompounder_default(function(result, word, index) { + return result + (index ? "_" : "") + word.toLowerCase(); +}); +var snakeCase_default = snakeCase; +/*! Bundled license information: + +lodash-es/lodash.js: + (** + * @license + * Lodash (Custom Build) + * Build: `lodash modularize exports="es" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + *) +*/ diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/needs-semicolon.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/needs-semicolon.js new file mode 100644 index 0000000000000000000000000000000000000000..044b9404de382f34243ca9fc5243e04f55ac3e76 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/needs-semicolon.js @@ -0,0 +1,114 @@ +'use strict'; + +// https://github.com/eslint/espree/blob/6b7d0b8100537dcd5c84a7fb17bbe28edcabe05d/lib/token-translator.js#L20 +const tokenTypesNeedsSemicolon = new Set([ + 'String', + 'Null', + 'Boolean', + 'Numeric', + 'RegularExpression', +]); + +const charactersMightNeedsSemicolon = new Set([ + '[', + '(', + '/', + '`', + '+', + '-', + '*', + ',', + '.', +]); + +/** +Determines if a semicolon needs to be inserted before `code`, in order to avoid a SyntaxError. + +@param {Token} tokenBefore Token before `code`. +@param {SourceCode} sourceCode +@param {String} [code] Code text to determine. +@returns {boolean} `true` if a semicolon needs to be inserted before `code`. +*/ + +function needsSemicolon(tokenBefore, sourceCode, code) { + if ( + code === '' + || (code && !charactersMightNeedsSemicolon.has(code.charAt(0))) + ) { + return false; + } + + if (!tokenBefore) { + return false; + } + + const {type, value, range} = tokenBefore; + const lastBlockNode = sourceCode.getNodeByRangeIndex(range[0]); + if (type === 'Punctuator') { + if (value === ';') { + return false; + } + + if (value === ']') { + return true; + } + + if (value === ')') { + switch (lastBlockNode.type) { + case 'IfStatement': { + if (sourceCode.getTokenBefore(lastBlockNode.consequent) === tokenBefore) { + return false; + } + + break; + } + + case 'ForStatement': + case 'ForInStatement': + case 'ForOfStatement': + case 'WhileStatement': + case 'DoWhileStatement': + case 'WithStatement': { + if (lastBlockNode.body && sourceCode.getTokenBefore(lastBlockNode.body) === tokenBefore) { + return false; + } + + break; + } + // No default + } + + return true; + } + } + + if (tokenTypesNeedsSemicolon.has(type)) { + return true; + } + + if (type === 'Template') { + return value.endsWith('`'); + } + + if (lastBlockNode.type === 'ObjectExpression') { + return true; + } + + if (type === 'Identifier') { + // `for...of` + if (value === 'of' && lastBlockNode.type === 'ForOfStatement') { + return false; + } + + // `await` + if (value === 'await' && lastBlockNode.type === 'AwaitExpression') { + return false; + } + + return true; + } + + return false; +} + +module.exports = needsSemicolon; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/numeric.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/numeric.js new file mode 100644 index 0000000000000000000000000000000000000000..02a2f402657ec63dfcd64b3ca94aed6ff59cc33b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/numeric.js @@ -0,0 +1,58 @@ +'use strict'; + +const {isNumberLiteral, isBigIntLiteral} = require('../ast/index.js'); + +// Determine whether this node is a decimal integer literal. +// Copied from https://github.com/eslint/eslint/blob/cc4871369645c3409dc56ded7a555af8a9f63d51/lib/rules/utils/ast-utils.js#L1237 +const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u; +const isDecimalInteger = text => DECIMAL_INTEGER_PATTERN.test(text); +const isDecimalIntegerNode = node => isNumberLiteral(node) && isDecimalInteger(node.raw); + +const isNumeric = node => isNumberLiteral(node) || isBigIntLiteral(node); +const isLegacyOctal = node => isNumberLiteral(node) && /^0\d+$/.test(node.raw); + +function getPrefix(text) { + let prefix = ''; + let data = text; + + if (/^0[box]/i.test(text)) { + prefix = text.slice(0, 2); + data = text.slice(2); + } + + return {prefix, data}; +} + +function parseNumber(text) { + const { + number, + mark = '', + sign = '', + power = '', + } = text.match(/^(?[\d._]*?)(?:(?[Ee])(?[+-])?(?[\d_]+))?$/).groups; + + return { + number, + mark, + sign, + power, + }; +} + +function parseFloatNumber(text) { + const parts = text.split('.'); + const [integer, fractional = ''] = parts; + const dot = parts.length === 2 ? '.' : ''; + + return {integer, dot, fractional}; +} + +module.exports = { + isDecimalIntegerNode, + isDecimalInteger, + isNumeric, + isLegacyOctal, + getPrefix, + parseNumber, + parseFloatNumber, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/parentheses.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/parentheses.js new file mode 100644 index 0000000000000000000000000000000000000000..a5443d41825a61e003e1b12ea9ee5a3691c6ab58 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/parentheses.js @@ -0,0 +1,73 @@ +'use strict'; +const {isParenthesized, isOpeningParenToken, isClosingParenToken} = require('@eslint-community/eslint-utils'); + +/* +Get how many times the node is parenthesized. + +@param {Node} node - The node to be checked. +@param {SourceCode} sourceCode - The source code object. +@returns {number} +*/ +function getParenthesizedTimes(node, sourceCode) { + let times = 0; + + while (isParenthesized(times + 1, node, sourceCode)) { + times++; + } + + return times; +} + +/* +Get all parentheses tokens around the node. + +@param {Node} node - The node to be checked. +@param {SourceCode} sourceCode - The source code object. +@returns {Token[]} +*/ +function getParentheses(node, sourceCode) { + const count = getParenthesizedTimes(node, sourceCode); + + if (count === 0) { + return []; + } + + return [ + ...sourceCode.getTokensBefore(node, {count, filter: isOpeningParenToken}), + ...sourceCode.getTokensAfter(node, {count, filter: isClosingParenToken}), + ]; +} + +/* +Get the parenthesized range of the node. + +@param {Node} node - The node to be checked. +@param {SourceCode} sourceCode - The source code object. +@returns {number[]} +*/ +function getParenthesizedRange(node, sourceCode) { + const parentheses = getParentheses(node, sourceCode); + const [start] = (parentheses[0] || node).range; + const [, end] = (parentheses.at(-1) || node).range; + return [start, end]; +} + +/* +Get the parenthesized text of the node. + +@param {Node} node - The node to be checked. +@param {SourceCode} sourceCode - The source code object. +@returns {string} +*/ +function getParenthesizedText(node, sourceCode) { + const [start, end] = getParenthesizedRange(node, sourceCode); + return sourceCode.text.slice(start, end); +} + +module.exports = { + isParenthesized, + getParenthesizedTimes, + getParentheses, + getParenthesizedRange, + getParenthesizedText, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/resolve-variable-name.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/resolve-variable-name.js new file mode 100644 index 0000000000000000000000000000000000000000..4d2c34cc16aa28cfcea9c45e89230a3116ca6ffb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/resolve-variable-name.js @@ -0,0 +1,20 @@ +'use strict'; + +/** +Finds a variable named `name` in the scope `scope` (or it's parents). + +@param {string} name - The variable name to be resolve. +@param {import('eslint').Scope.Scope} scope - The scope to look for the variable in. +@returns {import('eslint').Scope.Variable | void} - The found variable, if any. +*/ +module.exports = function resolveVariableName(name, scope) { + while (scope) { + const variable = scope.set.get(name); + + if (variable) { + return variable; + } + + scope = scope.upper; + } +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/rule.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/rule.js new file mode 100644 index 0000000000000000000000000000000000000000..46581a55b649642e33e303b6b0df95bd448a4bc6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/rule.js @@ -0,0 +1,190 @@ +'use strict'; +const path = require('node:path'); +const fs = require('node:fs'); +const getDocumentationUrl = require('./get-documentation-url.js'); + +const isIterable = object => typeof object?.[Symbol.iterator] === 'function'; + +class FixAbortError extends Error {} +const fixOptions = { + abort() { + throw new FixAbortError('Fix aborted.'); + }, +}; + +function wrapFixFunction(fix) { + return fixer => { + const result = fix(fixer, fixOptions); + + if (isIterable(result)) { + try { + return [...result]; + } catch (error) { + if (error instanceof FixAbortError) { + return; + } + + /* c8 ignore next */ + throw error; + } + } + + return result; + }; +} + +function reportListenerProblems(problems, context) { + if (!problems) { + return; + } + + if (!isIterable(problems)) { + problems = [problems]; + } + + for (const problem of problems) { + if (!problem) { + continue; + } + + problem.fix &&= wrapFixFunction(problem.fix); + + if (Array.isArray(problem.suggest)) { + for (const suggest of problem.suggest) { + suggest.fix &&= wrapFixFunction(suggest.fix); + + suggest.data = { + ...problem.data, + ...suggest.data, + }; + } + } + + context.report(problem); + } +} + +// `checkVueTemplate` function will wrap `create` function, there is no need to wrap twice +const wrappedFunctions = new Set(); +function reportProblems(create) { + if (wrappedFunctions.has(create)) { + return create; + } + + const wrapped = context => { + const listeners = {}; + const addListener = (selector, listener) => { + listeners[selector] ??= []; + listeners[selector].push(listener); + }; + + const contextProxy = new Proxy(context, { + get(target, property, receiver) { + if (property === 'on') { + return (selectorOrSelectors, listener) => { + const selectors = Array.isArray(selectorOrSelectors) ? selectorOrSelectors : [selectorOrSelectors]; + for (const selector of selectors) { + addListener(selector, listener); + } + }; + } + + if (property === 'onExit') { + return (selectorOrSelectors, listener) => { + const selectors = Array.isArray(selectorOrSelectors) ? selectorOrSelectors : [selectorOrSelectors]; + for (const selector of selectors) { + addListener(`${selector}:exit`, listener); + } + }; + } + + return Reflect.get(target, property, receiver); + }, + }); + + for (const [selector, listener] of Object.entries(create(contextProxy) ?? {})) { + addListener(selector, listener); + } + + return Object.fromEntries( + Object.entries(listeners) + .map(([selector, listeners]) => [ + selector, + // Listener arguments can be `codePath, node` or `node` + (...listenerArguments) => { + for (const listener of listeners) { + reportListenerProblems(listener(...listenerArguments), context); + } + }, + ]), + ); + }; + + wrappedFunctions.add(wrapped); + + return wrapped; +} + +function checkVueTemplate(create, options) { + const { + visitScriptBlock, + } = { + visitScriptBlock: true, + ...options, + }; + + create = reportProblems(create); + + const wrapped = context => { + const listeners = create(context); + const {parserServices} = context.sourceCode; + + // `vue-eslint-parser` + if (parserServices?.defineTemplateBodyVisitor) { + return visitScriptBlock + ? parserServices.defineTemplateBodyVisitor(listeners, listeners) + : parserServices.defineTemplateBodyVisitor(listeners); + } + + return listeners; + }; + + wrappedFunctions.add(wrapped); + return wrapped; +} + +/** @returns {import('eslint').Rule.RuleModule} */ +function loadRule(ruleId) { + const rule = require(`../${ruleId}`); + + return { + meta: { + // If there is are, options add `[]` so ESLint can validate that no data is passed to the rule. + // https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-schema.md + schema: [], + ...rule.meta, + docs: { + ...rule.meta.docs, + url: getDocumentationUrl(ruleId), + }, + }, + create: reportProblems(rule.create), + }; +} + +function loadRules() { + return Object.fromEntries( + fs.readdirSync(path.join(__dirname, '..'), {withFileTypes: true}) + .filter(file => file.isFile()) + .map(file => { + const ruleId = path.basename(file.name, '.js'); + return [ruleId, loadRule(ruleId)]; + }), + ); +} + +module.exports = { + loadRule, + loadRules, + checkVueTemplate, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-await-expression-argument.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-await-expression-argument.js new file mode 100644 index 0000000000000000000000000000000000000000..4f958f87a88abd429669d9e9e1b18e3b7bbf69b6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-await-expression-argument.js @@ -0,0 +1,21 @@ +'use strict'; + +/** +Check if parentheses should be added to a `node` when it's used as `argument` of `AwaitExpression`. + +@param {Node} node - The AST node to check. +@returns {boolean} +*/ +function shouldAddParenthesesToAwaitExpressionArgument(node) { + return ( + node.type === 'SequenceExpression' + || node.type === 'YieldExpression' + || node.type === 'ArrowFunctionExpression' + || node.type === 'ConditionalExpression' + || node.type === 'AssignmentExpression' + || node.type === 'LogicalExpression' + || node.type === 'BinaryExpression' + ); +} + +module.exports = shouldAddParenthesesToAwaitExpressionArgument; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-call-expression-callee.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-call-expression-callee.js new file mode 100644 index 0000000000000000000000000000000000000000..734cfc0fe2c6d9865cff819d0cdfa103038b6970 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-call-expression-callee.js @@ -0,0 +1,22 @@ +'use strict'; + +/** +Check if parentheses should be added to a `node` when it's used as `callee` of `CallExpression`. + +@param {Node} node - The AST node to check. +@returns {boolean} +*/ +function shouldAddParenthesesToCallExpressionCallee(node) { + return node.type === 'SequenceExpression' + || node.type === 'YieldExpression' + || node.type === 'ArrowFunctionExpression' + || node.type === 'ConditionalExpression' + || node.type === 'AssignmentExpression' + || node.type === 'LogicalExpression' + || node.type === 'BinaryExpression' + || node.type === 'UnaryExpression' + || node.type === 'UpdateExpression' + || node.type === 'NewExpression'; +} + +module.exports = shouldAddParenthesesToCallExpressionCallee; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-conditional-expression-child.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-conditional-expression-child.js new file mode 100644 index 0000000000000000000000000000000000000000..7705cb3d79612343cb1dd568d762127a4b1f145b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-conditional-expression-child.js @@ -0,0 +1,17 @@ +'use strict'; + +/** +Check if parentheses should be added to a `node` when it's used as child of `ConditionalExpression`. + +@param {Node} node - The AST node to check. +@returns {boolean} +*/ +function shouldAddParenthesesToConditionalExpressionChild(node) { + return node.type === 'AwaitExpression' + // Lower precedence, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table + || node.type === 'AssignmentExpression' + || node.type === 'YieldExpression' + || node.type === 'SequenceExpression'; +} + +module.exports = shouldAddParenthesesToConditionalExpressionChild; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-expression-statement-expression.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-expression-statement-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..659f016e273e5e3ce0e5e2feeb9c10d5650d20f2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-expression-statement-expression.js @@ -0,0 +1,26 @@ +'use strict'; + +/** +Check if parentheses should to be added to a `node` when it's used as an `expression` of `ExpressionStatement`. + +@param {Node} node - The AST node to check. +@param {SourceCode} sourceCode - The source code object. +@returns {boolean} +*/ +function shouldAddParenthesesToExpressionStatementExpression(node) { + switch (node.type) { + case 'ObjectExpression': { + return true; + } + + case 'AssignmentExpression': { + return node.left.type === 'ObjectPattern' || node.left.type === 'ArrayPattern'; + } + + default: { + return false; + } + } +} + +module.exports = shouldAddParenthesesToExpressionStatementExpression; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-logical-expression-child.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-logical-expression-child.js new file mode 100644 index 0000000000000000000000000000000000000000..4fdff11160e86b3b1f68c315002322fda5eeab84 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-logical-expression-child.js @@ -0,0 +1,47 @@ +'use strict'; + +/** +Check if parentheses should be added to a `node` when it's used as child of `LogicalExpression`. +@param {Node} node - The AST node to check. +@param {{operator: string, property: string}} options - Options +@returns {boolean} +*/ +function shouldAddParenthesesToLogicalExpressionChild(node, {operator, property}) { + // We are not using this, but we can improve this function with it + /* c8 ignore next 3 */ + if (!property) { + throw new Error('`property` is required.'); + } + + if ( + node.type === 'LogicalExpression' + && node.operator === operator + ) { + return false; + } + + // Not really needed, but more readable + if ( + node.type === 'AwaitExpression' + || node.type === 'BinaryExpression' + ) { + return true; + } + + // Lower precedence than `LogicalExpression` + // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table + if ( + node.type === 'LogicalExpression' + || node.type === 'ConditionalExpression' + || node.type === 'AssignmentExpression' + || node.type === 'ArrowFunctionExpression' + || node.type === 'YieldExpression' + || node.type === 'SequenceExpression' + ) { + return true; + } + + return false; +} + +module.exports = shouldAddParenthesesToLogicalExpressionChild; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-member-expression-object.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-member-expression-object.js new file mode 100644 index 0000000000000000000000000000000000000000..ab73ff2034c111017b18d2f060654d27d71aae50 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-member-expression-object.js @@ -0,0 +1,47 @@ +'use strict'; + +const isNewExpressionWithParentheses = require('./is-new-expression-with-parentheses.js'); +const {isDecimalIntegerNode} = require('./numeric.js'); + +/** +Check if parentheses should to be added to a `node` when it's used as an `object` of `MemberExpression`. + +@param {Node} node - The AST node to check. +@param {SourceCode} sourceCode - The source code object. +@returns {boolean} +*/ +function shouldAddParenthesesToMemberExpressionObject(node, sourceCode) { + switch (node.type) { + // This is not a full list. Some other nodes like `FunctionDeclaration` don't need parentheses, + // but it's not possible to be in the place we are checking at this point. + case 'Identifier': + case 'MemberExpression': + case 'CallExpression': + case 'ChainExpression': + case 'TemplateLiteral': + case 'ThisExpression': + case 'ArrayExpression': + case 'FunctionExpression': { + return false; + } + + case 'NewExpression': { + return !isNewExpressionWithParentheses(node, sourceCode); + } + + case 'Literal': { + /* c8 ignore next */ + if (isDecimalIntegerNode(node)) { + return true; + } + + return false; + } + + default: { + return true; + } + } +} + +module.exports = shouldAddParenthesesToMemberExpressionObject; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-new-expression-callee.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-new-expression-callee.js new file mode 100644 index 0000000000000000000000000000000000000000..1dac28e7eea461d340bbd89869abe9463d4c4a10 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-new-expression-callee.js @@ -0,0 +1,32 @@ +'use strict'; + +// Copied from https://github.com/eslint/eslint/blob/aa87329d919f569404ca573b439934552006572f/lib/rules/no-extra-parens.js#L448 +/** +Check if a member expression contains a call expression. + +@param {ASTNode} node - The `MemberExpression` node to evaluate. +@returns {boolean} true if found, false if not. +*/ +function doesMemberExpressionContainCallExpression(node) { + let currentNode = node.object; + let currentNodeType = node.object.type; + + while (currentNodeType === 'MemberExpression') { + currentNode = currentNode.object; + currentNodeType = currentNode.type; + } + + return currentNodeType === 'CallExpression'; +} + +/** +Check if parentheses should be added to a `node` when it's used as `callee` of `NewExpression`. + +@param {Node} node - The AST node to check. +@returns {boolean} +*/ +function shouldAddParenthesesToNewExpressionCallee(node) { + return node.type === 'MemberExpression' && doesMemberExpressionContainCallExpression(node); +} + +module.exports = shouldAddParenthesesToNewExpressionCallee; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/singular.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/singular.js new file mode 100644 index 0000000000000000000000000000000000000000..f198061e215691a1643d5fccdd02993f53c53af3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/singular.js @@ -0,0 +1,18 @@ +'use strict'; + +const {singular: pluralizeSingular} = require('pluralize'); + +/** +Singularizes a word/name, i.e. `items` to `item`. + +@param {string} original - The word/name to singularize. +@returns {string|undefined} - The singularized result, or `undefined` if attempting singularization resulted in no change. +*/ +const singular = original => { + const singularized = pluralizeSingular(original); + if (singularized !== original) { + return singularized; + } +}; + +module.exports = singular; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/to-location.js b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/to-location.js new file mode 100644 index 0000000000000000000000000000000000000000..efdb41939b2083dc17edd9b56ac1da821ec098d3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/eslint-plugin-unicorn/rules/utils/to-location.js @@ -0,0 +1,21 @@ +'use strict'; + +/** +Get location info for the given node or range. + +@param {import('estree').Node | number[]} nodeOrRange - The AST node or range to get the location for. +@param {import('eslint').SourceCode} sourceCode - The source code object. +@param {int} [startOffset] - Start position offset. +@param {int} [endOffset] - End position offset. +@returns {import('estree').SourceLocation} +*/ +function toLocation(nodeOrRange, sourceCode, startOffset = 0, endOffset = 0) { + const [start, end] = Array.isArray(nodeOrRange) ? nodeOrRange : nodeOrRange.range; + + return { + start: sourceCode.getLocFromIndex(start + startOffset), + end: sourceCode.getLocFromIndex(end + endOffset), + }; +} + +module.exports = toLocation; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/.stale.yml b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/.stale.yml new file mode 100644 index 0000000000000000000000000000000000000000..2ee12691a4fc015ba9eea94b53f14c037dc8f164 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/.stale.yml @@ -0,0 +1,21 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 15 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - "discussion" + - "feature request" + - "bug" + - "help wanted" + - "plugin suggestion" + - "good first issue" +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/dependabot.yml b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..35d66ca7ac75f125b9c9c5b3dee0987fdfca4a45 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/tests_checker.yml b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/tests_checker.yml new file mode 100644 index 0000000000000000000000000000000000000000..769469b2ab26d4ee6ed08df8d5747abff384b43f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/tests_checker.yml @@ -0,0 +1,8 @@ +comment: | + Hello! Thank you for contributing! + It appears that you have changed the code, but the tests that verify your change are missing. Could you please add them? +fileExtensions: + - '.ts' + - '.js' + +testDir: 'test' \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/workflows/ci.yml b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..88717877a8c8b093278386f9ebf99f3f6736a427 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/workflows/ci.yml @@ -0,0 +1,101 @@ +name: CI + +on: + push: + branches: + - main + - next + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +permissions: + contents: read + +jobs: + test-regression-check-node10: + name: Test compatibility with Node.js 10 + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - uses: actions/setup-node@v4 + with: + node-version: '10' + cache: 'npm' + cache-dependency-path: package.json + check-latest: true + + - name: Install + run: | + npm install --ignore-scripts + + - name: Copy project as fast-uri to node_node_modules + run: | + rm -rf ./node_modules/fast-uri/lib && + rm -rf ./node_modules/fast-uri/index.js && + cp -r ./lib ./node_modules/fast-uri/lib && + cp ./index.js ./node_modules/fast-uri/index.js + + - name: Run tests + run: | + npm run test:unit + env: + NODE_OPTIONS: no-network-family-autoselection + + test-browser: + name: Test browser compatibility + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest', 'windows-latest', 'macos-latest'] + browser: ['chromium', 'firefox', 'webkit'] + exclude: + - os: ubuntu-latest + browser: webkit + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - uses: actions/setup-node@v4 + with: + node-version: '24' + cache: 'npm' + cache-dependency-path: package.json + check-latest: true + + - name: Install dependencies + run: | + npm install --ignore-scripts + + - if: ${{ matrix.os == 'windows-latest' }} + run: npx playwright install winldd + + - name: Run browser tests + run: | + npm run test:browser:${{ matrix.browser }} + + test: + needs: + - test-regression-check-node10 + permissions: + contents: write + pull-requests: write + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 + with: + license-check: true + lint: true + node-versions: '["16", "18", "20", "22", "24"]' diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/workflows/package-manager-ci.yml b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/workflows/package-manager-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..c38d0600f8e4a1127e7313e449d089d42a065a94 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/.github/workflows/package-manager-ci.yml @@ -0,0 +1,24 @@ +name: package-manager-ci + +on: + push: + branches: + - main + - next + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +permissions: + contents: read + +jobs: + test: + permissions: + contents: read + uses: fastify/workflows/.github/workflows/plugins-ci-package-manager.yml@v5 diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/benchmark.mjs b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/benchmark.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2e49fc678343e81a563a4f31779a06dd585f8283 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/benchmark.mjs @@ -0,0 +1,159 @@ +import { Bench } from 'tinybench' +import { fastUri } from '../index.js' +import { parse as uriJsParse, serialize as uriJsSerialize, resolve as uriJsResolve, equal as uriJsEqual } from 'uri-js' + +const base = 'uri://a/b/c/d;p?q' + +const domain = 'https://example.com/foo#bar$fiz' +const ipv4 = '//10.10.10.10' +const ipv6 = '//[2001:db8::7]' +const urn = 'urn:foo:a123,456' +const urnuuid = 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + +const urnuuidComponent = { + scheme: 'urn', + nid: 'uuid', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' +} + +const { + parse: fastUriParse, + serialize: fastUriSerialize, + resolve: fastUriResolve, + equal: fastUriEqual, +} = fastUri + +// Initialization as there is a lot to parse at first +// eg: regexes +fastUriParse(domain) +uriJsParse(domain) + +const benchFastUri = new Bench({ name: 'fast-uri benchmark' }) +const benchUriJs = new Bench({ name: 'uri-js benchmark' }) +const benchWHATWG = new Bench({ name: 'WHATWG URL benchmark' }) + +benchFastUri.add('fast-uri: parse domain', function () { + fastUriParse(domain) +}) +benchUriJs.add('urijs: parse domain', function () { + uriJsParse(domain) +}) +benchWHATWG.add('WHATWG URL: parse domain', function () { + // eslint-disable-next-line + new URL(domain) +}) +benchFastUri.add('fast-uri: parse IPv4', function () { + fastUriParse(ipv4) +}) +benchUriJs.add('urijs: parse IPv4', function () { + uriJsParse(ipv4) +}) +benchFastUri.add('fast-uri: parse IPv6', function () { + fastUriParse(ipv6) +}) +benchUriJs.add('urijs: parse IPv6', function () { + uriJsParse(ipv6) +}) +benchFastUri.add('fast-uri: parse URN', function () { + fastUriParse(urn) +}) +benchUriJs.add('urijs: parse URN', function () { + uriJsParse(urn) +}) +benchWHATWG.add('WHATWG URL: parse URN', function () { + // eslint-disable-next-line + new URL(urn) +}) +benchFastUri.add('fast-uri: parse URN uuid', function () { + fastUriParse(urnuuid) +}) +benchUriJs.add('urijs: parse URN uuid', function () { + uriJsParse(urnuuid) +}) +benchFastUri.add('fast-uri: serialize URN uuid', function () { + fastUriSerialize(urnuuidComponent) +}) +benchUriJs.add('uri-js: serialize URN uuid', function () { + uriJsSerialize(urnuuidComponent) +}) +benchFastUri.add('fast-uri: serialize uri', function () { + fastUriSerialize({ + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: 'path', + query: 'query', + fragment: 'fragment' + }) +}) +benchUriJs.add('urijs: serialize uri', function () { + uriJsSerialize({ + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: 'path', + query: 'query', + fragment: 'fragment' + }) +}) +benchFastUri.add('fast-uri: serialize long uri with dots', function () { + fastUriSerialize({ + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: './a/./b/c/../.././d/../e/f/.././/', + query: 'query', + fragment: 'fragment' + }) +}) +benchUriJs.add('urijs: serialize long uri with dots', function () { + uriJsSerialize({ + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: './a/./b/c/../.././d/../e/f/.././/', + query: 'query', + fragment: 'fragment' + }) +}) +benchFastUri.add('fast-uri: serialize IPv6', function () { + fastUriSerialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }) +}) +benchUriJs.add('urijs: serialize IPv6', function () { + uriJsSerialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }) +}) +benchFastUri.add('fast-uri: serialize ws', function () { + fastUriSerialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }) +}) +benchUriJs.add('urijs: serialize ws', function () { + uriJsSerialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }) +}) +benchFastUri.add('fast-uri: resolve', function () { + fastUriResolve(base, '../../../g') +}) +benchUriJs.add('urijs: resolve', function () { + uriJsResolve(base, '../../../g') +}) + +benchFastUri.add('fast-uri: equal', function () { + fastUriEqual('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d') +}) +benchUriJs.add('urijs: equal', function () { + uriJsEqual('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d') +}) + +await benchFastUri.run() +console.log(benchFastUri.name) +console.table(benchFastUri.table()) + +await benchUriJs.run() +console.log(benchUriJs.name) +console.table(benchUriJs.table()) + +await benchWHATWG.run() +console.log(benchWHATWG.name) +console.table(benchWHATWG.table()) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/equal.mjs b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/equal.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3dea7ec8762a87635475adbea09ee54751285e13 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/equal.mjs @@ -0,0 +1,51 @@ +import { Bench } from 'tinybench' +import { fastUri } from '../index.js' + +const { + equal: fastUriEqual, + parse: fastUriParse, +} = fastUri + +const stringA = 'example://a/b/c/%7Bfoo%7D' +const stringB = 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d' + +const componentA = fastUriParse(stringA) +const componentB = fastUriParse(stringB) + +const benchFastUri = new Bench({ name: 'fast-uri equal' }) + +benchFastUri.add('equal string with string', function () { + fastUriEqual(stringA, stringA) +}) + +benchFastUri.add('equal component with component', function () { + fastUriEqual(componentA, componentA) +}) + +benchFastUri.add('equal component with string', function () { + fastUriEqual(componentA, stringA) +}) + +benchFastUri.add('equal string with component', function () { + fastUriEqual(stringA, componentA) +}) + +benchFastUri.add('not equal string with string', function () { + fastUriEqual(stringA, stringB) +}) + +benchFastUri.add('not equal component with component', function () { + fastUriEqual(componentA, componentB) +}) + +benchFastUri.add('not equal component with string', function () { + fastUriEqual(componentA, stringB) +}) + +benchFastUri.add('not equal string with component', function () { + fastUriEqual(stringA, componentB) +}) + +await benchFastUri.run() +console.log(benchFastUri.name) +console.table(benchFastUri.table()) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/non-simple-domain.mjs b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/non-simple-domain.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4c041da4cd3f3fd5182ccc9f11c6ec08f42003d6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/non-simple-domain.mjs @@ -0,0 +1,22 @@ +import { Bench } from 'tinybench' +import { nonSimpleDomain } from '../lib/utils.js' + +const benchNonSimpleDomain = new Bench({ name: 'nonSimpleDomain' }) + +const exampleCom = 'example.com' +const exaumlmpleCom = 'exämple.com' +const longDomain = 'abc'.repeat(100) + '.com' + +console.assert(nonSimpleDomain(exampleCom) === false, 'example.com should be a simple domain') +console.assert(nonSimpleDomain(exaumlmpleCom) === true, 'exämple.com should not be a simple domain') +console.assert(nonSimpleDomain(longDomain) === false, `${longDomain} should be a simple domain?`) + +benchNonSimpleDomain.add('nonSimpleDomain', function () { + nonSimpleDomain(exampleCom) + nonSimpleDomain(exaumlmpleCom) + nonSimpleDomain(longDomain) +}) + +await benchNonSimpleDomain.run() +console.log(benchNonSimpleDomain.name) +console.table(benchNonSimpleDomain.table()) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c0816a57919a8dcf1769563de87543218926d29 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/package.json @@ -0,0 +1,17 @@ +{ + "name": "benchmark", + "version": "1.0.0", + "description": "", + "main": "index.js", + "private": true, + "scripts": { + "bench": "node benchmark.mjs" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "tinybench": "^5.0.0", + "uri-js": "^4.4.1" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs new file mode 100644 index 0000000000000000000000000000000000000000..94875dade99a069e0cbc60267b412a8d53dd2bf9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs @@ -0,0 +1,24 @@ +import { Bench } from 'tinybench' +import { stringArrayToHexStripped } from '../lib/utils.js' + +const benchStringArrayToHexStripped = new Bench({ name: 'stringArrayToHexStripped' }) + +const case1 = ['0', '0', '0', '0'] +const case2 = ['0', '0', '0', '1'] +const case3 = ['0', '0', '1', '0'] +const case4 = ['0', '1', '0', '0'] +const case5 = ['1', '0', '0', '0'] +const case6 = ['1', '0', '0', '1'] + +benchStringArrayToHexStripped.add('stringArrayToHexStripped', function () { + stringArrayToHexStripped(case1) + stringArrayToHexStripped(case2) + stringArrayToHexStripped(case3) + stringArrayToHexStripped(case4) + stringArrayToHexStripped(case5) + stringArrayToHexStripped(case6) +}) + +await benchStringArrayToHexStripped.run() +console.log(benchStringArrayToHexStripped.name) +console.table(benchStringArrayToHexStripped.table()) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/ws-is-secure.mjs b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/ws-is-secure.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b579a7662170f8dfefb595f162620d5c5bf31f03 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/benchmark/ws-is-secure.mjs @@ -0,0 +1,65 @@ +import { Bench } from 'tinybench' +import { wsIsSecure } from '../lib/schemes.js' + +const benchWsIsSecure = new Bench({ name: 'wsIsSecure' }) + +const wsComponentAttributeSecureTrue = { + scheme: 'ws', + secure: true, +} + +const wsComponentAttributeSecureFalse = { + scheme: 'ws', + secure: false, +} + +const wssComponent = { + scheme: 'wss', +} + +const wssComponentMixedCase = { + scheme: 'Wss', +} + +const wssComponentUpperCase = { + scheme: 'WSS', +} + +const httpComponent = { + scheme: 'http', +} + +console.assert(wsIsSecure(wsComponentAttributeSecureTrue) === true, 'wsComponentAttributeSecureTrue should be secure') +console.assert(wsIsSecure(wsComponentAttributeSecureFalse) === false, 'wsComponentAttributeSecureFalse should not be secure') +console.assert(wsIsSecure(wssComponent) === true, 'wssComponent should be secure') +console.assert(wsIsSecure(wssComponentMixedCase) === true, 'wssComponentMixedCase should be secure') +console.assert(wsIsSecure(wssComponentUpperCase) === true, 'wssComponentUpperCase should be secure') +console.assert(wsIsSecure(httpComponent) === false, 'httpComponent should not be secure') + +benchWsIsSecure.add(JSON.stringify(wsComponentAttributeSecureFalse), function () { + wsIsSecure(wsComponentAttributeSecureFalse) +}) + +benchWsIsSecure.add(JSON.stringify(wsComponentAttributeSecureTrue), function () { + wsIsSecure(wsComponentAttributeSecureTrue) +}) + +benchWsIsSecure.add(JSON.stringify(wssComponent), function () { + wsIsSecure(wssComponent) +}) + +benchWsIsSecure.add(JSON.stringify(wssComponentMixedCase), function () { + wsIsSecure(wssComponentMixedCase) +}) + +benchWsIsSecure.add(JSON.stringify(wssComponentUpperCase), function () { + wsIsSecure(wssComponentUpperCase) +}) + +benchWsIsSecure.add(JSON.stringify(httpComponent), function () { + wsIsSecure(httpComponent) +}) + +await benchWsIsSecure.run() +console.log(benchWsIsSecure.name) +console.table(benchWsIsSecure.table()) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/lib/schemes.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/lib/schemes.js new file mode 100644 index 0000000000000000000000000000000000000000..554e379911e39ce4df7babc647b588419312649b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/lib/schemes.js @@ -0,0 +1,267 @@ +'use strict' + +const { isUUID } = require('./utils') +const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu + +const supportedSchemeNames = /** @type {const} */ (['http', 'https', 'ws', + 'wss', 'urn', 'urn:uuid']) + +/** @typedef {supportedSchemeNames[number]} SchemeName */ + +/** + * @param {string} name + * @returns {name is SchemeName} + */ +function isValidSchemeName (name) { + return supportedSchemeNames.indexOf(/** @type {*} */ (name)) !== -1 +} + +/** + * @callback SchemeFn + * @param {import('../types/index').URIComponent} component + * @param {import('../types/index').Options} options + * @returns {import('../types/index').URIComponent} + */ + +/** + * @typedef {Object} SchemeHandler + * @property {SchemeName} scheme - The scheme name. + * @property {boolean} [domainHost] - Indicates if the scheme supports domain hosts. + * @property {SchemeFn} parse - Function to parse the URI component for this scheme. + * @property {SchemeFn} serialize - Function to serialize the URI component for this scheme. + * @property {boolean} [skipNormalize] - Indicates if normalization should be skipped for this scheme. + * @property {boolean} [absolutePath] - Indicates if the scheme uses absolute paths. + * @property {boolean} [unicodeSupport] - Indicates if the scheme supports Unicode. + */ + +/** + * @param {import('../types/index').URIComponent} wsComponent + * @returns {boolean} + */ +function wsIsSecure (wsComponent) { + if (wsComponent.secure === true) { + return true + } else if (wsComponent.secure === false) { + return false + } else if (wsComponent.scheme) { + return ( + wsComponent.scheme.length === 3 && + (wsComponent.scheme[0] === 'w' || wsComponent.scheme[0] === 'W') && + (wsComponent.scheme[1] === 's' || wsComponent.scheme[1] === 'S') && + (wsComponent.scheme[2] === 's' || wsComponent.scheme[2] === 'S') + ) + } else { + return false + } +} + +/** @type {SchemeFn} */ +function httpParse (component) { + if (!component.host) { + component.error = component.error || 'HTTP URIs must have a host.' + } + + return component +} + +/** @type {SchemeFn} */ +function httpSerialize (component) { + const secure = String(component.scheme).toLowerCase() === 'https' + + // normalize the default port + if (component.port === (secure ? 443 : 80) || component.port === '') { + component.port = undefined + } + + // normalize the empty path + if (!component.path) { + component.path = '/' + } + + // NOTE: We do not parse query strings for HTTP URIs + // as WWW Form Url Encoded query strings are part of the HTML4+ spec, + // and not the HTTP spec. + + return component +} + +/** @type {SchemeFn} */ +function wsParse (wsComponent) { +// indicate if the secure flag is set + wsComponent.secure = wsIsSecure(wsComponent) + + // construct resouce name + wsComponent.resourceName = (wsComponent.path || '/') + (wsComponent.query ? '?' + wsComponent.query : '') + wsComponent.path = undefined + wsComponent.query = undefined + + return wsComponent +} + +/** @type {SchemeFn} */ +function wsSerialize (wsComponent) { +// normalize the default port + if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === '') { + wsComponent.port = undefined + } + + // ensure scheme matches secure flag + if (typeof wsComponent.secure === 'boolean') { + wsComponent.scheme = (wsComponent.secure ? 'wss' : 'ws') + wsComponent.secure = undefined + } + + // reconstruct path from resource name + if (wsComponent.resourceName) { + const [path, query] = wsComponent.resourceName.split('?') + wsComponent.path = (path && path !== '/' ? path : undefined) + wsComponent.query = query + wsComponent.resourceName = undefined + } + + // forbid fragment component + wsComponent.fragment = undefined + + return wsComponent +} + +/** @type {SchemeFn} */ +function urnParse (urnComponent, options) { + if (!urnComponent.path) { + urnComponent.error = 'URN can not be parsed' + return urnComponent + } + const matches = urnComponent.path.match(URN_REG) + if (matches) { + const scheme = options.scheme || urnComponent.scheme || 'urn' + urnComponent.nid = matches[1].toLowerCase() + urnComponent.nss = matches[2] + const urnScheme = `${scheme}:${options.nid || urnComponent.nid}` + const schemeHandler = getSchemeHandler(urnScheme) + urnComponent.path = undefined + + if (schemeHandler) { + urnComponent = schemeHandler.parse(urnComponent, options) + } + } else { + urnComponent.error = urnComponent.error || 'URN can not be parsed.' + } + + return urnComponent +} + +/** @type {SchemeFn} */ +function urnSerialize (urnComponent, options) { + if (urnComponent.nid === undefined) { + throw new Error('URN without nid cannot be serialized') + } + const scheme = options.scheme || urnComponent.scheme || 'urn' + const nid = urnComponent.nid.toLowerCase() + const urnScheme = `${scheme}:${options.nid || nid}` + const schemeHandler = getSchemeHandler(urnScheme) + + if (schemeHandler) { + urnComponent = schemeHandler.serialize(urnComponent, options) + } + + const uriComponent = urnComponent + const nss = urnComponent.nss + uriComponent.path = `${nid || options.nid}:${nss}` + + options.skipEscape = true + return uriComponent +} + +/** @type {SchemeFn} */ +function urnuuidParse (urnComponent, options) { + const uuidComponent = urnComponent + uuidComponent.uuid = uuidComponent.nss + uuidComponent.nss = undefined + + if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) { + uuidComponent.error = uuidComponent.error || 'UUID is not valid.' + } + + return uuidComponent +} + +/** @type {SchemeFn} */ +function urnuuidSerialize (uuidComponent) { + const urnComponent = uuidComponent + // normalize UUID + urnComponent.nss = (uuidComponent.uuid || '').toLowerCase() + return urnComponent +} + +const http = /** @type {SchemeHandler} */ ({ + scheme: 'http', + domainHost: true, + parse: httpParse, + serialize: httpSerialize +}) + +const https = /** @type {SchemeHandler} */ ({ + scheme: 'https', + domainHost: http.domainHost, + parse: httpParse, + serialize: httpSerialize +}) + +const ws = /** @type {SchemeHandler} */ ({ + scheme: 'ws', + domainHost: true, + parse: wsParse, + serialize: wsSerialize +}) + +const wss = /** @type {SchemeHandler} */ ({ + scheme: 'wss', + domainHost: ws.domainHost, + parse: ws.parse, + serialize: ws.serialize +}) + +const urn = /** @type {SchemeHandler} */ ({ + scheme: 'urn', + parse: urnParse, + serialize: urnSerialize, + skipNormalize: true +}) + +const urnuuid = /** @type {SchemeHandler} */ ({ + scheme: 'urn:uuid', + parse: urnuuidParse, + serialize: urnuuidSerialize, + skipNormalize: true +}) + +const SCHEMES = /** @type {Record} */ ({ + http, + https, + ws, + wss, + urn, + 'urn:uuid': urnuuid +}) + +Object.setPrototypeOf(SCHEMES, null) + +/** + * @param {string|undefined} scheme + * @returns {SchemeHandler|undefined} + */ +function getSchemeHandler (scheme) { + return ( + scheme && ( + SCHEMES[/** @type {SchemeName} */ (scheme)] || + SCHEMES[/** @type {SchemeName} */(scheme.toLowerCase())]) + ) || + undefined +} + +module.exports = { + wsIsSecure, + SCHEMES, + isValidSchemeName, + getSchemeHandler, +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/lib/utils.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/lib/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..1cd927b9e6e37648e150b17c816660d2d573b8ea --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/lib/utils.js @@ -0,0 +1,336 @@ +'use strict' + +/** @type {(value: string) => boolean} */ +const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu) + +/** @type {(value: string) => boolean} */ +const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u) + +/** + * @param {Array} input + * @returns {string} + */ +function stringArrayToHexStripped (input) { + let acc = '' + let code = 0 + let i = 0 + + for (i = 0; i < input.length; i++) { + code = input[i].charCodeAt(0) + if (code === 48) { + continue + } + if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) { + return '' + } + acc += input[i] + break + } + + for (i += 1; i < input.length; i++) { + code = input[i].charCodeAt(0) + if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) { + return '' + } + acc += input[i] + } + return acc +} + +/** + * @typedef {Object} GetIPV6Result + * @property {boolean} error - Indicates if there was an error parsing the IPv6 address. + * @property {string} address - The parsed IPv6 address. + * @property {string} [zone] - The zone identifier, if present. + */ + +/** + * @param {string} value + * @returns {boolean} + */ +const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u) + +/** + * @param {Array} buffer + * @returns {boolean} + */ +function consumeIsZone (buffer) { + buffer.length = 0 + return true +} + +/** + * @param {Array} buffer + * @param {Array} address + * @param {GetIPV6Result} output + * @returns {boolean} + */ +function consumeHextets (buffer, address, output) { + if (buffer.length) { + const hex = stringArrayToHexStripped(buffer) + if (hex !== '') { + address.push(hex) + } else { + output.error = true + return false + } + buffer.length = 0 + } + return true +} + +/** + * @param {string} input + * @returns {GetIPV6Result} + */ +function getIPV6 (input) { + let tokenCount = 0 + const output = { error: false, address: '', zone: '' } + /** @type {Array} */ + const address = [] + /** @type {Array} */ + const buffer = [] + let endipv6Encountered = false + let endIpv6 = false + + let consume = consumeHextets + + for (let i = 0; i < input.length; i++) { + const cursor = input[i] + if (cursor === '[' || cursor === ']') { continue } + if (cursor === ':') { + if (endipv6Encountered === true) { + endIpv6 = true + } + if (!consume(buffer, address, output)) { break } + if (++tokenCount > 7) { + // not valid + output.error = true + break + } + if (i > 0 && input[i - 1] === ':') { + endipv6Encountered = true + } + address.push(':') + continue + } else if (cursor === '%') { + if (!consume(buffer, address, output)) { break } + // switch to zone detection + consume = consumeIsZone + } else { + buffer.push(cursor) + continue + } + } + if (buffer.length) { + if (consume === consumeIsZone) { + output.zone = buffer.join('') + } else if (endIpv6) { + address.push(buffer.join('')) + } else { + address.push(stringArrayToHexStripped(buffer)) + } + } + output.address = address.join('') + return output +} + +/** + * @typedef {Object} NormalizeIPv6Result + * @property {string} host - The normalized host. + * @property {string} [escapedHost] - The escaped host. + * @property {boolean} isIPV6 - Indicates if the host is an IPv6 address. + */ + +/** + * @param {string} host + * @returns {NormalizeIPv6Result} + */ +function normalizeIPv6 (host) { + if (findToken(host, ':') < 2) { return { host, isIPV6: false } } + const ipv6 = getIPV6(host) + + if (!ipv6.error) { + let newHost = ipv6.address + let escapedHost = ipv6.address + if (ipv6.zone) { + newHost += '%' + ipv6.zone + escapedHost += '%25' + ipv6.zone + } + return { host: newHost, isIPV6: true, escapedHost } + } else { + return { host, isIPV6: false } + } +} + +/** + * @param {string} str + * @param {string} token + * @returns {number} + */ +function findToken (str, token) { + let ind = 0 + for (let i = 0; i < str.length; i++) { + if (str[i] === token) ind++ + } + return ind +} + +/** + * @param {string} path + * @returns {string} + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4 + */ +function removeDotSegments (path) { + let input = path + const output = [] + let nextSlash = -1 + let len = 0 + + // eslint-disable-next-line no-cond-assign + while (len = input.length) { + if (len === 1) { + if (input === '.') { + break + } else if (input === '/') { + output.push('/') + break + } else { + output.push(input) + break + } + } else if (len === 2) { + if (input[0] === '.') { + if (input[1] === '.') { + break + } else if (input[1] === '/') { + input = input.slice(2) + continue + } + } else if (input[0] === '/') { + if (input[1] === '.' || input[1] === '/') { + output.push('/') + break + } + } + } else if (len === 3) { + if (input === '/..') { + if (output.length !== 0) { + output.pop() + } + output.push('/') + break + } + } + if (input[0] === '.') { + if (input[1] === '.') { + if (input[2] === '/') { + input = input.slice(3) + continue + } + } else if (input[1] === '/') { + input = input.slice(2) + continue + } + } else if (input[0] === '/') { + if (input[1] === '.') { + if (input[2] === '/') { + input = input.slice(2) + continue + } else if (input[2] === '.') { + if (input[3] === '/') { + input = input.slice(3) + if (output.length !== 0) { + output.pop() + } + continue + } + } + } + } + + // Rule 2E: Move normal path segment to output + if ((nextSlash = input.indexOf('/', 1)) === -1) { + output.push(input) + break + } else { + output.push(input.slice(0, nextSlash)) + input = input.slice(nextSlash) + } + } + + return output.join('') +} + +/** + * @param {import('../types/index').URIComponent} component + * @param {boolean} esc + * @returns {import('../types/index').URIComponent} + */ +function normalizeComponentEncoding (component, esc) { + const func = esc !== true ? escape : unescape + if (component.scheme !== undefined) { + component.scheme = func(component.scheme) + } + if (component.userinfo !== undefined) { + component.userinfo = func(component.userinfo) + } + if (component.host !== undefined) { + component.host = func(component.host) + } + if (component.path !== undefined) { + component.path = func(component.path) + } + if (component.query !== undefined) { + component.query = func(component.query) + } + if (component.fragment !== undefined) { + component.fragment = func(component.fragment) + } + return component +} + +/** + * @param {import('../types/index').URIComponent} component + * @returns {string|undefined} + */ +function recomposeAuthority (component) { + const uriTokens = [] + + if (component.userinfo !== undefined) { + uriTokens.push(component.userinfo) + uriTokens.push('@') + } + + if (component.host !== undefined) { + let host = unescape(component.host) + if (!isIPv4(host)) { + const ipV6res = normalizeIPv6(host) + if (ipV6res.isIPV6 === true) { + host = `[${ipV6res.escapedHost}]` + } else { + host = component.host + } + } + uriTokens.push(host) + } + + if (typeof component.port === 'number' || typeof component.port === 'string') { + uriTokens.push(':') + uriTokens.push(String(component.port)) + } + + return uriTokens.length ? uriTokens.join('') : undefined +}; + +module.exports = { + nonSimpleDomain, + recomposeAuthority, + normalizeComponentEncoding, + removeDotSegments, + isIPv4, + isUUID, + normalizeIPv6, + stringArrayToHexStripped +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/ajv.test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/ajv.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e6a44fe8bba623bf841a7c5193a5f0e99f71f059 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/ajv.test.js @@ -0,0 +1,43 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +const AJV = require('ajv') + +const ajv = new AJV({ + uriResolver: fastURI // comment this line to see it works with uri-js +}) + +test('ajv', t => { + t.plan(1) + const schema = { + $ref: '#/definitions/Record%3Cstring%2CPerson%3E', + definitions: { + Person: { + type: 'object', + properties: { + firstName: { + type: 'string' + } + } + }, + 'Record': { + type: 'object', + additionalProperties: { + $ref: '#/definitions/Person' + } + } + } + } + + const data = { + joe: { + firstName: 'Joe' + } + + } + + const validate = ajv.compile(schema) + t.ok(validate(data)) +}) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/equal.test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/equal.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e5e9dfcfb7465da6b34dd08813547235b26c35cd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/equal.test.js @@ -0,0 +1,108 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +const fn = fastURI.equal +const runTest = (t, suite) => { + suite.forEach(s => { + const operator = s.result ? '==' : '!=' + t.equal(fn(s.pair[0], s.pair[1]), s.result, `${s.pair[0]} ${operator} ${s.pair[1]}`) + t.equal(fn(s.pair[1], s.pair[0]), s.result, `${s.pair[1]} ${operator} ${s.pair[0]}`) + }) +} + +test('URI Equals', (t) => { + const suite = [ + { pair: ['example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'], result: true }, // test from RFC 3986 + { pair: ['http://example.org/~user', 'http://example.org/%7euser'], result: true } // test from RFC 3987 + ] + runTest(t, suite) + t.end() +}) + +// test('IRI Equals', (t) => { +// // example from RFC 3987 +// t.equal(URI.equal('example://a/b/c/%7Bfoo%7D/ros\xE9', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9', IRI_OPTION), true) +// t.end() +// }) + +test('HTTP Equals', (t) => { + const suite = [ + // test from RFC 2616 + { pair: ['http://abc.com:80/~smith/home.html', 'http://abc.com/~smith/home.html'], result: true }, + { pair: [{ scheme: 'http', host: 'abc.com', port: 80, path: '/~smith/home.html' }, 'http://abc.com/~smith/home.html'], result: true }, + { pair: ['http://ABC.com/%7Esmith/home.html', 'http://abc.com/~smith/home.html'], result: true }, + { pair: ['http://ABC.com:/%7esmith/home.html', 'http://abc.com/~smith/home.html'], result: true }, + { pair: ['HTTP://ABC.COM', 'http://abc.com/'], result: true }, + // test from RFC 3986 + { pair: ['http://example.com:/', 'http://example.com:80/'], result: true } + ] + runTest(t, suite) + t.end() +}) + +test('HTTPS Equals', (t) => { + const suite = [ + { pair: ['https://example.com', 'https://example.com:443/'], result: true }, + { pair: ['https://example.com:/', 'https://example.com:443/'], result: true } + ] + runTest(t, suite) + t.end() +}) + +test('URN Equals', (t) => { + const suite = [ + // test from RFC 2141 + { pair: ['urn:foo:a123,456', 'urn:foo:a123,456'], result: true }, + { pair: ['urn:foo:a123,456', 'URN:foo:a123,456'], result: true }, + { pair: ['urn:foo:a123,456', 'urn:FOO:a123,456'], result: true } + ] + + // Disabling for now as the whole equal logic might need + // to be refactored + // t.equal(URI.equal('urn:foo:a123,456', 'urn:foo:A123,456'), false) + // t.equal(URI.equal('urn:foo:a123%2C456', 'URN:FOO:a123%2c456'), true) + + runTest(t, suite) + + t.throws(() => { + fn('urn:', 'urn:FOO:a123,456') + }, 'URN without nid cannot be serialized') + + t.end() +}) + +test('UUID Equals', (t) => { + const suite = [ + { pair: ['URN:UUID:F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6', 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'], result: true } + ] + + runTest(t, suite) + t.end() +}) + +// test('Mailto Equals', (t) => { +// // tests from RFC 6068 +// t.equal(URI.equal('mailto:addr1@an.example,addr2@an.example', 'mailto:?to=addr1@an.example,addr2@an.example'), true) +// t.equal(URI.equal('mailto:?to=addr1@an.example,addr2@an.example', 'mailto:addr1@an.example?to=addr2@an.example'), true) +// t.end() +// }) + +test('WS Equal', (t) => { + const suite = [ + { pair: ['WS://ABC.COM:80/chat#one', 'ws://abc.com/chat'], result: true } + ] + + runTest(t, suite) + t.end() +}) + +test('WSS Equal', (t) => { + const suite = [ + { pair: ['WSS://ABC.COM:443/chat#one', 'wss://abc.com/chat'], result: true } + ] + + runTest(t, suite) + t.end() +}) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/fixtures/uri-js-parse.json b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/fixtures/uri-js-parse.json new file mode 100644 index 0000000000000000000000000000000000000000..6b848134ea8e6254f003f7c79eb0a926e0c87752 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/fixtures/uri-js-parse.json @@ -0,0 +1,501 @@ +[ + [ + "//www.g.com/error\n/bleh/bleh", + { + "host": "www.g.com", + "path": "/error%0A/bleh/bleh", + "reference": "relative" + } + ], + [ + "https://fastify.org", + { + "scheme": "https", + "host": "fastify.org", + "path": "", + "reference": "absolute" + } + ], + [ + "/definitions/Record%3Cstring%2CPerson%3E", + { + "path": "/definitions/Record%3Cstring%2CPerson%3E", + "reference": "relative" + } + ], + [ + "//10.10.10.10", + { + "host": "10.10.10.10", + "path": "", + "reference": "relative" + } + ], + [ + "//10.10.000.10", + { + "host": "10.10.0.10", + "path": "", + "reference": "relative" + } + ], + [ + "//[2001:db8::7%en0]", + { + "host": "2001:db8::7%en0", + "path": "", + "reference": "relative" + } + ], + [ + "//[2001:dbZ::1]:80", + { + "host": "[2001:dbz::1]", + "port": 80, + "path": "", + "reference": "relative" + } + ], + [ + "//[2001:db8::1]:80", + { + "host": "2001:db8::1", + "port": 80, + "path": "", + "reference": "relative" + } + ], + [ + "//[2001:db8::001]:80", + { + "host": "2001:db8::1", + "port": 80, + "path": "", + "reference": "relative" + } + ], + [ + "uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body", + { + "scheme": "uri", + "userinfo": "user:pass", + "host": "example.com", + "port": 123, + "path": "/one/two.three", + "query": "q1=a1&q2=a2", + "fragment": "body", + "reference": "uri" + } + ], + [ + "http://user:pass@example.com:123/one/space in.url?q1=a1&q2=a2#body", + { + "scheme": "http", + "userinfo": "user:pass", + "host": "example.com", + "port": 123, + "path": "/one/space%20in.url", + "query": "q1=a1&q2=a2", + "fragment": "body", + "reference": "uri" + } + ], + [ + "http://User:Pass@example.com:123/one/space in.url?q1=a1&q2=a2#body", + { + "scheme": "http", + "userinfo": "User:Pass", + "host": "example.com", + "port": 123, + "path": "/one/space%20in.url", + "query": "q1=a1&q2=a2", + "fragment": "body", + "reference": "uri" + } + ], + [ + "http://A%3AB@example.com:123/one/space", + { + "scheme": "http", + "userinfo": "A%3AB", + "host": "example.com", + "port": 123, + "path": "/one/space", + "reference": "absolute" + } + ], + [ + "//[::ffff:129.144.52.38]", + { + "host": "::ffff:129.144.52.38", + "path": "", + "reference": "relative" + } + ], + [ + "uri://10.10.10.10.example.com/en/process", + { + "scheme": "uri", + "host": "10.10.10.10.example.com", + "path": "/en/process", + "reference": "absolute" + } + ], + [ + "//[2606:2800:220:1:248:1893:25c8:1946]/test", + { + "host": "2606:2800:220:1:248:1893:25c8:1946", + "path": "/test", + "reference": "relative" + } + ], + [ + "ws://example.com/chat", + { + "scheme": "ws", + "host": "example.com", + "reference": "absolute", + "secure": false, + "resourceName": "/chat" + } + ], + [ + "ws://example.com/foo?bar=baz", + { + "scheme": "ws", + "host": "example.com", + "reference": "absolute", + "secure": false, + "resourceName": "/foo?bar=baz" + } + ], + [ + "wss://example.com/?bar=baz", + { + "scheme": "wss", + "host": "example.com", + "reference": "absolute", + "secure": true, + "resourceName": "/?bar=baz" + } + ], + [ + "wss://example.com/chat", + { + "scheme": "wss", + "host": "example.com", + "reference": "absolute", + "secure": true, + "resourceName": "/chat" + } + ], + [ + "wss://example.com/foo?bar=baz", + { + "scheme": "wss", + "host": "example.com", + "reference": "absolute", + "secure": true, + "resourceName": "/foo?bar=baz" + } + ], + [ + "wss://example.com/?bar=baz", + { + "scheme": "wss", + "host": "example.com", + "reference": "absolute", + "secure": true, + "resourceName": "/?bar=baz" + } + ], + [ + "urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6", + { + "scheme": "urn", + "reference": "absolute", + "nid": "uuid", + "uuid": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6" + } + ], + [ + "urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6", + { + "scheme": "urn", + "reference": "absolute", + "nid": "uuid", + "uuid": "notauuid-7dec-11d0-a765-00a0c91e6bf6", + "error": "UUID is not valid." + } + ], + [ + "urn:example:%D0%B0123,z456", + { + "scheme": "urn", + "reference": "absolute", + "nid": "example", + "nss": "%D0%B0123,z456" + } + ], + [ + "//[2606:2800:220:1:248:1893:25c8:1946:43209]", + { + "host": "[2606:2800:220:1:248:1893:25c8:1946:43209]", + "path": "", + "reference": "relative" + } + ], + [ + "http://foo.bar", + { + "scheme": "http", + "host": "foo.bar", + "path": "", + "reference": "absolute" + } + ], + [ + "http://", + { + "scheme": "http", + "host": "", + "path": "", + "reference": "absolute", + "error": "HTTP URIs must have a host." + } + ], + [ + "#/$defs/stringMap", + { + "path": "", + "fragment": "/$defs/stringMap", + "reference": "same-document" + } + ], + [ + "#/$defs/string%20Map", + { + "path": "", + "fragment": "/$defs/string%20Map", + "reference": "same-document" + } + ], + [ + "#/$defs/string Map", + { + "path": "", + "fragment": "/$defs/string%20Map", + "reference": "same-document" + } + ], + [ + "//?json=%7B%22foo%22%3A%22bar%22%7D", + { + "host": "", + "path": "", + "query": "json=%7B%22foo%22%3A%22bar%22%7D", + "reference": "relative" + } + ], + [ + "mailto:chris@example.com", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "chris@example.com" + ] + } + ], + [ + "mailto:infobot@example.com?subject=current-issue", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "infobot@example.com" + ], + "subject": "current-issue" + } + ], + [ + "mailto:infobot@example.com?body=send%20current-issue", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "infobot@example.com" + ], + "body": "send current-issue" + } + ], + [ + "mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "infobot@example.com" + ], + "body": "send current-issue\r\nsend index" + } + ], + [ + "mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "list@example.org" + ], + "headers": { + "In-Reply-To": "<3469A91.D10AF4C@example.com>" + } + } + ], + [ + "mailto:majordomo@example.com?body=subscribe%20bamboo-l", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "majordomo@example.com" + ], + "body": "subscribe bamboo-l" + } + ], + [ + "mailto:joe@example.com?cc=bob@example.com&body=hello", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "joe@example.com" + ], + "body": "hello", + "headers": { + "cc": "bob@example.com" + } + } + ], + [ + "mailto:gorby%25kremvax@example.com", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "gorby%kremvax@example.com" + ] + } + ], + [ + "mailto:unlikely%3Faddress@example.com?blat=foop", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "unlikely?address@example.com" + ], + "headers": { + "blat": "foop" + } + } + ], + [ + "mailto:Mike%26family@example.org", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "Mike&family@example.org" + ] + } + ], + [ + "mailto:%22not%40me%22@example.org", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "\"not@me\"@example.org" + ] + } + ], + [ + "mailto:%22oh%5C%5Cno%22@example.org", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "\"oh\\\\no\"@example.org" + ] + } + ], + [ + "mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "\"\\\\\\\"it's\\ ugly\\\\\\\"\"@example.org" + ] + } + ], + [ + "mailto:user@example.org?subject=caf%C3%A9", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@example.org" + ], + "subject": "café" + } + ], + [ + "mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@example.org" + ], + "subject": "=?utf-8?Q?caf=C3=A9?=" + } + ], + [ + "mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@example.org" + ], + "subject": "=?iso-8859-1?Q?caf=E9?=" + } + ], + [ + "mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@example.org" + ], + "subject": "café", + "body": "café" + } + ], + [ + "mailto:user@%E7%B4%8D%E8%B1%86.example.org?subject=Test&body=NATTO", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@xn--99zt52a.example.org" + ], + "subject": "Test", + "body": "NATTO" + } + ] +] \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/fixtures/uri-js-serialize.json b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/fixtures/uri-js-serialize.json new file mode 100644 index 0000000000000000000000000000000000000000..87d7146797c473847daeb54a4921944d192e9478 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/fixtures/uri-js-serialize.json @@ -0,0 +1,120 @@ +[ + [ + { + "host": "10.10.10.10.example.com" + }, + "//10.10.10.10.example.com" + ], + [ + { + "host": "2001:db8::7" + }, + "//[2001:db8::7]" + ], + [ + { + "host": "::ffff:129.144.52.38" + }, + "//[::ffff:129.144.52.38]" + ], + [ + { + "host": "2606:2800:220:1:248:1893:25c8:1946" + }, + "//[2606:2800:220:1:248:1893:25c8:1946]" + ], + [ + { + "host": "10.10.10.10.example.com" + }, + "//10.10.10.10.example.com" + ], + [ + { + "host": "10.10.10.10" + }, + "//10.10.10.10" + ], + [ + { + "path": "?query" + }, + "%3Fquery" + ], + [ + { + "path": "foo:bar" + }, + "foo%3Abar" + ], + [ + { + "path": "//path" + }, + "/%2Fpath" + ], + [ + { + "scheme": "uri", + "host": "example.com", + "port": "9000" + }, + "uri://example.com:9000" + ], + [ + { + "scheme": "uri", + "userinfo": "foo:bar", + "host": "example.com", + "port": 1, + "path": "path", + "query": "query", + "fragment": "fragment" + }, + "uri://foo:bar@example.com:1/path?query#fragment" + ], + [ + { + "scheme": "", + "userinfo": "", + "host": "", + "port": 0, + "path": "", + "query": "", + "fragment": "" + }, + "//@:0?#" + ], + [ + {}, + "" + ], + [ + { + "host": "fe80::a%en1" + }, + "//[fe80::a%25en1]" + ], + [ + { + "host": "fe80::a%25en1" + }, + "//[fe80::a%25en1]" + ], + [ + { + "scheme": "wss", + "host": "example.com", + "path": "/foo", + "query": "bar" + }, + "wss://example.com/foo?bar" + ], + [ + { + "scheme": "scheme", + "path": "with:colon" + }, + "scheme:with:colon" + ] +] \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/parse.test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/parse.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6a2be03b4496b96750fcaeb4af8a6d671a8a872f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/parse.test.js @@ -0,0 +1,318 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +test('URI parse', (t) => { + let components + + // scheme + components = fastURI.parse('uri:') + t.equal(components.error, undefined, 'scheme errors') + t.equal(components.scheme, 'uri', 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // userinfo + components = fastURI.parse('//@') + t.equal(components.error, undefined, 'userinfo errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, "@", "authority"); + t.equal(components.userinfo, '', 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // host + components = fastURI.parse('//') + t.equal(components.error, undefined, 'host errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, "", "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // port + components = fastURI.parse('//:') + t.equal(components.error, undefined, 'port errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, ":", "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, '', 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // path + components = fastURI.parse('') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // query + components = fastURI.parse('?') + t.equal(components.error, undefined, 'query errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, '', 'query') + t.equal(components.fragment, undefined, 'fragment') + + // fragment + components = fastURI.parse('#') + t.equal(components.error, undefined, 'fragment errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '', 'fragment') + + // fragment with character tabulation + components = fastURI.parse('#\t') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%09', 'fragment') + + // fragment with line feed + components = fastURI.parse('#\n') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0A', 'fragment') + + // fragment with line tabulation + components = fastURI.parse('#\v') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0B', 'fragment') + + // fragment with form feed + components = fastURI.parse('#\f') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0C', 'fragment') + + // fragment with carriage return + components = fastURI.parse('#\r') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0D', 'fragment') + + // all + components = fastURI.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body') + t.equal(components.error, undefined, 'all errors') + t.equal(components.scheme, 'uri', 'scheme') + // t.equal(components.authority, "user:pass@example.com:123", "authority"); + t.equal(components.userinfo, 'user:pass', 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, 123, 'port') + t.equal(components.path, '/one/two.three', 'path') + t.equal(components.query, 'q1=a1&q2=a2', 'query') + t.equal(components.fragment, 'body', 'fragment') + + // IPv4address + components = fastURI.parse('//10.10.10.10') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.10.10', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv4address with unformated 0 stay as-is + components = fastURI.parse('//10.10.000.10') // not valid as per https://datatracker.ietf.org/doc/html/rfc5954#section-4.1 + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.000.10', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + components = fastURI.parse('//01.01.01.01') // not valid in URIs: https://datatracker.ietf.org/doc/html/rfc3986#section-7.4 + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '01.01.01.01', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address + components = fastURI.parse('//[2001:db8::7]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::7', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // invalid IPv6 + components = fastURI.parse('//[2001:dbZ::7]') + t.equal(components.host, '[2001:dbz::7]') + + // mixed IPv4address & IPv6address + components = fastURI.parse('//[::ffff:129.144.52.38]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '::ffff:129.144.52.38', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4) + components = fastURI.parse('uri://10.10.10.10.example.com/en/process') + t.equal(components.error, undefined, 'mixed errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.10.10.example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '/en/process', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16) + components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946]/test') + t.equal(components.error, undefined, 'IPv6address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2606:2800:220:1:248:1893:25c8:1946', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '/test', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address, example from RFC 5952 + components = fastURI.parse('//[2001:db8::1]:80') + t.equal(components.error, undefined, 'IPv6address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::1', 'host') + t.equal(components.port, 80, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address with zone identifier, RFC 6874 + components = fastURI.parse('//[fe80::a%25en1]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'fe80::a%en1', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22) + components = fastURI.parse('//[2001:db8::7%en0]') + t.equal(components.error, undefined, 'IPv6address interface errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::7%en0', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // UUID V1 + components = fastURI.parse('urn:uuid:b571b0bc-4713-11ec-81d3-0242ac130003') + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.nid, 'uuid', 'nid') + t.equal(components.nss, undefined, 'nss') + t.equal(components.uuid, 'b571b0bc-4713-11ec-81d3-0242ac130003', 'uuid') + + // UUID v4 + components = fastURI.parse('urn:uuid:97a32222-89b7-420e-8507-4360723e2c2a') + t.equal(components.uuid, '97a32222-89b7-420e-8507-4360723e2c2a', 'uuid') + + components = fastURI.parse('urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6') + t.notSame(components.error, undefined, 'errors') + + components = fastURI.parse('urn:foo:a123,456') + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.nid, 'foo', 'nid') + t.equal(components.nss, 'a123,456', 'nss') + + components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946:43209]') + t.equal(components.host, '[2606:2800:220:1:248:1893:25c8:1946:43209]') + + components = fastURI.parse('urn:foo:|\\24fpl') + t.equal(components.error, 'URN can not be parsed.') + t.end() +}) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/resolve.test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/resolve.test.js new file mode 100644 index 0000000000000000000000000000000000000000..200754c440cd6bd38a3d25de353e3e0a7b60dec2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/resolve.test.js @@ -0,0 +1,78 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +test('URI Resolving', (t) => { + // normal examples from RFC 3986 + const base = 'uri://a/b/c/d;p?q' + t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h') + t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h') + t.equal(fastURI.resolve(base, 'g'), 'uri://a/b/c/g', 'g') + t.equal(fastURI.resolve(base, './g'), 'uri://a/b/c/g', './g') + t.equal(fastURI.resolve(base, 'g/'), 'uri://a/b/c/g/', 'g/') + t.equal(fastURI.resolve(base, '/g'), 'uri://a/g', '/g') + t.equal(fastURI.resolve(base, '//g'), 'uri://g', '//g') + t.equal(fastURI.resolve(base, '?y'), 'uri://a/b/c/d;p?y', '?y') + t.equal(fastURI.resolve(base, 'g?y'), 'uri://a/b/c/g?y', 'g?y') + t.equal(fastURI.resolve(base, '#s'), 'uri://a/b/c/d;p?q#s', '#s') + t.equal(fastURI.resolve(base, 'g#s'), 'uri://a/b/c/g#s', 'g#s') + t.equal(fastURI.resolve(base, 'g?y#s'), 'uri://a/b/c/g?y#s', 'g?y#s') + t.equal(fastURI.resolve(base, ';x'), 'uri://a/b/c/;x', ';x') + t.equal(fastURI.resolve(base, 'g;x'), 'uri://a/b/c/g;x', 'g;x') + t.equal(fastURI.resolve(base, 'g;x?y#s'), 'uri://a/b/c/g;x?y#s', 'g;x?y#s') + t.equal(fastURI.resolve(base, ''), 'uri://a/b/c/d;p?q', '') + t.equal(fastURI.resolve(base, '.'), 'uri://a/b/c/', '.') + t.equal(fastURI.resolve(base, './'), 'uri://a/b/c/', './') + t.equal(fastURI.resolve(base, '..'), 'uri://a/b/', '..') + t.equal(fastURI.resolve(base, '../'), 'uri://a/b/', '../') + t.equal(fastURI.resolve(base, '../g'), 'uri://a/b/g', '../g') + t.equal(fastURI.resolve(base, '../..'), 'uri://a/', '../..') + t.equal(fastURI.resolve(base, '../../'), 'uri://a/', '../../') + t.equal(fastURI.resolve(base, '../../g'), 'uri://a/g', '../../g') + + // abnormal examples from RFC 3986 + t.equal(fastURI.resolve(base, '../../../g'), 'uri://a/g', '../../../g') + t.equal(fastURI.resolve(base, '../../../../g'), 'uri://a/g', '../../../../g') + + t.equal(fastURI.resolve(base, '/./g'), 'uri://a/g', '/./g') + t.equal(fastURI.resolve(base, '/../g'), 'uri://a/g', '/../g') + t.equal(fastURI.resolve(base, 'g.'), 'uri://a/b/c/g.', 'g.') + t.equal(fastURI.resolve(base, '.g'), 'uri://a/b/c/.g', '.g') + t.equal(fastURI.resolve(base, 'g..'), 'uri://a/b/c/g..', 'g..') + t.equal(fastURI.resolve(base, '..g'), 'uri://a/b/c/..g', '..g') + + t.equal(fastURI.resolve(base, './../g'), 'uri://a/b/g', './../g') + t.equal(fastURI.resolve(base, './g/.'), 'uri://a/b/c/g/', './g/.') + t.equal(fastURI.resolve(base, 'g/./h'), 'uri://a/b/c/g/h', 'g/./h') + t.equal(fastURI.resolve(base, 'g/../h'), 'uri://a/b/c/h', 'g/../h') + t.equal(fastURI.resolve(base, 'g;x=1/./y'), 'uri://a/b/c/g;x=1/y', 'g;x=1/./y') + t.equal(fastURI.resolve(base, 'g;x=1/../y'), 'uri://a/b/c/y', 'g;x=1/../y') + + t.equal(fastURI.resolve(base, 'g?y/./x'), 'uri://a/b/c/g?y/./x', 'g?y/./x') + t.equal(fastURI.resolve(base, 'g?y/../x'), 'uri://a/b/c/g?y/../x', 'g?y/../x') + t.equal(fastURI.resolve(base, 'g#s/./x'), 'uri://a/b/c/g#s/./x', 'g#s/./x') + t.equal(fastURI.resolve(base, 'g#s/../x'), 'uri://a/b/c/g#s/../x', 'g#s/../x') + + t.equal(fastURI.resolve(base, 'uri:g'), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', {}), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', { tolerant: undefined }), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', { tolerant: false }), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', { tolerant: true }), 'uri://a/b/c/g', 'uri:g') + + // examples by PAEz + // example was provided to avoid infinite loop within regex + // this is not the case anymore + // t.equal(URI.resolve('//www.g.com/', '/adf\ngf'), '//www.g.com/adf%0Agf', '/adf\\ngf') + // t.equal(URI.resolve('//www.g.com/error\n/bleh/bleh', '..'), '//www.g.com/error%0A/', '//www.g.com/error\\n/bleh/bleh') + t.end() +}) + +test('URN Resolving', (t) => { + // example from epoberezkin + t.equal(fastURI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop') + t.equal(fastURI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop') + t.equal(fastURI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop') + t.equal(fastURI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop') + t.end() +}) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/rfc-3986.test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/rfc-3986.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0a5adbeccaea3604a45e8ffdd30839bcf3935ea1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/rfc-3986.test.js @@ -0,0 +1,90 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +test('RFC 3986', (t) => { + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + // A. If the input buffer begins with a prefix of "../" or "./", + // then remove that prefix from the input buffer; otherwise, + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './', secure: true }), + 'http://example.com/', 'http://example.com/') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../../', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '././', secure: true }), + 'http://example.com/', 'http://example.com/') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './../', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.././', secure: true }), + 'http://example.com/', 'http://example.com/') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../../foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '././foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './../foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.././foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + // B. if the input buffer begins with a prefix of "/./" or "/.", + // where "." is a complete path segment, then replace that + // prefix with "/" in the input buffer; otherwise, + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/./', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/./foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.././foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + // C. if the input buffer begins with a prefix of "/../" or "/..", + // where ".." is a complete path segment, then replace that + // prefix with "/" in the input buffer and remove the last + // segment and its preceding "/" (if any) from the output + // buffer; otherwise, + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/../', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/..', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/../foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/..', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/bar/..', secure: true }), + 'http://example.com/foo/', 'http://example.com/foo/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/../bar/..', secure: true }), + 'http://example.com/', 'http://example.com/') + + // D. if the input buffer consists only of "." or "..", then remove + // that from the input buffer; otherwise, + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/..', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '..', secure: true }), + 'http://example.com/', 'http://example.com/') + + t.end() +}) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/serialize.test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/serialize.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0eaa346aba23a2e3855a2330aa13c6c09317c743 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/serialize.test.js @@ -0,0 +1,151 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +test('URI Serialize', (t) => { + let components = { + scheme: undefined, + userinfo: undefined, + host: undefined, + port: undefined, + path: undefined, + query: undefined, + fragment: undefined + } + t.equal(fastURI.serialize(components), '', 'Undefined Components') + + components = { + scheme: '', + userinfo: '', + host: '', + port: 0, + path: '', + query: '', + fragment: '' + } + t.equal(fastURI.serialize(components), '//@:0?#', 'Empty Components') + + components = { + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: 'path', + query: 'query', + fragment: 'fragment' + } + t.equal(fastURI.serialize(components), 'uri://foo:bar@example.com:1/path?query#fragment', 'All Components') + + components = { + scheme: 'uri', + host: 'example.com', + port: '9000' + } + t.equal(fastURI.serialize(components), 'uri://example.com:9000', 'String port') + + t.equal(fastURI.serialize({ path: '//path' }), '/%2Fpath', 'Double slash path') + t.equal(fastURI.serialize({ path: 'foo:bar' }), 'foo%3Abar', 'Colon path') + t.equal(fastURI.serialize({ path: '?query' }), '%3Fquery', 'Query path') + + t.equal(fastURI.serialize({ host: '10.10.10.10' }), '//10.10.10.10', 'IPv4address') + + // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4) + t.equal(fastURI.serialize({ host: '10.10.10.10.example.com' }), '//10.10.10.10.example.com', 'Mixed IPv4address & reg-name') + + // IPv6address + t.equal(fastURI.serialize({ host: '2001:db8::7' }), '//[2001:db8::7]', 'IPv6 Host') + t.equal(fastURI.serialize({ host: '::ffff:129.144.52.38' }), '//[::ffff:129.144.52.38]', 'IPv6 Mixed Host') + t.equal(fastURI.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }), '//[2606:2800:220:1:248:1893:25c8:1946]', 'IPv6 Full Host') + + // IPv6address with zone identifier, RFC 6874 + t.equal(fastURI.serialize({ host: 'fe80::a%en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Unescaped Host') + t.equal(fastURI.serialize({ host: 'fe80::a%25en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Escaped Host') + + t.end() +}) + +test('WS serialize', (t) => { + t.equal(fastURI.serialize({ scheme: 'ws' }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com' }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/' }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo' }), 'ws:/foo') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo?bar' }), 'ws:/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', secure: false }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', secure: true }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo' }), 'ws://example.com/foo') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar' }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: false }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: true }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar') + t.end() +}) + +test('WSS serialize', (t) => { + t.equal(fastURI.serialize({ scheme: 'wss' }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com' }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/' }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo' }), 'wss:/foo') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo?bar' }), 'wss:/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', secure: false }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'wss', secure: true }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo' }), 'wss://example.com/foo') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar' }), 'wss://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: false }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: true }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar') + + t.end() +}) + +test('URN serialize', (t) => { + // example from RFC 2141 + const components = { + scheme: 'urn', + nid: 'foo', + nss: 'a123,456' + } + t.equal(fastURI.serialize(components), 'urn:foo:a123,456') + // example from RFC 4122 + let uuidcomponents = { + scheme: 'urn', + nid: 'uuid', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(uuidcomponents), 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + + uuidcomponents = { + scheme: 'urn', + nid: 'uuid', + uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(uuidcomponents), 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6') + + uuidcomponents = { + scheme: 'urn', + nid: undefined, + uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6' + } + t.throws(() => { fastURI.serialize(uuidcomponents) }, 'URN without nid cannot be serialized') + + t.end() +}) +test('URN NID Override', (t) => { + let components = fastURI.parse('urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', { nid: 'uuid' }) + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + t.equal(components.path, undefined, 'path') + t.equal(components.nid, 'foo', 'nid') + t.equal(components.nss, undefined, 'nss') + t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid') + + components = { + scheme: 'urn', + nid: 'foo', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(components, { nid: 'uuid' }), 'urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + t.end() +}) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/uri-js-compatibility.test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/uri-js-compatibility.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a75869b18c8af470de4999dfb533f2305d44b450 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/uri-js-compatibility.test.js @@ -0,0 +1,33 @@ +'use strict' + +const test = require('tape') +const fastURI = require('../') + +const uriJsParseFixtures = require('./fixtures/uri-js-parse.json') +const uriJsSerializeFixtures = require('./fixtures/uri-js-serialize.json') + +test('uri-js compatibility Parse', (t) => { + uriJsParseFixtures.forEach(( + [value, expected] + ) => { + if (value === '//10.10.000.10') { + return t.skip('Skipping //10.10.000.10 as it is not a valid URI per URI spec: https://datatracker.ietf.org/doc/html/rfc5954#section-4.1') + } + if (value.slice(0, 6) === 'mailto') { + return t.skip('Skipping mailto schema test as it is not supported by fastifyURI') + } + t.same(JSON.parse(JSON.stringify(fastURI.parse(value))), expected, 'Compatibility parse: ' + value) + }) + t.end() +}) + +test('uri-js compatibility serialize', (t) => { + uriJsSerializeFixtures.forEach(([value, expected]) => { + t.same( + fastURI.serialize(value), + expected, + 'Compatibility serialize: ' + JSON.stringify(value) + ) + }) + t.end() +}) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/uri-js.test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/uri-js.test.js new file mode 100644 index 0000000000000000000000000000000000000000..109df95ea847cb4fc5e439c0f385f978b8e1072a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/uri-js.test.js @@ -0,0 +1,912 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +/** + * URI.js + * + * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/normalizing/resolving/serializing library for JavaScript. + * @author Gary Court + * @see http://github.com/garycourt/uri-js + */ + +/** + * Copyright 2011 Gary Court. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of Gary Court. + */ + +test('Acquire URI', (t) => { + t.ok(fastURI) + t.end() +}) + +test('URI Parsing', (t) => { + let components + + // scheme + components = fastURI.parse('uri:') + t.equal(components.error, undefined, 'scheme errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // userinfo + components = fastURI.parse('//@') + t.equal(components.error, undefined, 'userinfo errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, '', 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // host + components = fastURI.parse('//') + t.equal(components.error, undefined, 'host errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // port + components = fastURI.parse('//:') + t.equal(components.error, undefined, 'port errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, '', 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // path + components = fastURI.parse('') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // query + components = fastURI.parse('?') + t.equal(components.error, undefined, 'query errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, '', 'query') + t.equal(components.fragment, undefined, 'fragment') + + // fragment + components = fastURI.parse('#') + t.equal(components.error, undefined, 'fragment errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '', 'fragment') + + // fragment with character tabulation + components = fastURI.parse('#\t') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%09', 'fragment') + + // fragment with line feed + components = fastURI.parse('#\n') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0A', 'fragment') + + // fragment with line tabulation + components = fastURI.parse('#\v') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0B', 'fragment') + + // fragment with form feed + components = fastURI.parse('#\f') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0C', 'fragment') + + // fragment with carriage return + components = fastURI.parse('#\r') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0D', 'fragment') + + // all + components = fastURI.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body') + t.equal(components.error, undefined, 'all errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, 'user:pass', 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, 123, 'port') + t.equal(components.path, '/one/two.three', 'path') + t.equal(components.query, 'q1=a1&q2=a2', 'query') + t.equal(components.fragment, 'body', 'fragment') + + // IPv4address + components = fastURI.parse('//10.10.10.10') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.10.10', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address + components = fastURI.parse('//[2001:db8::7]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::7', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // mixed IPv4address & IPv6address + components = fastURI.parse('//[::ffff:129.144.52.38]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '::ffff:129.144.52.38', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4) + components = fastURI.parse('uri://10.10.10.10.example.com/en/process') + t.equal(components.error, undefined, 'mixed errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.10.10.example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '/en/process', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16) + components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946]/test') + t.equal(components.error, undefined, 'IPv6address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2606:2800:220:1:248:1893:25c8:1946', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '/test', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address, example from RFC 5952 + components = fastURI.parse('//[2001:db8::1]:80') + t.equal(components.error, undefined, 'IPv6address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::1', 'host') + t.equal(components.port, 80, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address with zone identifier, RFC 6874 + components = fastURI.parse('//[fe80::a%25en1]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'fe80::a%en1', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22) + components = fastURI.parse('//[2001:db8::7%en0]') + t.equal(components.error, undefined, 'IPv6address interface errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::7%en0', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + t.end() +}) + +test('URI Serialization', (t) => { + let components = { + scheme: undefined, + userinfo: undefined, + host: undefined, + port: undefined, + path: undefined, + query: undefined, + fragment: undefined + } + t.equal(fastURI.serialize(components), '', 'Undefined Components') + + components = { + scheme: '', + userinfo: '', + host: '', + port: 0, + path: '', + query: '', + fragment: '' + } + t.equal(fastURI.serialize(components), '//@:0?#', 'Empty Components') + + components = { + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: 'path', + query: 'query', + fragment: 'fragment' + } + t.equal(fastURI.serialize(components), 'uri://foo:bar@example.com:1/path?query#fragment', 'All Components') + + components = { + scheme: 'uri', + host: 'example.com', + port: '9000' + } + t.equal(fastURI.serialize(components), 'uri://example.com:9000', 'String port') + + t.equal(fastURI.serialize({ path: '//path' }), '/%2Fpath', 'Double slash path') + t.equal(fastURI.serialize({ path: 'foo:bar' }), 'foo%3Abar', 'Colon path') + t.equal(fastURI.serialize({ path: '?query' }), '%3Fquery', 'Query path') + + // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4) + t.equal(fastURI.serialize({ host: '10.10.10.10.example.com' }), '//10.10.10.10.example.com', 'Mixed IPv4address & reg-name') + + // IPv6address + t.equal(fastURI.serialize({ host: '2001:db8::7' }), '//[2001:db8::7]', 'IPv6 Host') + t.equal(fastURI.serialize({ host: '::ffff:129.144.52.38' }), '//[::ffff:129.144.52.38]', 'IPv6 Mixed Host') + t.equal(fastURI.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }), '//[2606:2800:220:1:248:1893:25c8:1946]', 'IPv6 Full Host') + + // IPv6address with zone identifier, RFC 6874 + t.equal(fastURI.serialize({ host: 'fe80::a%en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Unescaped Host') + t.equal(fastURI.serialize({ host: 'fe80::a%25en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Escaped Host') + + t.end() +}) + +test('URI Resolving', { skip: true }, (t) => { + // normal examples from RFC 3986 + const base = 'uri://a/b/c/d;p?q' + t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h') + t.equal(fastURI.resolve(base, 'g'), 'uri://a/b/c/g', 'g') + t.equal(fastURI.resolve(base, './g'), 'uri://a/b/c/g', './g') + t.equal(fastURI.resolve(base, 'g/'), 'uri://a/b/c/g/', 'g/') + t.equal(fastURI.resolve(base, '/g'), 'uri://a/g', '/g') + t.equal(fastURI.resolve(base, '//g'), 'uri://g', '//g') + t.equal(fastURI.resolve(base, '?y'), 'uri://a/b/c/d;p?y', '?y') + t.equal(fastURI.resolve(base, 'g?y'), 'uri://a/b/c/g?y', 'g?y') + t.equal(fastURI.resolve(base, '#s'), 'uri://a/b/c/d;p?q#s', '#s') + t.equal(fastURI.resolve(base, 'g#s'), 'uri://a/b/c/g#s', 'g#s') + t.equal(fastURI.resolve(base, 'g?y#s'), 'uri://a/b/c/g?y#s', 'g?y#s') + t.equal(fastURI.resolve(base, ';x'), 'uri://a/b/c/;x', ';x') + t.equal(fastURI.resolve(base, 'g;x'), 'uri://a/b/c/g;x', 'g;x') + t.equal(fastURI.resolve(base, 'g;x?y#s'), 'uri://a/b/c/g;x?y#s', 'g;x?y#s') + t.equal(fastURI.resolve(base, ''), 'uri://a/b/c/d;p?q', '') + t.equal(fastURI.resolve(base, '.'), 'uri://a/b/c/', '.') + t.equal(fastURI.resolve(base, './'), 'uri://a/b/c/', './') + t.equal(fastURI.resolve(base, '..'), 'uri://a/b/', '..') + t.equal(fastURI.resolve(base, '../'), 'uri://a/b/', '../') + t.equal(fastURI.resolve(base, '../g'), 'uri://a/b/g', '../g') + t.equal(fastURI.resolve(base, '../..'), 'uri://a/', '../..') + t.equal(fastURI.resolve(base, '../../'), 'uri://a/', '../../') + t.equal(fastURI.resolve(base, '../../g'), 'uri://a/g', '../../g') + + // abnormal examples from RFC 3986 + t.equal(fastURI.resolve(base, '../../../g'), 'uri://a/g', '../../../g') + t.equal(fastURI.resolve(base, '../../../../g'), 'uri://a/g', '../../../../g') + + t.equal(fastURI.resolve(base, '/./g'), 'uri://a/g', '/./g') + t.equal(fastURI.resolve(base, '/../g'), 'uri://a/g', '/../g') + t.equal(fastURI.resolve(base, 'g.'), 'uri://a/b/c/g.', 'g.') + t.equal(fastURI.resolve(base, '.g'), 'uri://a/b/c/.g', '.g') + t.equal(fastURI.resolve(base, 'g..'), 'uri://a/b/c/g..', 'g..') + t.equal(fastURI.resolve(base, '..g'), 'uri://a/b/c/..g', '..g') + + t.equal(fastURI.resolve(base, './../g'), 'uri://a/b/g', './../g') + t.equal(fastURI.resolve(base, './g/.'), 'uri://a/b/c/g/', './g/.') + t.equal(fastURI.resolve(base, 'g/./h'), 'uri://a/b/c/g/h', 'g/./h') + t.equal(fastURI.resolve(base, 'g/../h'), 'uri://a/b/c/h', 'g/../h') + t.equal(fastURI.resolve(base, 'g;x=1/./y'), 'uri://a/b/c/g;x=1/y', 'g;x=1/./y') + t.equal(fastURI.resolve(base, 'g;x=1/../y'), 'uri://a/b/c/y', 'g;x=1/../y') + + t.equal(fastURI.resolve(base, 'g?y/./x'), 'uri://a/b/c/g?y/./x', 'g?y/./x') + t.equal(fastURI.resolve(base, 'g?y/../x'), 'uri://a/b/c/g?y/../x', 'g?y/../x') + t.equal(fastURI.resolve(base, 'g#s/./x'), 'uri://a/b/c/g#s/./x', 'g#s/./x') + t.equal(fastURI.resolve(base, 'g#s/../x'), 'uri://a/b/c/g#s/../x', 'g#s/../x') + + t.equal(fastURI.resolve(base, 'uri:g'), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', { tolerant: true }), 'uri://a/b/c/g', 'uri:g') + + // examples by PAEz + t.equal(fastURI.resolve('//www.g.com/', '/adf\ngf'), '//www.g.com/adf%0Agf', '/adf\\ngf') + t.equal(fastURI.resolve('//www.g.com/error\n/bleh/bleh', '..'), '//www.g.com/error%0A/', '//www.g.com/error\\n/bleh/bleh') + + t.end() +}) + +test('URI Normalizing', { skip: true }, (t) => { + // test from RFC 3987 + t.equal(fastURI.normalize('uri://www.example.org/red%09ros\xE9#red'), 'uri://www.example.org/red%09ros%C3%A9#red') + + // IPv4address + t.equal(fastURI.normalize('//192.068.001.000'), '//192.68.1.0') + + // IPv6address, example from RFC 3513 + t.equal(fastURI.normalize('http://[1080::8:800:200C:417A]/'), 'http://[1080::8:800:200c:417a]/') + + // IPv6address, examples from RFC 5952 + t.equal(fastURI.normalize('//[2001:0db8::0001]/'), '//[2001:db8::1]/') + t.equal(fastURI.normalize('//[2001:db8::1:0000:1]/'), '//[2001:db8::1:0:1]/') + t.equal(fastURI.normalize('//[2001:db8:0:0:0:0:2:1]/'), '//[2001:db8::2:1]/') + t.equal(fastURI.normalize('//[2001:db8:0:1:1:1:1:1]/'), '//[2001:db8:0:1:1:1:1:1]/') + t.equal(fastURI.normalize('//[2001:0:0:1:0:0:0:1]/'), '//[2001:0:0:1::1]/') + t.equal(fastURI.normalize('//[2001:db8:0:0:1:0:0:1]/'), '//[2001:db8::1:0:0:1]/') + t.equal(fastURI.normalize('//[2001:DB8::1]/'), '//[2001:db8::1]/') + t.equal(fastURI.normalize('//[0:0:0:0:0:ffff:192.0.2.1]/'), '//[::ffff:192.0.2.1]/') + + // Mixed IPv4 and IPv6 address + t.equal(fastURI.normalize('//[1:2:3:4:5:6:192.0.2.1]/'), '//[1:2:3:4:5:6:192.0.2.1]/') + t.equal(fastURI.normalize('//[1:2:3:4:5:6:192.068.001.000]/'), '//[1:2:3:4:5:6:192.68.1.0]/') + + t.end() +}) + +test('URI Equals', (t) => { + // test from RFC 3986 + t.equal(fastURI.equal('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'), true) + + // test from RFC 3987 + t.equal(fastURI.equal('http://example.org/~user', 'http://example.org/%7euser'), true) + + t.end() +}) + +test('Escape Component', { skip: true }, (t) => { + let chr + for (let d = 0; d <= 129; ++d) { + chr = String.fromCharCode(d) + if (!chr.match(/[$&+,;=]/)) { + t.equal(fastURI.escapeComponent(chr), encodeURIComponent(chr)) + } else { + t.equal(fastURI.escapeComponent(chr), chr) + } + } + t.equal(fastURI.escapeComponent('\u00c0'), encodeURIComponent('\u00c0')) + t.equal(fastURI.escapeComponent('\u07ff'), encodeURIComponent('\u07ff')) + t.equal(fastURI.escapeComponent('\u0800'), encodeURIComponent('\u0800')) + t.equal(fastURI.escapeComponent('\u30a2'), encodeURIComponent('\u30a2')) + t.end() +}) + +test('Unescape Component', { skip: true }, (t) => { + let chr + for (let d = 0; d <= 129; ++d) { + chr = String.fromCharCode(d) + t.equal(fastURI.unescapeComponent(encodeURIComponent(chr)), chr) + } + t.equal(fastURI.unescapeComponent(encodeURIComponent('\u00c0')), '\u00c0') + t.equal(fastURI.unescapeComponent(encodeURIComponent('\u07ff')), '\u07ff') + t.equal(fastURI.unescapeComponent(encodeURIComponent('\u0800')), '\u0800') + t.equal(fastURI.unescapeComponent(encodeURIComponent('\u30a2')), '\u30a2') + t.end() +}) + +const IRI_OPTION = { iri: true, unicodeSupport: true } + +test('IRI Parsing', { skip: true }, (t) => { + const components = fastURI.parse('uri://us\xA0er:pa\uD7FFss@example.com:123/o\uF900ne/t\uFDCFwo.t\uFDF0hree?q1=a1\uF8FF\uE000&q2=a2#bo\uFFEFdy', IRI_OPTION) + t.equal(components.error, undefined, 'all errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, 'us\xA0er:pa\uD7FFss', 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, 123, 'port') + t.equal(components.path, '/o\uF900ne/t\uFDCFwo.t\uFDF0hree', 'path') + t.equal(components.query, 'q1=a1\uF8FF\uE000&q2=a2', 'query') + t.equal(components.fragment, 'bo\uFFEFdy', 'fragment') + t.end() +}) + +test('IRI Serialization', { skip: true }, (t) => { + const components = { + scheme: 'uri', + userinfo: 'us\xA0er:pa\uD7FFss', + host: 'example.com', + port: 123, + path: '/o\uF900ne/t\uFDCFwo.t\uFDF0hree', + query: 'q1=a1\uF8FF\uE000&q2=a2', + fragment: 'bo\uFFEFdy\uE001' + } + t.equal(fastURI.serialize(components, IRI_OPTION), 'uri://us\xA0er:pa\uD7FFss@example.com:123/o\uF900ne/t\uFDCFwo.t\uFDF0hree?q1=a1\uF8FF\uE000&q2=a2#bo\uFFEFdy%EE%80%81') + t.end() +}) + +test('IRI Normalizing', { skip: true }, (t) => { + t.equal(fastURI.normalize('uri://www.example.org/red%09ros\xE9#red', IRI_OPTION), 'uri://www.example.org/red%09ros\xE9#red') + t.end() +}) + +test('IRI Equals', { skip: true }, (t) => { + // example from RFC 3987 + t.equal(fastURI.equal('example://a/b/c/%7Bfoo%7D/ros\xE9', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9', IRI_OPTION), true) + t.end() +}) + +test('Convert IRI to URI', { skip: true }, (t) => { + // example from RFC 3987 + t.equal(fastURI.serialize(fastURI.parse('uri://www.example.org/red%09ros\xE9#red', IRI_OPTION)), 'uri://www.example.org/red%09ros%C3%A9#red') + + // Internationalized Domain Name conversion via punycode example from RFC 3987 + t.equal(fastURI.serialize(fastURI.parse('uri://r\xE9sum\xE9.example.org', { iri: true, domainHost: true }), { domainHost: true }), 'uri://xn--rsum-bpad.example.org') + t.end() +}) + +test('Convert URI to IRI', { skip: true }, (t) => { + // examples from RFC 3987 + t.equal(fastURI.serialize(fastURI.parse('uri://www.example.org/D%C3%BCrst'), IRI_OPTION), 'uri://www.example.org/D\xFCrst') + t.equal(fastURI.serialize(fastURI.parse('uri://www.example.org/D%FCrst'), IRI_OPTION), 'uri://www.example.org/D%FCrst') + t.equal(fastURI.serialize(fastURI.parse('uri://xn--99zt52a.example.org/%e2%80%ae'), IRI_OPTION), 'uri://xn--99zt52a.example.org/%E2%80%AE') // or uri://\u7D0D\u8C46.example.org/%E2%80%AE + + // Internationalized Domain Name conversion via punycode example from RFC 3987 + t.equal(fastURI.serialize(fastURI.parse('uri://xn--rsum-bpad.example.org', { domainHost: true }), { iri: true, domainHost: true }), 'uri://r\xE9sum\xE9.example.org') + t.end() +}) + +if (fastURI.SCHEMES.http) { + test('HTTP Equals', (t) => { + // test from RFC 2616 + t.equal(fastURI.equal('http://abc.com:80/~smith/home.html', 'http://abc.com/~smith/home.html'), true) + t.equal(fastURI.equal('http://ABC.com/%7Esmith/home.html', 'http://abc.com/~smith/home.html'), true) + t.equal(fastURI.equal('http://ABC.com:/%7esmith/home.html', 'http://abc.com/~smith/home.html'), true) + t.equal(fastURI.equal('HTTP://ABC.COM', 'http://abc.com/'), true) + // test from RFC 3986 + t.equal(fastURI.equal('http://example.com:/', 'http://example.com:80/'), true) + t.end() + }) +} + +if (fastURI.SCHEMES.https) { + test('HTTPS Equals', (t) => { + t.equal(fastURI.equal('https://example.com', 'https://example.com:443/'), true) + t.equal(fastURI.equal('https://example.com:/', 'https://example.com:443/'), true) + t.end() + }) +} + +if (fastURI.SCHEMES.urn) { + test('URN Parsing', (t) => { + // example from RFC 2141 + const components = fastURI.parse('urn:foo:a123,456') + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.nid, 'foo', 'nid') + t.equal(components.nss, 'a123,456', 'nss') + t.end() + }) + + test('URN Serialization', (t) => { + // example from RFC 2141 + const components = { + scheme: 'urn', + nid: 'foo', + nss: 'a123,456' + } + t.equal(fastURI.serialize(components), 'urn:foo:a123,456') + t.end() + }) + + test('URN Equals', { skip: true }, (t) => { + // test from RFC 2141 + t.equal(fastURI.equal('urn:foo:a123,456', 'urn:foo:a123,456'), true) + t.equal(fastURI.equal('urn:foo:a123,456', 'URN:foo:a123,456'), true) + t.equal(fastURI.equal('urn:foo:a123,456', 'urn:FOO:a123,456'), true) + t.equal(fastURI.equal('urn:foo:a123,456', 'urn:foo:A123,456'), false) + t.equal(fastURI.equal('urn:foo:a123%2C456', 'URN:FOO:a123%2c456'), true) + t.end() + }) + + test('URN Resolving', (t) => { + // example from epoberezkin + t.equal(fastURI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop') + t.equal(fastURI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop') + t.equal(fastURI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop') + t.equal(fastURI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop') + t.end() + }) + + test('UUID Parsing', (t) => { + // example from RFC 4122 + let components = fastURI.parse('urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.nid, 'uuid', 'nid') + t.equal(components.nss, undefined, 'nss') + t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid') + + components = fastURI.parse('urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6') + t.notEqual(components.error, undefined, 'errors') + t.end() + }) + + test('UUID Serialization', (t) => { + // example from RFC 4122 + let components = { + scheme: 'urn', + nid: 'uuid', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(components), 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + + components = { + scheme: 'urn', + nid: 'uuid', + uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(components), 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6') + t.end() + }) + + test('UUID Equals', (t) => { + t.equal(fastURI.equal('URN:UUID:F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6', 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'), true) + t.end() + }) + + test('URN NID Override', (t) => { + let components = fastURI.parse('urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', { nid: 'uuid' }) + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + t.equal(components.path, undefined, 'path') + t.equal(components.nid, 'foo', 'nid') + t.equal(components.nss, undefined, 'nss') + t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid') + + components = { + scheme: 'urn', + nid: 'foo', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(components, { nid: 'uuid' }), 'urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + t.end() + }) +} + +if (fastURI.SCHEMES.mailto) { + test('Mailto Parse', (t) => { + let components + + // tests from RFC 6068 + + components = fastURI.parse('mailto:chris@example.com') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'mailto', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.deepEqual(components.to, ['chris@example.com'], 'to') + t.equal(components.subject, undefined, 'subject') + t.equal(components.body, undefined, 'body') + t.equal(components.headers, undefined, 'headers') + + components = fastURI.parse('mailto:infobot@example.com?subject=current-issue') + t.deepEqual(components.to, ['infobot@example.com'], 'to') + t.equal(components.subject, 'current-issue', 'subject') + + components = fastURI.parse('mailto:infobot@example.com?body=send%20current-issue') + t.deepEqual(components.to, ['infobot@example.com'], 'to') + t.equal(components.body, 'send current-issue', 'body') + + components = fastURI.parse('mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index') + t.deepEqual(components.to, ['infobot@example.com'], 'to') + t.equal(components.body, 'send current-issue\x0D\x0Asend index', 'body') + + components = fastURI.parse('mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E') + t.deepEqual(components.to, ['list@example.org'], 'to') + t.deepEqual(components.headers, { 'In-Reply-To': '<3469A91.D10AF4C@example.com>' }, 'headers') + + components = fastURI.parse('mailto:majordomo@example.com?body=subscribe%20bamboo-l') + t.deepEqual(components.to, ['majordomo@example.com'], 'to') + t.equal(components.body, 'subscribe bamboo-l', 'body') + + components = fastURI.parse('mailto:joe@example.com?cc=bob@example.com&body=hello') + t.deepEqual(components.to, ['joe@example.com'], 'to') + t.equal(components.body, 'hello', 'body') + t.deepEqual(components.headers, { cc: 'bob@example.com' }, 'headers') + + components = fastURI.parse('mailto:joe@example.com?cc=bob@example.com?body=hello') + if (fastURI.VALIDATE_SUPPORT) t.ok(components.error, 'invalid header fields') + + components = fastURI.parse('mailto:gorby%25kremvax@example.com') + t.deepEqual(components.to, ['gorby%kremvax@example.com'], 'to gorby%kremvax@example.com') + + components = fastURI.parse('mailto:unlikely%3Faddress@example.com?blat=foop') + t.deepEqual(components.to, ['unlikely?address@example.com'], 'to unlikely?address@example.com') + t.deepEqual(components.headers, { blat: 'foop' }, 'headers') + + components = fastURI.parse('mailto:Mike%26family@example.org') + t.deepEqual(components.to, ['Mike&family@example.org'], 'to Mike&family@example.org') + + components = fastURI.parse('mailto:%22not%40me%22@example.org') + t.deepEqual(components.to, ['"not@me"@example.org'], 'to ' + '"not@me"@example.org') + + components = fastURI.parse('mailto:%22oh%5C%5Cno%22@example.org') + t.deepEqual(components.to, ['"oh\\\\no"@example.org'], 'to ' + '"oh\\\\no"@example.org') + + components = fastURI.parse("mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org") + t.deepEqual(components.to, ['"\\\\\\"it\'s\\ ugly\\\\\\""@example.org'], 'to ' + '"\\\\\\"it\'s\\ ugly\\\\\\""@example.org') + + components = fastURI.parse('mailto:user@example.org?subject=caf%C3%A9') + t.deepEqual(components.to, ['user@example.org'], 'to') + t.equal(components.subject, 'caf\xE9', 'subject') + + components = fastURI.parse('mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D') + t.deepEqual(components.to, ['user@example.org'], 'to') + t.equal(components.subject, '=?utf-8?Q?caf=C3=A9?=', 'subject') // TODO: Verify this + + components = fastURI.parse('mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D') + t.deepEqual(components.to, ['user@example.org'], 'to') + t.equal(components.subject, '=?iso-8859-1?Q?caf=E9?=', 'subject') // TODO: Verify this + + components = fastURI.parse('mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9') + t.deepEqual(components.to, ['user@example.org'], 'to') + t.equal(components.subject, 'caf\xE9', 'subject') + t.equal(components.body, 'caf\xE9', 'body') + + if (fastURI.IRI_SUPPORT) { + components = fastURI.parse('mailto:user@%E7%B4%8D%E8%B1%86.example.org?subject=Test&body=NATTO') + t.deepEqual(components.to, ['user@xn--99zt52a.example.org'], 'to') + t.equal(components.subject, 'Test', 'subject') + t.equal(components.body, 'NATTO', 'body') + } + + t.end() + }) + + test('Mailto Serialize', (t) => { + // tests from RFC 6068 + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['chris@example.com'] }), 'mailto:chris@example.com') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['infobot@example.com'], body: 'current-issue' }), 'mailto:infobot@example.com?body=current-issue') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['infobot@example.com'], body: 'send current-issue' }), 'mailto:infobot@example.com?body=send%20current-issue') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['infobot@example.com'], body: 'send current-issue\x0D\x0Asend index' }), 'mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['list@example.org'], headers: { 'In-Reply-To': '<3469A91.D10AF4C@example.com>' } }), 'mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['majordomo@example.com'], body: 'subscribe bamboo-l' }), 'mailto:majordomo@example.com?body=subscribe%20bamboo-l') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['joe@example.com'], headers: { cc: 'bob@example.com', body: 'hello' } }), 'mailto:joe@example.com?cc=bob@example.com&body=hello') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['gorby%25kremvax@example.com'] }), 'mailto:gorby%25kremvax@example.com') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['unlikely%3Faddress@example.com'], headers: { blat: 'foop' } }), 'mailto:unlikely%3Faddress@example.com?blat=foop') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['Mike&family@example.org'] }), 'mailto:Mike%26family@example.org') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['"not@me"@example.org'] }), 'mailto:%22not%40me%22@example.org') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['"oh\\\\no"@example.org'] }), 'mailto:%22oh%5C%5Cno%22@example.org') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['"\\\\\\"it\'s\\ ugly\\\\\\""@example.org'] }), "mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org") + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: 'caf\xE9' }), 'mailto:user@example.org?subject=caf%C3%A9') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: '=?utf-8?Q?caf=C3=A9?=' }), 'mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: '=?iso-8859-1?Q?caf=E9?=' }), 'mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: 'caf\xE9', body: 'caf\xE9' }), 'mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9') + if (fastURI.IRI_SUPPORT) { + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['us\xE9r@\u7d0d\u8c46.example.org'], subject: 'Test', body: 'NATTO' }), 'mailto:us%C3%A9r@xn--99zt52a.example.org?subject=Test&body=NATTO') + } + t.end() + }) + + test('Mailto Equals', (t) => { + // tests from RFC 6068 + t.equal(fastURI.equal('mailto:addr1@an.example,addr2@an.example', 'mailto:?to=addr1@an.example,addr2@an.example'), true) + t.equal(fastURI.equal('mailto:?to=addr1@an.example,addr2@an.example', 'mailto:addr1@an.example?to=addr2@an.example'), true) + t.end() + }) +} + +if (fastURI.SCHEMES.ws) { + test('WS Parse', (t) => { + let components + + // example from RFC 6455, Sec 4.1 + components = fastURI.parse('ws://example.com/chat') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'ws', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.resourceName, '/chat', 'resourceName') + t.equal(components.secure, false, 'secure') + + components = fastURI.parse('ws://example.com/foo?bar=baz') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'ws', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.resourceName, '/foo?bar=baz', 'resourceName') + t.equal(components.secure, false, 'secure') + + components = fastURI.parse('ws://example.com/?bar=baz') + t.equal(components.resourceName, '/?bar=baz', 'resourceName') + + t.end() + }) + + test('WS Serialize', (t) => { + t.equal(fastURI.serialize({ scheme: 'ws' }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com' }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/' }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo' }), 'ws:/foo') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo?bar' }), 'ws:/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', secure: false }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', secure: true }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo' }), 'ws://example.com/foo') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar' }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: false }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: true }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar') + t.end() + }) + + test('WS Equal', (t) => { + t.equal(fastURI.equal('WS://ABC.COM:80/chat#one', 'ws://abc.com/chat'), true) + t.end() + }) + + test('WS Normalize', (t) => { + t.equal(fastURI.normalize('ws://example.com:80/foo#hash'), 'ws://example.com/foo') + t.end() + }) +} + +if (fastURI.SCHEMES.wss) { + test('WSS Parse', (t) => { + let components + + // example from RFC 6455, Sec 4.1 + components = fastURI.parse('wss://example.com/chat') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'wss', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.resourceName, '/chat', 'resourceName') + t.equal(components.secure, true, 'secure') + + components = fastURI.parse('wss://example.com/foo?bar=baz') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'wss', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.resourceName, '/foo?bar=baz', 'resourceName') + t.equal(components.secure, true, 'secure') + + components = fastURI.parse('wss://example.com/?bar=baz') + t.equal(components.resourceName, '/?bar=baz', 'resourceName') + + t.end() + }) + + test('WSS Serialize', (t) => { + t.equal(fastURI.serialize({ scheme: 'wss' }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com' }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/' }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo' }), 'wss:/foo') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo?bar' }), 'wss:/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', secure: false }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'wss', secure: true }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo' }), 'wss://example.com/foo') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar' }), 'wss://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: false }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: true }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar') + t.end() + }) + + test('WSS Equal', (t) => { + t.equal(fastURI.equal('WSS://ABC.COM:443/chat#one', 'wss://abc.com/chat'), true) + t.end() + }) + + test('WSS Normalize', (t) => { + t.equal(fastURI.normalize('wss://example.com:443/foo#hash'), 'wss://example.com/foo') + t.end() + }) +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/util.test.js b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/util.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bbf7ebd8048b68531dce03eb828c3f6684e174c2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/test/util.test.js @@ -0,0 +1,38 @@ +'use strict' + +const test = require('tape') +const { + stringArrayToHexStripped, + removeDotSegments +} = require('../lib/utils') + +test('stringArrayToHexStripped', (t) => { + const testCases = [ + [['0', '0', '0', '0'], ''], + [['0', '0', '0', '1'], '1'], + [['0', '0', '1', '0'], '10'], + [['0', '1', '0', '0'], '100'], + [['1', '0', '0', '0'], '1000'], + [['1', '0', '0', '1'], '1001'], + ] + + t.plan(testCases.length) + + testCases.forEach(([input, expected]) => { + t.same(stringArrayToHexStripped(input), expected) + }) +}) + +// Just fixtures, because this function already tested by resolve +test('removeDotSegments', (t) => { + const testCases = [] + // https://github.com/fastify/fast-uri/issues/139 + testCases.push(['WS:/WS://1305G130505:1&%0D:1&C(XXXXX*)))))))XXX130505:UUVUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$aaaaaaaaaaaa13a', + 'WS:/WS://1305G130505:1&%0D:1&C(XXXXX*)))))))XXX130505:UUVUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$aaaaaaaaaaaa13a']) + + t.plan(testCases.length) + + testCases.forEach(([input, expected]) => { + t.same(removeDotSegments(input), expected) + }) +}) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/types/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1481ba9c3b8c99c0c1ca1893acaecf2943e46e4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/types/index.d.ts @@ -0,0 +1,60 @@ +type FastUri = typeof fastUri + +declare namespace fastUri { + export interface URIComponent { + scheme?: string; + userinfo?: string; + host?: string; + port?: number | string; + path?: string; + query?: string; + fragment?: string; + reference?: string; + nid?: string; + nss?: string; + resourceName?: string; + secure?: boolean; + uuid?: string; + error?: string; + } + export interface Options { + scheme?: string; + reference?: string; + unicodeSupport?: boolean; + domainHost?: boolean; + absolutePath?: boolean; + tolerant?: boolean; + skipEscape?: boolean; + nid?: string; + } + + /** + * @deprecated Use Options instead + */ + export type options = Options + /** + * @deprecated Use URIComponent instead + */ + export type URIComponents = URIComponent + + export function normalize (uri: string, opts?: Options): string + export function normalize (uri: URIComponent, opts?: Options): URIComponent + export function normalize (uri: any, opts?: Options): any + + export function resolve (baseURI: string, relativeURI: string, options?: Options): string + + export function resolveComponent (base: URIComponent, relative: URIComponent, options?: Options, skipNormalization?: boolean): URIComponent + + export function parse (uri: string, opts?: Options): URIComponent + + export function serialize (component: URIComponent, opts?: Options): string + + export function equal (uriA: string, uriB: string): boolean + + export function resolve (base: string, path: string): string + + export const fastUri: FastUri + export { fastUri as default } +} + +export = fastUri diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/types/index.test-d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/types/index.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..02670ced86048f1dab20e69266f060ded8887396 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/fast-uri/types/index.test-d.ts @@ -0,0 +1,17 @@ +import uri, { URIComponents, URIComponent, Options, options } from '..' +import { expectDeprecated, expectType } from 'tsd' + +const parsed = uri.parse('foo') +expectType(parsed) +const parsed2 = uri.parse('foo', { + domainHost: true, + scheme: 'https', + unicodeSupport: false +}) +expectType(parsed2) + +expectType({} as URIComponents) +expectDeprecated({} as URIComponents) + +expectType({} as options) +expectDeprecated({} as options) diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..64f40490e5fe9d3453f5b2158a908bea7c7df0a8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/index.d.ts @@ -0,0 +1,248 @@ +/* eslint-disable @typescript-eslint/unified-signatures */ +import {Options as LocatePathOptions} from 'locate-path'; + +/** +Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`. +*/ +export const findUpStop: unique symbol; + +export type Match = string | typeof findUpStop | undefined; + +export interface Options extends LocatePathOptions { + /** + The path to the directory to stop the search before reaching root if there were no matches before the `stopAt` directory. + + @default path.parse(cwd).root + */ + readonly stopAt?: string; +} + +/** +Find a file or directory by walking up parent directories. + +@param name - The name of the file or directory to find. Can be multiple. +@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. + +@example +``` +// / +// └── Users +// └── sindresorhus +// ├── unicorn.png +// └── foo +// └── bar +// ├── baz +// └── example.js + +// example.js +import {findUp} from 'find-up'; + +console.log(await findUp('unicorn.png')); +//=> '/Users/sindresorhus/unicorn.png' + +console.log(await findUp(['rainbow.png', 'unicorn.png'])); +//=> '/Users/sindresorhus/unicorn.png' +``` +*/ +export function findUp(name: string | readonly string[], options?: Options): Promise; + +/** +Find a file or directory by walking up parent directories. + +@param matcher - Called for each directory in the search. Return a path or `findUpStop` to stop the search. +@returns The first path found or `undefined` if none could be found. + +@example +``` +import path from 'node:path'; +import {findUp, pathExists} from 'find-up'; + +console.log(await findUp(async directory => { + const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; +}, {type: 'directory'})); +//=> '/Users/sindresorhus' +``` +*/ +export function findUp(matcher: (directory: string) => (Match | Promise), options?: Options): Promise; + +/** +Synchronously find a file or directory by walking up parent directories. + +@param name - The name of the file or directory to find. Can be multiple. +@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. + +@example +``` +// / +// └── Users +// └── sindresorhus +// ├── unicorn.png +// └── foo +// └── bar +// ├── baz +// └── example.js + +// example.js +import {findUpSync} from 'find-up'; + +console.log(findUpSync('unicorn.png')); +//=> '/Users/sindresorhus/unicorn.png' + +console.log(findUpSync(['rainbow.png', 'unicorn.png'])); +//=> '/Users/sindresorhus/unicorn.png' +``` +*/ +export function findUpSync(name: string | readonly string[], options?: Options): string | undefined; + +/** +Synchronously find a file or directory by walking up parent directories. + +@param matcher - Called for each directory in the search. Return a path or `findUpStop` to stop the search. +@returns The first path found or `undefined` if none could be found. + +@example +``` +import path from 'node:path'; +import {findUpSync, pathExistsSync} from 'find-up'; + +console.log(findUpSync(directory => { + const hasUnicorns = pathExistsSync(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; +}, {type: 'directory'})); +//=> '/Users/sindresorhus' +``` +*/ +export function findUpSync(matcher: (directory: string) => Match, options?: Options): string | undefined; + +/** +Find files or directories by walking up parent directories. + +@param name - The name of the file or directory to find. Can be multiple. +@returns All paths found (by respecting the order of `name`s) or an empty array if none could be found. + +@example +``` +// / +// └── Users +// └── sindresorhus +// ├── unicorn.png +// └── foo +// ├── unicorn.png +// └── bar +// ├── baz +// └── example.js + +// example.js +import {findUpMultiple} from 'find-up'; + +console.log(await findUpMultiple('unicorn.png')); +//=> ['/Users/sindresorhus/foo/unicorn.png', '/Users/sindresorhus/unicorn.png'] + +console.log(await findUpMultiple(['rainbow.png', 'unicorn.png'])); +//=> ['/Users/sindresorhus/foo/unicorn.png', '/Users/sindresorhus/unicorn.png'] +``` +*/ +export function findUpMultiple(name: string | readonly string[], options?: Options): Promise; + +/** +Find files or directories by walking up parent directories. + +@param matcher - Called for each directory in the search. Return a path or `findUpStop` to stop the search. +@returns All paths found or an empty array if none could be found. + +@example +``` +import path from 'node:path'; +import {findUpMultiple, pathExists} from 'find-up'; + +console.log(await findUpMultiple(async directory => { + const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; +}, {type: 'directory'})); +//=> ['/Users/sindresorhus/foo', '/Users/sindresorhus'] +``` +*/ +export function findUpMultiple(matcher: (directory: string) => (Match | Promise), options?: Options): Promise; + +/** +Synchronously find files or directories by walking up parent directories. + +@param name - The name of the file or directory to find. Can be multiple. +@returns All paths found (by respecting the order of `name`s) or an empty array if none could be found. + +@example +``` +// / +// └── Users +// └── sindresorhus +// ├── unicorn.png +// └── foo +// ├── unicorn.png +// └── bar +// ├── baz +// └── example.js + +// example.js +import {findUpMultipleSync} from 'find-up'; + +console.log(findUpMultipleSync('unicorn.png')); +//=> ['/Users/sindresorhus/foo/unicorn.png', '/Users/sindresorhus/unicorn.png'] + +console.log(findUpMultipleSync(['rainbow.png', 'unicorn.png'])); +//=> ['/Users/sindresorhus/foo/unicorn.png', '/Users/sindresorhus/unicorn.png'] +``` +*/ +export function findUpMultipleSync(name: string | readonly string[], options?: Options): string[]; + +/** +Synchronously find files or directories by walking up parent directories. + +@param matcher - Called for each directory in the search. Return a path or `findUpStop` to stop the search. +@returns All paths found or an empty array if none could be found. + +@example +``` +import path from 'node:path'; +import {findUpMultipleSync, pathExistsSync} from 'find-up'; + +console.log(findUpMultipleSync(directory => { + const hasUnicorns = pathExistsSync(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; +}, {type: 'directory'})); +//=> ['/Users/sindresorhus/foo', '/Users/sindresorhus'] +``` +*/ +export function findUpMultipleSync(matcher: (directory: string) => Match, options?: Options): string[]; + +/** +Check if a path exists. + +@param path - The path to a file or directory. +@returns Whether the path exists. + +@example +``` +import {pathExists} from 'find-up'; + +console.log(await pathExists('/Users/sindresorhus/unicorn.png')); +//=> true +``` +*/ +export function pathExists(path: string): Promise; + +/** +Synchronously check if a path exists. + +@param path - Path to the file or directory. +@returns Whether the path exists. + +@example +``` +import {pathExistsSync} from 'find-up'; + +console.log(pathExistsSync('/Users/sindresorhus/unicorn.png')); +//=> true +``` +*/ +export function pathExistsSync(path: string): boolean; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/index.js new file mode 100644 index 0000000000000000000000000000000000000000..647a1ceb17bbc55b6f6a9d840dc75a0282586007 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/index.js @@ -0,0 +1,109 @@ +import path from 'node:path'; +import {fileURLToPath} from 'node:url'; +import {locatePath, locatePathSync} from 'locate-path'; + +const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath; + +export const findUpStop = Symbol('findUpStop'); + +export async function findUpMultiple(name, options = {}) { + let directory = path.resolve(toPath(options.cwd) || ''); + const {root} = path.parse(directory); + const stopAt = path.resolve(directory, options.stopAt || root); + const limit = options.limit || Number.POSITIVE_INFINITY; + const paths = [name].flat(); + + const runMatcher = async locateOptions => { + if (typeof name !== 'function') { + return locatePath(paths, locateOptions); + } + + const foundPath = await name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePath([foundPath], locateOptions); + } + + return foundPath; + }; + + const matches = []; + // eslint-disable-next-line no-constant-condition + while (true) { + // eslint-disable-next-line no-await-in-loop + const foundPath = await runMatcher({...options, cwd: directory}); + + if (foundPath === findUpStop) { + break; + } + + if (foundPath) { + matches.push(path.resolve(directory, foundPath)); + } + + if (directory === stopAt || matches.length >= limit) { + break; + } + + directory = path.dirname(directory); + } + + return matches; +} + +export function findUpMultipleSync(name, options = {}) { + let directory = path.resolve(toPath(options.cwd) || ''); + const {root} = path.parse(directory); + const stopAt = options.stopAt || root; + const limit = options.limit || Number.POSITIVE_INFINITY; + const paths = [name].flat(); + + const runMatcher = locateOptions => { + if (typeof name !== 'function') { + return locatePathSync(paths, locateOptions); + } + + const foundPath = name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePathSync([foundPath], locateOptions); + } + + return foundPath; + }; + + const matches = []; + // eslint-disable-next-line no-constant-condition + while (true) { + const foundPath = runMatcher({...options, cwd: directory}); + + if (foundPath === findUpStop) { + break; + } + + if (foundPath) { + matches.push(path.resolve(directory, foundPath)); + } + + if (directory === stopAt || matches.length >= limit) { + break; + } + + directory = path.dirname(directory); + } + + return matches; +} + +export async function findUp(name, options = {}) { + const matches = await findUpMultiple(name, {...options, limit: 1}); + return matches[0]; +} + +export function findUpSync(name, options = {}) { + const matches = findUpMultipleSync(name, {...options, limit: 1}); + return matches[0]; +} + +export { + pathExists, + pathExistsSync, +} from 'path-exists'; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/license b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/license new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/package.json new file mode 100644 index 0000000000000000000000000000000000000000..23cb409da67434873fa723929a977784cfb13894 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/package.json @@ -0,0 +1,56 @@ +{ + "name": "find-up", + "version": "6.3.0", + "description": "Find a file or directory by walking up parent directories", + "license": "MIT", + "repository": "sindresorhus/find-up", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "package", + "resolve", + "parent", + "parents", + "folder", + "directory", + "walk", + "walking", + "path" + ], + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "devDependencies": { + "ava": "^3.15.0", + "is-path-inside": "^4.0.0", + "tempy": "^2.0.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..488ac618396e268fc6032d4b197ba4a2f0cb4dee --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/find-up/readme.md @@ -0,0 +1,172 @@ +# find-up + +> Find a file or directory by walking up parent directories + +## Install + +``` +$ npm install find-up +``` + +## Usage + +``` +/ +└── Users + └── sindresorhus + ├── unicorn.png + └── foo + └── bar + ├── baz + └── example.js +``` + +`example.js` + +```js +import path from 'node:path'; +import {findUp, pathExists} from 'find-up'; + +console.log(await findUp('unicorn.png')); +//=> '/Users/sindresorhus/unicorn.png' + +console.log(await findUp(['rainbow.png', 'unicorn.png'])); +//=> '/Users/sindresorhus/unicorn.png' + +console.log(await findUp(async directory => { + const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; +}, {type: 'directory'})); +//=> '/Users/sindresorhus' +``` + +## API + +### findUp(name, options?) +### findUp(matcher, options?) + +Returns a `Promise` for either the path or `undefined` if it couldn't be found. + +### findUp([...name], options?) + +Returns a `Promise` for either the first path found (by respecting the order of the array) or `undefined` if none could be found. + +### findUpMultiple(name, options?) +### findUpMultiple(matcher, options?) + +Returns a `Promise` for either an array of paths or an empty array if none could be found. + +### findUpMultiple([...name], options?) + +Returns a `Promise` for either an array of the first paths found (by respecting the order of the array) or an empty array if none could be found. + +### findUpSync(name, options?) +### findUpSync(matcher, options?) + +Returns a path or `undefined` if it couldn't be found. + +### findUpSync([...name], options?) + +Returns the first path found (by respecting the order of the array) or `undefined` if none could be found. + +### findUpMultipleSync(name, options?) +### findUpMultipleSync(matcher, options?) + +Returns an array of paths or an empty array if none could be found. + +### findUpMultipleSync([...name], options?) + +Returns an array of the first paths found (by respecting the order of the array) or an empty array if none could be found. + +#### name + +Type: `string` + +The name of the file or directory to find. + +#### matcher + +Type: `Function` + +A function that will be called with each directory until it returns a `string` with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use-cases. + +When using async mode, the `matcher` may optionally be an async or promise-returning function that returns the path. + +#### options + +Type: `object` + +##### cwd + +Type: `URL | string`\ +Default: `process.cwd()` + +The directory to start from. + +##### type + +Type: `string`\ +Default: `'file'`\ +Values: `'file'` `'directory'` + +The type of paths that can match. + +##### allowSymlinks + +Type: `boolean`\ +Default: `true` + +Allow symbolic links to match if they point to the chosen path type. + +##### stopAt + +Type: `string`\ +Default: `path.parse(cwd).root` + +The path to the directory to stop the search before reaching root if there were no matches before the `stopAt` directory. + +### pathExists(path) + +Returns a `Promise` of whether the path exists. + +### pathExistsSync(path) + +Returns a `boolean` of whether the path exists. + +#### path + +Type: `string` + +The path to a file or directory. + +### findUpStop + +A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem. + +```js +import path from 'node:path'; +import {findUp, findUpStop} from 'find-up'; + +await findUp(directory => { + return path.basename(directory) === 'work' ? findUpStop : 'logo.png'; +}); +``` + +## Related + +- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package +- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path + +--- + +
+ + Get professional support for 'find-up' with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4ecf24a2abf7b7c7bc1c66a8bbd39ce164467787 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/index.d.ts @@ -0,0 +1,92 @@ +export interface Options { + /** + The current working directory. + + @default process.cwd() + */ + readonly cwd?: URL | string; + + /** + The type of path to match. + + @default 'file' + */ + readonly type?: 'file' | 'directory'; + + /** + Allow symbolic links to match if they point to the requested path type. + + @default true + */ + readonly allowSymlinks?: boolean; +} + +export interface AsyncOptions extends Options { + /** + The number of concurrently pending promises. + + Minimum: `1` + + @default Infinity + */ + readonly concurrency?: number; + + /** + Preserve `paths` order when searching. + + Disable this to improve performance if you don't care about the order. + + @default true + */ + readonly preserveOrder?: boolean; +} + +/** +Get the first path that exists on disk of multiple paths. + +@param paths - The paths to check. +@returns The first path that exists or `undefined` if none exists. + +@example +``` +import {locatePath} from 'locate-path'; + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +console(await locatePath(files)); +//=> 'rainbow' +``` +*/ +export function locatePath( + paths: Iterable, + options?: AsyncOptions +): Promise; + +/** +Synchronously get the first path that exists on disk of multiple paths. + +@param paths - The paths to check. +@returns The first path that exists or `undefined` if none exists. + +@example +``` +import {locatePathSync} from 'locate-path'; + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +console(locatePathSync(files)); +//=> 'rainbow' +``` +*/ +export function locatePathSync( + paths: Iterable, + options?: Options +): string | undefined; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a5fed89ae7c37c061bf65e3e4c1ca751e8a2a686 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/index.js @@ -0,0 +1,77 @@ +import process from 'node:process'; +import path from 'node:path'; +import fs, {promises as fsPromises} from 'node:fs'; +import {fileURLToPath} from 'node:url'; +import pLocate from 'p-locate'; + +const typeMappings = { + directory: 'isDirectory', + file: 'isFile', +}; + +function checkType(type) { + if (Object.hasOwnProperty.call(typeMappings, type)) { + return; + } + + throw new Error(`Invalid type specified: ${type}`); +} + +const matchType = (type, stat) => stat[typeMappings[type]](); + +const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath; + +export async function locatePath( + paths, + { + cwd = process.cwd(), + type = 'file', + allowSymlinks = true, + concurrency, + preserveOrder, + } = {}, +) { + checkType(type); + cwd = toPath(cwd); + + const statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat; + + return pLocate(paths, async path_ => { + try { + const stat = await statFunction(path.resolve(cwd, path_)); + return matchType(type, stat); + } catch { + return false; + } + }, {concurrency, preserveOrder}); +} + +export function locatePathSync( + paths, + { + cwd = process.cwd(), + type = 'file', + allowSymlinks = true, + } = {}, +) { + checkType(type); + cwd = toPath(cwd); + + const statFunction = allowSymlinks ? fs.statSync : fs.lstatSync; + + for (const path_ of paths) { + try { + const stat = statFunction(path.resolve(cwd, path_), { + throwIfNoEntry: false, + }); + + if (!stat) { + continue; + } + + if (matchType(type, stat)) { + return path_; + } + } catch {} + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/license b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/license new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/package.json new file mode 100644 index 0000000000000000000000000000000000000000..28a2bda90eb2bd95d08b486c4010cd946bc877b6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/package.json @@ -0,0 +1,48 @@ +{ + "name": "locate-path", + "version": "7.2.0", + "description": "Get the first path that exists on disk of multiple paths", + "license": "MIT", + "repository": "sindresorhus/locate-path", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "locate", + "path", + "paths", + "file", + "files", + "exists", + "find", + "finder", + "search", + "searcher", + "array", + "iterable", + "iterator" + ], + "dependencies": { + "p-locate": "^6.0.0" + }, + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..ea871fd63ea56fbb274d68ffc851f7e06c54fe98 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/locate-path/readme.md @@ -0,0 +1,123 @@ +# locate-path + +> Get the first path that exists on disk of multiple paths + +## Install + +``` +$ npm install locate-path +``` + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +import {locatePath} from 'locate-path'; + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +console(await locatePath(files)); +//=> 'rainbow' +``` + +## API + +### locatePath(paths, options?) + +Returns a `Promise` for the first path that exists or `undefined` if none exists. + +#### paths + +Type: `Iterable` + +The paths to check. + +#### options + +Type: `object` + +##### concurrency + +Type: `number`\ +Default: `Infinity`\ +Minimum: `1` + +The number of concurrently pending promises. + +##### preserveOrder + +Type: `boolean`\ +Default: `true` + +Preserve `paths` order when searching. + +Disable this to improve performance if you don't care about the order. + +##### cwd + +Type: `URL | string`\ +Default: `process.cwd()` + +The current working directory. + +##### type + +Type: `string`\ +Default: `'file'`\ +Values: `'file' | 'directory'` + +The type of paths that can match. + +##### allowSymlinks + +Type: `boolean`\ +Default: `true` + +Allow symbolic links to match if they point to the chosen path type. + +### locatePathSync(paths, options?) + +Returns the first path that exists or `undefined` if none exists. + +#### paths + +Type: `Iterable` + +The paths to check. + +#### options + +Type: `object` + +##### cwd + +Same as above. + +##### type + +Same as above. + +##### allowSymlinks + +Same as above. + +## Related + +- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..caae030938fe9542988958c1206fb574adb59910 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/index.d.ts @@ -0,0 +1,40 @@ +/* eslint-disable @typescript-eslint/member-ordering */ + +export interface LimitFunction { + /** + The number of promises that are currently running. + */ + readonly activeCount: number; + + /** + The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). + */ + readonly pendingCount: number; + + /** + Discard pending promises that are waiting to run. + + This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. + + Note: This does not cancel promises that are already running. + */ + clearQueue: () => void; + + /** + @param fn - Promise-returning/async function. + @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. + @returns The promise returned by calling `fn(...arguments)`. + */ + ( + fn: (...arguments: Arguments) => PromiseLike | ReturnType, + ...arguments: Arguments + ): Promise; +} + +/** +Run multiple promise-returning & async functions with limited concurrency. + +@param concurrency - Concurrency limit. Minimum: `1`. +@returns A `limit` function. +*/ +export default function pLimit(concurrency: number): LimitFunction; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b54b99b09cbf26981000c36d5d7b5b5d6627ec8d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/index.js @@ -0,0 +1,68 @@ +import Queue from 'yocto-queue'; + +export default function pLimit(concurrency) { + if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) { + throw new TypeError('Expected `concurrency` to be a number from 1 and up'); + } + + const queue = new Queue(); + let activeCount = 0; + + const next = () => { + activeCount--; + + if (queue.size > 0) { + queue.dequeue()(); + } + }; + + const run = async (fn, resolve, args) => { + activeCount++; + + const result = (async () => fn(...args))(); + + resolve(result); + + try { + await result; + } catch {} + + next(); + }; + + const enqueue = (fn, resolve, args) => { + queue.enqueue(run.bind(undefined, fn, resolve, args)); + + (async () => { + // This function needs to wait until the next microtask before comparing + // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously + // when the run function is dequeued and called. The comparison in the if-statement + // needs to happen asynchronously as well to get an up-to-date value for `activeCount`. + await Promise.resolve(); + + if (activeCount < concurrency && queue.size > 0) { + queue.dequeue()(); + } + })(); + }; + + const generator = (fn, ...args) => new Promise(resolve => { + enqueue(fn, resolve, args); + }); + + Object.defineProperties(generator, { + activeCount: { + get: () => activeCount, + }, + pendingCount: { + get: () => queue.size, + }, + clearQueue: { + value: () => { + queue.clear(); + }, + }, + }); + + return generator; +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/license b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/license new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2e41e6e172c99235b59e6cf5c9bd6592741c19d3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/package.json @@ -0,0 +1,54 @@ +{ + "name": "p-limit", + "version": "4.0.0", + "description": "Run multiple promise-returning & async functions with limited concurrency", + "license": "MIT", + "repository": "sindresorhus/p-limit", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "promise", + "limit", + "limited", + "concurrency", + "throttle", + "throat", + "rate", + "batch", + "ratelimit", + "task", + "queue", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "devDependencies": { + "ava": "^3.15.0", + "delay": "^5.0.0", + "in-range": "^3.0.0", + "random-int": "^3.0.0", + "time-span": "^5.0.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..b02253bddc408bf09b60b2bbf9b2ab282f1cd790 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-limit/readme.md @@ -0,0 +1,99 @@ +# p-limit + +> Run multiple promise-returning & async functions with limited concurrency + +## Install + +``` +$ npm install p-limit +``` + +## Usage + +```js +import pLimit from 'p-limit'; + +const limit = pLimit(1); + +const input = [ + limit(() => fetchSomething('foo')), + limit(() => fetchSomething('bar')), + limit(() => doSomething()) +]; + +// Only one promise is run at once +const result = await Promise.all(input); +console.log(result); +``` + +## API + +### pLimit(concurrency) + +Returns a `limit` function. + +#### concurrency + +Type: `number`\ +Minimum: `1`\ +Default: `Infinity` + +Concurrency limit. + +### limit(fn, ...args) + +Returns the promise returned by calling `fn(...args)`. + +#### fn + +Type: `Function` + +Promise-returning/async function. + +#### args + +Any arguments to pass through to `fn`. + +Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions. + +### limit.activeCount + +The number of promises that are currently running. + +### limit.pendingCount + +The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). + +### limit.clearQueue() + +Discard pending promises that are waiting to run. + +This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. + +Note: This does not cancel promises that are already running. + +## FAQ + +### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package? + +This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue. + +## Related + +- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control +- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions +- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions +- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency +- [More…](https://github.com/sindresorhus/promise-fun) + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..43b89dadedac38116ba6271635b91158304542c9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/index.d.ts @@ -0,0 +1,49 @@ +export interface Options { + /** + The number of concurrently pending promises returned by `tester`. + + Minimum: `1` + + @default Infinity + */ + readonly concurrency?: number; + + /** + Preserve `input` order when searching. + + Disable this to improve performance if you don't care about the order. + + @default true + */ + readonly preserveOrder?: boolean; +} + +/** +Get the first fulfilled promise that satisfies the provided testing function. + +@param input - An iterable of promises/values to test. +@param tester - This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. +@returns A `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. + +@example +``` +import {pathExists} from 'path-exists'; +import pLocate from 'p-locate'; + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +const foundPath = await pLocate(files, file => pathExists(file)); + +console.log(foundPath); +//=> 'rainbow' +``` +*/ +export default function pLocate( + input: Iterable | ValueType>, + tester: (element: ValueType) => PromiseLike | boolean, + options?: Options +): Promise; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5b386369a0986365d27b02e915468ae4a0e3fb18 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/index.js @@ -0,0 +1,48 @@ +import pLimit from 'p-limit'; + +class EndError extends Error { + constructor(value) { + super(); + this.value = value; + } +} + +// The input can also be a promise, so we await it. +const testElement = async (element, tester) => tester(await element); + +// The input can also be a promise, so we `Promise.all()` them both. +const finder = async element => { + const values = await Promise.all(element); + if (values[1] === true) { + throw new EndError(values[0]); + } + + return false; +}; + +export default async function pLocate( + iterable, + tester, + { + concurrency = Number.POSITIVE_INFINITY, + preserveOrder = true, + } = {}, +) { + const limit = pLimit(concurrency); + + // Start all the promises concurrently with optional limit. + const items = [...iterable].map(element => [element, limit(testElement, element, tester)]); + + // Check the promises either serially or concurrently. + const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY); + + try { + await Promise.all(items.map(element => checkLimit(finder, element))); + } catch (error) { + if (error instanceof EndError) { + return error.value; + } + + throw error; + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/license b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/license new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a20cb6ff81072be0961b28ac6ce0900d7c2a1395 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/package.json @@ -0,0 +1,56 @@ +{ + "name": "p-locate", + "version": "6.0.0", + "description": "Get the first fulfilled promise that satisfies the provided testing function", + "license": "MIT", + "repository": "sindresorhus/p-locate", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "promise", + "locate", + "find", + "finder", + "search", + "searcher", + "test", + "array", + "collection", + "iterable", + "iterator", + "race", + "fulfilled", + "fastest", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "p-limit": "^4.0.0" + }, + "devDependencies": { + "ava": "^3.15.0", + "delay": "^5.0.0", + "in-range": "^3.0.0", + "time-span": "^5.0.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..9a2c0e3208d45f16e1b33ee08f9cb0ba0cdb1f20 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/p-locate/readme.md @@ -0,0 +1,91 @@ +# p-locate + +> Get the first fulfilled promise that satisfies the provided testing function + +Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find). + +## Install + +``` +$ npm install p-locate +``` + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +import {pathExists} from 'path-exists'; +import pLocate from 'p-locate'; + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +const foundPath = await pLocate(files, file => pathExists(file)); + +console.log(foundPath); +//=> 'rainbow' +``` + +*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.* + +## API + +### pLocate(input, tester, options?) + +Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. + +#### input + +Type: `Iterable` + +An iterable of promises/values to test. + +#### tester(element) + +Type: `Function` + +This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. + +#### options + +Type: `object` + +##### concurrency + +Type: `number`\ +Default: `Infinity`\ +Minimum: `1` + +The number of concurrently pending promises returned by `tester`. + +##### preserveOrder + +Type: `boolean`\ +Default: `true` + +Preserve `input` order when searching. + +Disable this to improve performance if you don't care about the order. + +## Related + +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently +- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled +- [More…](https://github.com/sindresorhus/promise-fun) + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3251306ce32d586bcf600d024bd5207cd98ae670 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/index.d.ts @@ -0,0 +1,31 @@ +/** +Check if a path exists. + +@returns Whether the path exists. + +@example +``` +// foo.ts +import {pathExists} from 'path-exists'; + +console.log(await pathExists('foo.ts')); +//=> true +``` +*/ +export function pathExists(path: string): Promise; + +/** +Synchronously check if a path exists. + +@returns Whether the path exists. + +@example +``` +// foo.ts +import {pathExistsSync} from 'path-exists'; + +console.log(pathExistsSync('foo.ts')); +//=> true +``` +*/ +export function pathExistsSync(path: string): boolean; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ef6443b1ad812ab12f3fb1139d2064553f0399e1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/index.js @@ -0,0 +1,19 @@ +import fs, {promises as fsPromises} from 'node:fs'; + +export async function pathExists(path) { + try { + await fsPromises.access(path); + return true; + } catch { + return false; + } +} + +export function pathExistsSync(path) { + try { + fs.accessSync(path); + return true; + } catch { + return false; + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/license b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/license new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f5bde2ba4fd0f05d7fb9067103ef9bffb139baf7 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/package.json @@ -0,0 +1,41 @@ +{ + "name": "path-exists", + "version": "5.0.0", + "description": "Check if a path exists", + "license": "MIT", + "repository": "sindresorhus/path-exists", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "path", + "exists", + "exist", + "file", + "filepath", + "fs", + "filesystem", + "file-system", + "access", + "stat" + ], + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..067b00c5f8896c39fbf16b86f23da440a06f3de3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/path-exists/readme.md @@ -0,0 +1,52 @@ +# path-exists + +> Check if a path exists + +NOTE: `fs.existsSync` has been un-deprecated in Node.js since 6.8.0. If you only need to check synchronously, this module is not needed. + +Never use this before handling a file though: + +> In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there. + +## Install + +``` +$ npm install path-exists +``` + +## Usage + +```js +// foo.js +import {pathExists} from 'path-exists'; + +console.log(await pathExists('foo.js')); +//=> true +``` + +## API + +### pathExists(path) + +Returns a `Promise` of whether the path exists. + +### pathExistsSync(path) + +Returns a `boolean` of whether the path exists. + +## Related + +- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module +- [path-type](https://github.com/sindresorhus/path-type) - Check if a path exists and whether it's a file, directory, or symlink + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9157f8923c16a03f5eda73f6cc06a5407ee3e7d6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/index.d.ts @@ -0,0 +1,58 @@ +export interface Options { + /** + The directory to start searching from. + + @default process.cwd() + */ + readonly cwd?: string; +} + +/** +Find the root directory of a Node.js project or npm package. + +@returns The project root path or `undefined` if it could not be found. + +@example +``` +// / +// └── Users +// └── sindresorhus +// └── foo +// ├── package.json +// └── bar +// ├── baz +// └── example.js + +// example.js +import {packageDirectory} from 'pkg-dir'; + +console.log(await packageDirectory()); +//=> '/Users/sindresorhus/foo' +``` +*/ +export function packageDirectory(options?: Options): Promise; + +/** +Synchronously find the root directory of a Node.js project or npm package. + +@returns The project root path or `undefined` if it could not be found. + +@example +``` +// / +// └── Users +// └── sindresorhus +// └── foo +// ├── package.json +// └── bar +// ├── baz +// └── example.js + +// example.js +import {packageDirectorySync} from 'pkg-dir'; + +console.log(packageDirectorySync()); +//=> '/Users/sindresorhus/foo' +``` +*/ +export function packageDirectorySync(options?: Options): string | undefined; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/index.js new file mode 100644 index 0000000000000000000000000000000000000000..294c767ad2e196448b6a264a27316cbc88b74d32 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/index.js @@ -0,0 +1,12 @@ +import path from 'node:path'; +import {findUp, findUpSync} from 'find-up'; + +export async function packageDirectory({cwd} = {}) { + const filePath = await findUp('package.json', {cwd}); + return filePath && path.dirname(filePath); +} + +export function packageDirectorySync({cwd} = {}) { + const filePath = findUpSync('package.json', {cwd}); + return filePath && path.dirname(filePath); +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/license b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/license new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7f2663278291070f08b46c25f22069756d9e67be --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/package.json @@ -0,0 +1,59 @@ +{ + "name": "pkg-dir", + "version": "7.0.0", + "description": "Find the root directory of a Node.js project or npm package", + "license": "MIT", + "repository": "sindresorhus/pkg-dir", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=14.16" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "package", + "json", + "root", + "npm", + "entry", + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "resolve", + "parent", + "parents", + "folder", + "directory", + "walk", + "walking", + "path" + ], + "dependencies": { + "find-up": "^6.3.0" + }, + "devDependencies": { + "ava": "^4.3.1", + "tempy": "^3.0.0", + "tsd": "^0.22.0", + "typescript": "^4.7.4", + "xo": "^0.51.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..8898c2496724afc557d3e0121153f7792715574e --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/pkg-dir/readme.md @@ -0,0 +1,69 @@ +# pkg-dir + +> Find the root directory of a Node.js project or npm package + +## Install + +```sh +npm install pkg-dir +``` + +## Usage + +``` +/ +└── Users + └── sindresorhus + └── foo + ├── package.json + └── bar + ├── baz + └── example.js +``` + +```js +// example.js +import {packageDirectory} from 'pkg-dir'; + +console.log(await packageDirectory()); +//=> '/Users/sindresorhus/foo' +``` + +## API + +### packageDirectory(option?) + +Returns a `Promise` for either the project root path or `undefined` if it could not be found. + +### packageDirectorySync(options?) + +Returns the project root path or `undefined` if it could not be found. + +#### options + +Type: `object` + +##### cwd + +Type: `string`\ +Default: `process.cwd()` + +The directory to start searching from. + +## Related + +- [pkg-dir-cli](https://github.com/sindresorhus/pkg-dir-cli) - CLI for this module +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/index.d.ts b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0475d9853a37ea304cac34ad41b1ac3736447ff3 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/index.d.ts @@ -0,0 +1,75 @@ +export default class Queue implements Iterable { + /** + The size of the queue. + */ + readonly size: number; + + /** + Tiny queue data structure. + + The instance is an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), which means you can iterate over the queue front to back with a “for…of” loop, or use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow. + + @example + ``` + import Queue from 'yocto-queue'; + + const queue = new Queue(); + + queue.enqueue('🦄'); + queue.enqueue('🌈'); + + console.log(queue.size); + //=> 2 + + console.log(...queue); + //=> '🦄 🌈' + + console.log(queue.dequeue()); + //=> '🦄' + + console.log(queue.dequeue()); + //=> '🌈' + ``` + */ + constructor(); + + /** + The instance is an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), which means you can iterate over the queue front to back with a “for…of” loop. Using the iterator will not remove the items from the queue. If you want that, use `drain()` instead. + + You can also use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow. + */ + [Symbol.iterator](): IterableIterator; + + /** + Returns an iterator that dequeues items as you consume it. + + This allows you to empty the queue while processing its items. + + If you want to not remove items as you consume it, use the `Queue` object as an iterator. + */ + drain(): IterableIterator; + + /** + Add a value to the queue. + */ + enqueue(value: ValueType): void; + + /** + Remove the next value in the queue. + + @returns The removed value or `undefined` if the queue is empty. + */ + dequeue(): ValueType | undefined; + + /** + Get the next value in the queue without removing it. + + @returns The value or `undefined` if the queue is empty. + */ + peek(): ValueType | undefined; + + /** + Clear the queue. + */ + clear(): void; +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/index.js new file mode 100644 index 0000000000000000000000000000000000000000..fb645592b5e17d1b8f876a747757d5686e011d04 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/index.js @@ -0,0 +1,84 @@ +/* +How it works: +`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value. +*/ + +class Node { + value; + next; + + constructor(value) { + this.value = value; + } +} + +export default class Queue { + #head; + #tail; + #size; + + constructor() { + this.clear(); + } + + enqueue(value) { + const node = new Node(value); + + if (this.#head) { + this.#tail.next = node; + this.#tail = node; + } else { + this.#head = node; + this.#tail = node; + } + + this.#size++; + } + + dequeue() { + const current = this.#head; + if (!current) { + return; + } + + this.#head = this.#head.next; + this.#size--; + return current.value; + } + + peek() { + if (!this.#head) { + return; + } + + return this.#head.value; + + // TODO: Node.js 18. + // return this.#head?.value; + } + + clear() { + this.#head = undefined; + this.#tail = undefined; + this.#size = 0; + } + + get size() { + return this.#size; + } + + * [Symbol.iterator]() { + let current = this.#head; + + while (current) { + yield current.value; + current = current.next; + } + } + + * drain() { + while (this.#head) { + yield this.dequeue(); + } + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/license b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/license new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/package.json b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7fde9acb43a5ec3abed97b481ae36de4d24a8a43 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/package.json @@ -0,0 +1,48 @@ +{ + "name": "yocto-queue", + "version": "1.2.1", + "description": "Tiny queue data structure", + "license": "MIT", + "repository": "sindresorhus/yocto-queue", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "types": "./index.d.ts", + "sideEffects": false, + "engines": { + "node": ">=12.20" + }, + "scripts": { + "//test": "xo && ava && tsd", + "test": "ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "queue", + "data", + "structure", + "algorithm", + "queues", + "queuing", + "list", + "array", + "linkedlist", + "fifo", + "enqueue", + "dequeue", + "data-structure" + ], + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/readme.md b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..f94f98ef865f793b8e09c28e9d1a862fd088ae34 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/find-cache-dir/node_modules/yocto-queue/readme.md @@ -0,0 +1,80 @@ +# yocto-queue [![](https://badgen.net/bundlephobia/minzip/yocto-queue)](https://bundlephobia.com/result?p=yocto-queue) + +> Tiny queue data structure + +You should use this package instead of an array if you do a lot of `Array#push()` and `Array#shift()` on large arrays, since `Array#shift()` has [linear time complexity](https://medium.com/@ariel.salem1989/an-easy-to-use-guide-to-big-o-time-complexity-5dcf4be8a444#:~:text=O(N)%E2%80%94Linear%20Time) *O(n)* while `Queue#dequeue()` has [constant time complexity](https://medium.com/@ariel.salem1989/an-easy-to-use-guide-to-big-o-time-complexity-5dcf4be8a444#:~:text=O(1)%20%E2%80%94%20Constant%20Time) *O(1)*. That makes a huge difference for large arrays. + +> A [queue](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) is an ordered list of elements where an element is inserted at the end of the queue and is removed from the front of the queue. A queue works based on the first-in, first-out ([FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics))) principle. + +## Install + +```sh +npm install yocto-queue +``` + +## Usage + +```js +import Queue from 'yocto-queue'; + +const queue = new Queue(); + +queue.enqueue('🦄'); +queue.enqueue('🌈'); + +console.log(queue.size); +//=> 2 + +console.log(...queue); +//=> '🦄 🌈' + +console.log(queue.dequeue()); +//=> '🦄' + +console.log(queue.dequeue()); +//=> '🌈' +``` + +## API + +### `queue = new Queue()` + +The instance is an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), which means you can iterate over the queue front to back with a “for…of” loop. Using the iterator will not remove the items from the queue. If you want that, use [`drain()`](#drain) instead. + +You can also use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow. + +#### `.enqueue(value)` + +Add a value to the queue. + +#### `.dequeue()` + +Remove the next value in the queue. + +Returns the removed value or `undefined` if the queue is empty. + +#### `.peek()` + +Get the next value in the queue without removing it. + +Returns the value or `undefined` if the queue is empty. + +#### `.drain()` + +Returns an iterator that dequeues items as you consume it. + +This allows you to empty the queue while processing its items. + +If you want to not remove items as you consume it, use the `Queue` object as an iterator. + +#### `.clear()` + +Clear the queue. + +#### `.size` + +The size of the queue. + +## Related + +- [quick-lru](https://github.com/sindresorhus/quick-lru) - Simple “Least Recently Used” (LRU) cache diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/lib/MemoryFileSystem.js b/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/lib/MemoryFileSystem.js new file mode 100644 index 0000000000000000000000000000000000000000..86e47e3b5c83fa087e5482d1774885f25468e32d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/lib/MemoryFileSystem.js @@ -0,0 +1,225 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +var normalize = require("./normalize"); + +function MemoryFileSystem(data) { + this.data = data || {}; +} +module.exports = MemoryFileSystem; + +function isDir(item) { + if(typeof item !== "object") return false; + return item[""] === true; +} + +function isFile(item) { + if(typeof item !== "object") return false; + return !item[""]; +} + +function pathToArray(path) { + path = normalize(path); + var nix = /^\//.test(path); + if(!nix) { + if(!/^[A-Za-z]:/.test(path)) throw new Error("Invalid path '" + path + "'"); + path = path.replace(/[\\\/]+/g, "\\"); // multi slashs + path = path.split(/[\\\/]/); + path[0] = path[0].toUpperCase(); + } else { + path = path.replace(/\/+/g, "/"); // multi slashs + path = path.substr(1).split("/"); + } + if(!path[path.length-1]) path.pop(); + return path; +} + +function trueFn() { return true; } +function falseFn() { return false; } + +MemoryFileSystem.prototype.statSync = function(_path) { + var path = pathToArray(_path); + var current = this.data; + for(var i = 0; i < path.length - 1; i++) { + if(!isDir(current[path[i]])) + throw new Error("Path doesn't exist '" + _path + "'"); + current = current[path[i]]; + } + if(_path === "/" || isDir(current[path[i]])) { + return { + isFile: falseFn, + isDirectory: trueFn, + isBlockDevice: falseFn, + isCharacterDevice: falseFn, + isSymbolicLink: falseFn, + isFIFO: falseFn, + isSocket: falseFn + }; + } else if(isFile(current[path[i]])) { + return { + isFile: trueFn, + isDirectory: falseFn, + isBlockDevice: falseFn, + isCharacterDevice: falseFn, + isSymbolicLink: falseFn, + isFIFO: falseFn, + isSocket: falseFn + }; + } else + throw new Error("Path doesn't exist '" + _path + "'"); +}; + +MemoryFileSystem.prototype.readFileSync = function(_path, encoding) { + var path = pathToArray(_path); + var current = this.data; + for(var i = 0; i < path.length - 1; i++) { + if(!isDir(current[path[i]])) + throw new Error("Path doesn't exist '" + _path + "'"); + current = current[path[i]]; + } + if(!isFile(current[path[i]])) { + if(isDir(current[path[i]])) + throw new Error("Cannot readFile on directory '" + _path + "'"); + else + throw new Error("Path doesn't exist '" + _path + "'"); + } + current = current[path[i]]; + return encoding ? current.toString(encoding) : current; +}; + +MemoryFileSystem.prototype.readdirSync = function(_path) { + if(_path === "/") return Object.keys(this.data).filter(Boolean); + var path = pathToArray(_path); + var current = this.data; + for(var i = 0; i < path.length - 1; i++) { + if(!isDir(current[path[i]])) + throw new Error("Path doesn't exist '" + _path + "'"); + current = current[path[i]]; + } + if(!isDir(current[path[i]])) { + if(isFile(current[path[i]])) + throw new Error("Cannot readdir on file '" + _path + "'"); + else + throw new Error("Path doesn't exist '" + _path + "'"); + } + return Object.keys(current[path[i]]).filter(Boolean); +}; + +MemoryFileSystem.prototype.mkdirpSync = function(_path) { + var path = pathToArray(_path); + if(path.length === 0) return; + var current = this.data; + for(var i = 0; i < path.length; i++) { + if(isFile(current[path[i]])) + throw new Error("Path is a file '" + _path + "'"); + else if(!isDir(current[path[i]])) + current[path[i]] = {"":true}; + current = current[path[i]]; + } + return; +}; + +MemoryFileSystem.prototype.mkdirSync = function(_path) { + var path = pathToArray(_path); + if(path.length === 0) return; + var current = this.data; + for(var i = 0; i < path.length - 1; i++) { + if(!isDir(current[path[i]])) + throw new Error("Path doesn't exist '" + _path + "'"); + current = current[path[i]]; + } + if(isDir(current[path[i]])) + throw new new Error("Directory already exist '" + _path + "'"); + else if(isFile(current[path[i]])) + throw new Error("Cannot mkdir on file '" + _path + "'"); + current[path[i]] = {"":true}; + return; +}; + +MemoryFileSystem.prototype._remove = function(_path, name, testFn) { + var path = pathToArray(_path); + if(path.length === 0) throw new Error("Path cannot be removed '" + _path + "'"); + var current = this.data; + for(var i = 0; i < path.length - 1; i++) { + if(!isDir(current[path[i]])) + throw new Error("Path doesn't exist '" + _path + "'"); + current = current[path[i]]; + } + if(!testFn(current[path[i]])) + throw new Error("'" + name + "' doesn't exist '" + _path + "'"); + delete current[path[i]]; + return; +}; + +MemoryFileSystem.prototype.rmdirSync = function(_path) { + return this._remove(_path, "Directory", isDir); +}; + +MemoryFileSystem.prototype.unlinkSync = function(_path) { + return this._remove(_path, "File", isFile); +}; + +MemoryFileSystem.prototype.readlinkSync = function(_path) { + throw new Error("Path is not a link '" + _path + "'"); +}; + +MemoryFileSystem.prototype.writeFileSync = function(_path, content, encoding) { + if(!content && !encoding) throw new Error("No content"); + var path = pathToArray(_path); + if(path.length === 0) throw new Error("Path is not a file '" + _path + "'"); + var current = this.data; + for(var i = 0; i < path.length - 1; i++) { + if(!isDir(current[path[i]])) + throw new Error("Path doesn't exist '" + _path + "'"); + current = current[path[i]]; + } + if(isDir(current[path[i]])) + throw new Error("Cannot writeFile on directory '" + _path + "'"); + current[path[i]] = encoding || typeof content === "string" ? new Buffer(content, encoding) : content; + return; +}; + +MemoryFileSystem.prototype.join = require("./join"); + +MemoryFileSystem.prototype.normalize = normalize; + +// async functions + +["stat", "readdir", "mkdirp", "mkdir", "rmdir", "unlink", "readlink"].forEach(function(fn) { + MemoryFileSystem.prototype[fn] = function(path, callback) { + try { + var result = this[fn + "Sync"](path); + } catch(e) { + return callback(e); + } + return callback(null, result); + }; +}); + +MemoryFileSystem.prototype.readFile = function(path, optArg, callback) { + if(!callback) { + callback = optArg; + optArg = undefined; + } + try { + var result = this.readFileSync(path, optArg); + } catch(e) { + return callback(e); + } + return callback(null, result); +}; + +MemoryFileSystem.prototype.writeFile = function (path, content, encoding, callback) { + if(!callback) { + callback = encoding; + encoding = undefined; + } + try { + this.writeFileSync(path, content, encoding); + } catch(e) { + return callback(e); + } + return callback(); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/lib/join.js b/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/lib/join.js new file mode 100644 index 0000000000000000000000000000000000000000..ad25bc52f80c41068f3fcd80b0a6f6f86875981b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/lib/join.js @@ -0,0 +1,14 @@ +var normalize = require("./normalize"); + +var absoluteWinRegExp = /^[A-Z]:([\\\/]|$)/i; +var absoluteNixRegExp = /^\//i; + +module.exports = function join(path, request) { + if(request == "") return normalize(path); + if(absoluteWinRegExp.test(request)) return normalize(request.replace(/\//g, "\\")); + if(absoluteNixRegExp.test(request)) return normalize(request); + if(path == "/") return normalize(path + request); + if(absoluteWinRegExp.test(path)) return normalize(path + "\\" + request.replace(/\//g, "\\")); + if(absoluteNixRegExp.test(path)) return normalize(path + "/" + request); + return normalize(path + "/" + request); +}; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/lib/normalize.js b/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/lib/normalize.js new file mode 100644 index 0000000000000000000000000000000000000000..2a612af3ae929b7325ded9244f2b1cf54f353acc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/lib/normalize.js @@ -0,0 +1,38 @@ +var doubleSlashWinRegExp = /\\+/g; +var doubleSlashNixRegExp = /\/+/g; +var currentDirectoryWinMiddleRegExp = /\\(\.\\)+/; +var currentDirectoryWinEndRegExp = /\\\.$/; +var parentDirectoryWinMiddleRegExp = /\\+[^\\]+\\+\.\.\\/; +var parentDirectoryWinEndRegExp1 = /([A-Z]:\\)\\*[^\\]+\\+\.\.$/i; +var parentDirectoryWinEndRegExp2 = /\\+[^\\]+\\+\.\.$/; +var currentDirectoryNixMiddleRegExp = /\/+(\.\/)+/; +var currentDirectoryNixEndRegExp1 = /^\/+\.$/; +var currentDirectoryNixEndRegExp2 = /\/+\.$/; +var parentDirectoryNixMiddleRegExp = /(^|\/[^\/]+)\/+\.\.\/+/; +var parentDirectoryNixEndRegExp1 = /^\/[^\/]+\/+\.\.$/; +var parentDirectoryNixEndRegExp2 = /\/+[^\/]+\/+\.\.$/; +var parentDirectoryNixEndRegExp3 = /^\/+\.\.$/; + +// RegExp magic :) + +module.exports = function normalize(path) { + while(currentDirectoryWinMiddleRegExp.test(path)) + path = path.replace(currentDirectoryWinMiddleRegExp, "\\"); + path = path.replace(currentDirectoryWinEndRegExp, ""); + while(parentDirectoryWinMiddleRegExp.test(path)) + path = path.replace(parentDirectoryWinMiddleRegExp, "\\"); + path = path.replace(parentDirectoryWinEndRegExp1, "$1"); + path = path.replace(parentDirectoryWinEndRegExp2, ""); + + while(currentDirectoryNixMiddleRegExp.test(path)) + path = path.replace(currentDirectoryNixMiddleRegExp, "/"); + path = path.replace(currentDirectoryNixEndRegExp1, "/"); + path = path.replace(currentDirectoryNixEndRegExp2, ""); + while(parentDirectoryNixMiddleRegExp.test(path)) + path = path.replace(parentDirectoryNixMiddleRegExp, "/"); + path = path.replace(parentDirectoryNixEndRegExp1, "/"); + path = path.replace(parentDirectoryNixEndRegExp2, ""); + path = path.replace(parentDirectoryNixEndRegExp3, "/"); + + return path.replace(doubleSlashWinRegExp, "\\").replace(doubleSlashNixRegExp, "/"); +}; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/test/MemoryFileSystem.js b/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/test/MemoryFileSystem.js new file mode 100644 index 0000000000000000000000000000000000000000..7f1b1e32eae57783f941603d7cfe67db6fc8e460 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/memory-fs/test/MemoryFileSystem.js @@ -0,0 +1,362 @@ +var should = require("should"); +var MemoryFileSystem = require("../lib/MemoryFileSystem"); + +describe("directory", function() { + it("should have a empty root directory as startup", function(done) { + var fs = new MemoryFileSystem(); + fs.readdirSync("/").should.be.eql([]); + var stat = fs.statSync("/"); + stat.isFile().should.be.eql(false); + stat.isDirectory().should.be.eql(true); + fs.readdir("/", function(err, files) { + if(err) throw err; + files.should.be.eql([]); + done(); + }); + }); + it("should make and remove directories (linux style)", function() { + var fs = new MemoryFileSystem(); + fs.mkdirSync("/test"); + fs.mkdirSync("/test//sub/"); + fs.mkdirpSync("/test/sub2"); + fs.mkdirSync("/root\\dir"); + fs.mkdirpSync("/"); + fs.mkdirSync("/"); + fs.readdirSync("/").should.be.eql(["test", "root\\dir"]); + fs.readdirSync("/test/").should.be.eql(["sub", "sub2"]); + fs.rmdirSync("/test/sub//"); + fs.readdirSync("//test").should.be.eql(["sub2"]); + fs.rmdirSync("/test/sub2"); + fs.rmdirSync("/test"); + (function() { + fs.readdirSync("/test"); + }).should.throw(); + fs.readdirSync("/").should.be.eql(["root\\dir"]); + fs.mkdirpSync("/a/depth/sub/dir"); + var stat = fs.statSync("/a/depth/sub"); + stat.isFile().should.be.eql(false); + stat.isDirectory().should.be.eql(true); + }); + it("should make and remove directories (windows style)", function() { + var fs = new MemoryFileSystem(); + fs.mkdirSync("C:\\"); + fs.mkdirSync("C:\\test"); + fs.mkdirSync("C:\\test\\\\sub/"); + fs.mkdirpSync("c:\\test/sub2"); + fs.mkdirSync("C:\\root-dir"); + fs.readdirSync("C:").should.be.eql(["test", "root-dir"]); + fs.readdirSync("C:/test/").should.be.eql(["sub", "sub2"]); + fs.rmdirSync("C:/test\\sub\\\\"); + fs.readdirSync("C:\\\\test").should.be.eql(["sub2"]); + fs.rmdirSync("C:\\test\\sub2"); + fs.rmdirSync("C:\\test"); + (function() { + fs.readdirSync("C:\\test"); + }).should.throw(); + fs.readdirSync("C:").should.be.eql(["root-dir"]); + fs.mkdirpSync("D:\\a\\depth\\sub\\dir"); + var stat = fs.statSync("D:\\a\\depth\\sub"); + stat.isFile().should.be.eql(false); + stat.isDirectory().should.be.eql(true); + fs.readdirSync("D:\\//a/depth/\\sub").should.be.eql(["dir"]); + }); +}); +describe("files", function() { + it("should make and remove files", function() { + var fs = new MemoryFileSystem(); + fs.mkdirSync("/test"); + var buf = new Buffer("Hello World", "utf-8"); + fs.writeFileSync("/test/hello-world.txt", buf); + fs.readFileSync("/test/hello-world.txt").should.be.eql(buf); + fs.readFileSync("/test/hello-world.txt", "utf-8").should.be.eql("Hello World"); + (function() { + fs.readFileSync("/test/other-file"); + }).should.throw(); + (function() { + fs.readFileSync("/test/other-file", "utf-8"); + }).should.throw(); + fs.writeFileSync("/a", "Test", "utf-8"); + fs.readFileSync("/a", "utf-8").should.be.eql("Test"); + var stat = fs.statSync("/a"); + stat.isFile().should.be.eql(true); + stat.isDirectory().should.be.eql(false); + }); +}); +describe("errors", function() { + it("should fail on invalid paths", function() { + var fs = new MemoryFileSystem(); + fs.mkdirpSync("/test/a/b/c"); + fs.mkdirpSync("/test/a/bc"); + fs.mkdirpSync("/test/abc"); + (function() { + fs.mkdirpSync("xyz"); + }).should.throw(); + (function() { + fs.readdirSync("/test/abc/a/b/c"); + }).should.throw(); + (function() { + fs.readdirSync("/abc"); + }).should.throw(); + (function() { + fs.statSync("/abc"); + }).should.throw(); + (function() { + fs.mkdirSync("/test/a/d/b/c"); + }).should.throw(); + (function() { + fs.writeFileSync("/test/a/d/b/c", "Hello"); + }).should.throw(); + (function() { + fs.readFileSync("/test/a/d/b/c"); + }).should.throw(); + (function() { + fs.readFileSync("/test/abcd"); + }).should.throw(); + (function() { + fs.mkdirSync("/test/abcd/dir"); + }).should.throw(); + (function() { + fs.unlinkSync("/test/abcd"); + }).should.throw(); + (function() { + fs.unlinkSync("/test/abcd/file"); + }).should.throw(); + (function() { + fs.statSync("/test/a/d/b/c"); + }).should.throw(); + (function() { + fs.statSync("/test/abcd"); + }).should.throw(); + fs.mkdir("/test/a/d/b/c", function(err) { + err.should.be.instanceof(Error); + }); + }); + it("should fail incorrect arguments", function() { + var fs = new MemoryFileSystem(); + (function() { + fs.writeFileSync("/test"); + }).should.throw(); + }); + it("should fail on wrong type", function() { + var fs = new MemoryFileSystem(); + fs.mkdirpSync("/test/dir"); + fs.mkdirpSync("/test/dir"); + fs.writeFileSync("/test/file", "Hello"); + (function() { + fs.writeFileSync("/test/dir", "Hello"); + }).should.throw(); + (function() { + fs.readFileSync("/test/dir"); + }).should.throw(); + (function() { + fs.writeFileSync("/", "Hello"); + }).should.throw(); + (function() { + fs.rmdirSync("/"); + }).should.throw(); + (function() { + fs.unlinkSync("/"); + }).should.throw(); + (function() { + fs.mkdirSync("/test/dir"); + }).should.throw(); + (function() { + fs.mkdirSync("/test/file"); + }).should.throw(); + (function() { + fs.mkdirpSync("/test/file"); + }).should.throw(); + (function() { + fs.readdirSync("/test/file"); + }).should.throw(); + fs.readdirSync("/test/").should.be.eql(["dir", "file"]); + }); + it("should throw on readlink", function() { + var fs = new MemoryFileSystem(); + fs.mkdirpSync("/test/dir"); + (function() { + fs.readlinkSync("/"); + }).should.throw(); + (function() { + fs.readlinkSync("/link"); + }).should.throw(); + (function() { + fs.readlinkSync("/test"); + }).should.throw(); + (function() { + fs.readlinkSync("/test/dir"); + }).should.throw(); + (function() { + fs.readlinkSync("/test/dir/link"); + }).should.throw(); + }); +}); +describe("async", function() { + it("should be able to use the async versions", function(done) { + var fs = new MemoryFileSystem(); + fs.mkdirp("/test/dir", function(err) { + if(err) throw err; + fs.writeFile("/test/dir/a", "Hello", function(err) { + if(err) throw err; + fs.writeFile("/test/dir/b", "World", "utf-8", function(err) { + if(err) throw err; + fs.readFile("/test/dir/a", "utf-8", function(err, content) { + if(err) throw err; + content.should.be.eql("Hello"); + fs.readFile("/test/dir/b", function(err, content) { + if(err) throw err; + content.should.be.eql(new Buffer("World")); + done(); + }); + }); + }); + }); + }); + }); + it("should return errors", function(done) { + var fs = new MemoryFileSystem(); + fs.readFile("/fail/file", function(err, content) { + err.should.be.instanceof(Error); + fs.writeFile("/fail/file", "", function(err) { + err.should.be.instanceof(Error); + done(); + }); + }); + }); +}); +describe("normalize", function() { + it("should normalize paths", function() { + var fs = new MemoryFileSystem(); + fs.normalize("/a/b/c").should.be.eql("/a/b/c"); + fs.normalize("/a//b/c").should.be.eql("/a/b/c"); + fs.normalize("/a//b//c").should.be.eql("/a/b/c"); + fs.normalize("//a//b//c").should.be.eql("/a/b/c"); + fs.normalize("/a/////b/c").should.be.eql("/a/b/c"); + fs.normalize("/./a/d///..////b/c").should.be.eql("/a/b/c"); + fs.normalize("/..").should.be.eql("/"); + fs.normalize("/.").should.be.eql("/"); + fs.normalize("/.git").should.be.eql("/.git"); + fs.normalize("/a/b/c/.git").should.be.eql("/a/b/c/.git"); + fs.normalize("/a/b/c/..git").should.be.eql("/a/b/c/..git"); + fs.normalize("/a/b/c/..").should.be.eql("/a/b"); + fs.normalize("/a/b/c/../..").should.be.eql("/a"); + fs.normalize("/a/b/c/../../..").should.be.eql("/"); + fs.normalize("C:\\a\\..").should.be.eql("C:\\"); + fs.normalize("C:\\a\\b\\..").should.be.eql("C:\\a"); + fs.normalize("C:\\a\\b\\\c\\..\\..").should.be.eql("C:\\a"); + fs.normalize("C:\\a\\b\\d\\..\\c\\..\\..").should.be.eql("C:\\a"); + fs.normalize("C:\\a\\b\\d\\\\.\\\\.\\c\\.\\..").should.be.eql("C:\\a\\b\\d"); + }); +}); +describe("join", function() { + it("should join paths", function() { + var fs = new MemoryFileSystem(); + fs.join("/", "a/b/c").should.be.eql("/a/b/c"); + fs.join("/a", "b/c").should.be.eql("/a/b/c"); + fs.join("/a/b", "c").should.be.eql("/a/b/c"); + fs.join("/a/", "b/c").should.be.eql("/a/b/c"); + fs.join("/a//", "b/c").should.be.eql("/a/b/c"); + fs.join("a", "b/c").should.be.eql("a/b/c"); + fs.join("a/b", "c").should.be.eql("a/b/c"); + fs.join("C:", "a/b").should.be.eql("C:\\a\\b"); + fs.join("C:\\", "a/b").should.be.eql("C:\\a\\b"); + fs.join("C:\\", "a\\b").should.be.eql("C:\\a\\b"); + }); + it("should join paths (weird cases)", function() { + var fs = new MemoryFileSystem(); + fs.join("/", "").should.be.eql("/"); + fs.join("/a/b/", "").should.be.eql("/a/b/"); + fs.join("/a/b/c", "").should.be.eql("/a/b/c"); + fs.join("C:", "").should.be.eql("C:"); + fs.join("C:\\a\\b", "").should.be.eql("C:\\a\\b"); + }); + it("should join paths (absolute request)", function() { + var fs = new MemoryFileSystem(); + fs.join("/a/b/c", "/d/e/f").should.be.eql("/d/e/f"); + fs.join("C:\\a\\b\\c", "/d/e/f").should.be.eql("/d/e/f"); + fs.join("/a/b/c", "C:\\d\\e\\f").should.be.eql("C:\\d\\e\\f"); + fs.join("C:\\a\\b\\c", "C:\\d\\e\\f").should.be.eql("C:\\d\\e\\f"); + }); +}); +describe("os", function() { + var fileSystem; + + beforeEach(function() { + fileSystem = new MemoryFileSystem({ + "": true, + a: { + "": true, + index: new Buffer("1"), // /a/index + dir: { + "": true, + index: new Buffer("2") // /a/dir/index + } + }, + "C:": { + "": true, + a: { + "": true, + index: new Buffer("3"), // C:\files\index + dir: { + "": true, + index: new Buffer("4") // C:\files\a\index + } + } + } + }); + }); + + describe("unix", function() { + it("should stat stuff", function() { + fileSystem.statSync("/a").isDirectory().should.be.eql(true); + fileSystem.statSync("/a").isFile().should.be.eql(false); + fileSystem.statSync("/a/index").isDirectory().should.be.eql(false); + fileSystem.statSync("/a/index").isFile().should.be.eql(true); + fileSystem.statSync("/a/dir").isDirectory().should.be.eql(true); + fileSystem.statSync("/a/dir").isFile().should.be.eql(false); + fileSystem.statSync("/a/dir/index").isDirectory().should.be.eql(false); + fileSystem.statSync("/a/dir/index").isFile().should.be.eql(true); + }); + it("should readdir directories", function() { + fileSystem.readdirSync("/a").should.be.eql(["index", "dir"]); + fileSystem.readdirSync("/a/dir").should.be.eql(["index"]); + }); + it("should readdir directories", function() { + fileSystem.readFileSync("/a/index", "utf-8").should.be.eql("1"); + fileSystem.readFileSync("/a/dir/index", "utf-8").should.be.eql("2"); + }); + it("should also accept multi slashs", function() { + fileSystem.statSync("/a///dir//index").isFile().should.be.eql(true); + }); + }); + + describe("windows", function() { + it("should stat stuff", function() { + fileSystem.statSync("C:\\a").isDirectory().should.be.eql(true); + fileSystem.statSync("C:\\a").isFile().should.be.eql(false); + fileSystem.statSync("C:\\a\\index").isDirectory().should.be.eql(false); + fileSystem.statSync("C:\\a\\index").isFile().should.be.eql(true); + fileSystem.statSync("C:\\a\\dir").isDirectory().should.be.eql(true); + fileSystem.statSync("C:\\a\\dir").isFile().should.be.eql(false); + fileSystem.statSync("C:\\a\\dir\\index").isDirectory().should.be.eql(false); + fileSystem.statSync("C:\\a\\dir\\index").isFile().should.be.eql(true); + }); + it("should readdir directories", function() { + fileSystem.readdirSync("C:\\a").should.be.eql(["index", "dir"]); + fileSystem.readdirSync("C:\\a\\dir").should.be.eql(["index"]); + }); + it("should readdir directories", function() { + fileSystem.readFileSync("C:\\a\\index", "utf-8").should.be.eql("3"); + fileSystem.readFileSync("C:\\a\\dir\\index", "utf-8").should.be.eql("4"); + }); + it("should also accept multi slashs", function() { + fileSystem.statSync("C:\\\\a\\\\\\dir\\\\index").isFile().should.be.eql(true); + }); + it("should also accept a normal slash", function() { + fileSystem.statSync("C:\\a\\dir/index").isFile().should.be.eql(true); + fileSystem.statSync("C:\\a\\dir\\index").isFile().should.be.eql(true); + fileSystem.statSync("C:\\a/dir/index").isFile().should.be.eql(true); + fileSystem.statSync("C:\\a/dir\\index").isFile().should.be.eql(true); + }); + }); +}); \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/dist/source-map.debug.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/dist/source-map.debug.js new file mode 100644 index 0000000000000000000000000000000000000000..aad0620d70e16717ec338fc1d332279739e0d97c --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/dist/source-map.debug.js @@ -0,0 +1,3234 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["sourceMap"] = factory(); + else + root["sourceMap"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + /* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ + exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; + exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; + exports.SourceNode = __webpack_require__(10).SourceNode; + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var base64VLQ = __webpack_require__(2); + var util = __webpack_require__(4); + var ArraySet = __webpack_require__(5).ArraySet; + var MappingList = __webpack_require__(6).MappingList; + + /** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ + function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; + } + + SourceMapGenerator.prototype._version = 3; + + /** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ + SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var sourceRelative = sourceFile; + if (sourceRoot !== null) { + sourceRelative = util.relative(sourceRoot, sourceFile); + } + + if (!generator._sources.has(sourceRelative)) { + generator._sources.add(sourceRelative); + } + + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + + /** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ + SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + + /** + * Set the source content for a source file. + */ + SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + + /** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ + SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + + /** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ + SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + + /** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ + SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + + SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + + /** + * Externalize the source map. + */ + SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + + /** + * Render the source map being generated to a string. + */ + SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + + exports.SourceMapGenerator = SourceMapGenerator; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + var base64 = __webpack_require__(3); + + // A single base 64 digit can contain 6 bits of data. For the base 64 variable + // length quantities we use in the source map spec, the first bit is the sign, + // the next four bits are the actual value, and the 6th bit is the + // continuation bit. The continuation bit tells us whether there are more + // digits in this value following this digit. + // + // Continuation + // | Sign + // | | + // V V + // 101011 + + var VLQ_BASE_SHIFT = 5; + + // binary: 100000 + var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + + // binary: 011111 + var VLQ_BASE_MASK = VLQ_BASE - 1; + + // binary: 100000 + var VLQ_CONTINUATION_BIT = VLQ_BASE; + + /** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ + function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; + } + + /** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ + function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; + } + + /** + * Returns the base 64 VLQ encoded value. + */ + exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; + }; + + /** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ + exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; + }; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + + /** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ + exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); + }; + + /** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ + exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; + }; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + /** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ + function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } + } + exports.getArg = getArg; + + var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; + var dataUrlRegexp = /^data:.+\,.+$/; + + function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; + } + exports.urlParse = urlParse; + + function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; + } + exports.urlGenerate = urlGenerate; + + /** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ + function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; + } + exports.normalize = normalize; + + /** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ + function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; + } + exports.join = join; + + exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || urlRegexp.test(aPath); + }; + + /** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ + function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); + } + exports.relative = relative; + + var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); + }()); + + function identity (s) { + return s; + } + + /** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ + function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; + } + exports.toSetString = supportsNullProto ? identity : toSetString; + + function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; + } + exports.fromSetString = supportsNullProto ? identity : fromSetString; + + function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; + } + + /** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ + function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); + } + exports.compareByOriginalPositions = compareByOriginalPositions; + + /** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ + function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); + } + exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + + function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 === null) { + return 1; // aStr2 !== null + } + + if (aStr2 === null) { + return -1; // aStr1 !== null + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; + } + + /** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ + function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); + } + exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + + /** + * Strip any JSON XSSI avoidance prefix from the string (as documented + * in the source maps specification), and then parse the string as + * JSON. + */ + function parseSourceMapInput(str) { + return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); + } + exports.parseSourceMapInput = parseSourceMapInput; + + /** + * Compute the URL of a source given the the source root, the source's + * URL, and the source map's URL. + */ + function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { + sourceURL = sourceURL || ''; + + if (sourceRoot) { + // This follows what Chrome does. + if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { + sourceRoot += '/'; + } + // The spec says: + // Line 4: An optional source root, useful for relocating source + // files on a server or removing repeated values in the + // “sources” entry. This value is prepended to the individual + // entries in the “source” field. + sourceURL = sourceRoot + sourceURL; + } + + // Historically, SourceMapConsumer did not take the sourceMapURL as + // a parameter. This mode is still somewhat supported, which is why + // this code block is conditional. However, it's preferable to pass + // the source map URL to SourceMapConsumer, so that this function + // can implement the source URL resolution algorithm as outlined in + // the spec. This block is basically the equivalent of: + // new URL(sourceURL, sourceMapURL).toString() + // ... except it avoids using URL, which wasn't available in the + // older releases of node still supported by this library. + // + // The spec says: + // If the sources are not absolute URLs after prepending of the + // “sourceRoot”, the sources are resolved relative to the + // SourceMap (like resolving script src in a html document). + if (sourceMapURL) { + var parsed = urlParse(sourceMapURL); + if (!parsed) { + throw new Error("sourceMapURL could not be parsed"); + } + if (parsed.path) { + // Strip the last path component, but keep the "/". + var index = parsed.path.lastIndexOf('/'); + if (index >= 0) { + parsed.path = parsed.path.substring(0, index + 1); + } + } + sourceURL = join(urlGenerate(parsed), sourceURL); + } + + return normalize(sourceURL); + } + exports.computeSourceURL = computeSourceURL; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + var has = Object.prototype.hasOwnProperty; + var hasNativeMap = typeof Map !== "undefined"; + + /** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ + function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); + } + + /** + * Static method for creating ArraySet instances from an existing array. + */ + ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; + }; + + /** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ + ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; + }; + + /** + * Add the given string to this set. + * + * @param String aStr + */ + ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); + }; + + /** + * What is the element at the given index? + * + * @param Number aIdx + */ + ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); + }; + + /** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ + ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); + }; + + exports.ArraySet = ArraySet; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + + /** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ + function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; + } + + /** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ + function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; + } + + /** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ + MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + + /** + * Add the given source mapping. + * + * @param Object aMapping + */ + MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } + }; + + /** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ + MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; + }; + + exports.MappingList = MappingList; + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + var binarySearch = __webpack_require__(8); + var ArraySet = __webpack_require__(5).ArraySet; + var base64VLQ = __webpack_require__(2); + var quickSort = __webpack_require__(9).quickSort; + + function SourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) + : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); + } + + SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); + } + + /** + * The version of the source mapping spec that we are consuming. + */ + SourceMapConsumer.prototype._version = 3; + + // `__generatedMappings` and `__originalMappings` are arrays that hold the + // parsed mapping coordinates from the source map's "mappings" attribute. They + // are lazily instantiated, accessed via the `_generatedMappings` and + // `_originalMappings` getters respectively, and we only parse the mappings + // and create these arrays once queried for a source location. We jump through + // these hoops because there can be many thousands of mappings, and parsing + // them is expensive, so we only want to do it if we must. + // + // Each object in the arrays is of the form: + // + // { + // generatedLine: The line number in the generated code, + // generatedColumn: The column number in the generated code, + // source: The path to the original source file that generated this + // chunk of code, + // originalLine: The line number in the original source that + // corresponds to this chunk of generated code, + // originalColumn: The column number in the original source that + // corresponds to this chunk of generated code, + // name: The name of the original symbol which generated this chunk of + // code. + // } + // + // All properties except for `generatedLine` and `generatedColumn` can be + // `null`. + // + // `_generatedMappings` is ordered by the generated positions. + // + // `_originalMappings` is ordered by the original positions. + + SourceMapConsumer.prototype.__generatedMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } + }); + + SourceMapConsumer.prototype.__originalMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } + }); + + SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + + SourceMapConsumer.GENERATED_ORDER = 1; + SourceMapConsumer.ORIGINAL_ORDER = 2; + + SourceMapConsumer.GREATEST_LOWER_BOUND = 1; + SourceMapConsumer.LEAST_UPPER_BOUND = 2; + + /** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ + SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + + /** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number is 1-based. + * - column: Optional. the column number in the original source. + * The column number is 0-based. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ + SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + needle.source = this._findSourceIndex(needle.source); + if (needle.source < 0) { + return []; + } + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + + exports.SourceMapConsumer = SourceMapConsumer; + + /** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The first parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ + function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + if (sourceRoot) { + sourceRoot = util.normalize(sourceRoot); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this._absoluteSources = this._sources.toArray().map(function (s) { + return util.computeSourceURL(sourceRoot, s, aSourceMapURL); + }); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this._sourceMapURL = aSourceMapURL; + this.file = file; + } + + BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + + /** + * Utility function to find the index of a source. Returns -1 if not + * found. + */ + BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + if (this._sources.has(relativeSource)) { + return this._sources.indexOf(relativeSource); + } + + // Maybe aSource is an absolute URL as returned by |sources|. In + // this case we can't simply undo the transform. + var i; + for (i = 0; i < this._absoluteSources.length; ++i) { + if (this._absoluteSources[i] == aSource) { + return i; + } + } + + return -1; + }; + + /** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @param String aSourceMapURL + * The URL at which the source map can be found (optional) + * @returns BasicSourceMapConsumer + */ + BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + smc._sourceMapURL = aSourceMapURL; + smc._absoluteSources = smc._sources.toArray().map(function (s) { + return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); + }); + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + + /** + * The version of the source mapping spec that we are consuming. + */ + BasicSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._absoluteSources.slice(); + } + }); + + /** + * Provide the JIT with a nice shape / hidden class. + */ + function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; + } + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + + /** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ + BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + + /** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ + BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ + BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + var index = this._findSourceIndex(aSource); + if (index >= 0) { + return this.sourcesContent[index]; + } + + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + relativeSource)) { + return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + relativeSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ + BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + source = this._findSourceIndex(source); + if (source < 0) { + return { + line: null, + column: null, + lastColumn: null + }; + } + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + + exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + + /** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The first parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ + function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) + } + }); + } + + IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + + /** + * The version of the source mapping spec that we are consuming. + */ + IndexedSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } + }); + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ + IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ + IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = null; + if (mapping.name) { + name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + } + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + + exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + exports.GREATEST_LOWER_BOUND = 1; + exports.LEAST_UPPER_BOUND = 2; + + /** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ + function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } + } + + /** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ + exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; + }; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + // It turns out that some (most?) JavaScript engines don't self-host + // `Array.prototype.sort`. This makes sense because C++ will likely remain + // faster than JS when doing raw CPU-intensive sorting. However, when using a + // custom comparator function, calling back and forth between the VM's C++ and + // JIT'd JS is rather slow *and* loses JIT type information, resulting in + // worse generated code for the comparator function than would be optimal. In + // fact, when sorting with a comparator, these costs outweigh the benefits of + // sorting in C++. By using our own JS-implemented Quick Sort (below), we get + // a ~3500ms mean speed-up in `bench/bench.html`. + + /** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ + function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; + } + + /** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ + function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); + } + + /** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ + function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } + } + + /** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ + exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); + }; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; + var util = __webpack_require__(4); + + // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other + // operating systems these days (capturing the result). + var REGEX_NEWLINE = /(\r?\n)/; + + // Newline character code for charCodeAt() comparisons + var NEWLINE_CODE = 10; + + // Private symbol for identifying `SourceNode`s when multiple versions of + // the source-map library are loaded. This MUST NOT CHANGE across + // versions! + var isSourceNode = "$$$isSourceNode$$$"; + + /** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ + function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); + } + + /** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ + SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex] || ''; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex] || ''; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + + /** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + }; + + /** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + }; + + /** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } + }; + + /** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ + SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; + }; + + /** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ + SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; + }; + + /** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ + SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + + /** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + + /** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ + SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; + }; + + /** + * Returns the string representation of this source node along with a source + * map. + */ + SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; + }; + + exports.SourceNode = SourceNode; + + +/***/ }) +/******/ ]) +}); +; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCAxNjI0YzcyOTliODg3ZjdiZGY2NCIsIndlYnBhY2s6Ly8vLi9zb3VyY2UtbWFwLmpzIiwid2VicGFjazovLy8uL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LXZscS5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LmpzIiwid2VicGFjazovLy8uL2xpYi91dGlsLmpzIiwid2VicGFjazovLy8uL2xpYi9hcnJheS1zZXQuanMiLCJ3ZWJwYWNrOi8vLy4vbGliL21hcHBpbmctbGlzdC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW1hcC1jb25zdW1lci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmluYXJ5LXNlYXJjaC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvcXVpY2stc29ydC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW5vZGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsQ0FBQztBQUNELE87QUNWQTtBQUNBOztBQUVBO0FB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ICAgICAgbmV4dCArPSBiYXNlNjRWTFEuZW5jb2RlKHNvdXJjZUlkeCAtIHByZXZpb3VzU291cmNlKTtcbiAgICAgICAgcHJldmlvdXNTb3VyY2UgPSBzb3VyY2VJZHg7XG5cbiAgICAgICAgLy8gbGluZXMgYXJlIHN0b3JlZCAwLWJhc2VkIGluIFNvdXJjZU1hcCBzcGVjIHZlcnNpb24gM1xuICAgICAgICBuZXh0ICs9IGJhc2U2NFZMUS5lbmNvZGUobWFwcGluZy5vcmlnaW5hbExpbmUgLSAxXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gcHJldmlvdXNPcmlnaW5hbExpbmUpO1xuICAgICAgICBwcmV2aW91c09yaWdpbmFsTGluZSA9IG1hcHBpbmcub3JpZ2luYWxMaW5lIC0gMTtcblxuICAgICAgICBuZXh0ICs9IGJhc2U2NFZMUS5lbmNvZGUobWFwcGluZy5vcmlnaW5hbENvbHVtblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHByZXZpb3VzT3JpZ2luYWxDb2x1bW4pO1xuICAgICAgICBwcmV2aW91c09yaWdpbmFsQ29sdW1uID0gbWFwcGluZy5vcmlnaW5hbENvbHVtbjtcblxuICAgICAgICBpZiAobWFwcGluZy5uYW1lICE9IG51bGwpIHtcbiAgICAgICAgICBuYW1lSWR4ID0gdGhpcy5fbmFtZXMuaW5kZXhPZihtYXBwaW5nLm5hbWUpO1xuICAgICAgICAgIG5leHQgKz0gYmFzZTY0VkxRLmVuY29kZShuYW1lSWR4IC0gcHJldmlvdXNOYW1lKTtcbiAgICAgICAgICBwcmV2aW91c05hbWUgPSBuYW1lSWR4O1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJlc3VsdCArPSBuZXh0O1xuICAgIH1cblxuICAgIHJldHVybiByZXN1bHQ7XG4gIH07XG5cblNvdXJjZU1hcEdlbmVyYXRvci5wcm90b3R5cGUuX2dlbmVyYXRlU291cmNlc0NvbnRlbnQgPVx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WU7XG4gICAgICAgICAgICBpbmRleCA9IHRlbXAucmVzdDtcbiAgICAgICAgICAgIHNlZ21lbnQucHVzaCh2YWx1ZSk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAyKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlLCBidXQgbm8gbGluZSBhbmQgY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlIGFuZCBsaW5lLCBidXQgbm8gY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY2FjaGVkU2VnbWVudHNbc3RyXSA9IHNlZ21lbnQ7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBHZW5lcmF0ZWQgY29sdW1uLlxuICAgICAgICBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbiA9IHByZXZpb3VzR2VuZXJhdGVkQ29sdW1uICsgc2VnbWVudFswXTtcbiAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbjtcblxuICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPiAxKSB7XG4gICAgICAgICAgLy8gT3JpZ2luYWwgc291cmNlLlxuICAgICAgICAgIG1hcHBpbmcuc291cmNlID0gcHJldmlvdXNTb3VyY2UgKyBzZWdtZW50WzFdO1xuICAgICAgICAgIHByZXZpb3VzU291cmNlICs9IHNlZ21lbnRbMV07XG5cbiAgICAgICAgICAvLyBPcmlnaW5hbCBsaW5lLlxuICAgICAgICAgIG1hcHBpbmcub3JpZ2luYWxMaW5lID0gcHJldmlvdXNPcmlnaW5hbExpbmUgKyBzZWdtZW50WzJdO1xuICAgICAgICAgIHByZXZpb3VzT3JpZ2lu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291cmNlcy5mb3JFYWNoKGZ1bmN0aW9uIChzb3VyY2VGaWxlKSB7XG4gICAgICB2YXIgY29udGVudCA9IGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VDb250ZW50Rm9yKHNvdXJjZUZpbGUpO1xuICAgICAgaWYgKGNvbnRlbnQgIT0gbnVsbCkge1xuICAgICAgICBpZiAoYVJlbGF0aXZlUGF0aCAhPSBudWxsKSB7XG4gICAgICAgICAgc291cmNlRmlsZSA9IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBzb3VyY2VGaWxlKTtcbiAgICAgICAgfVxuICAgICAgICBub2RlLnNldFNvdXJjZUNvbnRlbnQoc291cmNlRmlsZSwgY29udGVudCk7XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICByZXR1cm4gbm9kZTtcblxuICAgIGZ1bmN0aW9uIGFkZE1hcHBpbmdXaXRoQ29kZShtYXBwaW5nLCBjb2RlKSB7XG4gICAgICBpZiAobWFwcGluZyA9PT0gbnVsbCB8fCBtYXBwaW5nLnNvdXJjZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIG5vZGUuYWRkKGNvZGUpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdmFyIHNvdXJjZSA9IGFSZWxhdGl2ZVBhdGhcbiAgICAgICAgICA/IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBtYXBwaW5nLnNvdXJjZSlcbiAgICAgICAgICA6IG1hcHBpbmcuc291cmNlO1xuICAgICAgICBub2RlLmFkZChuZXcgU291cmNlTm9kZShtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBwaW5nLm5hbWUpKTt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gICBzb3VyY2VNYXBwaW5nQWN0aXZlID0gZmFsc2U7XG4gICAgfVxuICAgIGZvciAodmFyIGlkeCA9IDAsIGxlbmd0aCA9IGNodW5rLmxlbmd0aDsgaWR4IDwgbGVuZ3RoOyBpZHgrKykge1xuICAgICAgaWYgKGNodW5rLmNoYXJDb2RlQXQoaWR4KSA9PT0gTkVXTElORV9DT0RFKSB7XG4gICAgICAgIGdlbmVyYXRlZC5saW5lKys7XG4gICAgICAgIGdlbmVyYXRlZC5jb2x1bW4gPSAwO1xuICAgICAgICAvLyBNYXBwaW5ncyBlbmQgYXQgZW9sXG4gICAgICAgIGlmIChpZHggKyAxID09PSBsZW5ndGgpIHtcbiAgICAgICAgICBsYXN0T3JpZ2luYWxTb3VyY2UgPSBudWxsO1xuICAgICAgICAgIHNvdXJjZU1hcHBpbmdBY3RpdmUgPSBmYWxzZTtcbiAgICAgICAgfSBlbHNlIGlmIChzb3VyY2VNYXBwaW5nQWN0aXZlKSB7XG4gICAgICAgICAgbWFwLmFkZE1hcHBpbmcoe1xuICAgICAgICAgICAgc291cmNlOiBvcmlnaW5hbC5zb3VyY2UsXG4gICAgICAgICAgICBvcmlnaW5hbDoge1xuICAgICAgICAgICAgICBsaW5lOiBvcmlnaW5hbC5saW5lLFxuICAgICAgICAgICAgICBjb2x1bW46IG9yaWdpbmFsLmNvbHVtblxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgICAgICBsaW5lOiBnZW5lcmF0ZWQubGluZSxcbiAgICAgICAgICAgICAgY29sdW1uOiBnZW5lcmF0ZWQuY29sdW1uXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbmFtZTogb3JpZ2luYWwubmFtZVxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBnZW5lcmF0ZWQuY29sdW1uKys7XG4gICAgICB9XG4gICAgfVxuICB9KTtcbiAgdGhpcy53YWxrU291cmNlQ29udGVudHMoZnVuY3Rpb24gKHNvdXJjZUZpbGUsIHNvdXJjZUNvbnRlbnQpIHtcbiAgICBtYXAuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBzb3VyY2VDb250ZW50KTtcbiAgfSk7XG5cbiAgcmV0dXJuIHsgY29kZTogZ2VuZXJhdGVkLmNvZGUsIG1hcDogbWFwIH07XG59O1xuXG5leHBvcnRzLlNvdXJjZU5vZGUgPSBTb3VyY2VOb2RlO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvc291cmNlLW5vZGUuanNcbi8vIG1vZHVsZSBpZCA9IDEwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/dist/source-map.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/dist/source-map.js new file mode 100644 index 0000000000000000000000000000000000000000..b4eb08742598ff797f613e9bf15e55ce70c9fb10 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/dist/source-map.js @@ -0,0 +1,3233 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["sourceMap"] = factory(); + else + root["sourceMap"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + /* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ + exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; + exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; + exports.SourceNode = __webpack_require__(10).SourceNode; + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var base64VLQ = __webpack_require__(2); + var util = __webpack_require__(4); + var ArraySet = __webpack_require__(5).ArraySet; + var MappingList = __webpack_require__(6).MappingList; + + /** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ + function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; + } + + SourceMapGenerator.prototype._version = 3; + + /** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ + SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var sourceRelative = sourceFile; + if (sourceRoot !== null) { + sourceRelative = util.relative(sourceRoot, sourceFile); + } + + if (!generator._sources.has(sourceRelative)) { + generator._sources.add(sourceRelative); + } + + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + + /** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ + SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + + /** + * Set the source content for a source file. + */ + SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + + /** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ + SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + + /** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ + SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + + /** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ + SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + + SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + + /** + * Externalize the source map. + */ + SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + + /** + * Render the source map being generated to a string. + */ + SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + + exports.SourceMapGenerator = SourceMapGenerator; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + var base64 = __webpack_require__(3); + + // A single base 64 digit can contain 6 bits of data. For the base 64 variable + // length quantities we use in the source map spec, the first bit is the sign, + // the next four bits are the actual value, and the 6th bit is the + // continuation bit. The continuation bit tells us whether there are more + // digits in this value following this digit. + // + // Continuation + // | Sign + // | | + // V V + // 101011 + + var VLQ_BASE_SHIFT = 5; + + // binary: 100000 + var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + + // binary: 011111 + var VLQ_BASE_MASK = VLQ_BASE - 1; + + // binary: 100000 + var VLQ_CONTINUATION_BIT = VLQ_BASE; + + /** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ + function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; + } + + /** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ + function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; + } + + /** + * Returns the base 64 VLQ encoded value. + */ + exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; + }; + + /** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ + exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; + }; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + + /** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ + exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); + }; + + /** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ + exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; + }; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + /** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ + function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } + } + exports.getArg = getArg; + + var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; + var dataUrlRegexp = /^data:.+\,.+$/; + + function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; + } + exports.urlParse = urlParse; + + function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; + } + exports.urlGenerate = urlGenerate; + + /** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ + function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; + } + exports.normalize = normalize; + + /** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ + function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; + } + exports.join = join; + + exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || urlRegexp.test(aPath); + }; + + /** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ + function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); + } + exports.relative = relative; + + var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); + }()); + + function identity (s) { + return s; + } + + /** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ + function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; + } + exports.toSetString = supportsNullProto ? identity : toSetString; + + function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; + } + exports.fromSetString = supportsNullProto ? identity : fromSetString; + + function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; + } + + /** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ + function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); + } + exports.compareByOriginalPositions = compareByOriginalPositions; + + /** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ + function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); + } + exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + + function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 === null) { + return 1; // aStr2 !== null + } + + if (aStr2 === null) { + return -1; // aStr1 !== null + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; + } + + /** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ + function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); + } + exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + + /** + * Strip any JSON XSSI avoidance prefix from the string (as documented + * in the source maps specification), and then parse the string as + * JSON. + */ + function parseSourceMapInput(str) { + return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); + } + exports.parseSourceMapInput = parseSourceMapInput; + + /** + * Compute the URL of a source given the the source root, the source's + * URL, and the source map's URL. + */ + function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { + sourceURL = sourceURL || ''; + + if (sourceRoot) { + // This follows what Chrome does. + if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { + sourceRoot += '/'; + } + // The spec says: + // Line 4: An optional source root, useful for relocating source + // files on a server or removing repeated values in the + // “sources” entry. This value is prepended to the individual + // entries in the “source” field. + sourceURL = sourceRoot + sourceURL; + } + + // Historically, SourceMapConsumer did not take the sourceMapURL as + // a parameter. This mode is still somewhat supported, which is why + // this code block is conditional. However, it's preferable to pass + // the source map URL to SourceMapConsumer, so that this function + // can implement the source URL resolution algorithm as outlined in + // the spec. This block is basically the equivalent of: + // new URL(sourceURL, sourceMapURL).toString() + // ... except it avoids using URL, which wasn't available in the + // older releases of node still supported by this library. + // + // The spec says: + // If the sources are not absolute URLs after prepending of the + // “sourceRoot”, the sources are resolved relative to the + // SourceMap (like resolving script src in a html document). + if (sourceMapURL) { + var parsed = urlParse(sourceMapURL); + if (!parsed) { + throw new Error("sourceMapURL could not be parsed"); + } + if (parsed.path) { + // Strip the last path component, but keep the "/". + var index = parsed.path.lastIndexOf('/'); + if (index >= 0) { + parsed.path = parsed.path.substring(0, index + 1); + } + } + sourceURL = join(urlGenerate(parsed), sourceURL); + } + + return normalize(sourceURL); + } + exports.computeSourceURL = computeSourceURL; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + var has = Object.prototype.hasOwnProperty; + var hasNativeMap = typeof Map !== "undefined"; + + /** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ + function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); + } + + /** + * Static method for creating ArraySet instances from an existing array. + */ + ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; + }; + + /** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ + ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; + }; + + /** + * Add the given string to this set. + * + * @param String aStr + */ + ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); + }; + + /** + * What is the element at the given index? + * + * @param Number aIdx + */ + ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); + }; + + /** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ + ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); + }; + + exports.ArraySet = ArraySet; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + + /** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ + function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; + } + + /** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ + function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; + } + + /** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ + MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + + /** + * Add the given source mapping. + * + * @param Object aMapping + */ + MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } + }; + + /** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ + MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; + }; + + exports.MappingList = MappingList; + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + var binarySearch = __webpack_require__(8); + var ArraySet = __webpack_require__(5).ArraySet; + var base64VLQ = __webpack_require__(2); + var quickSort = __webpack_require__(9).quickSort; + + function SourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) + : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); + } + + SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); + } + + /** + * The version of the source mapping spec that we are consuming. + */ + SourceMapConsumer.prototype._version = 3; + + // `__generatedMappings` and `__originalMappings` are arrays that hold the + // parsed mapping coordinates from the source map's "mappings" attribute. They + // are lazily instantiated, accessed via the `_generatedMappings` and + // `_originalMappings` getters respectively, and we only parse the mappings + // and create these arrays once queried for a source location. We jump through + // these hoops because there can be many thousands of mappings, and parsing + // them is expensive, so we only want to do it if we must. + // + // Each object in the arrays is of the form: + // + // { + // generatedLine: The line number in the generated code, + // generatedColumn: The column number in the generated code, + // source: The path to the original source file that generated this + // chunk of code, + // originalLine: The line number in the original source that + // corresponds to this chunk of generated code, + // originalColumn: The column number in the original source that + // corresponds to this chunk of generated code, + // name: The name of the original symbol which generated this chunk of + // code. + // } + // + // All properties except for `generatedLine` and `generatedColumn` can be + // `null`. + // + // `_generatedMappings` is ordered by the generated positions. + // + // `_originalMappings` is ordered by the original positions. + + SourceMapConsumer.prototype.__generatedMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } + }); + + SourceMapConsumer.prototype.__originalMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } + }); + + SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + + SourceMapConsumer.GENERATED_ORDER = 1; + SourceMapConsumer.ORIGINAL_ORDER = 2; + + SourceMapConsumer.GREATEST_LOWER_BOUND = 1; + SourceMapConsumer.LEAST_UPPER_BOUND = 2; + + /** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ + SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + + /** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number is 1-based. + * - column: Optional. the column number in the original source. + * The column number is 0-based. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ + SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + needle.source = this._findSourceIndex(needle.source); + if (needle.source < 0) { + return []; + } + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + + exports.SourceMapConsumer = SourceMapConsumer; + + /** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The first parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ + function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + if (sourceRoot) { + sourceRoot = util.normalize(sourceRoot); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this._absoluteSources = this._sources.toArray().map(function (s) { + return util.computeSourceURL(sourceRoot, s, aSourceMapURL); + }); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this._sourceMapURL = aSourceMapURL; + this.file = file; + } + + BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + + /** + * Utility function to find the index of a source. Returns -1 if not + * found. + */ + BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + if (this._sources.has(relativeSource)) { + return this._sources.indexOf(relativeSource); + } + + // Maybe aSource is an absolute URL as returned by |sources|. In + // this case we can't simply undo the transform. + var i; + for (i = 0; i < this._absoluteSources.length; ++i) { + if (this._absoluteSources[i] == aSource) { + return i; + } + } + + return -1; + }; + + /** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @param String aSourceMapURL + * The URL at which the source map can be found (optional) + * @returns BasicSourceMapConsumer + */ + BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + smc._sourceMapURL = aSourceMapURL; + smc._absoluteSources = smc._sources.toArray().map(function (s) { + return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); + }); + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + + /** + * The version of the source mapping spec that we are consuming. + */ + BasicSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._absoluteSources.slice(); + } + }); + + /** + * Provide the JIT with a nice shape / hidden class. + */ + function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; + } + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + + /** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ + BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + + /** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ + BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ + BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + var index = this._findSourceIndex(aSource); + if (index >= 0) { + return this.sourcesContent[index]; + } + + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + relativeSource)) { + return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + relativeSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ + BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + source = this._findSourceIndex(source); + if (source < 0) { + return { + line: null, + column: null, + lastColumn: null + }; + } + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + + exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + + /** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The first parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ + function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) + } + }); + } + + IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + + /** + * The version of the source mapping spec that we are consuming. + */ + IndexedSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } + }); + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ + IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ + IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = null; + if (mapping.name) { + name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + } + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + + exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + exports.GREATEST_LOWER_BOUND = 1; + exports.LEAST_UPPER_BOUND = 2; + + /** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ + function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } + } + + /** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ + exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; + }; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + // It turns out that some (most?) JavaScript engines don't self-host + // `Array.prototype.sort`. This makes sense because C++ will likely remain + // faster than JS when doing raw CPU-intensive sorting. However, when using a + // custom comparator function, calling back and forth between the VM's C++ and + // JIT'd JS is rather slow *and* loses JIT type information, resulting in + // worse generated code for the comparator function than would be optimal. In + // fact, when sorting with a comparator, these costs outweigh the benefits of + // sorting in C++. By using our own JS-implemented Quick Sort (below), we get + // a ~3500ms mean speed-up in `bench/bench.html`. + + /** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ + function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; + } + + /** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ + function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); + } + + /** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ + function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } + } + + /** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ + exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); + }; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; + var util = __webpack_require__(4); + + // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other + // operating systems these days (capturing the result). + var REGEX_NEWLINE = /(\r?\n)/; + + // Newline character code for charCodeAt() comparisons + var NEWLINE_CODE = 10; + + // Private symbol for identifying `SourceNode`s when multiple versions of + // the source-map library are loaded. This MUST NOT CHANGE across + // versions! + var isSourceNode = "$$$isSourceNode$$$"; + + /** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ + function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); + } + + /** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ + SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex] || ''; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex] || ''; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + + /** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + }; + + /** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + }; + + /** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } + }; + + /** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ + SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; + }; + + /** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ + SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; + }; + + /** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ + SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + + /** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + + /** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ + SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; + }; + + /** + * Returns the string representation of this source node along with a source + * map. + */ + SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; + }; + + exports.SourceNode = SourceNode; + + +/***/ }) +/******/ ]) +}); +; \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/dist/source-map.min.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/dist/source-map.min.js new file mode 100644 index 0000000000000000000000000000000000000000..c7c72dad8b59de41f3c932da18a5e5577ba76cb8 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/dist/source-map.min.js @@ -0,0 +1,2 @@ +!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.sourceMap=n():e.sourceMap=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){n.SourceMapGenerator=r(1).SourceMapGenerator,n.SourceMapConsumer=r(7).SourceMapConsumer,n.SourceNode=r(10).SourceNode},function(e,n,r){function t(e){e||(e={}),this._file=i.getArg(e,"file",null),this._sourceRoot=i.getArg(e,"sourceRoot",null),this._skipValidation=i.getArg(e,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new a,this._sourcesContents=null}var o=r(2),i=r(4),s=r(5).ArraySet,a=r(6).MappingList;t.prototype._version=3,t.fromSourceMap=function(e){var n=e.sourceRoot,r=new t({file:e.file,sourceRoot:n});return e.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=n&&(t.source=i.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),r.addMapping(t)}),e.sources.forEach(function(t){var o=t;null!==n&&(o=i.relative(n,t)),r._sources.has(o)||r._sources.add(o);var s=e.sourceContentFor(t);null!=s&&r.setSourceContent(t,s)}),r},t.prototype.addMapping=function(e){var n=i.getArg(e,"generated"),r=i.getArg(e,"original",null),t=i.getArg(e,"source",null),o=i.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,t,o),null!=t&&(t=String(t),this._sources.has(t)||this._sources.add(t)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:t,name:o})},t.prototype.setSourceContent=function(e,n){var r=e;null!=this._sourceRoot&&(r=i.relative(this._sourceRoot,r)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[i.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[i.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},t.prototype.applySourceMap=function(e,n,r){var t=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');t=e.file}var o=this._sourceRoot;null!=o&&(t=i.relative(o,t));var a=new s,u=new s;this._mappings.unsortedForEach(function(n){if(n.source===t&&null!=n.originalLine){var s=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=s.source&&(n.source=s.source,null!=r&&(n.source=i.join(r,n.source)),null!=o&&(n.source=i.relative(o,n.source)),n.originalLine=s.line,n.originalColumn=s.column,null!=s.name&&(n.name=s.name))}var l=n.source;null==l||a.has(l)||a.add(l);var c=n.name;null==c||u.has(c)||u.add(c)},this),this._sources=a,this._names=u,e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&(null!=r&&(n=i.join(r,n)),null!=o&&(n=i.relative(o,n)),this.setSourceContent(n,t))},this)},t.prototype._validateMapping=function(e,n,r,t){if(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||n||r||t)&&!(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:n,name:t}))},t.prototype._serializeMappings=function(){for(var e,n,r,t,s=0,a=1,u=0,l=0,c=0,g=0,p="",h=this._mappings.toArray(),f=0,d=h.length;f0){if(!i.compareByGeneratedPositionsInflated(n,h[f-1]))continue;e+=","}e+=o.encode(n.generatedColumn-s),s=n.generatedColumn,null!=n.source&&(t=this._sources.indexOf(n.source),e+=o.encode(t-g),g=t,e+=o.encode(n.originalLine-1-l),l=n.originalLine-1,e+=o.encode(n.originalColumn-u),u=n.originalColumn,null!=n.name&&(r=this._names.indexOf(n.name),e+=o.encode(r-c),c=r)),p+=e}return p},t.prototype._generateSourcesContent=function(e,n){return e.map(function(e){if(!this._sourcesContents)return null;null!=n&&(e=i.relative(n,e));var r=i.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},t.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},t.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=t},function(e,n,r){function t(e){return e<0?(-e<<1)+1:(e<<1)+0}function o(e){var n=1===(1&e),r=e>>1;return n?-r:r}var i=r(3),s=5,a=1<>>=s,o>0&&(n|=l),r+=i.encode(n);while(o>0);return r},n.decode=function(e,n,r){var t,a,c=e.length,g=0,p=0;do{if(n>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(a=i.decode(e.charCodeAt(n++)),a===-1)throw new Error("Invalid base64 digit: "+e.charAt(n-1));t=!!(a&l),a&=u,g+=a<=0;c--)s=u[c],"."===s?u.splice(c,1):".."===s?l++:l>0&&(""===s?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return r=u.join("/"),""===r&&(r=a?"/":"."),i?(i.path=r,o(i)):r}function s(e,n){""===e&&(e="."),""===n&&(n=".");var r=t(n),s=t(e);if(s&&(e=s.path||"/"),r&&!r.scheme)return s&&(r.scheme=s.scheme),o(r);if(r||n.match(y))return n;if(s&&!s.host&&!s.path)return s.host=n,o(s);var a="/"===n.charAt(0)?n:i(e.replace(/\/+$/,"")+"/"+n);return s?(s.path=a,o(s)):a}function a(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==n.indexOf(e+"/");){var t=e.lastIndexOf("/");if(t<0)return n;if(e=e.slice(0,t),e.match(/^([^\/]+:\/)?\/*$/))return n;++r}return Array(r+1).join("../")+n.substr(e.length+1)}function u(e){return e}function l(e){return g(e)?"$"+e:e}function c(e){return g(e)?e.slice(1):e}function g(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function p(e,n,r){var t=f(e.source,n.source);return 0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t||r?t:(t=e.generatedColumn-n.generatedColumn,0!==t?t:(t=e.generatedLine-n.generatedLine,0!==t?t:f(e.name,n.name)))))}function h(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t?t:(t=e.generatedColumn-n.generatedColumn,0!==t||r?t:(t=f(e.source,n.source),0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t?t:f(e.name,n.name)))))}function f(e,n){return e===n?0:null===e?1:null===n?-1:e>n?1:-1}function d(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:(r=e.generatedColumn-n.generatedColumn,0!==r?r:(r=f(e.source,n.source),0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r?r:f(e.name,n.name)))))}function m(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}function _(e,n,r){if(n=n||"",e&&("/"!==e[e.length-1]&&"/"!==n[0]&&(e+="/"),n=e+n),r){var a=t(r);if(!a)throw new Error("sourceMapURL could not be parsed");if(a.path){var u=a.path.lastIndexOf("/");u>=0&&(a.path=a.path.substring(0,u+1))}n=s(o(a),n)}return i(n)}n.getArg=r;var v=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,y=/^data:.+\,.+$/;n.urlParse=t,n.urlGenerate=o,n.normalize=i,n.join=s,n.isAbsolute=function(e){return"/"===e.charAt(0)||v.test(e)},n.relative=a;var C=function(){var e=Object.create(null);return!("__proto__"in e)}();n.toSetString=C?u:l,n.fromSetString=C?u:c,n.compareByOriginalPositions=p,n.compareByGeneratedPositionsDeflated=h,n.compareByGeneratedPositionsInflated=d,n.parseSourceMapInput=m,n.computeSourceURL=_},function(e,n,r){function t(){this._array=[],this._set=s?new Map:Object.create(null)}var o=r(4),i=Object.prototype.hasOwnProperty,s="undefined"!=typeof Map;t.fromArray=function(e,n){for(var r=new t,o=0,i=e.length;o=0)return n}else{var r=o.toSetString(e);if(i.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},t.prototype.at=function(e){if(e>=0&&er||t==r&&s>=o||i.compareByGeneratedPositionsInflated(e,n)<=0}function o(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var i=r(4);o.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)},o.prototype.add=function(e){t(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},o.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=o},function(e,n,r){function t(e,n){var r=e;return"string"==typeof e&&(r=a.parseSourceMapInput(e)),null!=r.sections?new s(r,n):new o(r,n)}function o(e,n){var r=e;"string"==typeof e&&(r=a.parseSourceMapInput(e));var t=a.getArg(r,"version"),o=a.getArg(r,"sources"),i=a.getArg(r,"names",[]),s=a.getArg(r,"sourceRoot",null),u=a.getArg(r,"sourcesContent",null),c=a.getArg(r,"mappings"),g=a.getArg(r,"file",null);if(t!=this._version)throw new Error("Unsupported version: "+t);s&&(s=a.normalize(s)),o=o.map(String).map(a.normalize).map(function(e){return s&&a.isAbsolute(s)&&a.isAbsolute(e)?a.relative(s,e):e}),this._names=l.fromArray(i.map(String),!0),this._sources=l.fromArray(o,!0),this._absoluteSources=this._sources.toArray().map(function(e){return a.computeSourceURL(s,e,n)}),this.sourceRoot=s,this.sourcesContent=u,this._mappings=c,this._sourceMapURL=n,this.file=g}function i(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function s(e,n){var r=e;"string"==typeof e&&(r=a.parseSourceMapInput(e));var o=a.getArg(r,"version"),i=a.getArg(r,"sections");if(o!=this._version)throw new Error("Unsupported version: "+o);this._sources=new l,this._names=new l;var s={line:-1,column:0};this._sections=i.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var r=a.getArg(e,"offset"),o=a.getArg(r,"line"),i=a.getArg(r,"column");if(o=0){var i=this._originalMappings[o];if(void 0===e.column)for(var s=i.originalLine;i&&i.originalLine===s;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o];else for(var l=i.originalColumn;i&&i.originalLine===n&&i.originalColumn==l;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o]}return t},n.SourceMapConsumer=t,o.prototype=Object.create(t.prototype),o.prototype.consumer=t,o.prototype._findSourceIndex=function(e){var n=e;if(null!=this.sourceRoot&&(n=a.relative(this.sourceRoot,n)),this._sources.has(n))return this._sources.indexOf(n);var r;for(r=0;r1&&(r.source=d+o[1],d+=o[1],r.originalLine=h+o[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=f+o[3],f=r.originalColumn,o.length>4&&(r.name=m+o[4],m+=o[4])),A.push(r),"number"==typeof r.originalLine&&S.push(r)}g(A,a.compareByGeneratedPositionsDeflated),this.__generatedMappings=A,g(S,a.compareByOriginalPositions),this.__originalMappings=S},o.prototype._findMapping=function(e,n,r,t,o,i){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[t]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[t]);return u.search(e,n,o,i)},o.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=a.getArg(o,"source",null);null!==i&&(i=this._sources.at(i),i=a.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));var s=a.getArg(o,"name",null);return null!==s&&(s=this._names.at(s)),{source:i,line:a.getArg(o,"originalLine",null),column:a.getArg(o,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},o.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var t=e;null!=this.sourceRoot&&(t=a.relative(this.sourceRoot,t));var o;if(null!=this.sourceRoot&&(o=a.urlParse(this.sourceRoot))){var i=t.replace(/^file:\/\//,"");if("file"==o.scheme&&this._sources.has(i))return this.sourcesContent[this._sources.indexOf(i)];if((!o.path||"/"==o.path)&&this._sources.has("/"+t))return this.sourcesContent[this._sources.indexOf("/"+t)]}if(n)return null;throw new Error('"'+t+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(e){var n=a.getArg(e,"source");if(n=this._findSourceIndex(n),n<0)return{line:null,column:null,lastColumn:null};var r={source:n,originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",t.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=o,s.prototype=Object.create(t.prototype),s.prototype.constructor=t,s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){for(var e=[],n=0;n0?t-u>1?r(u,t,o,i,s,a):a==n.LEAST_UPPER_BOUND?t1?r(e,u,o,i,s,a):a==n.LEAST_UPPER_BOUND?u:e<0?-1:e}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,o,i){if(0===t.length)return-1;var s=r(-1,t.length,e,t,o,i||n.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===o(t[s],t[s-1],!0);)--s;return s}},function(e,n){function r(e,n,r){var t=e[n];e[n]=e[r],e[r]=t}function t(e,n){return Math.round(e+Math.random()*(n-e))}function o(e,n,i,s){if(i=0;n--)this.prepend(e[n]);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},t.prototype.walk=function(e){for(var n,r=0,t=this.children.length;r0){for(n=[],r=0;r 0 && aGenerated.column >= 0\n\t && !aOriginal && !aSource && !aName) {\n\t // Case 1.\n\t return;\n\t }\n\t else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n\t && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n\t && aGenerated.line > 0 && aGenerated.column >= 0\n\t && aOriginal.line > 0 && aOriginal.column >= 0\n\t && aSource) {\n\t // Cases 2 and 3.\n\t return;\n\t }\n\t else {\n\t throw new Error('Invalid mapping: ' + JSON.stringify({\n\t generated: aGenerated,\n\t source: aSource,\n\t original: aOriginal,\n\t name: aName\n\t }));\n\t }\n\t };\n\t\n\t/**\n\t * Serialize the accumulated mappings in to the stream of base 64 VLQs\n\t * specified by the source map format.\n\t */\n\tSourceMapGenerator.prototype._serializeMappings =\n\t function SourceMapGenerator_serializeMappings() {\n\t var previousGeneratedColumn = 0;\n\t var previousGeneratedLine = 1;\n\t var previousOriginalColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousName = 0;\n\t var previousSource = 0;\n\t var result = '';\n\t var next;\n\t var mapping;\n\t var nameIdx;\n\t var sourceIdx;\n\t\n\t var mappings = this._mappings.toArray();\n\t for (var i = 0, len = mappings.length; i < len; i++) {\n\t mapping = mappings[i];\n\t next = ''\n\t\n\t if (mapping.generatedLine !== previousGeneratedLine) {\n\t previousGeneratedColumn = 0;\n\t while (mapping.generatedLine !== previousGeneratedLine) {\n\t next += ';';\n\t previousGeneratedLine++;\n\t }\n\t }\n\t else {\n\t if (i > 0) {\n\t if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n\t continue;\n\t }\n\t next += ',';\n\t }\n\t }\n\t\n\t next += base64VLQ.encode(mapping.generatedColumn\n\t - previousGeneratedColumn);\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (mapping.source != null) {\n\t sourceIdx = this._sources.indexOf(mapping.source);\n\t next += base64VLQ.encode(sourceIdx - previousSource);\n\t previousSource = sourceIdx;\n\t\n\t // lines are stored 0-based in SourceMap spec version 3\n\t next += base64VLQ.encode(mapping.originalLine - 1\n\t - previousOriginalLine);\n\t previousOriginalLine = mapping.originalLine - 1;\n\t\n\t next += base64VLQ.encode(mapping.originalColumn\n\t - previousOriginalColumn);\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (mapping.name != null) {\n\t nameIdx = this._names.indexOf(mapping.name);\n\t next += base64VLQ.encode(nameIdx - previousName);\n\t previousName = nameIdx;\n\t }\n\t }\n\t\n\t result += next;\n\t }\n\t\n\t return result;\n\t };\n\t\n\tSourceMapGenerator.prototype._generateSourcesContent =\n\t function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n\t return aSources.map(function (source) {\n\t if (!this._sourcesContents) {\n\t return null;\n\t }\n\t if (aSourceRoot != null) {\n\t source = util.relative(aSourceRoot, source);\n\t }\n\t var key = util.toSetString(source);\n\t return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n\t ? this._sourcesContents[key]\n\t : null;\n\t }, this);\n\t };\n\t\n\t/**\n\t * Externalize the source map.\n\t */\n\tSourceMapGenerator.prototype.toJSON =\n\t function SourceMapGenerator_toJSON() {\n\t var map = {\n\t version: this._version,\n\t sources: this._sources.toArray(),\n\t names: this._names.toArray(),\n\t mappings: this._serializeMappings()\n\t };\n\t if (this._file != null) {\n\t map.file = this._file;\n\t }\n\t if (this._sourceRoot != null) {\n\t map.sourceRoot = this._sourceRoot;\n\t }\n\t if (this._sourcesContents) {\n\t map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n\t }\n\t\n\t return map;\n\t };\n\t\n\t/**\n\t * Render the source map being generated to a string.\n\t */\n\tSourceMapGenerator.prototype.toString =\n\t function SourceMapGenerator_toString() {\n\t return JSON.stringify(this.toJSON());\n\t };\n\t\n\texports.SourceMapGenerator = SourceMapGenerator;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t *\n\t * Based on the Base 64 VLQ implementation in Closure Compiler:\n\t * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n\t *\n\t * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n\t * Redistribution and use in source and binary forms, with or without\n\t * modification, are permitted provided that the following conditions are\n\t * met:\n\t *\n\t * * Redistributions of source code must retain the above copyright\n\t * notice, this list of conditions and the following disclaimer.\n\t * * Redistributions in binary form must reproduce the above\n\t * copyright notice, this list of conditions and the following\n\t * disclaimer in the documentation and/or other materials provided\n\t * with the distribution.\n\t * * Neither the name of Google Inc. nor the names of its\n\t * contributors may be used to endorse or promote products derived\n\t * from this software without specific prior written permission.\n\t *\n\t * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\t * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\t * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\t * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\t * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\t * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\t * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\t * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\t * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t */\n\t\n\tvar base64 = __webpack_require__(3);\n\t\n\t// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n\t// length quantities we use in the source map spec, the first bit is the sign,\n\t// the next four bits are the actual value, and the 6th bit is the\n\t// continuation bit. The continuation bit tells us whether there are more\n\t// digits in this value following this digit.\n\t//\n\t// Continuation\n\t// | Sign\n\t// | |\n\t// V V\n\t// 101011\n\t\n\tvar VLQ_BASE_SHIFT = 5;\n\t\n\t// binary: 100000\n\tvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\t\n\t// binary: 011111\n\tvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\t\n\t// binary: 100000\n\tvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\t\n\t/**\n\t * Converts from a two-complement value to a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n\t * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n\t */\n\tfunction toVLQSigned(aValue) {\n\t return aValue < 0\n\t ? ((-aValue) << 1) + 1\n\t : (aValue << 1) + 0;\n\t}\n\t\n\t/**\n\t * Converts to a two-complement value from a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n\t * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n\t */\n\tfunction fromVLQSigned(aValue) {\n\t var isNegative = (aValue & 1) === 1;\n\t var shifted = aValue >> 1;\n\t return isNegative\n\t ? -shifted\n\t : shifted;\n\t}\n\t\n\t/**\n\t * Returns the base 64 VLQ encoded value.\n\t */\n\texports.encode = function base64VLQ_encode(aValue) {\n\t var encoded = \"\";\n\t var digit;\n\t\n\t var vlq = toVLQSigned(aValue);\n\t\n\t do {\n\t digit = vlq & VLQ_BASE_MASK;\n\t vlq >>>= VLQ_BASE_SHIFT;\n\t if (vlq > 0) {\n\t // There are still more digits in this value, so we must make sure the\n\t // continuation bit is marked.\n\t digit |= VLQ_CONTINUATION_BIT;\n\t }\n\t encoded += base64.encode(digit);\n\t } while (vlq > 0);\n\t\n\t return encoded;\n\t};\n\t\n\t/**\n\t * Decodes the next base 64 VLQ value from the given string and returns the\n\t * value and the rest of the string via the out parameter.\n\t */\n\texports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n\t var strLen = aStr.length;\n\t var result = 0;\n\t var shift = 0;\n\t var continuation, digit;\n\t\n\t do {\n\t if (aIndex >= strLen) {\n\t throw new Error(\"Expected more digits in base 64 VLQ value.\");\n\t }\n\t\n\t digit = base64.decode(aStr.charCodeAt(aIndex++));\n\t if (digit === -1) {\n\t throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n\t }\n\t\n\t continuation = !!(digit & VLQ_CONTINUATION_BIT);\n\t digit &= VLQ_BASE_MASK;\n\t result = result + (digit << shift);\n\t shift += VLQ_BASE_SHIFT;\n\t } while (continuation);\n\t\n\t aOutParam.value = fromVLQSigned(result);\n\t aOutParam.rest = aIndex;\n\t};\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\t\n\t/**\n\t * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n\t */\n\texports.encode = function (number) {\n\t if (0 <= number && number < intToCharMap.length) {\n\t return intToCharMap[number];\n\t }\n\t throw new TypeError(\"Must be between 0 and 63: \" + number);\n\t};\n\t\n\t/**\n\t * Decode a single base 64 character code digit to an integer. Returns -1 on\n\t * failure.\n\t */\n\texports.decode = function (charCode) {\n\t var bigA = 65; // 'A'\n\t var bigZ = 90; // 'Z'\n\t\n\t var littleA = 97; // 'a'\n\t var littleZ = 122; // 'z'\n\t\n\t var zero = 48; // '0'\n\t var nine = 57; // '9'\n\t\n\t var plus = 43; // '+'\n\t var slash = 47; // '/'\n\t\n\t var littleOffset = 26;\n\t var numberOffset = 52;\n\t\n\t // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\t if (bigA <= charCode && charCode <= bigZ) {\n\t return (charCode - bigA);\n\t }\n\t\n\t // 26 - 51: abcdefghijklmnopqrstuvwxyz\n\t if (littleA <= charCode && charCode <= littleZ) {\n\t return (charCode - littleA + littleOffset);\n\t }\n\t\n\t // 52 - 61: 0123456789\n\t if (zero <= charCode && charCode <= nine) {\n\t return (charCode - zero + numberOffset);\n\t }\n\t\n\t // 62: +\n\t if (charCode == plus) {\n\t return 62;\n\t }\n\t\n\t // 63: /\n\t if (charCode == slash) {\n\t return 63;\n\t }\n\t\n\t // Invalid base64 digit.\n\t return -1;\n\t};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\t/**\n\t * This is a helper function for getting values from parameter/options\n\t * objects.\n\t *\n\t * @param args The object we are extracting values from\n\t * @param name The name of the property we are getting.\n\t * @param defaultValue An optional value to return if the property is missing\n\t * from the object. If this is not specified and the property is missing, an\n\t * error will be thrown.\n\t */\n\tfunction getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}\n\texports.getArg = getArg;\n\t\n\tvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.-]*)(?::(\\d+))?(.*)$/;\n\tvar dataUrlRegexp = /^data:.+\\,.+$/;\n\t\n\tfunction urlParse(aUrl) {\n\t var match = aUrl.match(urlRegexp);\n\t if (!match) {\n\t return null;\n\t }\n\t return {\n\t scheme: match[1],\n\t auth: match[2],\n\t host: match[3],\n\t port: match[4],\n\t path: match[5]\n\t };\n\t}\n\texports.urlParse = urlParse;\n\t\n\tfunction urlGenerate(aParsedUrl) {\n\t var url = '';\n\t if (aParsedUrl.scheme) {\n\t url += aParsedUrl.scheme + ':';\n\t }\n\t url += '//';\n\t if (aParsedUrl.auth) {\n\t url += aParsedUrl.auth + '@';\n\t }\n\t if (aParsedUrl.host) {\n\t url += aParsedUrl.host;\n\t }\n\t if (aParsedUrl.port) {\n\t url += \":\" + aParsedUrl.port\n\t }\n\t if (aParsedUrl.path) {\n\t url += aParsedUrl.path;\n\t }\n\t return url;\n\t}\n\texports.urlGenerate = urlGenerate;\n\t\n\t/**\n\t * Normalizes a path, or the path portion of a URL:\n\t *\n\t * - Replaces consecutive slashes with one slash.\n\t * - Removes unnecessary '.' parts.\n\t * - Removes unnecessary '/..' parts.\n\t *\n\t * Based on code in the Node.js 'path' core module.\n\t *\n\t * @param aPath The path or url to normalize.\n\t */\n\tfunction normalize(aPath) {\n\t var path = aPath;\n\t var url = urlParse(aPath);\n\t if (url) {\n\t if (!url.path) {\n\t return aPath;\n\t }\n\t path = url.path;\n\t }\n\t var isAbsolute = exports.isAbsolute(path);\n\t\n\t var parts = path.split(/\\/+/);\n\t for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n\t part = parts[i];\n\t if (part === '.') {\n\t parts.splice(i, 1);\n\t } else if (part === '..') {\n\t up++;\n\t } else if (up > 0) {\n\t if (part === '') {\n\t // The first part is blank if the path is absolute. Trying to go\n\t // above the root is a no-op. Therefore we can remove all '..' parts\n\t // directly after the root.\n\t parts.splice(i + 1, up);\n\t up = 0;\n\t } else {\n\t parts.splice(i, 2);\n\t up--;\n\t }\n\t }\n\t }\n\t path = parts.join('/');\n\t\n\t if (path === '') {\n\t path = isAbsolute ? '/' : '.';\n\t }\n\t\n\t if (url) {\n\t url.path = path;\n\t return urlGenerate(url);\n\t }\n\t return path;\n\t}\n\texports.normalize = normalize;\n\t\n\t/**\n\t * Joins two paths/URLs.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be joined with the root.\n\t *\n\t * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n\t * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n\t * first.\n\t * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n\t * is updated with the result and aRoot is returned. Otherwise the result\n\t * is returned.\n\t * - If aPath is absolute, the result is aPath.\n\t * - Otherwise the two paths are joined with a slash.\n\t * - Joining for example 'http://' and 'www.example.com' is also supported.\n\t */\n\tfunction join(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t if (aPath === \"\") {\n\t aPath = \".\";\n\t }\n\t var aPathUrl = urlParse(aPath);\n\t var aRootUrl = urlParse(aRoot);\n\t if (aRootUrl) {\n\t aRoot = aRootUrl.path || '/';\n\t }\n\t\n\t // `join(foo, '//www.example.org')`\n\t if (aPathUrl && !aPathUrl.scheme) {\n\t if (aRootUrl) {\n\t aPathUrl.scheme = aRootUrl.scheme;\n\t }\n\t return urlGenerate(aPathUrl);\n\t }\n\t\n\t if (aPathUrl || aPath.match(dataUrlRegexp)) {\n\t return aPath;\n\t }\n\t\n\t // `join('http://', 'www.example.com')`\n\t if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n\t aRootUrl.host = aPath;\n\t return urlGenerate(aRootUrl);\n\t }\n\t\n\t var joined = aPath.charAt(0) === '/'\n\t ? aPath\n\t : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\t\n\t if (aRootUrl) {\n\t aRootUrl.path = joined;\n\t return urlGenerate(aRootUrl);\n\t }\n\t return joined;\n\t}\n\texports.join = join;\n\t\n\texports.isAbsolute = function (aPath) {\n\t return aPath.charAt(0) === '/' || urlRegexp.test(aPath);\n\t};\n\t\n\t/**\n\t * Make a path relative to a URL or another path.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be made relative to aRoot.\n\t */\n\tfunction relative(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t\n\t aRoot = aRoot.replace(/\\/$/, '');\n\t\n\t // It is possible for the path to be above the root. In this case, simply\n\t // checking whether the root is a prefix of the path won't work. Instead, we\n\t // need to remove components from the root one by one, until either we find\n\t // a prefix that fits, or we run out of components to remove.\n\t var level = 0;\n\t while (aPath.indexOf(aRoot + '/') !== 0) {\n\t var index = aRoot.lastIndexOf(\"/\");\n\t if (index < 0) {\n\t return aPath;\n\t }\n\t\n\t // If the only part of the root that is left is the scheme (i.e. http://,\n\t // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n\t // have exhausted all components, so the path is not relative to the root.\n\t aRoot = aRoot.slice(0, index);\n\t if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n\t return aPath;\n\t }\n\t\n\t ++level;\n\t }\n\t\n\t // Make sure we add a \"../\" for each component we removed from the root.\n\t return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n\t}\n\texports.relative = relative;\n\t\n\tvar supportsNullProto = (function () {\n\t var obj = Object.create(null);\n\t return !('__proto__' in obj);\n\t}());\n\t\n\tfunction identity (s) {\n\t return s;\n\t}\n\t\n\t/**\n\t * Because behavior goes wacky when you set `__proto__` on objects, we\n\t * have to prefix all the strings in our set with an arbitrary character.\n\t *\n\t * See https://github.com/mozilla/source-map/pull/31 and\n\t * https://github.com/mozilla/source-map/issues/30\n\t *\n\t * @param String aStr\n\t */\n\tfunction toSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return '$' + aStr;\n\t }\n\t\n\t return aStr;\n\t}\n\texports.toSetString = supportsNullProto ? identity : toSetString;\n\t\n\tfunction fromSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return aStr.slice(1);\n\t }\n\t\n\t return aStr;\n\t}\n\texports.fromSetString = supportsNullProto ? identity : fromSetString;\n\t\n\tfunction isProtoString(s) {\n\t if (!s) {\n\t return false;\n\t }\n\t\n\t var length = s.length;\n\t\n\t if (length < 9 /* \"__proto__\".length */) {\n\t return false;\n\t }\n\t\n\t if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n\t s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n\t s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n\t s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 9) !== 95 /* '_' */) {\n\t return false;\n\t }\n\t\n\t for (var i = length - 10; i >= 0; i--) {\n\t if (s.charCodeAt(i) !== 36 /* '$' */) {\n\t return false;\n\t }\n\t }\n\t\n\t return true;\n\t}\n\t\n\t/**\n\t * Comparator between two mappings where the original positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same original source/line/column, but different generated\n\t * line and column the same. Useful when searching for a mapping with a\n\t * stubbed out mapping.\n\t */\n\tfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n\t var cmp = strcmp(mappingA.source, mappingB.source);\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0 || onlyCompareOriginal) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return strcmp(mappingA.name, mappingB.name);\n\t}\n\texports.compareByOriginalPositions = compareByOriginalPositions;\n\t\n\t/**\n\t * Comparator between two mappings with deflated source and name indices where\n\t * the generated positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same generated line and column, but different\n\t * source/name/original line and column the same. Useful when searching for a\n\t * mapping with a stubbed out mapping.\n\t */\n\tfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0 || onlyCompareGenerated) {\n\t return cmp;\n\t }\n\t\n\t cmp = strcmp(mappingA.source, mappingB.source);\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return strcmp(mappingA.name, mappingB.name);\n\t}\n\texports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\t\n\tfunction strcmp(aStr1, aStr2) {\n\t if (aStr1 === aStr2) {\n\t return 0;\n\t }\n\t\n\t if (aStr1 === null) {\n\t return 1; // aStr2 !== null\n\t }\n\t\n\t if (aStr2 === null) {\n\t return -1; // aStr1 !== null\n\t }\n\t\n\t if (aStr1 > aStr2) {\n\t return 1;\n\t }\n\t\n\t return -1;\n\t}\n\t\n\t/**\n\t * Comparator between two mappings with inflated source and name strings where\n\t * the generated positions are compared.\n\t */\n\tfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = strcmp(mappingA.source, mappingB.source);\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return strcmp(mappingA.name, mappingB.name);\n\t}\n\texports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\t\n\t/**\n\t * Strip any JSON XSSI avoidance prefix from the string (as documented\n\t * in the source maps specification), and then parse the string as\n\t * JSON.\n\t */\n\tfunction parseSourceMapInput(str) {\n\t return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, ''));\n\t}\n\texports.parseSourceMapInput = parseSourceMapInput;\n\t\n\t/**\n\t * Compute the URL of a source given the the source root, the source's\n\t * URL, and the source map's URL.\n\t */\n\tfunction computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {\n\t sourceURL = sourceURL || '';\n\t\n\t if (sourceRoot) {\n\t // This follows what Chrome does.\n\t if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {\n\t sourceRoot += '/';\n\t }\n\t // The spec says:\n\t // Line 4: An optional source root, useful for relocating source\n\t // files on a server or removing repeated values in the\n\t // “sources” entry. This value is prepended to the individual\n\t // entries in the “source” field.\n\t sourceURL = sourceRoot + sourceURL;\n\t }\n\t\n\t // Historically, SourceMapConsumer did not take the sourceMapURL as\n\t // a parameter. This mode is still somewhat supported, which is why\n\t // this code block is conditional. However, it's preferable to pass\n\t // the source map URL to SourceMapConsumer, so that this function\n\t // can implement the source URL resolution algorithm as outlined in\n\t // the spec. This block is basically the equivalent of:\n\t // new URL(sourceURL, sourceMapURL).toString()\n\t // ... except it avoids using URL, which wasn't available in the\n\t // older releases of node still supported by this library.\n\t //\n\t // The spec says:\n\t // If the sources are not absolute URLs after prepending of the\n\t // “sourceRoot”, the sources are resolved relative to the\n\t // SourceMap (like resolving script src in a html document).\n\t if (sourceMapURL) {\n\t var parsed = urlParse(sourceMapURL);\n\t if (!parsed) {\n\t throw new Error(\"sourceMapURL could not be parsed\");\n\t }\n\t if (parsed.path) {\n\t // Strip the last path component, but keep the \"/\".\n\t var index = parsed.path.lastIndexOf('/');\n\t if (index >= 0) {\n\t parsed.path = parsed.path.substring(0, index + 1);\n\t }\n\t }\n\t sourceURL = join(urlGenerate(parsed), sourceURL);\n\t }\n\t\n\t return normalize(sourceURL);\n\t}\n\texports.computeSourceURL = computeSourceURL;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar hasNativeMap = typeof Map !== \"undefined\";\n\t\n\t/**\n\t * A data structure which is a combination of an array and a set. Adding a new\n\t * member is O(1), testing for membership is O(1), and finding the index of an\n\t * element is O(1). Removing elements from the set is not supported. Only\n\t * strings are supported for membership.\n\t */\n\tfunction ArraySet() {\n\t this._array = [];\n\t this._set = hasNativeMap ? new Map() : Object.create(null);\n\t}\n\t\n\t/**\n\t * Static method for creating ArraySet instances from an existing array.\n\t */\n\tArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n\t var set = new ArraySet();\n\t for (var i = 0, len = aArray.length; i < len; i++) {\n\t set.add(aArray[i], aAllowDuplicates);\n\t }\n\t return set;\n\t};\n\t\n\t/**\n\t * Return how many unique items are in this ArraySet. If duplicates have been\n\t * added, than those do not count towards the size.\n\t *\n\t * @returns Number\n\t */\n\tArraySet.prototype.size = function ArraySet_size() {\n\t return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n\t};\n\t\n\t/**\n\t * Add the given string to this set.\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n\t var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n\t var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n\t var idx = this._array.length;\n\t if (!isDuplicate || aAllowDuplicates) {\n\t this._array.push(aStr);\n\t }\n\t if (!isDuplicate) {\n\t if (hasNativeMap) {\n\t this._set.set(aStr, idx);\n\t } else {\n\t this._set[sStr] = idx;\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Is the given string a member of this set?\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.has = function ArraySet_has(aStr) {\n\t if (hasNativeMap) {\n\t return this._set.has(aStr);\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t return has.call(this._set, sStr);\n\t }\n\t};\n\t\n\t/**\n\t * What is the index of the given string in the array?\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n\t if (hasNativeMap) {\n\t var idx = this._set.get(aStr);\n\t if (idx >= 0) {\n\t return idx;\n\t }\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t if (has.call(this._set, sStr)) {\n\t return this._set[sStr];\n\t }\n\t }\n\t\n\t throw new Error('\"' + aStr + '\" is not in the set.');\n\t};\n\t\n\t/**\n\t * What is the element at the given index?\n\t *\n\t * @param Number aIdx\n\t */\n\tArraySet.prototype.at = function ArraySet_at(aIdx) {\n\t if (aIdx >= 0 && aIdx < this._array.length) {\n\t return this._array[aIdx];\n\t }\n\t throw new Error('No element indexed by ' + aIdx);\n\t};\n\t\n\t/**\n\t * Returns the array representation of this set (which has the proper indices\n\t * indicated by indexOf). Note that this is a copy of the internal array used\n\t * for storing the members so that no one can mess with internal state.\n\t */\n\tArraySet.prototype.toArray = function ArraySet_toArray() {\n\t return this._array.slice();\n\t};\n\t\n\texports.ArraySet = ArraySet;\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2014 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\t\n\t/**\n\t * Determine whether mappingB is after mappingA with respect to generated\n\t * position.\n\t */\n\tfunction generatedPositionAfter(mappingA, mappingB) {\n\t // Optimized for most common case\n\t var lineA = mappingA.generatedLine;\n\t var lineB = mappingB.generatedLine;\n\t var columnA = mappingA.generatedColumn;\n\t var columnB = mappingB.generatedColumn;\n\t return lineB > lineA || lineB == lineA && columnB >= columnA ||\n\t util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n\t}\n\t\n\t/**\n\t * A data structure to provide a sorted view of accumulated mappings in a\n\t * performance conscious manner. It trades a neglibable overhead in general\n\t * case for a large speedup in case of mappings being added in order.\n\t */\n\tfunction MappingList() {\n\t this._array = [];\n\t this._sorted = true;\n\t // Serves as infimum\n\t this._last = {generatedLine: -1, generatedColumn: 0};\n\t}\n\t\n\t/**\n\t * Iterate through internal items. This method takes the same arguments that\n\t * `Array.prototype.forEach` takes.\n\t *\n\t * NOTE: The order of the mappings is NOT guaranteed.\n\t */\n\tMappingList.prototype.unsortedForEach =\n\t function MappingList_forEach(aCallback, aThisArg) {\n\t this._array.forEach(aCallback, aThisArg);\n\t };\n\t\n\t/**\n\t * Add the given source mapping.\n\t *\n\t * @param Object aMapping\n\t */\n\tMappingList.prototype.add = function MappingList_add(aMapping) {\n\t if (generatedPositionAfter(this._last, aMapping)) {\n\t this._last = aMapping;\n\t this._array.push(aMapping);\n\t } else {\n\t this._sorted = false;\n\t this._array.push(aMapping);\n\t }\n\t};\n\t\n\t/**\n\t * Returns the flat, sorted array of mappings. The mappings are sorted by\n\t * generated position.\n\t *\n\t * WARNING: This method returns internal data without copying, for\n\t * performance. The return value must NOT be mutated, and should be treated as\n\t * an immutable borrow. If you want to take ownership, you must make your own\n\t * copy.\n\t */\n\tMappingList.prototype.toArray = function MappingList_toArray() {\n\t if (!this._sorted) {\n\t this._array.sort(util.compareByGeneratedPositionsInflated);\n\t this._sorted = true;\n\t }\n\t return this._array;\n\t};\n\t\n\texports.MappingList = MappingList;\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\tvar binarySearch = __webpack_require__(8);\n\tvar ArraySet = __webpack_require__(5).ArraySet;\n\tvar base64VLQ = __webpack_require__(2);\n\tvar quickSort = __webpack_require__(9).quickSort;\n\t\n\tfunction SourceMapConsumer(aSourceMap, aSourceMapURL) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = util.parseSourceMapInput(aSourceMap);\n\t }\n\t\n\t return sourceMap.sections != null\n\t ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)\n\t : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);\n\t}\n\t\n\tSourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {\n\t return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);\n\t}\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tSourceMapConsumer.prototype._version = 3;\n\t\n\t// `__generatedMappings` and `__originalMappings` are arrays that hold the\n\t// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n\t// are lazily instantiated, accessed via the `_generatedMappings` and\n\t// `_originalMappings` getters respectively, and we only parse the mappings\n\t// and create these arrays once queried for a source location. We jump through\n\t// these hoops because there can be many thousands of mappings, and parsing\n\t// them is expensive, so we only want to do it if we must.\n\t//\n\t// Each object in the arrays is of the form:\n\t//\n\t// {\n\t// generatedLine: The line number in the generated code,\n\t// generatedColumn: The column number in the generated code,\n\t// source: The path to the original source file that generated this\n\t// chunk of code,\n\t// originalLine: The line number in the original source that\n\t// corresponds to this chunk of generated code,\n\t// originalColumn: The column number in the original source that\n\t// corresponds to this chunk of generated code,\n\t// name: The name of the original symbol which generated this chunk of\n\t// code.\n\t// }\n\t//\n\t// All properties except for `generatedLine` and `generatedColumn` can be\n\t// `null`.\n\t//\n\t// `_generatedMappings` is ordered by the generated positions.\n\t//\n\t// `_originalMappings` is ordered by the original positions.\n\t\n\tSourceMapConsumer.prototype.__generatedMappings = null;\n\tObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n\t configurable: true,\n\t enumerable: true,\n\t get: function () {\n\t if (!this.__generatedMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__generatedMappings;\n\t }\n\t});\n\t\n\tSourceMapConsumer.prototype.__originalMappings = null;\n\tObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n\t configurable: true,\n\t enumerable: true,\n\t get: function () {\n\t if (!this.__originalMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__originalMappings;\n\t }\n\t});\n\t\n\tSourceMapConsumer.prototype._charIsMappingSeparator =\n\t function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n\t var c = aStr.charAt(index);\n\t return c === \";\" || c === \",\";\n\t };\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t throw new Error(\"Subclasses must implement _parseMappings\");\n\t };\n\t\n\tSourceMapConsumer.GENERATED_ORDER = 1;\n\tSourceMapConsumer.ORIGINAL_ORDER = 2;\n\t\n\tSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\n\tSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\t\n\t/**\n\t * Iterate over each mapping between an original source/line/column and a\n\t * generated line/column in this source map.\n\t *\n\t * @param Function aCallback\n\t * The function that is called with each mapping.\n\t * @param Object aContext\n\t * Optional. If specified, this object will be the value of `this` every\n\t * time that `aCallback` is called.\n\t * @param aOrder\n\t * Either `SourceMapConsumer.GENERATED_ORDER` or\n\t * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n\t * iterate over the mappings sorted by the generated file's line/column\n\t * order or the original's source/line/column order, respectively. Defaults to\n\t * `SourceMapConsumer.GENERATED_ORDER`.\n\t */\n\tSourceMapConsumer.prototype.eachMapping =\n\t function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n\t var context = aContext || null;\n\t var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\t\n\t var mappings;\n\t switch (order) {\n\t case SourceMapConsumer.GENERATED_ORDER:\n\t mappings = this._generatedMappings;\n\t break;\n\t case SourceMapConsumer.ORIGINAL_ORDER:\n\t mappings = this._originalMappings;\n\t break;\n\t default:\n\t throw new Error(\"Unknown order of iteration.\");\n\t }\n\t\n\t var sourceRoot = this.sourceRoot;\n\t mappings.map(function (mapping) {\n\t var source = mapping.source === null ? null : this._sources.at(mapping.source);\n\t source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);\n\t return {\n\t source: source,\n\t generatedLine: mapping.generatedLine,\n\t generatedColumn: mapping.generatedColumn,\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: mapping.name === null ? null : this._names.at(mapping.name)\n\t };\n\t }, this).forEach(aCallback, context);\n\t };\n\t\n\t/**\n\t * Returns all generated line and column information for the original source,\n\t * line, and column provided. If no column is provided, returns all mappings\n\t * corresponding to a either the line we are searching for or the next\n\t * closest line that has any mappings. Otherwise, returns all mappings\n\t * corresponding to the given line and either the column we are searching for\n\t * or the next closest column that has any offsets.\n\t *\n\t * The only argument is an object with the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source. The line number is 1-based.\n\t * - column: Optional. the column number in the original source.\n\t * The column number is 0-based.\n\t *\n\t * and an array of objects is returned, each with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null. The\n\t * line number is 1-based.\n\t * - column: The column number in the generated source, or null.\n\t * The column number is 0-based.\n\t */\n\tSourceMapConsumer.prototype.allGeneratedPositionsFor =\n\t function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n\t var line = util.getArg(aArgs, 'line');\n\t\n\t // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n\t // returns the index of the closest mapping less than the needle. By\n\t // setting needle.originalColumn to 0, we thus find the last mapping for\n\t // the given line, provided such a mapping exists.\n\t var needle = {\n\t source: util.getArg(aArgs, 'source'),\n\t originalLine: line,\n\t originalColumn: util.getArg(aArgs, 'column', 0)\n\t };\n\t\n\t needle.source = this._findSourceIndex(needle.source);\n\t if (needle.source < 0) {\n\t return [];\n\t }\n\t\n\t var mappings = [];\n\t\n\t var index = this._findMapping(needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t binarySearch.LEAST_UPPER_BOUND);\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (aArgs.column === undefined) {\n\t var originalLine = mapping.originalLine;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we found. Since\n\t // mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we found.\n\t while (mapping && mapping.originalLine === originalLine) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t } else {\n\t var originalColumn = mapping.originalColumn;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we were searching for.\n\t // Since mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we are searching for.\n\t while (mapping &&\n\t mapping.originalLine === line &&\n\t mapping.originalColumn == originalColumn) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t }\n\t }\n\t\n\t return mappings;\n\t };\n\t\n\texports.SourceMapConsumer = SourceMapConsumer;\n\t\n\t/**\n\t * A BasicSourceMapConsumer instance represents a parsed source map which we can\n\t * query for information about the original file positions by giving it a file\n\t * position in the generated source.\n\t *\n\t * The first parameter is the raw source map (either as a JSON string, or\n\t * already parsed to an object). According to the spec, source maps have the\n\t * following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - sources: An array of URLs to the original source files.\n\t * - names: An array of identifiers which can be referrenced by individual mappings.\n\t * - sourceRoot: Optional. The URL root from which all sources are relative.\n\t * - sourcesContent: Optional. An array of contents of the original source files.\n\t * - mappings: A string of base64 VLQs which contain the actual mappings.\n\t * - file: Optional. The generated file this source map is associated with.\n\t *\n\t * Here is an example source map, taken from the source map spec[0]:\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"out.js\",\n\t * sourceRoot : \"\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AA,AB;;ABCDE;\"\n\t * }\n\t *\n\t * The second parameter, if given, is a string whose value is the URL\n\t * at which the source map was found. This URL is used to compute the\n\t * sources array.\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n\t */\n\tfunction BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = util.parseSourceMapInput(aSourceMap);\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sources = util.getArg(sourceMap, 'sources');\n\t // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n\t // requires the array) to play nice here.\n\t var names = util.getArg(sourceMap, 'names', []);\n\t var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n\t var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n\t var mappings = util.getArg(sourceMap, 'mappings');\n\t var file = util.getArg(sourceMap, 'file', null);\n\t\n\t // Once again, Sass deviates from the spec and supplies the version as a\n\t // string rather than a number, so we use loose equality checking here.\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t if (sourceRoot) {\n\t sourceRoot = util.normalize(sourceRoot);\n\t }\n\t\n\t sources = sources\n\t .map(String)\n\t // Some source maps produce relative source paths like \"./foo.js\" instead of\n\t // \"foo.js\". Normalize these first so that future comparisons will succeed.\n\t // See bugzil.la/1090768.\n\t .map(util.normalize)\n\t // Always ensure that absolute sources are internally stored relative to\n\t // the source root, if the source root is absolute. Not doing this would\n\t // be particularly problematic when the source root is a prefix of the\n\t // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n\t .map(function (source) {\n\t return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n\t ? util.relative(sourceRoot, source)\n\t : source;\n\t });\n\t\n\t // Pass `true` below to allow duplicate names and sources. While source maps\n\t // are intended to be compressed and deduplicated, the TypeScript compiler\n\t // sometimes generates source maps with duplicates in them. See Github issue\n\t // #72 and bugzil.la/889492.\n\t this._names = ArraySet.fromArray(names.map(String), true);\n\t this._sources = ArraySet.fromArray(sources, true);\n\t\n\t this._absoluteSources = this._sources.toArray().map(function (s) {\n\t return util.computeSourceURL(sourceRoot, s, aSourceMapURL);\n\t });\n\t\n\t this.sourceRoot = sourceRoot;\n\t this.sourcesContent = sourcesContent;\n\t this._mappings = mappings;\n\t this._sourceMapURL = aSourceMapURL;\n\t this.file = file;\n\t}\n\t\n\tBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\t\n\t/**\n\t * Utility function to find the index of a source. Returns -1 if not\n\t * found.\n\t */\n\tBasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {\n\t var relativeSource = aSource;\n\t if (this.sourceRoot != null) {\n\t relativeSource = util.relative(this.sourceRoot, relativeSource);\n\t }\n\t\n\t if (this._sources.has(relativeSource)) {\n\t return this._sources.indexOf(relativeSource);\n\t }\n\t\n\t // Maybe aSource is an absolute URL as returned by |sources|. In\n\t // this case we can't simply undo the transform.\n\t var i;\n\t for (i = 0; i < this._absoluteSources.length; ++i) {\n\t if (this._absoluteSources[i] == aSource) {\n\t return i;\n\t }\n\t }\n\t\n\t return -1;\n\t};\n\t\n\t/**\n\t * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n\t *\n\t * @param SourceMapGenerator aSourceMap\n\t * The source map that will be consumed.\n\t * @param String aSourceMapURL\n\t * The URL at which the source map can be found (optional)\n\t * @returns BasicSourceMapConsumer\n\t */\n\tBasicSourceMapConsumer.fromSourceMap =\n\t function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {\n\t var smc = Object.create(BasicSourceMapConsumer.prototype);\n\t\n\t var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n\t var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n\t smc.sourceRoot = aSourceMap._sourceRoot;\n\t smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n\t smc.sourceRoot);\n\t smc.file = aSourceMap._file;\n\t smc._sourceMapURL = aSourceMapURL;\n\t smc._absoluteSources = smc._sources.toArray().map(function (s) {\n\t return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);\n\t });\n\t\n\t // Because we are modifying the entries (by converting string sources and\n\t // names to indices into the sources and names ArraySets), we have to make\n\t // a copy of the entry or else bad things happen. Shared mutable state\n\t // strikes again! See github issue #191.\n\t\n\t var generatedMappings = aSourceMap._mappings.toArray().slice();\n\t var destGeneratedMappings = smc.__generatedMappings = [];\n\t var destOriginalMappings = smc.__originalMappings = [];\n\t\n\t for (var i = 0, length = generatedMappings.length; i < length; i++) {\n\t var srcMapping = generatedMappings[i];\n\t var destMapping = new Mapping;\n\t destMapping.generatedLine = srcMapping.generatedLine;\n\t destMapping.generatedColumn = srcMapping.generatedColumn;\n\t\n\t if (srcMapping.source) {\n\t destMapping.source = sources.indexOf(srcMapping.source);\n\t destMapping.originalLine = srcMapping.originalLine;\n\t destMapping.originalColumn = srcMapping.originalColumn;\n\t\n\t if (srcMapping.name) {\n\t destMapping.name = names.indexOf(srcMapping.name);\n\t }\n\t\n\t destOriginalMappings.push(destMapping);\n\t }\n\t\n\t destGeneratedMappings.push(destMapping);\n\t }\n\t\n\t quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\t\n\t return smc;\n\t };\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tBasicSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t return this._absoluteSources.slice();\n\t }\n\t});\n\t\n\t/**\n\t * Provide the JIT with a nice shape / hidden class.\n\t */\n\tfunction Mapping() {\n\t this.generatedLine = 0;\n\t this.generatedColumn = 0;\n\t this.source = null;\n\t this.originalLine = null;\n\t this.originalColumn = null;\n\t this.name = null;\n\t}\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tBasicSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t var generatedLine = 1;\n\t var previousGeneratedColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousOriginalColumn = 0;\n\t var previousSource = 0;\n\t var previousName = 0;\n\t var length = aStr.length;\n\t var index = 0;\n\t var cachedSegments = {};\n\t var temp = {};\n\t var originalMappings = [];\n\t var generatedMappings = [];\n\t var mapping, str, segment, end, value;\n\t\n\t while (index < length) {\n\t if (aStr.charAt(index) === ';') {\n\t generatedLine++;\n\t index++;\n\t previousGeneratedColumn = 0;\n\t }\n\t else if (aStr.charAt(index) === ',') {\n\t index++;\n\t }\n\t else {\n\t mapping = new Mapping();\n\t mapping.generatedLine = generatedLine;\n\t\n\t // Because each offset is encoded relative to the previous one,\n\t // many segments often have the same encoding. We can exploit this\n\t // fact by caching the parsed variable length fields of each segment,\n\t // allowing us to avoid a second parse if we encounter the same\n\t // segment again.\n\t for (end = index; end < length; end++) {\n\t if (this._charIsMappingSeparator(aStr, end)) {\n\t break;\n\t }\n\t }\n\t str = aStr.slice(index, end);\n\t\n\t segment = cachedSegments[str];\n\t if (segment) {\n\t index += str.length;\n\t } else {\n\t segment = [];\n\t while (index < end) {\n\t base64VLQ.decode(aStr, index, temp);\n\t value = temp.value;\n\t index = temp.rest;\n\t segment.push(value);\n\t }\n\t\n\t if (segment.length === 2) {\n\t throw new Error('Found a source, but no line and column');\n\t }\n\t\n\t if (segment.length === 3) {\n\t throw new Error('Found a source and line, but no column');\n\t }\n\t\n\t cachedSegments[str] = segment;\n\t }\n\t\n\t // Generated column.\n\t mapping.generatedColumn = previousGeneratedColumn + segment[0];\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (segment.length > 1) {\n\t // Original source.\n\t mapping.source = previousSource + segment[1];\n\t previousSource += segment[1];\n\t\n\t // Original line.\n\t mapping.originalLine = previousOriginalLine + segment[2];\n\t previousOriginalLine = mapping.originalLine;\n\t // Lines are stored 0-based\n\t mapping.originalLine += 1;\n\t\n\t // Original column.\n\t mapping.originalColumn = previousOriginalColumn + segment[3];\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (segment.length > 4) {\n\t // Original name.\n\t mapping.name = previousName + segment[4];\n\t previousName += segment[4];\n\t }\n\t }\n\t\n\t generatedMappings.push(mapping);\n\t if (typeof mapping.originalLine === 'number') {\n\t originalMappings.push(mapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t this.__generatedMappings = generatedMappings;\n\t\n\t quickSort(originalMappings, util.compareByOriginalPositions);\n\t this.__originalMappings = originalMappings;\n\t };\n\t\n\t/**\n\t * Find the mapping that best matches the hypothetical \"needle\" mapping that\n\t * we are searching for in the given \"haystack\" of mappings.\n\t */\n\tBasicSourceMapConsumer.prototype._findMapping =\n\t function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n\t aColumnName, aComparator, aBias) {\n\t // To return the position we are searching for, we must first find the\n\t // mapping for the given position and then return the opposite position it\n\t // points to. Because the mappings are sorted, we can use binary search to\n\t // find the best mapping.\n\t\n\t if (aNeedle[aLineName] <= 0) {\n\t throw new TypeError('Line must be greater than or equal to 1, got '\n\t + aNeedle[aLineName]);\n\t }\n\t if (aNeedle[aColumnName] < 0) {\n\t throw new TypeError('Column must be greater than or equal to 0, got '\n\t + aNeedle[aColumnName]);\n\t }\n\t\n\t return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n\t };\n\t\n\t/**\n\t * Compute the last column for each generated mapping. The last column is\n\t * inclusive.\n\t */\n\tBasicSourceMapConsumer.prototype.computeColumnSpans =\n\t function SourceMapConsumer_computeColumnSpans() {\n\t for (var index = 0; index < this._generatedMappings.length; ++index) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t // Mappings do not contain a field for the last generated columnt. We\n\t // can come up with an optimistic estimate, however, by assuming that\n\t // mappings are contiguous (i.e. given two consecutive mappings, the\n\t // first mapping ends where the second one starts).\n\t if (index + 1 < this._generatedMappings.length) {\n\t var nextMapping = this._generatedMappings[index + 1];\n\t\n\t if (mapping.generatedLine === nextMapping.generatedLine) {\n\t mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n\t continue;\n\t }\n\t }\n\t\n\t // The last mapping for each line spans the entire line.\n\t mapping.lastGeneratedColumn = Infinity;\n\t }\n\t };\n\t\n\t/**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source. The line number\n\t * is 1-based.\n\t * - column: The column number in the generated source. The column\n\t * number is 0-based.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null. The\n\t * line number is 1-based.\n\t * - column: The column number in the original source, or null. The\n\t * column number is 0-based.\n\t * - name: The original identifier, or null.\n\t */\n\tBasicSourceMapConsumer.prototype.originalPositionFor =\n\t function SourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._generatedMappings,\n\t \"generatedLine\",\n\t \"generatedColumn\",\n\t util.compareByGeneratedPositionsDeflated,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t if (mapping.generatedLine === needle.generatedLine) {\n\t var source = util.getArg(mapping, 'source', null);\n\t if (source !== null) {\n\t source = this._sources.at(source);\n\t source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);\n\t }\n\t var name = util.getArg(mapping, 'name', null);\n\t if (name !== null) {\n\t name = this._names.at(name);\n\t }\n\t return {\n\t source: source,\n\t line: util.getArg(mapping, 'originalLine', null),\n\t column: util.getArg(mapping, 'originalColumn', null),\n\t name: name\n\t };\n\t }\n\t }\n\t\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t };\n\t\n\t/**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\tBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function BasicSourceMapConsumer_hasContentsOfAllSources() {\n\t if (!this.sourcesContent) {\n\t return false;\n\t }\n\t return this.sourcesContent.length >= this._sources.size() &&\n\t !this.sourcesContent.some(function (sc) { return sc == null; });\n\t };\n\t\n\t/**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\tBasicSourceMapConsumer.prototype.sourceContentFor =\n\t function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t if (!this.sourcesContent) {\n\t return null;\n\t }\n\t\n\t var index = this._findSourceIndex(aSource);\n\t if (index >= 0) {\n\t return this.sourcesContent[index];\n\t }\n\t\n\t var relativeSource = aSource;\n\t if (this.sourceRoot != null) {\n\t relativeSource = util.relative(this.sourceRoot, relativeSource);\n\t }\n\t\n\t var url;\n\t if (this.sourceRoot != null\n\t && (url = util.urlParse(this.sourceRoot))) {\n\t // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n\t // many users. We can help them out when they expect file:// URIs to\n\t // behave like it would if they were running a local HTTP server. See\n\t // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n\t var fileUriAbsPath = relativeSource.replace(/^file:\\/\\//, \"\");\n\t if (url.scheme == \"file\"\n\t && this._sources.has(fileUriAbsPath)) {\n\t return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n\t }\n\t\n\t if ((!url.path || url.path == \"/\")\n\t && this._sources.has(\"/\" + relativeSource)) {\n\t return this.sourcesContent[this._sources.indexOf(\"/\" + relativeSource)];\n\t }\n\t }\n\t\n\t // This function is used recursively from\n\t // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n\t // don't want to throw if we can't find the source - we just want to\n\t // return null, so we provide a flag to exit gracefully.\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + relativeSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t/**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source. The line number\n\t * is 1-based.\n\t * - column: The column number in the original source. The column\n\t * number is 0-based.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null. The\n\t * line number is 1-based.\n\t * - column: The column number in the generated source, or null.\n\t * The column number is 0-based.\n\t */\n\tBasicSourceMapConsumer.prototype.generatedPositionFor =\n\t function SourceMapConsumer_generatedPositionFor(aArgs) {\n\t var source = util.getArg(aArgs, 'source');\n\t source = this._findSourceIndex(source);\n\t if (source < 0) {\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t }\n\t\n\t var needle = {\n\t source: source,\n\t originalLine: util.getArg(aArgs, 'line'),\n\t originalColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (mapping.source === needle.source) {\n\t return {\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t };\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t };\n\t\n\texports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\t\n\t/**\n\t * An IndexedSourceMapConsumer instance represents a parsed source map which\n\t * we can query for information. It differs from BasicSourceMapConsumer in\n\t * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n\t * input.\n\t *\n\t * The first parameter is a raw source map (either as a JSON string, or already\n\t * parsed to an object). According to the spec for indexed source maps, they\n\t * have the following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - file: Optional. The generated file this source map is associated with.\n\t * - sections: A list of section definitions.\n\t *\n\t * Each value under the \"sections\" field has two fields:\n\t * - offset: The offset into the original specified at which this section\n\t * begins to apply, defined as an object with a \"line\" and \"column\"\n\t * field.\n\t * - map: A source map definition. This source map could also be indexed,\n\t * but doesn't have to be.\n\t *\n\t * Instead of the \"map\" field, it's also possible to have a \"url\" field\n\t * specifying a URL to retrieve a source map from, but that's currently\n\t * unsupported.\n\t *\n\t * Here's an example source map, taken from the source map spec[0], but\n\t * modified to omit a section which uses the \"url\" field.\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"app.js\",\n\t * sections: [{\n\t * offset: {line:100, column:10},\n\t * map: {\n\t * version : 3,\n\t * file: \"section.js\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AAAA,E;;ABCDE;\"\n\t * }\n\t * }],\n\t * }\n\t *\n\t * The second parameter, if given, is a string whose value is the URL\n\t * at which the source map was found. This URL is used to compute the\n\t * sources array.\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n\t */\n\tfunction IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = util.parseSourceMapInput(aSourceMap);\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sections = util.getArg(sourceMap, 'sections');\n\t\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t this._sources = new ArraySet();\n\t this._names = new ArraySet();\n\t\n\t var lastOffset = {\n\t line: -1,\n\t column: 0\n\t };\n\t this._sections = sections.map(function (s) {\n\t if (s.url) {\n\t // The url field will require support for asynchronicity.\n\t // See https://github.com/mozilla/source-map/issues/16\n\t throw new Error('Support for url field in sections not implemented.');\n\t }\n\t var offset = util.getArg(s, 'offset');\n\t var offsetLine = util.getArg(offset, 'line');\n\t var offsetColumn = util.getArg(offset, 'column');\n\t\n\t if (offsetLine < lastOffset.line ||\n\t (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n\t throw new Error('Section offsets must be ordered and non-overlapping.');\n\t }\n\t lastOffset = offset;\n\t\n\t return {\n\t generatedOffset: {\n\t // The offset fields are 0-based, but we use 1-based indices when\n\t // encoding/decoding from VLQ.\n\t generatedLine: offsetLine + 1,\n\t generatedColumn: offsetColumn + 1\n\t },\n\t consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)\n\t }\n\t });\n\t}\n\t\n\tIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tIndexedSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t var sources = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n\t sources.push(this._sections[i].consumer.sources[j]);\n\t }\n\t }\n\t return sources;\n\t }\n\t});\n\t\n\t/**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source. The line number\n\t * is 1-based.\n\t * - column: The column number in the generated source. The column\n\t * number is 0-based.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null. The\n\t * line number is 1-based.\n\t * - column: The column number in the original source, or null. The\n\t * column number is 0-based.\n\t * - name: The original identifier, or null.\n\t */\n\tIndexedSourceMapConsumer.prototype.originalPositionFor =\n\t function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t // Find the section containing the generated position we're trying to map\n\t // to an original position.\n\t var sectionIndex = binarySearch.search(needle, this._sections,\n\t function(needle, section) {\n\t var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n\t if (cmp) {\n\t return cmp;\n\t }\n\t\n\t return (needle.generatedColumn -\n\t section.generatedOffset.generatedColumn);\n\t });\n\t var section = this._sections[sectionIndex];\n\t\n\t if (!section) {\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t }\n\t\n\t return section.consumer.originalPositionFor({\n\t line: needle.generatedLine -\n\t (section.generatedOffset.generatedLine - 1),\n\t column: needle.generatedColumn -\n\t (section.generatedOffset.generatedLine === needle.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t bias: aArgs.bias\n\t });\n\t };\n\t\n\t/**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\tIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n\t return this._sections.every(function (s) {\n\t return s.consumer.hasContentsOfAllSources();\n\t });\n\t };\n\t\n\t/**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\tIndexedSourceMapConsumer.prototype.sourceContentFor =\n\t function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t var content = section.consumer.sourceContentFor(aSource, true);\n\t if (content) {\n\t return content;\n\t }\n\t }\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t/**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source. The line number\n\t * is 1-based.\n\t * - column: The column number in the original source. The column\n\t * number is 0-based.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null. The\n\t * line number is 1-based. \n\t * - column: The column number in the generated source, or null.\n\t * The column number is 0-based.\n\t */\n\tIndexedSourceMapConsumer.prototype.generatedPositionFor =\n\t function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t // Only consider this section if the requested source is in the list of\n\t // sources of the consumer.\n\t if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {\n\t continue;\n\t }\n\t var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n\t if (generatedPosition) {\n\t var ret = {\n\t line: generatedPosition.line +\n\t (section.generatedOffset.generatedLine - 1),\n\t column: generatedPosition.column +\n\t (section.generatedOffset.generatedLine === generatedPosition.line\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0)\n\t };\n\t return ret;\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null\n\t };\n\t };\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tIndexedSourceMapConsumer.prototype._parseMappings =\n\t function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t this.__generatedMappings = [];\n\t this.__originalMappings = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t var sectionMappings = section.consumer._generatedMappings;\n\t for (var j = 0; j < sectionMappings.length; j++) {\n\t var mapping = sectionMappings[j];\n\t\n\t var source = section.consumer._sources.at(mapping.source);\n\t source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);\n\t this._sources.add(source);\n\t source = this._sources.indexOf(source);\n\t\n\t var name = null;\n\t if (mapping.name) {\n\t name = section.consumer._names.at(mapping.name);\n\t this._names.add(name);\n\t name = this._names.indexOf(name);\n\t }\n\t\n\t // The mappings coming from the consumer for the section have\n\t // generated positions relative to the start of the section, so we\n\t // need to offset them to be relative to the start of the concatenated\n\t // generated file.\n\t var adjustedMapping = {\n\t source: source,\n\t generatedLine: mapping.generatedLine +\n\t (section.generatedOffset.generatedLine - 1),\n\t generatedColumn: mapping.generatedColumn +\n\t (section.generatedOffset.generatedLine === mapping.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: name\n\t };\n\t\n\t this.__generatedMappings.push(adjustedMapping);\n\t if (typeof adjustedMapping.originalLine === 'number') {\n\t this.__originalMappings.push(adjustedMapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t quickSort(this.__originalMappings, util.compareByOriginalPositions);\n\t };\n\t\n\texports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\texports.GREATEST_LOWER_BOUND = 1;\n\texports.LEAST_UPPER_BOUND = 2;\n\t\n\t/**\n\t * Recursive implementation of binary search.\n\t *\n\t * @param aLow Indices here and lower do not contain the needle.\n\t * @param aHigh Indices here and higher do not contain the needle.\n\t * @param aNeedle The element being searched for.\n\t * @param aHaystack The non-empty array being searched.\n\t * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t */\n\tfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n\t // This function terminates when one of the following is true:\n\t //\n\t // 1. We find the exact element we are looking for.\n\t //\n\t // 2. We did not find the exact element, but we can return the index of\n\t // the next-closest element.\n\t //\n\t // 3. We did not find the exact element, and there is no next-closest\n\t // element than the one we are searching for, so we return -1.\n\t var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n\t var cmp = aCompare(aNeedle, aHaystack[mid], true);\n\t if (cmp === 0) {\n\t // Found the element we are looking for.\n\t return mid;\n\t }\n\t else if (cmp > 0) {\n\t // Our needle is greater than aHaystack[mid].\n\t if (aHigh - mid > 1) {\n\t // The element is in the upper half.\n\t return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // The exact needle element was not found in this haystack. Determine if\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return aHigh < aHaystack.length ? aHigh : -1;\n\t } else {\n\t return mid;\n\t }\n\t }\n\t else {\n\t // Our needle is less than aHaystack[mid].\n\t if (mid - aLow > 1) {\n\t // The element is in the lower half.\n\t return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return mid;\n\t } else {\n\t return aLow < 0 ? -1 : aLow;\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * This is an implementation of binary search which will always try and return\n\t * the index of the closest element if there is no exact hit. This is because\n\t * mappings between original and generated line/col pairs are single points,\n\t * and there is an implicit region between each of them, so a miss just means\n\t * that you aren't on the very start of a region.\n\t *\n\t * @param aNeedle The element you are looking for.\n\t * @param aHaystack The array that is being searched.\n\t * @param aCompare A function which takes the needle and an element in the\n\t * array and returns -1, 0, or 1 depending on whether the needle is less\n\t * than, equal to, or greater than the element, respectively.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n\t */\n\texports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n\t if (aHaystack.length === 0) {\n\t return -1;\n\t }\n\t\n\t var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n\t aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n\t if (index < 0) {\n\t return -1;\n\t }\n\t\n\t // We have found either the exact element, or the next-closest element than\n\t // the one we are searching for. However, there may be more than one such\n\t // element. Make sure we always return the smallest of these.\n\t while (index - 1 >= 0) {\n\t if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n\t break;\n\t }\n\t --index;\n\t }\n\t\n\t return index;\n\t};\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\t// It turns out that some (most?) JavaScript engines don't self-host\n\t// `Array.prototype.sort`. This makes sense because C++ will likely remain\n\t// faster than JS when doing raw CPU-intensive sorting. However, when using a\n\t// custom comparator function, calling back and forth between the VM's C++ and\n\t// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n\t// worse generated code for the comparator function than would be optimal. In\n\t// fact, when sorting with a comparator, these costs outweigh the benefits of\n\t// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n\t// a ~3500ms mean speed-up in `bench/bench.html`.\n\t\n\t/**\n\t * Swap the elements indexed by `x` and `y` in the array `ary`.\n\t *\n\t * @param {Array} ary\n\t * The array.\n\t * @param {Number} x\n\t * The index of the first item.\n\t * @param {Number} y\n\t * The index of the second item.\n\t */\n\tfunction swap(ary, x, y) {\n\t var temp = ary[x];\n\t ary[x] = ary[y];\n\t ary[y] = temp;\n\t}\n\t\n\t/**\n\t * Returns a random integer within the range `low .. high` inclusive.\n\t *\n\t * @param {Number} low\n\t * The lower bound on the range.\n\t * @param {Number} high\n\t * The upper bound on the range.\n\t */\n\tfunction randomIntInRange(low, high) {\n\t return Math.round(low + (Math.random() * (high - low)));\n\t}\n\t\n\t/**\n\t * The Quick Sort algorithm.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t * @param {Number} p\n\t * Start index of the array\n\t * @param {Number} r\n\t * End index of the array\n\t */\n\tfunction doQuickSort(ary, comparator, p, r) {\n\t // If our lower bound is less than our upper bound, we (1) partition the\n\t // array into two pieces and (2) recurse on each half. If it is not, this is\n\t // the empty array and our base case.\n\t\n\t if (p < r) {\n\t // (1) Partitioning.\n\t //\n\t // The partitioning chooses a pivot between `p` and `r` and moves all\n\t // elements that are less than or equal to the pivot to the before it, and\n\t // all the elements that are greater than it after it. The effect is that\n\t // once partition is done, the pivot is in the exact place it will be when\n\t // the array is put in sorted order, and it will not need to be moved\n\t // again. This runs in O(n) time.\n\t\n\t // Always choose a random pivot so that an input array which is reverse\n\t // sorted does not cause O(n^2) running time.\n\t var pivotIndex = randomIntInRange(p, r);\n\t var i = p - 1;\n\t\n\t swap(ary, pivotIndex, r);\n\t var pivot = ary[r];\n\t\n\t // Immediately after `j` is incremented in this loop, the following hold\n\t // true:\n\t //\n\t // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n\t //\n\t // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n\t for (var j = p; j < r; j++) {\n\t if (comparator(ary[j], pivot) <= 0) {\n\t i += 1;\n\t swap(ary, i, j);\n\t }\n\t }\n\t\n\t swap(ary, i + 1, j);\n\t var q = i + 1;\n\t\n\t // (2) Recurse on each half.\n\t\n\t doQuickSort(ary, comparator, p, q - 1);\n\t doQuickSort(ary, comparator, q + 1, r);\n\t }\n\t}\n\t\n\t/**\n\t * Sort the given array in-place with the given comparator function.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t */\n\texports.quickSort = function (ary, comparator) {\n\t doQuickSort(ary, comparator, 0, ary.length - 1);\n\t};\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;\n\tvar util = __webpack_require__(4);\n\t\n\t// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n\t// operating systems these days (capturing the result).\n\tvar REGEX_NEWLINE = /(\\r?\\n)/;\n\t\n\t// Newline character code for charCodeAt() comparisons\n\tvar NEWLINE_CODE = 10;\n\t\n\t// Private symbol for identifying `SourceNode`s when multiple versions of\n\t// the source-map library are loaded. This MUST NOT CHANGE across\n\t// versions!\n\tvar isSourceNode = \"$$$isSourceNode$$$\";\n\t\n\t/**\n\t * SourceNodes provide a way to abstract over interpolating/concatenating\n\t * snippets of generated JavaScript source code while maintaining the line and\n\t * column information associated with the original source code.\n\t *\n\t * @param aLine The original line number.\n\t * @param aColumn The original column number.\n\t * @param aSource The original source's filename.\n\t * @param aChunks Optional. An array of strings which are snippets of\n\t * generated JS, or other SourceNodes.\n\t * @param aName The original identifier.\n\t */\n\tfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n\t this.children = [];\n\t this.sourceContents = {};\n\t this.line = aLine == null ? null : aLine;\n\t this.column = aColumn == null ? null : aColumn;\n\t this.source = aSource == null ? null : aSource;\n\t this.name = aName == null ? null : aName;\n\t this[isSourceNode] = true;\n\t if (aChunks != null) this.add(aChunks);\n\t}\n\t\n\t/**\n\t * Creates a SourceNode from generated code and a SourceMapConsumer.\n\t *\n\t * @param aGeneratedCode The generated code\n\t * @param aSourceMapConsumer The SourceMap for the generated code\n\t * @param aRelativePath Optional. The path that relative sources in the\n\t * SourceMapConsumer should be relative to.\n\t */\n\tSourceNode.fromStringWithSourceMap =\n\t function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n\t // The SourceNode we want to fill with the generated code\n\t // and the SourceMap\n\t var node = new SourceNode();\n\t\n\t // All even indices of this array are one line of the generated code,\n\t // while all odd indices are the newlines between two adjacent lines\n\t // (since `REGEX_NEWLINE` captures its match).\n\t // Processed fragments are accessed by calling `shiftNextLine`.\n\t var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n\t var remainingLinesIndex = 0;\n\t var shiftNextLine = function() {\n\t var lineContents = getNextLine();\n\t // The last line of a file might not have a newline.\n\t var newLine = getNextLine() || \"\";\n\t return lineContents + newLine;\n\t\n\t function getNextLine() {\n\t return remainingLinesIndex < remainingLines.length ?\n\t remainingLines[remainingLinesIndex++] : undefined;\n\t }\n\t };\n\t\n\t // We need to remember the position of \"remainingLines\"\n\t var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\t\n\t // The generate SourceNodes we need a code range.\n\t // To extract it current and last mapping is used.\n\t // Here we store the last mapping.\n\t var lastMapping = null;\n\t\n\t aSourceMapConsumer.eachMapping(function (mapping) {\n\t if (lastMapping !== null) {\n\t // We add the code from \"lastMapping\" to \"mapping\":\n\t // First check if there is a new line in between.\n\t if (lastGeneratedLine < mapping.generatedLine) {\n\t // Associate first line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t lastGeneratedLine++;\n\t lastGeneratedColumn = 0;\n\t // The remaining code is added without mapping\n\t } else {\n\t // There is no new line in between.\n\t // Associate the code between \"lastGeneratedColumn\" and\n\t // \"mapping.generatedColumn\" with \"lastMapping\"\n\t var nextLine = remainingLines[remainingLinesIndex] || '';\n\t var code = nextLine.substr(0, mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t addMappingWithCode(lastMapping, code);\n\t // No more remaining code, continue\n\t lastMapping = mapping;\n\t return;\n\t }\n\t }\n\t // We add the generated code until the first mapping\n\t // to the SourceNode without any mapping.\n\t // Each line is added as separate string.\n\t while (lastGeneratedLine < mapping.generatedLine) {\n\t node.add(shiftNextLine());\n\t lastGeneratedLine++;\n\t }\n\t if (lastGeneratedColumn < mapping.generatedColumn) {\n\t var nextLine = remainingLines[remainingLinesIndex] || '';\n\t node.add(nextLine.substr(0, mapping.generatedColumn));\n\t remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t }\n\t lastMapping = mapping;\n\t }, this);\n\t // We have processed all mappings.\n\t if (remainingLinesIndex < remainingLines.length) {\n\t if (lastMapping) {\n\t // Associate the remaining code in the current line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t }\n\t // and add the remaining lines without any mapping\n\t node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n\t }\n\t\n\t // Copy sourcesContent into SourceNode\n\t aSourceMapConsumer.sources.forEach(function (sourceFile) {\n\t var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n\t if (content != null) {\n\t if (aRelativePath != null) {\n\t sourceFile = util.join(aRelativePath, sourceFile);\n\t }\n\t node.setSourceContent(sourceFile, content);\n\t }\n\t });\n\t\n\t return node;\n\t\n\t function addMappingWithCode(mapping, code) {\n\t if (mapping === null || mapping.source === undefined) {\n\t node.add(code);\n\t } else {\n\t var source = aRelativePath\n\t ? util.join(aRelativePath, mapping.source)\n\t : mapping.source;\n\t node.add(new SourceNode(mapping.originalLine,\n\t mapping.originalColumn,\n\t source,\n\t code,\n\t mapping.name));\n\t }\n\t }\n\t };\n\t\n\t/**\n\t * Add a chunk of generated JS to this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\tSourceNode.prototype.add = function SourceNode_add(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t aChunk.forEach(function (chunk) {\n\t this.add(chunk);\n\t }, this);\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t if (aChunk) {\n\t this.children.push(aChunk);\n\t }\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Add a chunk of generated JS to the beginning of this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\tSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t for (var i = aChunk.length-1; i >= 0; i--) {\n\t this.prepend(aChunk[i]);\n\t }\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t this.children.unshift(aChunk);\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Walk over the tree of JS snippets in this node and its children. The\n\t * walking function is called once for each snippet of JS and is passed that\n\t * snippet and the its original associated source's line/column location.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\tSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n\t var chunk;\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t chunk = this.children[i];\n\t if (chunk[isSourceNode]) {\n\t chunk.walk(aFn);\n\t }\n\t else {\n\t if (chunk !== '') {\n\t aFn(chunk, { source: this.source,\n\t line: this.line,\n\t column: this.column,\n\t name: this.name });\n\t }\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n\t * each of `this.children`.\n\t *\n\t * @param aSep The separator.\n\t */\n\tSourceNode.prototype.join = function SourceNode_join(aSep) {\n\t var newChildren;\n\t var i;\n\t var len = this.children.length;\n\t if (len > 0) {\n\t newChildren = [];\n\t for (i = 0; i < len-1; i++) {\n\t newChildren.push(this.children[i]);\n\t newChildren.push(aSep);\n\t }\n\t newChildren.push(this.children[i]);\n\t this.children = newChildren;\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Call String.prototype.replace on the very right-most source snippet. Useful\n\t * for trimming whitespace from the end of a source node, etc.\n\t *\n\t * @param aPattern The pattern to replace.\n\t * @param aReplacement The thing to replace the pattern with.\n\t */\n\tSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n\t var lastChild = this.children[this.children.length - 1];\n\t if (lastChild[isSourceNode]) {\n\t lastChild.replaceRight(aPattern, aReplacement);\n\t }\n\t else if (typeof lastChild === 'string') {\n\t this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n\t }\n\t else {\n\t this.children.push(''.replace(aPattern, aReplacement));\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Set the source content for a source file. This will be added to the SourceMapGenerator\n\t * in the sourcesContent field.\n\t *\n\t * @param aSourceFile The filename of the source file\n\t * @param aSourceContent The content of the source file\n\t */\n\tSourceNode.prototype.setSourceContent =\n\t function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n\t this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n\t };\n\t\n\t/**\n\t * Walk over the tree of SourceNodes. The walking function is called for each\n\t * source file content and is passed the filename and source content.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\tSourceNode.prototype.walkSourceContents =\n\t function SourceNode_walkSourceContents(aFn) {\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t if (this.children[i][isSourceNode]) {\n\t this.children[i].walkSourceContents(aFn);\n\t }\n\t }\n\t\n\t var sources = Object.keys(this.sourceContents);\n\t for (var i = 0, len = sources.length; i < len; i++) {\n\t aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n\t }\n\t };\n\t\n\t/**\n\t * Return the string representation of this source node. Walks over the tree\n\t * and concatenates all the various snippets together to one string.\n\t */\n\tSourceNode.prototype.toString = function SourceNode_toString() {\n\t var str = \"\";\n\t this.walk(function (chunk) {\n\t str += chunk;\n\t });\n\t return str;\n\t};\n\t\n\t/**\n\t * Returns the string representation of this source node along with a source\n\t * map.\n\t */\n\tSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n\t var generated = {\n\t code: \"\",\n\t line: 1,\n\t column: 0\n\t };\n\t var map = new SourceMapGenerator(aArgs);\n\t var sourceMappingActive = false;\n\t var lastOriginalSource = null;\n\t var lastOriginalLine = null;\n\t var lastOriginalColumn = null;\n\t var lastOriginalName = null;\n\t this.walk(function (chunk, original) {\n\t generated.code += chunk;\n\t if (original.source !== null\n\t && original.line !== null\n\t && original.column !== null) {\n\t if(lastOriginalSource !== original.source\n\t || lastOriginalLine !== original.line\n\t || lastOriginalColumn !== original.column\n\t || lastOriginalName !== original.name) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t lastOriginalSource = original.source;\n\t lastOriginalLine = original.line;\n\t lastOriginalColumn = original.column;\n\t lastOriginalName = original.name;\n\t sourceMappingActive = true;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t }\n\t });\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t }\n\t for (var idx = 0, length = chunk.length; idx < length; idx++) {\n\t if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n\t generated.line++;\n\t generated.column = 0;\n\t // Mappings end at eol\n\t if (idx + 1 === length) {\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t } else {\n\t generated.column++;\n\t }\n\t }\n\t });\n\t this.walkSourceContents(function (sourceFile, sourceContent) {\n\t map.setSourceContent(sourceFile, sourceContent);\n\t });\n\t\n\t return { code: generated.code, map: map };\n\t};\n\t\n\texports.SourceNode = SourceNode;\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// source-map.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0fd5815da764db5fb9fe","/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = require('./lib/source-node').SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./source-map.js\n// module id = 0\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar MappingList = require('./mapping-list').MappingList;\n\n/**\n * An instance of the SourceMapGenerator represents a source map which is\n * being built incrementally. You may pass an object with the following\n * properties:\n *\n * - file: The filename of the generated source.\n * - sourceRoot: A root for all relative URLs in this source map.\n */\nfunction SourceMapGenerator(aArgs) {\n if (!aArgs) {\n aArgs = {};\n }\n this._file = util.getArg(aArgs, 'file', null);\n this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n this._sources = new ArraySet();\n this._names = new ArraySet();\n this._mappings = new MappingList();\n this._sourcesContents = null;\n}\n\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.fromSourceMap =\n function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n var sourceRoot = aSourceMapConsumer.sourceRoot;\n var generator = new SourceMapGenerator({\n file: aSourceMapConsumer.file,\n sourceRoot: sourceRoot\n });\n aSourceMapConsumer.eachMapping(function (mapping) {\n var newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn\n }\n };\n\n if (mapping.source != null) {\n newMapping.source = mapping.source;\n if (sourceRoot != null) {\n newMapping.source = util.relative(sourceRoot, newMapping.source);\n }\n\n newMapping.original = {\n line: mapping.originalLine,\n column: mapping.originalColumn\n };\n\n if (mapping.name != null) {\n newMapping.name = mapping.name;\n }\n }\n\n generator.addMapping(newMapping);\n });\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var sourceRelative = sourceFile;\n if (sourceRoot !== null) {\n sourceRelative = util.relative(sourceRoot, sourceFile);\n }\n\n if (!generator._sources.has(sourceRelative)) {\n generator._sources.add(sourceRelative);\n }\n\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n generator.setSourceContent(sourceFile, content);\n }\n });\n return generator;\n };\n\n/**\n * Add a single mapping from original source line and column to the generated\n * source's line and column for this source map being created. The mapping\n * object should have the following properties:\n *\n * - generated: An object with the generated line and column positions.\n * - original: An object with the original line and column positions.\n * - source: The original source file (relative to the sourceRoot).\n * - name: An optional original token name for this mapping.\n */\nSourceMapGenerator.prototype.addMapping =\n function SourceMapGenerator_addMapping(aArgs) {\n var generated = util.getArg(aArgs, 'generated');\n var original = util.getArg(aArgs, 'original', null);\n var source = util.getArg(aArgs, 'source', null);\n var name = util.getArg(aArgs, 'name', null);\n\n if (!this._skipValidation) {\n this._validateMapping(generated, original, source, name);\n }\n\n if (source != null) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\n }\n\n this._mappings.add({\n generatedLine: generated.line,\n generatedColumn: generated.column,\n originalLine: original != null && original.line,\n originalColumn: original != null && original.column,\n source: source,\n name: name\n });\n };\n\n/**\n * Set the source content for a source file.\n */\nSourceMapGenerator.prototype.setSourceContent =\n function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n var source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesContents map if the property is null.\n if (!this._sourcesContents) {\n this._sourcesContents = Object.create(null);\n }\n this._sourcesContents[util.toSetString(source)] = aSourceContent;\n } else if (this._sourcesContents) {\n // Remove the source file from the _sourcesContents map.\n // If the _sourcesContents map is empty, set the property to null.\n delete this._sourcesContents[util.toSetString(source)];\n if (Object.keys(this._sourcesContents).length === 0) {\n this._sourcesContents = null;\n }\n }\n };\n\n/**\n * Applies the mappings of a sub-source-map for a specific source file to the\n * source map being generated. Each mapping to the supplied source file is\n * rewritten using the supplied source map. Note: The resolution for the\n * resulting mappings is the minimium of this map and the supplied map.\n *\n * @param aSourceMapConsumer The source map to be applied.\n * @param aSourceFile Optional. The filename of the source file.\n * If omitted, SourceMapConsumer's file property will be used.\n * @param aSourceMapPath Optional. The dirname of the path to the source map\n * to be applied. If relative, it is relative to the SourceMapConsumer.\n * This parameter is needed when the two source maps aren't in the same\n * directory, and the source map to be applied contains relative source\n * paths. If so, those relative source paths need to be rewritten\n * relative to the SourceMapGenerator.\n */\nSourceMapGenerator.prototype.applySourceMap =\n function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n var sourceFile = aSourceFile;\n // If aSourceFile is omitted, we will use the file property of the SourceMap\n if (aSourceFile == null) {\n if (aSourceMapConsumer.file == null) {\n throw new Error(\n 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n 'or the source map\\'s \"file\" property. Both were omitted.'\n );\n }\n sourceFile = aSourceMapConsumer.file;\n }\n var sourceRoot = this._sourceRoot;\n // Make \"sourceFile\" relative if an absolute Url is passed.\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n // Applying the SourceMap can add and remove items from the sources and\n // the names array.\n var newSources = new ArraySet();\n var newNames = new ArraySet();\n\n // Find mappings for the \"sourceFile\"\n this._mappings.unsortedForEach(function (mapping) {\n if (mapping.source === sourceFile && mapping.originalLine != null) {\n // Check if it can be mapped by the source map, then update the mapping.\n var original = aSourceMapConsumer.originalPositionFor({\n line: mapping.originalLine,\n column: mapping.originalColumn\n });\n if (original.source != null) {\n // Copy mapping\n mapping.source = original.source;\n if (aSourceMapPath != null) {\n mapping.source = util.join(aSourceMapPath, mapping.source)\n }\n if (sourceRoot != null) {\n mapping.source = util.relative(sourceRoot, mapping.source);\n }\n mapping.originalLine = original.line;\n mapping.originalColumn = original.column;\n if (original.name != null) {\n mapping.name = original.name;\n }\n }\n }\n\n var source = mapping.source;\n if (source != null && !newSources.has(source)) {\n newSources.add(source);\n }\n\n var name = mapping.name;\n if (name != null && !newNames.has(name)) {\n newNames.add(name);\n }\n\n }, this);\n this._sources = newSources;\n this._names = newNames;\n\n // Copy sourcesContents of applied map.\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aSourceMapPath != null) {\n sourceFile = util.join(aSourceMapPath, sourceFile);\n }\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n this.setSourceContent(sourceFile, content);\n }\n }, this);\n };\n\n/**\n * A mapping can have one of the three levels of data:\n *\n * 1. Just the generated position.\n * 2. The Generated position, original position, and original source.\n * 3. Generated and original position, original source, as well as a name\n * token.\n *\n * To maintain consistency, we validate that any new mapping being added falls\n * in to one of these categories.\n */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n throw new Error(\n 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n );\n }\n\n if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aGenerated.line > 0 && aGenerated.column >= 0\n && !aOriginal && !aSource && !aName) {\n // Case 1.\n return;\n }\n else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n && aGenerated.line > 0 && aGenerated.column >= 0\n && aOriginal.line > 0 && aOriginal.column >= 0\n && aSource) {\n // Cases 2 and 3.\n return;\n }\n else {\n throw new Error('Invalid mapping: ' + JSON.stringify({\n generated: aGenerated,\n source: aSource,\n original: aOriginal,\n name: aName\n }));\n }\n };\n\n/**\n * Serialize the accumulated mappings in to the stream of base 64 VLQs\n * specified by the source map format.\n */\nSourceMapGenerator.prototype._serializeMappings =\n function SourceMapGenerator_serializeMappings() {\n var previousGeneratedColumn = 0;\n var previousGeneratedLine = 1;\n var previousOriginalColumn = 0;\n var previousOriginalLine = 0;\n var previousName = 0;\n var previousSource = 0;\n var result = '';\n var next;\n var mapping;\n var nameIdx;\n var sourceIdx;\n\n var mappings = this._mappings.toArray();\n for (var i = 0, len = mappings.length; i < len; i++) {\n mapping = mappings[i];\n next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.prototype._generateSourcesContent =\n function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n return aSources.map(function (source) {\n if (!this._sourcesContents) {\n return null;\n }\n if (aSourceRoot != null) {\n source = util.relative(aSourceRoot, source);\n }\n var key = util.toSetString(source);\n return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.prototype.toJSON =\n function SourceMapGenerator_toJSON() {\n var map = {\n version: this._version,\n sources: this._sources.toArray(),\n names: this._names.toArray(),\n mappings: this._serializeMappings()\n };\n if (this._file != null) {\n map.file = this._file;\n }\n if (this._sourceRoot != null) {\n map.sourceRoot = this._sourceRoot;\n }\n if (this._sourcesContents) {\n map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n }\n\n return map;\n };\n\n/**\n * Render the source map being generated to a string.\n */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-generator.js\n// module id = 1\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n * * Neither the name of Google Inc. nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar base64 = require('./base64');\n\n// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n// length quantities we use in the source map spec, the first bit is the sign,\n// the next four bits are the actual value, and the 6th bit is the\n// continuation bit. The continuation bit tells us whether there are more\n// digits in this value following this digit.\n//\n// Continuation\n// | Sign\n// | |\n// V V\n// 101011\n\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n/**\n * Converts from a two-complement value to a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n */\nfunction toVLQSigned(aValue) {\n return aValue < 0\n ? ((-aValue) << 1) + 1\n : (aValue << 1) + 0;\n}\n\n/**\n * Converts to a two-complement value from a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n */\nfunction fromVLQSigned(aValue) {\n var isNegative = (aValue & 1) === 1;\n var shifted = aValue >> 1;\n return isNegative\n ? -shifted\n : shifted;\n}\n\n/**\n * Returns the base 64 VLQ encoded value.\n */\nexports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n};\n\n/**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\nexports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64-vlq.js\n// module id = 2\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.encode = function (number) {\n if (0 <= number && number < intToCharMap.length) {\n return intToCharMap[number];\n }\n throw new TypeError(\"Must be between 0 and 63: \" + number);\n};\n\n/**\n * Decode a single base 64 character code digit to an integer. Returns -1 on\n * failure.\n */\nexports.decode = function (charCode) {\n var bigA = 65; // 'A'\n var bigZ = 90; // 'Z'\n\n var littleA = 97; // 'a'\n var littleZ = 122; // 'z'\n\n var zero = 48; // '0'\n var nine = 57; // '9'\n\n var plus = 43; // '+'\n var slash = 47; // '/'\n\n var littleOffset = 26;\n var numberOffset = 52;\n\n // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n if (bigA <= charCode && charCode <= bigZ) {\n return (charCode - bigA);\n }\n\n // 26 - 51: abcdefghijklmnopqrstuvwxyz\n if (littleA <= charCode && charCode <= littleZ) {\n return (charCode - littleA + littleOffset);\n }\n\n // 52 - 61: 0123456789\n if (zero <= charCode && charCode <= nine) {\n return (charCode - zero + numberOffset);\n }\n\n // 62: +\n if (charCode == plus) {\n return 62;\n }\n\n // 63: /\n if (charCode == slash) {\n return 63;\n }\n\n // Invalid base64 digit.\n return -1;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64.js\n// module id = 3\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n/**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\nfunction getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.-]*)(?::(\\d+))?(.*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n}\nexports.urlParse = urlParse;\n\nfunction urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n}\nexports.urlGenerate = urlGenerate;\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\nfunction normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n\n var parts = path.split(/\\/+/);\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n}\nexports.normalize = normalize;\n\n/**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\nfunction join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n}\nexports.join = join;\n\nexports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || urlRegexp.test(aPath);\n};\n\n/**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\nfunction relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\n\n/**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\nfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByOriginalPositions = compareByOriginalPositions;\n\n/**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\nfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 === null) {\n return 1; // aStr2 !== null\n }\n\n if (aStr2 === null) {\n return -1; // aStr1 !== null\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n}\n\n/**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\nfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented\n * in the source maps specification), and then parse the string as\n * JSON.\n */\nfunction parseSourceMapInput(str) {\n return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, ''));\n}\nexports.parseSourceMapInput = parseSourceMapInput;\n\n/**\n * Compute the URL of a source given the the source root, the source's\n * URL, and the source map's URL.\n */\nfunction computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {\n sourceURL = sourceURL || '';\n\n if (sourceRoot) {\n // This follows what Chrome does.\n if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {\n sourceRoot += '/';\n }\n // The spec says:\n // Line 4: An optional source root, useful for relocating source\n // files on a server or removing repeated values in the\n // “sources” entry. This value is prepended to the individual\n // entries in the “source” field.\n sourceURL = sourceRoot + sourceURL;\n }\n\n // Historically, SourceMapConsumer did not take the sourceMapURL as\n // a parameter. This mode is still somewhat supported, which is why\n // this code block is conditional. However, it's preferable to pass\n // the source map URL to SourceMapConsumer, so that this function\n // can implement the source URL resolution algorithm as outlined in\n // the spec. This block is basically the equivalent of:\n // new URL(sourceURL, sourceMapURL).toString()\n // ... except it avoids using URL, which wasn't available in the\n // older releases of node still supported by this library.\n //\n // The spec says:\n // If the sources are not absolute URLs after prepending of the\n // “sourceRoot”, the sources are resolved relative to the\n // SourceMap (like resolving script src in a html document).\n if (sourceMapURL) {\n var parsed = urlParse(sourceMapURL);\n if (!parsed) {\n throw new Error(\"sourceMapURL could not be parsed\");\n }\n if (parsed.path) {\n // Strip the last path component, but keep the \"/\".\n var index = parsed.path.lastIndexOf('/');\n if (index >= 0) {\n parsed.path = parsed.path.substring(0, index + 1);\n }\n }\n sourceURL = join(urlGenerate(parsed), sourceURL);\n }\n\n return normalize(sourceURL);\n}\nexports.computeSourceURL = computeSourceURL;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/util.js\n// module id = 4\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\n\n/**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n};\n\n/**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\n\n throw new Error('\"' + aStr + '\" is not in the set.');\n};\n\n/**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\nArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n};\n\n/**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/array-set.js\n// module id = 5\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2014 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction generatedPositionAfter(mappingA, mappingB) {\n // Optimized for most common case\n var lineA = mappingA.generatedLine;\n var lineB = mappingB.generatedLine;\n var columnA = mappingA.generatedColumn;\n var columnB = mappingB.generatedColumn;\n return lineB > lineA || lineB == lineA && columnB >= columnA ||\n util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n}\n\n/**\n * A data structure to provide a sorted view of accumulated mappings in a\n * performance conscious manner. It trades a neglibable overhead in general\n * case for a large speedup in case of mappings being added in order.\n */\nfunction MappingList() {\n this._array = [];\n this._sorted = true;\n // Serves as infimum\n this._last = {generatedLine: -1, generatedColumn: 0};\n}\n\n/**\n * Iterate through internal items. This method takes the same arguments that\n * `Array.prototype.forEach` takes.\n *\n * NOTE: The order of the mappings is NOT guaranteed.\n */\nMappingList.prototype.unsortedForEach =\n function MappingList_forEach(aCallback, aThisArg) {\n this._array.forEach(aCallback, aThisArg);\n };\n\n/**\n * Add the given source mapping.\n *\n * @param Object aMapping\n */\nMappingList.prototype.add = function MappingList_add(aMapping) {\n if (generatedPositionAfter(this._last, aMapping)) {\n this._last = aMapping;\n this._array.push(aMapping);\n } else {\n this._sorted = false;\n this._array.push(aMapping);\n }\n};\n\n/**\n * Returns the flat, sorted array of mappings. The mappings are sorted by\n * generated position.\n *\n * WARNING: This method returns internal data without copying, for\n * performance. The return value must NOT be mutated, and should be treated as\n * an immutable borrow. If you want to take ownership, you must make your own\n * copy.\n */\nMappingList.prototype.toArray = function MappingList_toArray() {\n if (!this._sorted) {\n this._array.sort(util.compareByGeneratedPositionsInflated);\n this._sorted = true;\n }\n return this._array;\n};\n\nexports.MappingList = MappingList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/mapping-list.js\n// module id = 6\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction SourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)\n : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);\n}\n\nSourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.prototype._version = 3;\n\n// `__generatedMappings` and `__originalMappings` are arrays that hold the\n// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n// are lazily instantiated, accessed via the `_generatedMappings` and\n// `_originalMappings` getters respectively, and we only parse the mappings\n// and create these arrays once queried for a source location. We jump through\n// these hoops because there can be many thousands of mappings, and parsing\n// them is expensive, so we only want to do it if we must.\n//\n// Each object in the arrays is of the form:\n//\n// {\n// generatedLine: The line number in the generated code,\n// generatedColumn: The column number in the generated code,\n// source: The path to the original source file that generated this\n// chunk of code,\n// originalLine: The line number in the original source that\n// corresponds to this chunk of generated code,\n// originalColumn: The column number in the original source that\n// corresponds to this chunk of generated code,\n// name: The name of the original symbol which generated this chunk of\n// code.\n// }\n//\n// All properties except for `generatedLine` and `generatedColumn` can be\n// `null`.\n//\n// `_generatedMappings` is ordered by the generated positions.\n//\n// `_originalMappings` is ordered by the original positions.\n\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n});\n\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n});\n\nSourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n/**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\nSourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n mappings.map(function (mapping) {\n var source = mapping.source === null ? null : this._sources.at(mapping.source);\n source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);\n return {\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : this._names.at(mapping.name)\n };\n }, this).forEach(aCallback, context);\n };\n\n/**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number is 1-based.\n * - column: Optional. the column number in the original source.\n * The column number is 0-based.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nSourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n needle.source = this._findSourceIndex(needle.source);\n if (needle.source < 0) {\n return [];\n }\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\nexports.SourceMapConsumer = SourceMapConsumer;\n\n/**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The first parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\nfunction BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n if (sourceRoot) {\n sourceRoot = util.normalize(sourceRoot);\n }\n\n sources = sources\n .map(String)\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names.map(String), true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this._absoluteSources = this._sources.toArray().map(function (s) {\n return util.computeSourceURL(sourceRoot, s, aSourceMapURL);\n });\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this._sourceMapURL = aSourceMapURL;\n this.file = file;\n}\n\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n/**\n * Utility function to find the index of a source. Returns -1 if not\n * found.\n */\nBasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n if (this._sources.has(relativeSource)) {\n return this._sources.indexOf(relativeSource);\n }\n\n // Maybe aSource is an absolute URL as returned by |sources|. In\n // this case we can't simply undo the transform.\n var i;\n for (i = 0; i < this._absoluteSources.length; ++i) {\n if (this._absoluteSources[i] == aSource) {\n return i;\n }\n }\n\n return -1;\n};\n\n/**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @param String aSourceMapURL\n * The URL at which the source map can be found (optional)\n * @returns BasicSourceMapConsumer\n */\nBasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n smc._sourceMapURL = aSourceMapURL;\n smc._absoluteSources = smc._sources.toArray().map(function (s) {\n return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);\n });\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._absoluteSources.slice();\n }\n});\n\n/**\n * Provide the JIT with a nice shape / hidden class.\n */\nfunction Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n}\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nBasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n // Because each offset is encoded relative to the previous one,\n // many segments often have the same encoding. We can exploit this\n // fact by caching the parsed variable length fields of each segment,\n // allowing us to avoid a second parse if we encounter the same\n // segment again.\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = cachedSegments[str];\n if (segment) {\n index += str.length;\n } else {\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n cachedSegments[str] = segment;\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n originalMappings.push(mapping);\n }\n }\n }\n\n quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n this.__generatedMappings = generatedMappings;\n\n quickSort(originalMappings, util.compareByOriginalPositions);\n this.__originalMappings = originalMappings;\n };\n\n/**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\nBasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n/**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\nBasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nBasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nBasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n var index = this._findSourceIndex(aSource);\n if (index >= 0) {\n return this.sourcesContent[index];\n }\n\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = relativeSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + relativeSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + relativeSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + relativeSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nBasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n source = this._findSourceIndex(source);\n if (source < 0) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\nexports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n/**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The first parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\nfunction IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)\n }\n });\n}\n\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n});\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nIndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nIndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content) {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based. \n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nIndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nIndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = null;\n if (mapping.name) {\n name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n }\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-consumer.js\n// module id = 7\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nexports.GREATEST_LOWER_BOUND = 1;\nexports.LEAST_UPPER_BOUND = 2;\n\n/**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\nfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n}\n\n/**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\nexports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/binary-search.js\n// module id = 8\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n// It turns out that some (most?) JavaScript engines don't self-host\n// `Array.prototype.sort`. This makes sense because C++ will likely remain\n// faster than JS when doing raw CPU-intensive sorting. However, when using a\n// custom comparator function, calling back and forth between the VM's C++ and\n// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n// worse generated code for the comparator function than would be optimal. In\n// fact, when sorting with a comparator, these costs outweigh the benefits of\n// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n// a ~3500ms mean speed-up in `bench/bench.html`.\n\n/**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\nfunction swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n}\n\n/**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\nfunction randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n}\n\n/**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\nfunction doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n}\n\n/**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\nexports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/quick-sort.js\n// module id = 9\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar util = require('./util');\n\n// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n// operating systems these days (capturing the result).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar NEWLINE_CODE = 10;\n\n// Private symbol for identifying `SourceNode`s when multiple versions of\n// the source-map library are loaded. This MUST NOT CHANGE across\n// versions!\nvar isSourceNode = \"$$$isSourceNode$$$\";\n\n/**\n * SourceNodes provide a way to abstract over interpolating/concatenating\n * snippets of generated JavaScript source code while maintaining the line and\n * column information associated with the original source code.\n *\n * @param aLine The original line number.\n * @param aColumn The original column number.\n * @param aSource The original source's filename.\n * @param aChunks Optional. An array of strings which are snippets of\n * generated JS, or other SourceNodes.\n * @param aName The original identifier.\n */\nfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n this.children = [];\n this.sourceContents = {};\n this.line = aLine == null ? null : aLine;\n this.column = aColumn == null ? null : aColumn;\n this.source = aSource == null ? null : aSource;\n this.name = aName == null ? null : aName;\n this[isSourceNode] = true;\n if (aChunks != null) this.add(aChunks);\n}\n\n/**\n * Creates a SourceNode from generated code and a SourceMapConsumer.\n *\n * @param aGeneratedCode The generated code\n * @param aSourceMapConsumer The SourceMap for the generated code\n * @param aRelativePath Optional. The path that relative sources in the\n * SourceMapConsumer should be relative to.\n */\nSourceNode.fromStringWithSourceMap =\n function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n // The SourceNode we want to fill with the generated code\n // and the SourceMap\n var node = new SourceNode();\n\n // All even indices of this array are one line of the generated code,\n // while all odd indices are the newlines between two adjacent lines\n // (since `REGEX_NEWLINE` captures its match).\n // Processed fragments are accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\n };\n\n // We need to remember the position of \"remainingLines\"\n var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n // The generate SourceNodes we need a code range.\n // To extract it current and last mapping is used.\n // Here we store the last mapping.\n var lastMapping = null;\n\n aSourceMapConsumer.eachMapping(function (mapping) {\n if (lastMapping !== null) {\n // We add the code from \"lastMapping\" to \"mapping\":\n // First check if there is a new line in between.\n if (lastGeneratedLine < mapping.generatedLine) {\n // Associate first line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n lastGeneratedLine++;\n lastGeneratedColumn = 0;\n // The remaining code is added without mapping\n } else {\n // There is no new line in between.\n // Associate the code between \"lastGeneratedColumn\" and\n // \"mapping.generatedColumn\" with \"lastMapping\"\n var nextLine = remainingLines[remainingLinesIndex] || '';\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n lastGeneratedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n addMappingWithCode(lastMapping, code);\n // No more remaining code, continue\n lastMapping = mapping;\n return;\n }\n }\n // We add the generated code until the first mapping\n // to the SourceNode without any mapping.\n // Each line is added as separate string.\n while (lastGeneratedLine < mapping.generatedLine) {\n node.add(shiftNextLine());\n lastGeneratedLine++;\n }\n if (lastGeneratedColumn < mapping.generatedColumn) {\n var nextLine = remainingLines[remainingLinesIndex] || '';\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\n if (lastMapping) {\n // Associate the remaining code in the current line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n }\n // and add the remaining lines without any mapping\n node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n }\n\n // Copy sourcesContent into SourceNode\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aRelativePath != null) {\n sourceFile = util.join(aRelativePath, sourceFile);\n }\n node.setSourceContent(sourceFile, content);\n }\n });\n\n return node;\n\n function addMappingWithCode(mapping, code) {\n if (mapping === null || mapping.source === undefined) {\n node.add(code);\n } else {\n var source = aRelativePath\n ? util.join(aRelativePath, mapping.source)\n : mapping.source;\n node.add(new SourceNode(mapping.originalLine,\n mapping.originalColumn,\n source,\n code,\n mapping.name));\n }\n }\n };\n\n/**\n * Add a chunk of generated JS to this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.add = function SourceNode_add(aChunk) {\n if (Array.isArray(aChunk)) {\n aChunk.forEach(function (chunk) {\n this.add(chunk);\n }, this);\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n if (aChunk) {\n this.children.push(aChunk);\n }\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Add a chunk of generated JS to the beginning of this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n if (Array.isArray(aChunk)) {\n for (var i = aChunk.length-1; i >= 0; i--) {\n this.prepend(aChunk[i]);\n }\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n this.children.unshift(aChunk);\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Walk over the tree of JS snippets in this node and its children. The\n * walking function is called once for each snippet of JS and is passed that\n * snippet and the its original associated source's line/column location.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n var chunk;\n for (var i = 0, len = this.children.length; i < len; i++) {\n chunk = this.children[i];\n if (chunk[isSourceNode]) {\n chunk.walk(aFn);\n }\n else {\n if (chunk !== '') {\n aFn(chunk, { source: this.source,\n line: this.line,\n column: this.column,\n name: this.name });\n }\n }\n }\n};\n\n/**\n * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n * each of `this.children`.\n *\n * @param aSep The separator.\n */\nSourceNode.prototype.join = function SourceNode_join(aSep) {\n var newChildren;\n var i;\n var len = this.children.length;\n if (len > 0) {\n newChildren = [];\n for (i = 0; i < len-1; i++) {\n newChildren.push(this.children[i]);\n newChildren.push(aSep);\n }\n newChildren.push(this.children[i]);\n this.children = newChildren;\n }\n return this;\n};\n\n/**\n * Call String.prototype.replace on the very right-most source snippet. Useful\n * for trimming whitespace from the end of a source node, etc.\n *\n * @param aPattern The pattern to replace.\n * @param aReplacement The thing to replace the pattern with.\n */\nSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n var lastChild = this.children[this.children.length - 1];\n if (lastChild[isSourceNode]) {\n lastChild.replaceRight(aPattern, aReplacement);\n }\n else if (typeof lastChild === 'string') {\n this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n }\n else {\n this.children.push(''.replace(aPattern, aReplacement));\n }\n return this;\n};\n\n/**\n * Set the source content for a source file. This will be added to the SourceMapGenerator\n * in the sourcesContent field.\n *\n * @param aSourceFile The filename of the source file\n * @param aSourceContent The content of the source file\n */\nSourceNode.prototype.setSourceContent =\n function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n };\n\n/**\n * Walk over the tree of SourceNodes. The walking function is called for each\n * source file content and is passed the filename and source content.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walkSourceContents =\n function SourceNode_walkSourceContents(aFn) {\n for (var i = 0, len = this.children.length; i < len; i++) {\n if (this.children[i][isSourceNode]) {\n this.children[i].walkSourceContents(aFn);\n }\n }\n\n var sources = Object.keys(this.sourceContents);\n for (var i = 0, len = sources.length; i < len; i++) {\n aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n }\n };\n\n/**\n * Return the string representation of this source node. Walks over the tree\n * and concatenates all the various snippets together to one string.\n */\nSourceNode.prototype.toString = function SourceNode_toString() {\n var str = \"\";\n this.walk(function (chunk) {\n str += chunk;\n });\n return str;\n};\n\n/**\n * Returns the string representation of this source node along with a source\n * map.\n */\nSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n var generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n var map = new SourceMapGenerator(aArgs);\n var sourceMappingActive = false;\n var lastOriginalSource = null;\n var lastOriginalLine = null;\n var lastOriginalColumn = null;\n var lastOriginalName = null;\n this.walk(function (chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if(lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (var idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function (sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map: map };\n};\n\nexports.SourceNode = SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-node.js\n// module id = 10\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/array-set.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/array-set.js new file mode 100644 index 0000000000000000000000000000000000000000..fbd5c81cae66fa6401f871ac7fb02e96fdb9c213 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/array-set.js @@ -0,0 +1,121 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); +var has = Object.prototype.hasOwnProperty; +var hasNativeMap = typeof Map !== "undefined"; + +/** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ +function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); +} + +/** + * Static method for creating ArraySet instances from an existing array. + */ +ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; +}; + +/** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ +ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; +}; + +/** + * Add the given string to this set. + * + * @param String aStr + */ +ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); +}; + +/** + * What is the element at the given index? + * + * @param Number aIdx + */ +ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); +}; + +/** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ +ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); +}; + +exports.ArraySet = ArraySet; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/base64-vlq.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/base64-vlq.js new file mode 100644 index 0000000000000000000000000000000000000000..612b404018ece911ab71fc0a8db326d16e6b1287 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/base64-vlq.js @@ -0,0 +1,140 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +var base64 = require('./base64'); + +// A single base 64 digit can contain 6 bits of data. For the base 64 variable +// length quantities we use in the source map spec, the first bit is the sign, +// the next four bits are the actual value, and the 6th bit is the +// continuation bit. The continuation bit tells us whether there are more +// digits in this value following this digit. +// +// Continuation +// | Sign +// | | +// V V +// 101011 + +var VLQ_BASE_SHIFT = 5; + +// binary: 100000 +var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + +// binary: 011111 +var VLQ_BASE_MASK = VLQ_BASE - 1; + +// binary: 100000 +var VLQ_CONTINUATION_BIT = VLQ_BASE; + +/** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ +function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; +} + +/** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ +function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; +} + +/** + * Returns the base 64 VLQ encoded value. + */ +exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; +}; + +/** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ +exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/base64.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/base64.js new file mode 100644 index 0000000000000000000000000000000000000000..8aa86b30264363990334a7df0aa0d0c9cc1aecfc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/base64.js @@ -0,0 +1,67 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + +/** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ +exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); +}; + +/** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ +exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/binary-search.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/binary-search.js new file mode 100644 index 0000000000000000000000000000000000000000..010ac941e1568d59c89b67cb649051a14608ee79 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/binary-search.js @@ -0,0 +1,111 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +exports.GREATEST_LOWER_BOUND = 1; +exports.LEAST_UPPER_BOUND = 2; + +/** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ +function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } +} + +/** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ +exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/mapping-list.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/mapping-list.js new file mode 100644 index 0000000000000000000000000000000000000000..06d1274a025a8a30879f31c9c6703a14f79f73b9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/mapping-list.js @@ -0,0 +1,79 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); + +/** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ +function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +} + +/** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ +function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; +} + +/** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ +MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + +/** + * Add the given source mapping. + * + * @param Object aMapping + */ +MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } +}; + +/** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ +MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; +}; + +exports.MappingList = MappingList; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/quick-sort.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/quick-sort.js new file mode 100644 index 0000000000000000000000000000000000000000..6a7caadbbdbea1865cfb947cb21fbf0c8da1289a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/quick-sort.js @@ -0,0 +1,114 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +// It turns out that some (most?) JavaScript engines don't self-host +// `Array.prototype.sort`. This makes sense because C++ will likely remain +// faster than JS when doing raw CPU-intensive sorting. However, when using a +// custom comparator function, calling back and forth between the VM's C++ and +// JIT'd JS is rather slow *and* loses JIT type information, resulting in +// worse generated code for the comparator function than would be optimal. In +// fact, when sorting with a comparator, these costs outweigh the benefits of +// sorting in C++. By using our own JS-implemented Quick Sort (below), we get +// a ~3500ms mean speed-up in `bench/bench.html`. + +/** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ +function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; +} + +/** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ +function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); +} + +/** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ +function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } +} + +/** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ +exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/source-map-consumer.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/source-map-consumer.js new file mode 100644 index 0000000000000000000000000000000000000000..7b99d1da7feac7c5345af8945ed047c7c054c0ba --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/source-map-consumer.js @@ -0,0 +1,1145 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); +var binarySearch = require('./binary-search'); +var ArraySet = require('./array-set').ArraySet; +var base64VLQ = require('./base64-vlq'); +var quickSort = require('./quick-sort').quickSort; + +function SourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) + : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); +} + +SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); +} + +/** + * The version of the source mapping spec that we are consuming. + */ +SourceMapConsumer.prototype._version = 3; + +// `__generatedMappings` and `__originalMappings` are arrays that hold the +// parsed mapping coordinates from the source map's "mappings" attribute. They +// are lazily instantiated, accessed via the `_generatedMappings` and +// `_originalMappings` getters respectively, and we only parse the mappings +// and create these arrays once queried for a source location. We jump through +// these hoops because there can be many thousands of mappings, and parsing +// them is expensive, so we only want to do it if we must. +// +// Each object in the arrays is of the form: +// +// { +// generatedLine: The line number in the generated code, +// generatedColumn: The column number in the generated code, +// source: The path to the original source file that generated this +// chunk of code, +// originalLine: The line number in the original source that +// corresponds to this chunk of generated code, +// originalColumn: The column number in the original source that +// corresponds to this chunk of generated code, +// name: The name of the original symbol which generated this chunk of +// code. +// } +// +// All properties except for `generatedLine` and `generatedColumn` can be +// `null`. +// +// `_generatedMappings` is ordered by the generated positions. +// +// `_originalMappings` is ordered by the original positions. + +SourceMapConsumer.prototype.__generatedMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } +}); + +SourceMapConsumer.prototype.__originalMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } +}); + +SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + +SourceMapConsumer.GENERATED_ORDER = 1; +SourceMapConsumer.ORIGINAL_ORDER = 2; + +SourceMapConsumer.GREATEST_LOWER_BOUND = 1; +SourceMapConsumer.LEAST_UPPER_BOUND = 2; + +/** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ +SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + +/** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number is 1-based. + * - column: Optional. the column number in the original source. + * The column number is 0-based. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + needle.source = this._findSourceIndex(needle.source); + if (needle.source < 0) { + return []; + } + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + +exports.SourceMapConsumer = SourceMapConsumer; + +/** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The first parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ +function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + if (sourceRoot) { + sourceRoot = util.normalize(sourceRoot); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this._absoluteSources = this._sources.toArray().map(function (s) { + return util.computeSourceURL(sourceRoot, s, aSourceMapURL); + }); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this._sourceMapURL = aSourceMapURL; + this.file = file; +} + +BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + +/** + * Utility function to find the index of a source. Returns -1 if not + * found. + */ +BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + if (this._sources.has(relativeSource)) { + return this._sources.indexOf(relativeSource); + } + + // Maybe aSource is an absolute URL as returned by |sources|. In + // this case we can't simply undo the transform. + var i; + for (i = 0; i < this._absoluteSources.length; ++i) { + if (this._absoluteSources[i] == aSource) { + return i; + } + } + + return -1; +}; + +/** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @param String aSourceMapURL + * The URL at which the source map can be found (optional) + * @returns BasicSourceMapConsumer + */ +BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + smc._sourceMapURL = aSourceMapURL; + smc._absoluteSources = smc._sources.toArray().map(function (s) { + return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); + }); + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + +/** + * The version of the source mapping spec that we are consuming. + */ +BasicSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._absoluteSources.slice(); + } +}); + +/** + * Provide the JIT with a nice shape / hidden class. + */ +function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; +} + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + +/** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ +BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + +/** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ +BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + var index = this._findSourceIndex(aSource); + if (index >= 0) { + return this.sourcesContent[index]; + } + + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + relativeSource)) { + return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + relativeSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + source = this._findSourceIndex(source); + if (source < 0) { + return { + line: null, + column: null, + lastColumn: null + }; + } + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + +exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + +/** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The first parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ +function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) + } + }); +} + +IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + +/** + * The version of the source mapping spec that we are consuming. + */ +IndexedSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } +}); + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = null; + if (mapping.name) { + name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + } + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + +exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/source-map-generator.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/source-map-generator.js new file mode 100644 index 0000000000000000000000000000000000000000..508bcfbbc936da21673108f7ace72a0af6081664 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/source-map-generator.js @@ -0,0 +1,425 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var base64VLQ = require('./base64-vlq'); +var util = require('./util'); +var ArraySet = require('./array-set').ArraySet; +var MappingList = require('./mapping-list').MappingList; + +/** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ +function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; +} + +SourceMapGenerator.prototype._version = 3; + +/** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ +SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var sourceRelative = sourceFile; + if (sourceRoot !== null) { + sourceRelative = util.relative(sourceRoot, sourceFile); + } + + if (!generator._sources.has(sourceRelative)) { + generator._sources.add(sourceRelative); + } + + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + +/** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ +SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + +/** + * Set the source content for a source file. + */ +SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + +/** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ +SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + +/** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ +SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + +/** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ +SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + +SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + +/** + * Externalize the source map. + */ +SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + +/** + * Render the source map being generated to a string. + */ +SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + +exports.SourceMapGenerator = SourceMapGenerator; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/source-node.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/source-node.js new file mode 100644 index 0000000000000000000000000000000000000000..8bcdbe385d2c0d333bcd62648ca700f13f9d3181 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/source-node.js @@ -0,0 +1,413 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; +var util = require('./util'); + +// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other +// operating systems these days (capturing the result). +var REGEX_NEWLINE = /(\r?\n)/; + +// Newline character code for charCodeAt() comparisons +var NEWLINE_CODE = 10; + +// Private symbol for identifying `SourceNode`s when multiple versions of +// the source-map library are loaded. This MUST NOT CHANGE across +// versions! +var isSourceNode = "$$$isSourceNode$$$"; + +/** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ +function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); +} + +/** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ +SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex] || ''; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex] || ''; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + +/** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } +}; + +/** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ +SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; +}; + +/** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ +SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; +}; + +/** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ +SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + +/** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + +/** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ +SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; +}; + +/** + * Returns the string representation of this source node along with a source + * map. + */ +SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; +}; + +exports.SourceNode = SourceNode; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/util.js b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/util.js new file mode 100644 index 0000000000000000000000000000000000000000..3ca92e56f2a8cf086821031145ed60c53f8e9ab2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/source-map/lib/util.js @@ -0,0 +1,488 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +/** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ +function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } +} +exports.getArg = getArg; + +var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; +var dataUrlRegexp = /^data:.+\,.+$/; + +function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; +} +exports.urlParse = urlParse; + +function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; +} +exports.urlGenerate = urlGenerate; + +/** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ +function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; +} +exports.normalize = normalize; + +/** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ +function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; +} +exports.join = join; + +exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || urlRegexp.test(aPath); +}; + +/** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ +function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ +function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByOriginalPositions = compareByOriginalPositions; + +/** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 === null) { + return 1; // aStr2 !== null + } + + if (aStr2 === null) { + return -1; // aStr1 !== null + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; +} + +/** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + +/** + * Strip any JSON XSSI avoidance prefix from the string (as documented + * in the source maps specification), and then parse the string as + * JSON. + */ +function parseSourceMapInput(str) { + return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); +} +exports.parseSourceMapInput = parseSourceMapInput; + +/** + * Compute the URL of a source given the the source root, the source's + * URL, and the source map's URL. + */ +function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { + sourceURL = sourceURL || ''; + + if (sourceRoot) { + // This follows what Chrome does. + if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { + sourceRoot += '/'; + } + // The spec says: + // Line 4: An optional source root, useful for relocating source + // files on a server or removing repeated values in the + // “sources” entry. This value is prepended to the individual + // entries in the “source” field. + sourceURL = sourceRoot + sourceURL; + } + + // Historically, SourceMapConsumer did not take the sourceMapURL as + // a parameter. This mode is still somewhat supported, which is why + // this code block is conditional. However, it's preferable to pass + // the source map URL to SourceMapConsumer, so that this function + // can implement the source URL resolution algorithm as outlined in + // the spec. This block is basically the equivalent of: + // new URL(sourceURL, sourceMapURL).toString() + // ... except it avoids using URL, which wasn't available in the + // older releases of node still supported by this library. + // + // The spec says: + // If the sources are not absolute URLs after prepending of the + // “sourceRoot”, the sources are resolved relative to the + // SourceMap (like resolving script src in a html document). + if (sourceMapURL) { + var parsed = urlParse(sourceMapURL); + if (!parsed) { + throw new Error("sourceMapURL could not be parsed"); + } + if (parsed.path) { + // Strip the last path component, but keep the "/". + var index = parsed.path.lastIndexOf('/'); + if (index >= 0) { + parsed.path = parsed.path.substring(0, index + 1); + } + } + sourceURL = join(urlGenerate(parsed), sourceURL); + } + + return normalize(sourceURL); +} +exports.computeSourceURL = computeSourceURL; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/OriginalSource.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/OriginalSource.js new file mode 100644 index 0000000000000000000000000000000000000000..ee27842a44b299bc27a5df6031251013b5bc39af --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/OriginalSource.js @@ -0,0 +1,198 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const Source = require("./Source"); +const { getMap, getSourceAndMap } = require("./helpers/getFromStreamChunks"); +const getGeneratedSourceInfo = require("./helpers/getGeneratedSourceInfo"); +const splitIntoLines = require("./helpers/splitIntoLines"); +const splitIntoPotentialTokens = require("./helpers/splitIntoPotentialTokens"); +const { + isDualStringBufferCachingEnabled, +} = require("./helpers/stringBufferUtils"); + +/** @typedef {import("./Source").HashLike} HashLike */ +/** @typedef {import("./Source").MapOptions} MapOptions */ +/** @typedef {import("./Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./Source").SourceAndMap} SourceAndMap */ +/** @typedef {import("./Source").SourceValue} SourceValue */ +/** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */ +/** @typedef {import("./helpers/streamChunks").OnName} OnName */ +/** @typedef {import("./helpers/streamChunks").OnSource} OnSource */ +/** @typedef {import("./helpers/streamChunks").Options} Options */ + +class OriginalSource extends Source { + /** + * @param {string | Buffer} value value + * @param {string} name name + */ + constructor(value, name) { + super(); + + const isBuffer = Buffer.isBuffer(value); + + /** + * @private + * @type {undefined | string} + */ + this._value = isBuffer ? undefined : value; + /** + * @private + * @type {undefined | Buffer} + */ + this._valueAsBuffer = isBuffer ? value : undefined; + this._name = name; + } + + getName() { + return this._name; + } + + /** + * @returns {SourceValue} source + */ + source() { + if (this._value === undefined) { + const value = + /** @type {Buffer} */ + (this._valueAsBuffer).toString("utf8"); + if (isDualStringBufferCachingEnabled()) { + this._value = value; + } + return value; + } + return this._value; + } + + buffer() { + if (this._valueAsBuffer === undefined) { + const value = Buffer.from(/** @type {string} */ (this._value), "utf8"); + if (isDualStringBufferCachingEnabled()) { + this._valueAsBuffer = value; + } + return value; + } + return this._valueAsBuffer; + } + + /** + * @param {MapOptions=} options map options + * @returns {RawSourceMap | null} map + */ + map(options) { + return getMap(this, options); + } + + /** + * @param {MapOptions=} options map options + * @returns {SourceAndMap} source and map + */ + sourceAndMap(options) { + return getSourceAndMap(this, options); + } + + /** + * @param {Options} options options + * @param {OnChunk} onChunk called for each chunk of code + * @param {OnSource} onSource called for each source + * @param {OnName} _onName called for each name + * @returns {GeneratedSourceInfo} generated source info + */ + streamChunks(options, onChunk, onSource, _onName) { + if (this._value === undefined) { + this._value = + /** @type {Buffer} */ + (this._valueAsBuffer).toString("utf8"); + } + onSource(0, this._name, this._value); + const finalSource = Boolean(options && options.finalSource); + if (!options || options.columns !== false) { + // With column info we need to read all lines and split them + const matches = splitIntoPotentialTokens(this._value); + let line = 1; + let column = 0; + if (matches !== null) { + for (const match of matches) { + const isEndOfLine = match.endsWith("\n"); + if (isEndOfLine && match.length === 1) { + if (!finalSource) onChunk(match, line, column, -1, -1, -1, -1); + } else { + const chunk = finalSource ? undefined : match; + onChunk(chunk, line, column, 0, line, column, -1); + } + if (isEndOfLine) { + line++; + column = 0; + } else { + column += match.length; + } + } + } + return { + generatedLine: line, + generatedColumn: column, + source: finalSource ? this._value : undefined, + }; + } else if (finalSource) { + // Without column info and with final source we only + // need meta info to generate mapping + const result = getGeneratedSourceInfo(this._value); + const { generatedLine, generatedColumn } = result; + if (generatedColumn === 0) { + for ( + let line = 1; + line < /** @type {number} */ (generatedLine); + line++ + ) { + onChunk(undefined, line, 0, 0, line, 0, -1); + } + } else { + for ( + let line = 1; + line <= /** @type {number} */ (generatedLine); + line++ + ) { + onChunk(undefined, line, 0, 0, line, 0, -1); + } + } + return result; + } + // Without column info, but also without final source + // we need to split source by lines + let line = 1; + const matches = splitIntoLines(this._value); + /** @type {string | undefined} */ + let match; + for (match of matches) { + onChunk(finalSource ? undefined : match, line, 0, 0, line, 0, -1); + line++; + } + return matches.length === 0 || /** @type {string} */ (match).endsWith("\n") + ? { + generatedLine: matches.length + 1, + generatedColumn: 0, + source: finalSource ? this._value : undefined, + } + : { + generatedLine: matches.length, + generatedColumn: /** @type {string} */ (match).length, + source: finalSource ? this._value : undefined, + }; + } + + /** + * @param {HashLike} hash hash + * @returns {void} + */ + updateHash(hash) { + hash.update("OriginalSource"); + hash.update(this.buffer()); + hash.update(this._name || ""); + } +} + +module.exports = OriginalSource; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/PrefixSource.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/PrefixSource.js new file mode 100644 index 0000000000000000000000000000000000000000..d0962f800d3b5a7dfbe4a4b1307282d8b6e21ed2 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/PrefixSource.js @@ -0,0 +1,158 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const RawSource = require("./RawSource"); +const Source = require("./Source"); +const { getMap, getSourceAndMap } = require("./helpers/getFromStreamChunks"); +const streamChunks = require("./helpers/streamChunks"); + +/** @typedef {import("./Source").HashLike} HashLike */ +/** @typedef {import("./Source").MapOptions} MapOptions */ +/** @typedef {import("./Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./Source").SourceAndMap} SourceAndMap */ +/** @typedef {import("./Source").SourceValue} SourceValue */ +/** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */ +/** @typedef {import("./helpers/streamChunks").OnName} OnName */ +/** @typedef {import("./helpers/streamChunks").OnSource} OnSource */ +/** @typedef {import("./helpers/streamChunks").Options} Options */ + +const REPLACE_REGEX = /\n(?=.|\s)/g; + +class PrefixSource extends Source { + /** + * @param {string} prefix prefix + * @param {string | Buffer | Source} source source + */ + constructor(prefix, source) { + super(); + /** + * @private + * @type {Source} + */ + this._source = + typeof source === "string" || Buffer.isBuffer(source) + ? new RawSource(source, true) + : source; + this._prefix = prefix; + } + + getPrefix() { + return this._prefix; + } + + original() { + return this._source; + } + + /** + * @returns {SourceValue} source + */ + source() { + const node = /** @type {string} */ (this._source.source()); + const prefix = this._prefix; + return prefix + node.replace(REPLACE_REGEX, `\n${prefix}`); + } + + // TODO efficient buffer() implementation + + /** + * @param {MapOptions=} options map options + * @returns {RawSourceMap | null} map + */ + map(options) { + return getMap(this, options); + } + + /** + * @param {MapOptions=} options map options + * @returns {SourceAndMap} source and map + */ + sourceAndMap(options) { + return getSourceAndMap(this, options); + } + + /** + * @param {Options} options options + * @param {OnChunk} onChunk called for each chunk of code + * @param {OnSource} onSource called for each source + * @param {OnName} onName called for each name + * @returns {GeneratedSourceInfo} generated source info + */ + streamChunks(options, onChunk, onSource, onName) { + const prefix = this._prefix; + const prefixOffset = prefix.length; + const linesOnly = Boolean(options && options.columns === false); + const { generatedLine, generatedColumn, source } = streamChunks( + this._source, + options, + ( + chunk, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + if (generatedColumn !== 0) { + // In the middle of the line, we just adject the column + generatedColumn += prefixOffset; + } else if (chunk !== undefined) { + // At the start of the line, when we have source content + // add the prefix as generated mapping + // (in lines only mode we just add it to the original mapping + // for performance reasons) + if (linesOnly || sourceIndex < 0) { + chunk = prefix + chunk; + } else if (prefixOffset > 0) { + onChunk(prefix, generatedLine, generatedColumn, -1, -1, -1, -1); + generatedColumn += prefixOffset; + } + } else if (!linesOnly) { + // Without source content, we only need to adject the column info + // expect in lines only mode where prefix is added to original mapping + generatedColumn += prefixOffset; + } + onChunk( + chunk, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ); + }, + onSource, + onName, + ); + return { + generatedLine, + generatedColumn: + generatedColumn === 0 + ? 0 + : prefixOffset + /** @type {number} */ (generatedColumn), + source: + source !== undefined + ? prefix + source.replace(REPLACE_REGEX, `\n${prefix}`) + : undefined, + }; + } + + /** + * @param {HashLike} hash hash + * @returns {void} + */ + updateHash(hash) { + hash.update("PrefixSource"); + this._source.updateHash(hash); + hash.update(this._prefix); + } +} + +module.exports = PrefixSource; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/RawSource.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/RawSource.js new file mode 100644 index 0000000000000000000000000000000000000000..0df4baf61dd949a3585faaff19dbb9135e2d5ee9 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/RawSource.js @@ -0,0 +1,136 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const Source = require("./Source"); +const streamChunksOfRawSource = require("./helpers/streamChunksOfRawSource"); +const { + internString, + isDualStringBufferCachingEnabled, +} = require("./helpers/stringBufferUtils"); + +/** @typedef {import("./Source").HashLike} HashLike */ +/** @typedef {import("./Source").MapOptions} MapOptions */ +/** @typedef {import("./Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./Source").SourceValue} SourceValue */ +/** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */ +/** @typedef {import("./helpers/streamChunks").OnName} OnName */ +/** @typedef {import("./helpers/streamChunks").OnSource} OnSource */ +/** @typedef {import("./helpers/streamChunks").Options} Options */ + +class RawSource extends Source { + /** + * @param {string | Buffer} value value + * @param {boolean=} convertToString convert to string + */ + constructor(value, convertToString = false) { + super(); + const isBuffer = Buffer.isBuffer(value); + if (!isBuffer && typeof value !== "string") { + throw new TypeError("argument 'value' must be either string or Buffer"); + } + this._valueIsBuffer = !convertToString && isBuffer; + const internedString = + typeof value === "string" ? internString(value) : undefined; + /** + * @private + * @type {undefined | string | Buffer} + */ + this._value = + convertToString && isBuffer + ? undefined + : typeof value === "string" + ? internedString + : value; + /** + * @private + * @type {undefined | Buffer} + */ + this._valueAsBuffer = isBuffer ? value : undefined; + /** + * @private + * @type {undefined | string} + */ + this._valueAsString = isBuffer ? undefined : internedString; + } + + isBuffer() { + return this._valueIsBuffer; + } + + /** + * @returns {SourceValue} source + */ + source() { + if (this._value === undefined) { + const value = + /** @type {Buffer} */ + (this._valueAsBuffer).toString("utf8"); + if (isDualStringBufferCachingEnabled()) { + this._value = internString(value); + } + return value; + } + return this._value; + } + + buffer() { + if (this._valueAsBuffer === undefined) { + const value = Buffer.from(/** @type {string} */ (this._value), "utf8"); + if (isDualStringBufferCachingEnabled()) { + this._valueAsBuffer = value; + } + return value; + } + return this._valueAsBuffer; + } + + /** + * @param {MapOptions=} options map options + * @returns {RawSourceMap | null} map + */ + // eslint-disable-next-line no-unused-vars + map(options) { + return null; + } + + /** + * @param {Options} options options + * @param {OnChunk} onChunk called for each chunk of code + * @param {OnSource} onSource called for each source + * @param {OnName} onName called for each name + * @returns {GeneratedSourceInfo} generated source info + */ + streamChunks(options, onChunk, onSource, onName) { + let strValue = this._valueAsString; + if (strValue === undefined) { + const value = this.source(); + strValue = typeof value === "string" ? value : value.toString("utf8"); + if (isDualStringBufferCachingEnabled()) { + this._valueAsString = internString(strValue); + } + } + return streamChunksOfRawSource( + strValue, + onChunk, + onSource, + onName, + Boolean(options && options.finalSource), + ); + } + + /** + * @param {HashLike} hash hash + * @returns {void} + */ + updateHash(hash) { + hash.update("RawSource"); + hash.update(this.buffer()); + } +} + +module.exports = RawSource; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/ReplaceSource.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/ReplaceSource.js new file mode 100644 index 0000000000000000000000000000000000000000..9d5833d4c84f119d866ede938af0366cc59e10cd --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/ReplaceSource.js @@ -0,0 +1,545 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const Source = require("./Source"); +const { getMap, getSourceAndMap } = require("./helpers/getFromStreamChunks"); +const splitIntoLines = require("./helpers/splitIntoLines"); +const streamChunks = require("./helpers/streamChunks"); + +/** @typedef {import("./Source").HashLike} HashLike */ +/** @typedef {import("./Source").MapOptions} MapOptions */ +/** @typedef {import("./Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./Source").SourceAndMap} SourceAndMap */ +/** @typedef {import("./Source").SourceValue} SourceValue */ +/** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */ +/** @typedef {import("./helpers/streamChunks").OnName} OnName */ +/** @typedef {import("./helpers/streamChunks").OnSource} OnSource */ +/** @typedef {import("./helpers/streamChunks").Options} Options */ + +// since v8 7.0, Array.prototype.sort is stable +const hasStableSort = + typeof process === "object" && + process.versions && + typeof process.versions.v8 === "string" && + !/^[0-6]\./.test(process.versions.v8); + +// This is larger than max string length +const MAX_SOURCE_POSITION = 0x20000000; + +class Replacement { + /** + * @param {number} start start + * @param {number} end end + * @param {string} content content + * @param {string=} name name + */ + constructor(start, end, content, name) { + this.start = start; + this.end = end; + this.content = content; + this.name = name; + if (!hasStableSort) { + this.index = -1; + } + } +} + +class ReplaceSource extends Source { + /** + * @param {Source} source source + * @param {string=} name name + */ + constructor(source, name) { + super(); + this._source = source; + this._name = name; + /** @type {Replacement[]} */ + this._replacements = []; + this._isSorted = true; + } + + getName() { + return this._name; + } + + getReplacements() { + this._sortReplacements(); + return this._replacements; + } + + /** + * @param {number} start start + * @param {number} end end + * @param {string} newValue new value + * @param {string=} name name + * @returns {void} + */ + replace(start, end, newValue, name) { + if (typeof newValue !== "string") { + throw new Error( + `insertion must be a string, but is a ${typeof newValue}`, + ); + } + this._replacements.push(new Replacement(start, end, newValue, name)); + this._isSorted = false; + } + + /** + * @param {number} pos pos + * @param {string} newValue new value + * @param {string=} name name + * @returns {void} + */ + insert(pos, newValue, name) { + if (typeof newValue !== "string") { + throw new Error( + `insertion must be a string, but is a ${typeof newValue}: ${newValue}`, + ); + } + this._replacements.push(new Replacement(pos, pos - 1, newValue, name)); + this._isSorted = false; + } + + /** + * @returns {SourceValue} source + */ + source() { + if (this._replacements.length === 0) { + return this._source.source(); + } + let current = this._source.source(); + let pos = 0; + const result = []; + + this._sortReplacements(); + for (const replacement of this._replacements) { + const start = Math.floor(replacement.start); + const end = Math.floor(replacement.end + 1); + if (pos < start) { + const offset = start - pos; + result.push(current.slice(0, offset)); + current = current.slice(offset); + pos = start; + } + result.push(replacement.content); + if (pos < end) { + const offset = end - pos; + current = current.slice(offset); + pos = end; + } + } + result.push(current); + return result.join(""); + } + + /** + * @param {MapOptions=} options map options + * @returns {RawSourceMap | null} map + */ + map(options) { + if (this._replacements.length === 0) { + return this._source.map(options); + } + return getMap(this, options); + } + + /** + * @param {MapOptions=} options map options + * @returns {SourceAndMap} source and map + */ + sourceAndMap(options) { + if (this._replacements.length === 0) { + return this._source.sourceAndMap(options); + } + return getSourceAndMap(this, options); + } + + original() { + return this._source; + } + + _sortReplacements() { + if (this._isSorted) return; + if (hasStableSort) { + this._replacements.sort((a, b) => { + const diff1 = a.start - b.start; + if (diff1 !== 0) return diff1; + const diff2 = a.end - b.end; + if (diff2 !== 0) return diff2; + return 0; + }); + } else { + for (const [i, repl] of this._replacements.entries()) repl.index = i; + this._replacements.sort((a, b) => { + const diff1 = a.start - b.start; + if (diff1 !== 0) return diff1; + const diff2 = a.end - b.end; + if (diff2 !== 0) return diff2; + return ( + /** @type {number} */ (a.index) - /** @type {number} */ (b.index) + ); + }); + } + this._isSorted = true; + } + + /** + * @param {Options} options options + * @param {OnChunk} onChunk called for each chunk of code + * @param {OnSource} onSource called for each source + * @param {OnName} onName called for each name + * @returns {GeneratedSourceInfo} generated source info + */ + streamChunks(options, onChunk, onSource, onName) { + this._sortReplacements(); + const replacements = this._replacements; + let pos = 0; + let i = 0; + let replacementEnd = -1; + let nextReplacement = + i < replacements.length + ? Math.floor(replacements[i].start) + : MAX_SOURCE_POSITION; + let generatedLineOffset = 0; + let generatedColumnOffset = 0; + let generatedColumnOffsetLine = 0; + /** @type {(string | string[] | undefined)[]} */ + const sourceContents = []; + /** @type {Map} */ + const nameMapping = new Map(); + /** @type {number[]} */ + const nameIndexMapping = []; + /** + * @param {number} sourceIndex source index + * @param {number} line line + * @param {number} column column + * @param {string} expectedChunk expected chunk + * @returns {boolean} result + */ + const checkOriginalContent = (sourceIndex, line, column, expectedChunk) => { + /** @type {undefined | string | string[]} */ + let content = + sourceIndex < sourceContents.length + ? sourceContents[sourceIndex] + : undefined; + if (content === undefined) return false; + if (typeof content === "string") { + content = splitIntoLines(content); + sourceContents[sourceIndex] = content; + } + const contentLine = line <= content.length ? content[line - 1] : null; + if (contentLine === null) return false; + return ( + contentLine.slice(column, column + expectedChunk.length) === + expectedChunk + ); + }; + const { generatedLine, generatedColumn } = streamChunks( + this._source, + { ...options, finalSource: false }, + ( + _chunk, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + let chunkPos = 0; + const chunk = /** @type {string} */ (_chunk); + const endPos = pos + chunk.length; + + // Skip over when it has been replaced + if (replacementEnd > pos) { + // Skip over the whole chunk + if (replacementEnd >= endPos) { + const line = generatedLine + generatedLineOffset; + if (chunk.endsWith("\n")) { + generatedLineOffset--; + if (generatedColumnOffsetLine === line) { + // undo exiting corrections form the current line + generatedColumnOffset += generatedColumn; + } + } else if (generatedColumnOffsetLine === line) { + generatedColumnOffset -= chunk.length; + } else { + generatedColumnOffset = -chunk.length; + generatedColumnOffsetLine = line; + } + pos = endPos; + return; + } + + // Partially skip over chunk + chunkPos = replacementEnd - pos; + if ( + checkOriginalContent( + sourceIndex, + originalLine, + originalColumn, + chunk.slice(0, chunkPos), + ) + ) { + originalColumn += chunkPos; + } + pos += chunkPos; + const line = generatedLine + generatedLineOffset; + if (generatedColumnOffsetLine === line) { + generatedColumnOffset -= chunkPos; + } else { + generatedColumnOffset = -chunkPos; + generatedColumnOffsetLine = line; + } + generatedColumn += chunkPos; + } + + // Is a replacement in the chunk? + if (nextReplacement < endPos) { + do { + let line = generatedLine + generatedLineOffset; + if (nextReplacement > pos) { + // Emit chunk until replacement + const offset = nextReplacement - pos; + const chunkSlice = chunk.slice(chunkPos, chunkPos + offset); + onChunk( + chunkSlice, + line, + generatedColumn + + (line === generatedColumnOffsetLine + ? generatedColumnOffset + : 0), + sourceIndex, + originalLine, + originalColumn, + nameIndex < 0 || nameIndex >= nameIndexMapping.length + ? -1 + : nameIndexMapping[nameIndex], + ); + generatedColumn += offset; + chunkPos += offset; + pos = nextReplacement; + if ( + checkOriginalContent( + sourceIndex, + originalLine, + originalColumn, + chunkSlice, + ) + ) { + originalColumn += chunkSlice.length; + } + } + + // Insert replacement content splitted into chunks by lines + const { content, name } = replacements[i]; + const matches = splitIntoLines(content); + let replacementNameIndex = nameIndex; + if (sourceIndex >= 0 && name) { + let globalIndex = nameMapping.get(name); + if (globalIndex === undefined) { + globalIndex = nameMapping.size; + nameMapping.set(name, globalIndex); + onName(globalIndex, name); + } + replacementNameIndex = globalIndex; + } + for (let m = 0; m < matches.length; m++) { + const contentLine = matches[m]; + onChunk( + contentLine, + line, + generatedColumn + + (line === generatedColumnOffsetLine + ? generatedColumnOffset + : 0), + sourceIndex, + originalLine, + originalColumn, + replacementNameIndex, + ); + + // Only the first chunk has name assigned + replacementNameIndex = -1; + + if (m === matches.length - 1 && !contentLine.endsWith("\n")) { + if (generatedColumnOffsetLine === line) { + generatedColumnOffset += contentLine.length; + } else { + generatedColumnOffset = contentLine.length; + generatedColumnOffsetLine = line; + } + } else { + generatedLineOffset++; + line++; + generatedColumnOffset = -generatedColumn; + generatedColumnOffsetLine = line; + } + } + + // Remove replaced content by settings this variable + replacementEnd = Math.max( + replacementEnd, + Math.floor(replacements[i].end + 1), + ); + + // Move to next replacement + i++; + nextReplacement = + i < replacements.length + ? Math.floor(replacements[i].start) + : MAX_SOURCE_POSITION; + + // Skip over when it has been replaced + const offset = chunk.length - endPos + replacementEnd - chunkPos; + if (offset > 0) { + // Skip over whole chunk + if (replacementEnd >= endPos) { + const line = generatedLine + generatedLineOffset; + if (chunk.endsWith("\n")) { + generatedLineOffset--; + if (generatedColumnOffsetLine === line) { + // undo exiting corrections form the current line + generatedColumnOffset += generatedColumn; + } + } else if (generatedColumnOffsetLine === line) { + generatedColumnOffset -= chunk.length - chunkPos; + } else { + generatedColumnOffset = chunkPos - chunk.length; + generatedColumnOffsetLine = line; + } + pos = endPos; + return; + } + + // Partially skip over chunk + const line = generatedLine + generatedLineOffset; + if ( + checkOriginalContent( + sourceIndex, + originalLine, + originalColumn, + chunk.slice(chunkPos, chunkPos + offset), + ) + ) { + originalColumn += offset; + } + chunkPos += offset; + pos += offset; + if (generatedColumnOffsetLine === line) { + generatedColumnOffset -= offset; + } else { + generatedColumnOffset = -offset; + generatedColumnOffsetLine = line; + } + generatedColumn += offset; + } + } while (nextReplacement < endPos); + } + + // Emit remaining chunk + if (chunkPos < chunk.length) { + const chunkSlice = chunkPos === 0 ? chunk : chunk.slice(chunkPos); + const line = generatedLine + generatedLineOffset; + onChunk( + chunkSlice, + line, + generatedColumn + + (line === generatedColumnOffsetLine ? generatedColumnOffset : 0), + sourceIndex, + originalLine, + originalColumn, + nameIndex < 0 ? -1 : nameIndexMapping[nameIndex], + ); + } + pos = endPos; + }, + (sourceIndex, source, sourceContent) => { + while (sourceContents.length < sourceIndex) { + sourceContents.push(undefined); + } + sourceContents[sourceIndex] = sourceContent; + onSource(sourceIndex, source, sourceContent); + }, + (nameIndex, name) => { + let globalIndex = nameMapping.get(name); + if (globalIndex === undefined) { + globalIndex = nameMapping.size; + nameMapping.set(name, globalIndex); + onName(globalIndex, name); + } + nameIndexMapping[nameIndex] = globalIndex; + }, + ); + + // Handle remaining replacements + let remainer = ""; + for (; i < replacements.length; i++) { + remainer += replacements[i].content; + } + + // Insert remaining replacements content splitted into chunks by lines + let line = /** @type {number} */ (generatedLine) + generatedLineOffset; + const matches = splitIntoLines(remainer); + for (let m = 0; m < matches.length; m++) { + const contentLine = matches[m]; + onChunk( + contentLine, + line, + /** @type {number} */ + (generatedColumn) + + (line === generatedColumnOffsetLine ? generatedColumnOffset : 0), + -1, + -1, + -1, + -1, + ); + + if (m === matches.length - 1 && !contentLine.endsWith("\n")) { + if (generatedColumnOffsetLine === line) { + generatedColumnOffset += contentLine.length; + } else { + generatedColumnOffset = contentLine.length; + generatedColumnOffsetLine = line; + } + } else { + generatedLineOffset++; + line++; + generatedColumnOffset = -(/** @type {number} */ (generatedColumn)); + generatedColumnOffsetLine = line; + } + } + + return { + generatedLine: line, + generatedColumn: + /** @type {number} */ + (generatedColumn) + + (line === generatedColumnOffsetLine ? generatedColumnOffset : 0), + }; + } + + /** + * @param {HashLike} hash hash + * @returns {void} + */ + updateHash(hash) { + this._sortReplacements(); + hash.update("ReplaceSource"); + this._source.updateHash(hash); + hash.update(this._name || ""); + for (const repl of this._replacements) { + hash.update( + `${repl.start}${repl.end}${repl.content}${repl.name ? repl.name : ""}`, + ); + } + } +} + +module.exports = ReplaceSource; +module.exports.Replacement = Replacement; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/SizeOnlySource.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/SizeOnlySource.js new file mode 100644 index 0000000000000000000000000000000000000000..fca8f8a44a367d47067300ac53e6a15e2aeb47dc --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/SizeOnlySource.js @@ -0,0 +1,67 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const Source = require("./Source"); + +/** @typedef {import("./Source").HashLike} HashLike */ +/** @typedef {import("./Source").MapOptions} MapOptions */ +/** @typedef {import("./Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./Source").SourceValue} SourceValue */ + +class SizeOnlySource extends Source { + /** + * @param {number} size size + */ + constructor(size) { + super(); + this._size = size; + } + + _error() { + return new Error( + "Content and Map of this Source is not available (only size() is supported)", + ); + } + + size() { + return this._size; + } + + /** + * @returns {SourceValue} source + */ + source() { + throw this._error(); + } + + /** + * @returns {Buffer} buffer + */ + buffer() { + throw this._error(); + } + + /** + * @param {MapOptions=} options map options + * @returns {RawSourceMap | null} map + */ + // eslint-disable-next-line no-unused-vars + map(options) { + throw this._error(); + } + + /** + * @param {HashLike} hash hash + * @returns {void} + */ + // eslint-disable-next-line no-unused-vars + updateHash(hash) { + throw this._error(); + } +} + +module.exports = SizeOnlySource; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/Source.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/Source.js new file mode 100644 index 0000000000000000000000000000000000000000..39859e2ba6c31ffa2544435193b0e9aefef60dcb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/Source.js @@ -0,0 +1,89 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +/** + * @typedef {object} MapOptions + * @property {boolean=} columns need columns? + * @property {boolean=} module is module + */ + +/** + * @typedef {object} RawSourceMap + * @property {number} version version + * @property {string[]} sources sources + * @property {string[]} names names + * @property {string=} sourceRoot source root + * @property {string[]=} sourcesContent sources content + * @property {string} mappings mappings + * @property {string} file file + * @property {string=} debugId debug id + * @property {number[]=} ignoreList ignore list + */ + +/** @typedef {string | Buffer} SourceValue */ + +/** + * @typedef {object} SourceAndMap + * @property {SourceValue} source source + * @property {RawSourceMap | null} map map + */ + +/** + * @typedef {object} HashLike + * @property {(data: string | Buffer, inputEncoding?: string) => HashLike} update make hash update + * @property {(encoding?: string) => string | Buffer} digest get hash digest + */ + +class Source { + /** + * @returns {SourceValue} source + */ + source() { + throw new Error("Abstract"); + } + + buffer() { + const source = this.source(); + if (Buffer.isBuffer(source)) return source; + return Buffer.from(source, "utf8"); + } + + size() { + return this.buffer().length; + } + + /** + * @param {MapOptions=} options map options + * @returns {RawSourceMap | null} map + */ + // eslint-disable-next-line no-unused-vars + map(options) { + return null; + } + + /** + * @param {MapOptions=} options map options + * @returns {SourceAndMap} source and map + */ + sourceAndMap(options) { + return { + source: this.source(), + map: this.map(options), + }; + } + + /** + * @param {HashLike} hash hash + * @returns {void} + */ + // eslint-disable-next-line no-unused-vars + updateHash(hash) { + throw new Error("Abstract"); + } +} + +module.exports = Source; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/SourceMapSource.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/SourceMapSource.js new file mode 100644 index 0000000000000000000000000000000000000000..f9be82a032d7daed828f4819e70cde42088bafc6 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/SourceMapSource.js @@ -0,0 +1,366 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const Source = require("./Source"); +const { getMap, getSourceAndMap } = require("./helpers/getFromStreamChunks"); +const streamChunksOfCombinedSourceMap = require("./helpers/streamChunksOfCombinedSourceMap"); +const streamChunksOfSourceMap = require("./helpers/streamChunksOfSourceMap"); +const { + isDualStringBufferCachingEnabled, +} = require("./helpers/stringBufferUtils"); + +/** @typedef {import("./Source").HashLike} HashLike */ +/** @typedef {import("./Source").MapOptions} MapOptions */ +/** @typedef {import("./Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./Source").SourceAndMap} SourceAndMap */ +/** @typedef {import("./Source").SourceValue} SourceValue */ +/** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */ +/** @typedef {import("./helpers/streamChunks").OnName} OnName */ +/** @typedef {import("./helpers/streamChunks").OnSource} OnSource */ +/** @typedef {import("./helpers/streamChunks").Options} Options */ + +class SourceMapSource extends Source { + /** + * @param {string | Buffer} value value + * @param {string} name name + * @param {string | Buffer | RawSourceMap=} sourceMap source map + * @param {SourceValue=} originalSource original source + * @param {(string | Buffer | RawSourceMap)=} innerSourceMap inner source map + * @param {boolean=} removeOriginalSource do remove original source + */ + constructor( + value, + name, + sourceMap, + originalSource, + innerSourceMap, + removeOriginalSource, + ) { + super(); + const valueIsBuffer = Buffer.isBuffer(value); + /** + * @private + * @type {undefined | string} + */ + this._valueAsString = valueIsBuffer ? undefined : value; + /** + * @private + * @type {undefined | Buffer} + */ + this._valueAsBuffer = valueIsBuffer ? value : undefined; + + this._name = name; + + this._hasSourceMap = Boolean(sourceMap); + const sourceMapIsBuffer = Buffer.isBuffer(sourceMap); + const sourceMapIsString = typeof sourceMap === "string"; + /** + * @private + * @type {undefined | RawSourceMap} + */ + this._sourceMapAsObject = + sourceMapIsBuffer || sourceMapIsString ? undefined : sourceMap; + /** + * @private + * @type {undefined | string} + */ + this._sourceMapAsString = sourceMapIsString ? sourceMap : undefined; + /** + * @private + * @type {undefined | Buffer} + */ + this._sourceMapAsBuffer = sourceMapIsBuffer ? sourceMap : undefined; + + this._hasOriginalSource = Boolean(originalSource); + const originalSourceIsBuffer = Buffer.isBuffer(originalSource); + this._originalSourceAsString = originalSourceIsBuffer + ? undefined + : originalSource; + this._originalSourceAsBuffer = originalSourceIsBuffer + ? originalSource + : undefined; + + this._hasInnerSourceMap = Boolean(innerSourceMap); + const innerSourceMapIsBuffer = Buffer.isBuffer(innerSourceMap); + const innerSourceMapIsString = typeof innerSourceMap === "string"; + /** + * @private + * @type {undefined | RawSourceMap} + */ + this._innerSourceMapAsObject = + innerSourceMapIsBuffer || innerSourceMapIsString + ? undefined + : innerSourceMap; + /** + * @private + * @type {undefined | string} + */ + this._innerSourceMapAsString = innerSourceMapIsString + ? innerSourceMap + : undefined; + /** + * @private + * @type {undefined | Buffer} + */ + this._innerSourceMapAsBuffer = innerSourceMapIsBuffer + ? innerSourceMap + : undefined; + + this._removeOriginalSource = removeOriginalSource; + } + + /** + * @returns {[Buffer, string, Buffer, Buffer | undefined, Buffer | undefined, boolean | undefined]} args + */ + getArgsAsBuffers() { + return [ + this.buffer(), + this._name, + this._sourceMapBuffer(), + this._originalSourceBuffer(), + this._innerSourceMapBuffer(), + this._removeOriginalSource, + ]; + } + + buffer() { + if (this._valueAsBuffer === undefined) { + const value = Buffer.from( + /** @type {string} */ (this._valueAsString), + "utf8", + ); + if (isDualStringBufferCachingEnabled()) { + this._valueAsBuffer = value; + } + return value; + } + return this._valueAsBuffer; + } + + /** + * @returns {SourceValue} source + */ + source() { + if (this._valueAsString === undefined) { + const value = + /** @type {Buffer} */ + (this._valueAsBuffer).toString("utf8"); + if (isDualStringBufferCachingEnabled()) { + this._valueAsString = value; + } + return value; + } + return this._valueAsString; + } + + /** + * @private + * @returns {undefined | Buffer} buffer + */ + _originalSourceBuffer() { + if (this._originalSourceAsBuffer === undefined && this._hasOriginalSource) { + const value = Buffer.from( + /** @type {string} */ + (this._originalSourceAsString), + "utf8", + ); + if (isDualStringBufferCachingEnabled()) { + this._originalSourceAsBuffer = value; + } + return value; + } + return this._originalSourceAsBuffer; + } + + _originalSourceString() { + if (this._originalSourceAsString === undefined && this._hasOriginalSource) { + const value = + /** @type {Buffer} */ + (this._originalSourceAsBuffer).toString("utf8"); + if (isDualStringBufferCachingEnabled()) { + this._originalSourceAsString = value; + } + return value; + } + return this._originalSourceAsString; + } + + _innerSourceMapObject() { + if (this._innerSourceMapAsObject === undefined && this._hasInnerSourceMap) { + const value = JSON.parse(this._innerSourceMapString()); + if (isDualStringBufferCachingEnabled()) { + this._innerSourceMapAsObject = value; + } + return value; + } + return this._innerSourceMapAsObject; + } + + _innerSourceMapBuffer() { + if (this._innerSourceMapAsBuffer === undefined && this._hasInnerSourceMap) { + const value = Buffer.from(this._innerSourceMapString(), "utf8"); + if (isDualStringBufferCachingEnabled()) { + this._innerSourceMapAsBuffer = value; + } + return value; + } + return this._innerSourceMapAsBuffer; + } + + /** + * @private + * @returns {string} result + */ + _innerSourceMapString() { + if (this._innerSourceMapAsString === undefined && this._hasInnerSourceMap) { + if (this._innerSourceMapAsBuffer !== undefined) { + const value = this._innerSourceMapAsBuffer.toString("utf8"); + if (isDualStringBufferCachingEnabled()) { + this._innerSourceMapAsString = value; + } + return value; + } + const value = JSON.stringify(this._innerSourceMapAsObject); + if (isDualStringBufferCachingEnabled()) { + this._innerSourceMapAsString = value; + } + return value; + } + return /** @type {string} */ (this._innerSourceMapAsString); + } + + _sourceMapObject() { + if (this._sourceMapAsObject === undefined) { + const value = JSON.parse(this._sourceMapString()); + if (isDualStringBufferCachingEnabled()) { + this._sourceMapAsObject = value; + } + return value; + } + return this._sourceMapAsObject; + } + + _sourceMapBuffer() { + if (this._sourceMapAsBuffer === undefined) { + const value = Buffer.from(this._sourceMapString(), "utf8"); + if (isDualStringBufferCachingEnabled()) { + this._sourceMapAsBuffer = value; + } + return value; + } + return this._sourceMapAsBuffer; + } + + _sourceMapString() { + if (this._sourceMapAsString === undefined) { + if (this._sourceMapAsBuffer !== undefined) { + const value = this._sourceMapAsBuffer.toString("utf8"); + if (isDualStringBufferCachingEnabled()) { + this._sourceMapAsString = value; + } + return value; + } + const value = JSON.stringify(this._sourceMapAsObject); + if (isDualStringBufferCachingEnabled()) { + this._sourceMapAsString = value; + } + return value; + } + return this._sourceMapAsString; + } + + /** + * @param {MapOptions=} options map options + * @returns {RawSourceMap | null} map + */ + map(options) { + if (!this._hasInnerSourceMap) { + return this._sourceMapObject(); + } + return getMap(this, options); + } + + /** + * @param {MapOptions=} options map options + * @returns {SourceAndMap} source and map + */ + sourceAndMap(options) { + if (!this._hasInnerSourceMap) { + return { + source: this.source(), + map: this._sourceMapObject(), + }; + } + return getSourceAndMap(this, options); + } + + /** + * @param {Options} options options + * @param {OnChunk} onChunk called for each chunk of code + * @param {OnSource} onSource called for each source + * @param {OnName} onName called for each name + * @returns {GeneratedSourceInfo} generated source info + */ + streamChunks(options, onChunk, onSource, onName) { + if (this._hasInnerSourceMap) { + return streamChunksOfCombinedSourceMap( + /** @type {string} */ + (this.source()), + this._sourceMapObject(), + this._name, + /** @type {string} */ + (this._originalSourceString()), + this._innerSourceMapObject(), + this._removeOriginalSource, + onChunk, + onSource, + onName, + Boolean(options && options.finalSource), + Boolean(options && options.columns !== false), + ); + } + return streamChunksOfSourceMap( + /** @type {string} */ + (this.source()), + this._sourceMapObject(), + onChunk, + onSource, + onName, + Boolean(options && options.finalSource), + Boolean(options && options.columns !== false), + ); + } + + /** + * @param {HashLike} hash hash + * @returns {void} + */ + updateHash(hash) { + hash.update("SourceMapSource"); + hash.update(this.buffer()); + hash.update(this._sourceMapBuffer()); + + if (this._hasOriginalSource) { + hash.update( + /** @type {Buffer} */ + (this._originalSourceBuffer()), + ); + } + + if (this._hasInnerSourceMap) { + hash.update( + /** @type {Buffer} */ + (this._innerSourceMapBuffer()), + ); + } + + hash.update(this._removeOriginalSource ? "true" : "false"); + } +} + +module.exports = SourceMapSource; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/createMappingsSerializer.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/createMappingsSerializer.js new file mode 100644 index 0000000000000000000000000000000000000000..860b3dac48e906248f5178e2cde9a9fb15c53eb5 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/createMappingsSerializer.js @@ -0,0 +1,225 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +/** + * @callback MappingsSerializer + * @param {number} generatedLine generated line + * @param {number} generatedColumn generated column + * @param {number} sourceIndex source index + * @param {number} originalLine original line + * @param {number} originalColumn generated line + * @param {number} nameIndex generated line + * @returns {string} result + */ + +const ALPHABET = [ + ..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", +]; + +const CONTINUATION_BIT = 0x20; + +const createFullMappingsSerializer = () => { + let currentLine = 1; + let currentColumn = 0; + let currentSourceIndex = 0; + let currentOriginalLine = 1; + let currentOriginalColumn = 0; + let currentNameIndex = 0; + let activeMapping = false; + let activeName = false; + let initial = true; + /** @type {MappingsSerializer} */ + return ( + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + if (activeMapping && currentLine === generatedLine) { + // A mapping is still active + if ( + sourceIndex === currentSourceIndex && + originalLine === currentOriginalLine && + originalColumn === currentOriginalColumn && + !activeName && + nameIndex < 0 + ) { + // avoid repeating the same original mapping + return ""; + } + } + // No mapping is active + else if (sourceIndex < 0) { + // avoid writing unneccessary generated mappings + return ""; + } + + /** @type {undefined | string} */ + let str; + if (currentLine < generatedLine) { + str = ";".repeat(generatedLine - currentLine); + currentLine = generatedLine; + currentColumn = 0; + initial = false; + } else if (initial) { + str = ""; + initial = false; + } else { + str = ","; + } + + /** + * @param {number} value value + * @returns {void} + */ + const writeValue = (value) => { + const sign = (value >>> 31) & 1; + const mask = value >> 31; + const absValue = (value + mask) ^ mask; + let data = (absValue << 1) | sign; + for (;;) { + const sextet = data & 0x1f; + data >>= 5; + if (data === 0) { + str += ALPHABET[sextet]; + break; + } else { + str += ALPHABET[sextet | CONTINUATION_BIT]; + } + } + }; + writeValue(generatedColumn - currentColumn); + currentColumn = generatedColumn; + if (sourceIndex >= 0) { + activeMapping = true; + if (sourceIndex === currentSourceIndex) { + str += "A"; + } else { + writeValue(sourceIndex - currentSourceIndex); + currentSourceIndex = sourceIndex; + } + writeValue(originalLine - currentOriginalLine); + currentOriginalLine = originalLine; + if (originalColumn === currentOriginalColumn) { + str += "A"; + } else { + writeValue(originalColumn - currentOriginalColumn); + currentOriginalColumn = originalColumn; + } + if (nameIndex >= 0) { + writeValue(nameIndex - currentNameIndex); + currentNameIndex = nameIndex; + activeName = true; + } else { + activeName = false; + } + } else { + activeMapping = false; + } + return str; + }; +}; + +const createLinesOnlyMappingsSerializer = () => { + let lastWrittenLine = 0; + let currentLine = 1; + let currentSourceIndex = 0; + let currentOriginalLine = 1; + /** @type {MappingsSerializer} */ + return ( + generatedLine, + _generatedColumn, + sourceIndex, + originalLine, + _originalColumn, + _nameIndex, + ) => { + if (sourceIndex < 0) { + // avoid writing generated mappings at all + return ""; + } + if (lastWrittenLine === generatedLine) { + // avoid writing multiple original mappings per line + return ""; + } + /** @type {undefined | string} */ + let str; + /** + * @param {number} value value + * @returns {void} + */ + const writeValue = (value) => { + const sign = (value >>> 31) & 1; + const mask = value >> 31; + const absValue = (value + mask) ^ mask; + let data = (absValue << 1) | sign; + for (;;) { + const sextet = data & 0x1f; + data >>= 5; + if (data === 0) { + str += ALPHABET[sextet]; + break; + } else { + str += ALPHABET[sextet | CONTINUATION_BIT]; + } + } + }; + lastWrittenLine = generatedLine; + if (generatedLine === currentLine + 1) { + currentLine = generatedLine; + if (sourceIndex === currentSourceIndex) { + if (originalLine === currentOriginalLine + 1) { + currentOriginalLine = originalLine; + return ";AACA"; + } + str = ";AA"; + writeValue(originalLine - currentOriginalLine); + currentOriginalLine = originalLine; + return `${str}A`; + } + str = ";A"; + writeValue(sourceIndex - currentSourceIndex); + currentSourceIndex = sourceIndex; + writeValue(originalLine - currentOriginalLine); + currentOriginalLine = originalLine; + return `${str}A`; + } + str = ";".repeat(generatedLine - currentLine); + currentLine = generatedLine; + if (sourceIndex === currentSourceIndex) { + if (originalLine === currentOriginalLine + 1) { + currentOriginalLine = originalLine; + return `${str}AACA`; + } + str += "AA"; + writeValue(originalLine - currentOriginalLine); + currentOriginalLine = originalLine; + return `${str}A`; + } + str += "A"; + writeValue(sourceIndex - currentSourceIndex); + currentSourceIndex = sourceIndex; + writeValue(originalLine - currentOriginalLine); + currentOriginalLine = originalLine; + return `${str}A`; + }; +}; + +/** + * @param {{ columns?: boolean }=} options options + * @returns {MappingsSerializer} mappings serializer + */ +const createMappingsSerializer = (options) => { + const linesOnly = options && options.columns === false; + return linesOnly + ? createLinesOnlyMappingsSerializer() + : createFullMappingsSerializer(); +}; + +module.exports = createMappingsSerializer; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getFromStreamChunks.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getFromStreamChunks.js new file mode 100644 index 0000000000000000000000000000000000000000..fbd046effa278ae9eec0db70a43156fc9d64a618 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getFromStreamChunks.js @@ -0,0 +1,159 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const createMappingsSerializer = require("./createMappingsSerializer"); + +/** @typedef {import("../Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("../Source").SourceAndMap} SourceAndMap */ +/** @typedef {import("./streamChunks").Options} Options */ +/** @typedef {import("./streamChunks").StreamChunksFunction} StreamChunksFunction */ + +/** @typedef {{ streamChunks: StreamChunksFunction }} SourceLikeWithStreamChunks */ + +/** + * @param {SourceLikeWithStreamChunks} inputSource input source + * @param {Options=} options options + * @returns {SourceAndMap} map + */ +module.exports.getSourceAndMap = (inputSource, options) => { + let code = ""; + let mappings = ""; + /** @type {(string | null)[]} */ + const potentialSources = []; + /** @type {(string | null)[]} */ + const potentialSourcesContent = []; + /** @type {(string | null)[]} */ + const potentialNames = []; + const addMapping = createMappingsSerializer(options); + const { source } = inputSource.streamChunks( + { ...options, finalSource: true }, + ( + chunk, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + if (chunk !== undefined) code += chunk; + mappings += addMapping( + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ); + }, + (sourceIndex, source, sourceContent) => { + while (potentialSources.length < sourceIndex) { + potentialSources.push(null); + } + potentialSources[sourceIndex] = source; + if (sourceContent !== undefined) { + while (potentialSourcesContent.length < sourceIndex) { + potentialSourcesContent.push(null); + } + potentialSourcesContent[sourceIndex] = sourceContent; + } + }, + (nameIndex, name) => { + while (potentialNames.length < nameIndex) { + potentialNames.push(null); + } + potentialNames[nameIndex] = name; + }, + ); + return { + source: source !== undefined ? source : code, + map: + mappings.length > 0 + ? { + version: 3, + file: "x", + mappings, + // We handle broken sources as `null`, in spec this field should be string, but no information what we should do in such cases if we change type it will be breaking change + sources: /** @type {string[]} */ (potentialSources), + sourcesContent: + potentialSourcesContent.length > 0 + ? /** @type {string[]} */ (potentialSourcesContent) + : undefined, + names: /** @type {string[]} */ (potentialNames), + } + : null, + }; +}; + +/** + * @param {SourceLikeWithStreamChunks} source source + * @param {Options=} options options + * @returns {RawSourceMap | null} map + */ +module.exports.getMap = (source, options) => { + let mappings = ""; + /** @type {(string | null)[]} */ + const potentialSources = []; + /** @type {(string | null)[]} */ + const potentialSourcesContent = []; + /** @type {(string | null)[]} */ + const potentialNames = []; + const addMapping = createMappingsSerializer(options); + source.streamChunks( + { ...options, source: false, finalSource: true }, + ( + chunk, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + mappings += addMapping( + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ); + }, + (sourceIndex, source, sourceContent) => { + while (potentialSources.length < sourceIndex) { + potentialSources.push(null); + } + potentialSources[sourceIndex] = source; + if (sourceContent !== undefined) { + while (potentialSourcesContent.length < sourceIndex) { + potentialSourcesContent.push(null); + } + potentialSourcesContent[sourceIndex] = sourceContent; + } + }, + (nameIndex, name) => { + while (potentialNames.length < nameIndex) { + potentialNames.push(null); + } + potentialNames[nameIndex] = name; + }, + ); + return mappings.length > 0 + ? { + version: 3, + file: "x", + mappings, + // We handle broken sources as `null`, in spec this field should be string, but no information what we should do in such cases if we change type it will be breaking change + sources: /** @type {string[]} */ (potentialSources), + sourcesContent: + potentialSourcesContent.length > 0 + ? /** @type {string[]} */ (potentialSourcesContent) + : undefined, + names: /** @type {string[]} */ (potentialNames), + } + : null; +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getGeneratedSourceInfo.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getGeneratedSourceInfo.js new file mode 100644 index 0000000000000000000000000000000000000000..baee63edbf814e146e0bc95f4515d8855a295cb1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getGeneratedSourceInfo.js @@ -0,0 +1,44 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const CHAR_CODE_NEW_LINE = "\n".charCodeAt(0); + +/** + * @typedef {object} GeneratedSourceInfo + * @property {number=} generatedLine generated line + * @property {number=} generatedColumn generated column + * @property {string=} source source + */ + +/** + * @param {string | undefined} source source + * @returns {GeneratedSourceInfo} source info + */ +const getGeneratedSourceInfo = (source) => { + if (source === undefined) { + return {}; + } + const lastLineStart = source.lastIndexOf("\n"); + if (lastLineStart === -1) { + return { + generatedLine: 1, + generatedColumn: source.length, + source, + }; + } + let generatedLine = 2; + for (let i = 0; i < lastLineStart; i++) { + if (source.charCodeAt(i) === CHAR_CODE_NEW_LINE) generatedLine++; + } + return { + generatedLine, + generatedColumn: source.length - lastLineStart - 1, + source, + }; +}; + +module.exports = getGeneratedSourceInfo; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getName.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getName.js new file mode 100644 index 0000000000000000000000000000000000000000..df290d3ebbc2ae845539a45404090e7570762ab4 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getName.js @@ -0,0 +1,21 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +/** @typedef {import("../Source").RawSourceMap} RawSourceMap */ + +/** + * @param {RawSourceMap} sourceMap source map + * @param {number} index index + * @returns {string | undefined | null} name + */ +const getName = (sourceMap, index) => { + if (index < 0) return null; + const { names } = sourceMap; + return names[index]; +}; + +module.exports = getName; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getSource.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getSource.js new file mode 100644 index 0000000000000000000000000000000000000000..f1f9ce3f77592567bf3a08d0ae12585dd08ebe7d --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/getSource.js @@ -0,0 +1,24 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +/** @typedef {import("../Source").RawSourceMap} RawSourceMap */ + +/** + * @param {RawSourceMap} sourceMap source map + * @param {number} index index + * @returns {string | null} name + */ +const getSource = (sourceMap, index) => { + if (index < 0) return null; + const { sourceRoot, sources } = sourceMap; + const source = sources[index]; + if (!sourceRoot) return source; + if (sourceRoot.endsWith("/")) return sourceRoot + source; + return `${sourceRoot}/${source}`; +}; + +module.exports = getSource; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/readMappings.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/readMappings.js new file mode 100644 index 0000000000000000000000000000000000000000..28dcece5cb127c68246511ebe818f82c0bec2d06 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/readMappings.js @@ -0,0 +1,120 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const ALPHABET = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +const CONTINUATION_BIT = 0x20; +const END_SEGMENT_BIT = 0x40; +const NEXT_LINE = END_SEGMENT_BIT | 0x01; +const INVALID = END_SEGMENT_BIT | 0x02; +const DATA_MASK = 0x1f; + +const ccToValue = new Uint8Array("z".charCodeAt(0) + 1); + +ccToValue.fill(INVALID); + +for (let i = 0; i < ALPHABET.length; i++) { + ccToValue[ALPHABET.charCodeAt(i)] = i; +} + +ccToValue[",".charCodeAt(0)] = END_SEGMENT_BIT; +ccToValue[";".charCodeAt(0)] = NEXT_LINE; + +const ccMax = ccToValue.length - 1; + +/** @typedef {(generatedLine: number, generatedColumn: number, sourceIndex: number, originalLine: number, originalColumn: number, nameIndex: number) => void} OnMapping */ + +/** + * @param {string} mappings the mappings string + * @param {OnMapping} onMapping called for each mapping + * @returns {void} + */ +const readMappings = (mappings, onMapping) => { + // generatedColumn, [sourceIndex, originalLine, orignalColumn, [nameIndex]] + const currentData = new Uint32Array([0, 0, 1, 0, 0]); + let currentDataPos = 0; + // currentValue will include a sign bit at bit 0 + let currentValue = 0; + let currentValuePos = 0; + let generatedLine = 1; + let generatedColumn = -1; + for (let i = 0; i < mappings.length; i++) { + const cc = mappings.charCodeAt(i); + if (cc > ccMax) continue; + const value = ccToValue[cc]; + if ((value & END_SEGMENT_BIT) !== 0) { + // End current segment + if (currentData[0] > generatedColumn) { + if (currentDataPos === 1) { + onMapping(generatedLine, currentData[0], -1, -1, -1, -1); + } else if (currentDataPos === 4) { + onMapping( + generatedLine, + currentData[0], + currentData[1], + currentData[2], + currentData[3], + -1, + ); + } else if (currentDataPos === 5) { + onMapping( + generatedLine, + currentData[0], + currentData[1], + currentData[2], + currentData[3], + currentData[4], + ); + } + [generatedColumn] = currentData; + } + currentDataPos = 0; + if (value === NEXT_LINE) { + // Start new line + generatedLine++; + currentData[0] = 0; + generatedColumn = -1; + } + } else if ((value & CONTINUATION_BIT) === 0) { + // last sextet + currentValue |= value << currentValuePos; + const finalValue = + currentValue & 1 ? -(currentValue >> 1) : currentValue >> 1; + currentData[currentDataPos++] += finalValue; + currentValuePos = 0; + currentValue = 0; + } else { + currentValue |= (value & DATA_MASK) << currentValuePos; + currentValuePos += 5; + } + } + // End current segment + if (currentDataPos === 1) { + onMapping(generatedLine, currentData[0], -1, -1, -1, -1); + } else if (currentDataPos === 4) { + onMapping( + generatedLine, + currentData[0], + currentData[1], + currentData[2], + currentData[3], + -1, + ); + } else if (currentDataPos === 5) { + onMapping( + generatedLine, + currentData[0], + currentData[1], + currentData[2], + currentData[3], + currentData[4], + ); + } +}; + +module.exports = readMappings; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/splitIntoLines.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/splitIntoLines.js new file mode 100644 index 0000000000000000000000000000000000000000..b2a4f580c7ba7fbe9ea5d1cc59de976cdf33262f --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/splitIntoLines.js @@ -0,0 +1,33 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +/** + * @param {string} str string + * @returns {string[]} array of string separated by lines + */ +const splitIntoLines = (str) => { + const results = []; + const len = str.length; + let i = 0; + while (i < len) { + const cc = str.charCodeAt(i); + // 10 is "\n".charCodeAt(0) + if (cc === 10) { + results.push("\n"); + i++; + } else { + let j = i + 1; + // 10 is "\n".charCodeAt(0) + while (j < len && str.charCodeAt(j) !== 10) j++; + results.push(str.slice(i, j + 1)); + i = j + 1; + } + } + return results; +}; + +module.exports = splitIntoLines; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/splitIntoPotentialTokens.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/splitIntoPotentialTokens.js new file mode 100644 index 0000000000000000000000000000000000000000..4ea2bbfb105b2a8377bc790066e524794640b3aa --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/splitIntoPotentialTokens.js @@ -0,0 +1,53 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +// \n = 10 +// ; = 59 +// { = 123 +// } = 125 +// = 32 +// \r = 13 +// \t = 9 + +/** + * @param {string} str string + * @returns {string[] | null} array of string separated by potential tokens + */ +const splitIntoPotentialTokens = (str) => { + const len = str.length; + if (len === 0) return null; + const results = []; + let i = 0; + while (i < len) { + const start = i; + block: { + let cc = str.charCodeAt(i); + while (cc !== 10 && cc !== 59 && cc !== 123 && cc !== 125) { + if (++i >= len) break block; + cc = str.charCodeAt(i); + } + while ( + cc === 59 || + cc === 32 || + cc === 123 || + cc === 125 || + cc === 13 || + cc === 9 + ) { + if (++i >= len) break block; + cc = str.charCodeAt(i); + } + if (cc === 10) { + i++; + } + } + results.push(str.slice(start, i)); + } + return results; +}; + +module.exports = splitIntoPotentialTokens; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamAndGetSourceAndMap.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamAndGetSourceAndMap.js new file mode 100644 index 0000000000000000000000000000000000000000..0db0549af636736a0bd20b0e4e81387fcc34e31a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamAndGetSourceAndMap.js @@ -0,0 +1,123 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const createMappingsSerializer = require("./createMappingsSerializer"); +const streamChunks = require("./streamChunks"); + +/** @typedef {import("../Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./streamChunks").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./streamChunks").OnChunk} OnChunk */ +/** @typedef {import("./streamChunks").OnName} OnName */ +/** @typedef {import("./streamChunks").OnSource} OnSource */ +/** @typedef {import("./streamChunks").Options} Options */ +/** @typedef {import("./streamChunks").SourceMaybeWithStreamChunksFunction} SourceMaybeWithStreamChunksFunction */ + +/** + * @param {SourceMaybeWithStreamChunksFunction} inputSource input source + * @param {Options} options options + * @param {OnChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} onName on name + * @returns {{ result: GeneratedSourceInfo, source: string, map: RawSourceMap | null }} result + */ +const streamAndGetSourceAndMap = ( + inputSource, + options, + onChunk, + onSource, + onName, +) => { + let code = ""; + let mappings = ""; + /** @type {(string | null)[]} */ + const potentialSources = []; + /** @type {(string | null)[]} */ + const potentialSourcesContent = []; + /** @type {(string | null)[]} */ + const potentialNames = []; + const addMapping = createMappingsSerializer({ ...options, columns: true }); + const finalSource = Boolean(options && options.finalSource); + const { generatedLine, generatedColumn, source } = streamChunks( + inputSource, + options, + ( + chunk, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + if (chunk !== undefined) code += chunk; + mappings += addMapping( + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ); + return onChunk( + finalSource ? undefined : chunk, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ); + }, + (sourceIndex, source, sourceContent) => { + while (potentialSources.length < sourceIndex) { + potentialSources.push(null); + } + potentialSources[sourceIndex] = source; + if (sourceContent !== undefined) { + while (potentialSourcesContent.length < sourceIndex) { + potentialSourcesContent.push(null); + } + potentialSourcesContent[sourceIndex] = sourceContent; + } + return onSource(sourceIndex, source, sourceContent); + }, + (nameIndex, name) => { + while (potentialNames.length < nameIndex) { + potentialNames.push(null); + } + potentialNames[nameIndex] = name; + return onName(nameIndex, name); + }, + ); + const resultSource = source !== undefined ? source : code; + + return { + result: { + generatedLine, + generatedColumn, + source: finalSource ? resultSource : undefined, + }, + source: resultSource, + map: + mappings.length > 0 + ? { + version: 3, + file: "x", + mappings, + // We handle broken sources as `null`, in spec this field should be string, but no information what we should do in such cases if we change type it will be breaking change + sources: /** @type {string[]} */ (potentialSources), + sourcesContent: + potentialSourcesContent.length > 0 + ? /** @type {string[]} */ (potentialSourcesContent) + : undefined, + names: /** @type {string[]} */ (potentialNames), + } + : null, + }; +}; + +module.exports = streamAndGetSourceAndMap; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunks.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunks.js new file mode 100644 index 0000000000000000000000000000000000000000..514015640356185c4c416cfc4f7493fa1fcb7e8a --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunks.js @@ -0,0 +1,62 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const streamChunksOfRawSource = require("./streamChunksOfRawSource"); +const streamChunksOfSourceMap = require("./streamChunksOfSourceMap"); + +/** @typedef {import("../Source")} Source */ +/** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {(chunk: string | undefined, generatedLine: number, generatedColumn: number, sourceIndex: number, originalLine: number, originalColumn: number, nameIndex: number) => void} OnChunk */ +/** @typedef {(sourceIndex: number, source: string | null, sourceContent: string | undefined) => void} OnSource */ +/** @typedef {(nameIndex: number, name: string) => void} OnName */ + +/** @typedef {{ source?: boolean, finalSource?: boolean, columns?: boolean }} Options */ + +/** + * @callback StreamChunksFunction + * @param {Options} options options + * @param {OnChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} onName on name + */ + +/** @typedef {Source & { streamChunks?: StreamChunksFunction }} SourceMaybeWithStreamChunksFunction */ + +/** + * @param {SourceMaybeWithStreamChunksFunction} source source + * @param {Options} options options + * @param {OnChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} onName on name + * @returns {GeneratedSourceInfo} generated source info + */ +module.exports = (source, options, onChunk, onSource, onName) => { + if (typeof source.streamChunks === "function") { + return source.streamChunks(options, onChunk, onSource, onName); + } + const sourceAndMap = source.sourceAndMap(options); + if (sourceAndMap.map) { + return streamChunksOfSourceMap( + /** @type {string} */ + (sourceAndMap.source), + sourceAndMap.map, + onChunk, + onSource, + onName, + Boolean(options && options.finalSource), + Boolean(options && options.columns !== false), + ); + } + return streamChunksOfRawSource( + /** @type {string} */ + (sourceAndMap.source), + onChunk, + onSource, + onName, + Boolean(options && options.finalSource), + ); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunksOfCombinedSourceMap.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunksOfCombinedSourceMap.js new file mode 100644 index 0000000000000000000000000000000000000000..d1355f188fc4fe707736d137297eb3634607346b --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunksOfCombinedSourceMap.js @@ -0,0 +1,366 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const splitIntoLines = require("./splitIntoLines"); +const streamChunksOfSourceMap = require("./streamChunksOfSourceMap"); + +/** @typedef {import("../Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./streamChunks").OnChunk} onChunk */ +/** @typedef {import("./streamChunks").OnName} OnName */ +/** @typedef {import("./streamChunks").OnSource} OnSource */ + +/** + * @param {string} source source + * @param {RawSourceMap} sourceMap source map + * @param {string} innerSourceName inner source name + * @param {string} innerSource inner source + * @param {RawSourceMap} innerSourceMap inner source map + * @param {boolean | undefined} removeInnerSource do remove inner source + * @param {onChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} onName on name + * @param {boolean} finalSource finalSource + * @param {boolean} columns columns + * @returns {GeneratedSourceInfo} generated source info + */ +const streamChunksOfCombinedSourceMap = ( + source, + sourceMap, + innerSourceName, + innerSource, + innerSourceMap, + removeInnerSource, + onChunk, + onSource, + onName, + finalSource, + columns, +) => { + /** @type {Map} */ + const sourceMapping = new Map(); + /** @type {Map} */ + const nameMapping = new Map(); + /** @type {number[]} */ + const sourceIndexMapping = []; + /** @type {number[]} */ + const nameIndexMapping = []; + /** @type {string[]} */ + const nameIndexValueMapping = []; + let outerSourceIndex = -2; + /** @type {number[]} */ + const innerSourceIndexMapping = []; + /** @type {[string | null, string | undefined][]} */ + const innerSourceIndexValueMapping = []; + /** @type {(string | undefined)[]} */ + const innerSourceContents = []; + /** @type {(null | undefined | string[])[]} */ + const innerSourceContentLines = []; + /** @type {number[]} */ + const innerNameIndexMapping = []; + /** @type {string[]} */ + const innerNameIndexValueMapping = []; + /** @typedef {[number, number, number, number, number] | number[]} MappingsData */ + /** @type {{ chunks: string[], mappingsData: MappingsData }[]} */ + const innerSourceMapLineData = []; + /** + * @param {number} line line + * @param {number} column column + * @returns {number} result + */ + const findInnerMapping = (line, column) => { + if (line > innerSourceMapLineData.length) return -1; + const { mappingsData } = innerSourceMapLineData[line - 1]; + let l = 0; + let r = mappingsData.length / 5; + while (l < r) { + const m = (l + r) >> 1; + if (mappingsData[m * 5] <= column) { + l = m + 1; + } else { + r = m; + } + } + if (l === 0) return -1; + return l - 1; + }; + return streamChunksOfSourceMap( + source, + sourceMap, + ( + chunk, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + // Check if this is a mapping to the inner source + if (sourceIndex === outerSourceIndex) { + // Check if there is a mapping in the inner source + const idx = findInnerMapping(originalLine, originalColumn); + if (idx !== -1) { + const { chunks, mappingsData } = + innerSourceMapLineData[originalLine - 1]; + const mi = idx * 5; + const innerSourceIndex = mappingsData[mi + 1]; + const innerOriginalLine = mappingsData[mi + 2]; + let innerOriginalColumn = mappingsData[mi + 3]; + let innerNameIndex = mappingsData[mi + 4]; + if (innerSourceIndex >= 0) { + // Check for an identity mapping + // where we are allowed to adjust the original column + const innerChunk = chunks[idx]; + const innerGeneratedColumn = mappingsData[mi]; + const locationInChunk = originalColumn - innerGeneratedColumn; + if (locationInChunk > 0) { + let originalSourceLines = + innerSourceIndex < innerSourceContentLines.length + ? innerSourceContentLines[innerSourceIndex] + : null; + if (originalSourceLines === undefined) { + const originalSource = innerSourceContents[innerSourceIndex]; + originalSourceLines = originalSource + ? splitIntoLines(originalSource) + : null; + innerSourceContentLines[innerSourceIndex] = originalSourceLines; + } + if (originalSourceLines !== null) { + const originalChunk = + innerOriginalLine <= originalSourceLines.length + ? originalSourceLines[innerOriginalLine - 1].slice( + innerOriginalColumn, + innerOriginalColumn + locationInChunk, + ) + : ""; + if (innerChunk.slice(0, locationInChunk) === originalChunk) { + innerOriginalColumn += locationInChunk; + innerNameIndex = -1; + } + } + } + + // We have a inner mapping to original source + + // emit source when needed and compute global source index + let sourceIndex = + innerSourceIndex < innerSourceIndexMapping.length + ? innerSourceIndexMapping[innerSourceIndex] + : -2; + if (sourceIndex === -2) { + const [source, sourceContent] = + innerSourceIndex < innerSourceIndexValueMapping.length + ? innerSourceIndexValueMapping[innerSourceIndex] + : [null, undefined]; + let globalIndex = sourceMapping.get(source); + if (globalIndex === undefined) { + sourceMapping.set(source, (globalIndex = sourceMapping.size)); + onSource(globalIndex, source, sourceContent); + } + sourceIndex = globalIndex; + innerSourceIndexMapping[innerSourceIndex] = sourceIndex; + } + + // emit name when needed and compute global name index + let finalNameIndex = -1; + if (innerNameIndex >= 0) { + // when we have a inner name + finalNameIndex = + innerNameIndex < innerNameIndexMapping.length + ? innerNameIndexMapping[innerNameIndex] + : -2; + if (finalNameIndex === -2) { + const name = + innerNameIndex < innerNameIndexValueMapping.length + ? innerNameIndexValueMapping[innerNameIndex] + : undefined; + if (name) { + let globalIndex = nameMapping.get(name); + if (globalIndex === undefined) { + nameMapping.set(name, (globalIndex = nameMapping.size)); + onName(globalIndex, name); + } + finalNameIndex = globalIndex; + } else { + finalNameIndex = -1; + } + innerNameIndexMapping[innerNameIndex] = finalNameIndex; + } + } else if (nameIndex >= 0) { + // when we don't have an inner name, + // but we have an outer name + // it can be used when inner original code equals to the name + let originalSourceLines = + innerSourceContentLines[innerSourceIndex]; + if (originalSourceLines === undefined) { + const originalSource = innerSourceContents[innerSourceIndex]; + originalSourceLines = originalSource + ? splitIntoLines(originalSource) + : null; + innerSourceContentLines[innerSourceIndex] = originalSourceLines; + } + if (originalSourceLines !== null) { + const name = nameIndexValueMapping[nameIndex]; + const originalName = + innerOriginalLine <= originalSourceLines.length + ? originalSourceLines[innerOriginalLine - 1].slice( + innerOriginalColumn, + innerOriginalColumn + name.length, + ) + : ""; + if (name === originalName) { + finalNameIndex = + nameIndex < nameIndexMapping.length + ? nameIndexMapping[nameIndex] + : -2; + if (finalNameIndex === -2) { + const name = nameIndexValueMapping[nameIndex]; + if (name) { + let globalIndex = nameMapping.get(name); + if (globalIndex === undefined) { + nameMapping.set(name, (globalIndex = nameMapping.size)); + onName(globalIndex, name); + } + finalNameIndex = globalIndex; + } else { + finalNameIndex = -1; + } + nameIndexMapping[nameIndex] = finalNameIndex; + } + } + } + } + onChunk( + chunk, + generatedLine, + generatedColumn, + sourceIndex, + innerOriginalLine, + innerOriginalColumn, + finalNameIndex, + ); + return; + } + } + + // We have a mapping to the inner source, but no inner mapping + if (removeInnerSource) { + onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1); + return; + } + if (sourceIndexMapping[sourceIndex] === -2) { + let globalIndex = sourceMapping.get(innerSourceName); + if (globalIndex === undefined) { + sourceMapping.set(source, (globalIndex = sourceMapping.size)); + onSource(globalIndex, innerSourceName, innerSource); + } + sourceIndexMapping[sourceIndex] = globalIndex; + } + } + + const finalSourceIndex = + sourceIndex < 0 || sourceIndex >= sourceIndexMapping.length + ? -1 + : sourceIndexMapping[sourceIndex]; + if (finalSourceIndex < 0) { + // no source, so we make it a generated chunk + onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1); + } else { + // Pass through the chunk with mapping + let finalNameIndex = -1; + if (nameIndex >= 0 && nameIndex < nameIndexMapping.length) { + finalNameIndex = nameIndexMapping[nameIndex]; + if (finalNameIndex === -2) { + const name = nameIndexValueMapping[nameIndex]; + let globalIndex = nameMapping.get(name); + if (globalIndex === undefined) { + nameMapping.set(name, (globalIndex = nameMapping.size)); + onName(globalIndex, name); + } + finalNameIndex = globalIndex; + nameIndexMapping[nameIndex] = finalNameIndex; + } + } + onChunk( + chunk, + generatedLine, + generatedColumn, + finalSourceIndex, + originalLine, + originalColumn, + finalNameIndex, + ); + } + }, + (i, source, sourceContent) => { + if (source === innerSourceName) { + outerSourceIndex = i; + if (innerSource !== undefined) sourceContent = innerSource; + else innerSource = /** @type {string} */ (sourceContent); + sourceIndexMapping[i] = -2; + streamChunksOfSourceMap( + /** @type {string} */ + (sourceContent), + innerSourceMap, + ( + chunk, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + while (innerSourceMapLineData.length < generatedLine) { + innerSourceMapLineData.push({ + mappingsData: [], + chunks: [], + }); + } + const data = innerSourceMapLineData[generatedLine - 1]; + data.mappingsData.push( + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ); + data.chunks.push(/** @type {string} */ (chunk)); + }, + (i, source, sourceContent) => { + innerSourceContents[i] = sourceContent; + innerSourceContentLines[i] = undefined; + innerSourceIndexMapping[i] = -2; + innerSourceIndexValueMapping[i] = [source, sourceContent]; + }, + (i, name) => { + innerNameIndexMapping[i] = -2; + innerNameIndexValueMapping[i] = name; + }, + false, + columns, + ); + } else { + let globalIndex = sourceMapping.get(source); + if (globalIndex === undefined) { + sourceMapping.set(source, (globalIndex = sourceMapping.size)); + onSource(globalIndex, source, sourceContent); + } + sourceIndexMapping[i] = globalIndex; + } + }, + (i, name) => { + nameIndexMapping[i] = -2; + nameIndexValueMapping[i] = name; + }, + finalSource, + columns, + ); +}; + +module.exports = streamChunksOfCombinedSourceMap; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunksOfRawSource.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunksOfRawSource.js new file mode 100644 index 0000000000000000000000000000000000000000..ef8871579b82108fde18930ac142b35e60bac702 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunksOfRawSource.js @@ -0,0 +1,54 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const getGeneratedSourceInfo = require("./getGeneratedSourceInfo"); +const splitIntoLines = require("./splitIntoLines"); + +/** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./streamChunks").OnChunk} OnChunk */ +/** @typedef {import("./streamChunks").OnName} OnName */ +/** @typedef {import("./streamChunks").OnSource} OnSource */ + +/** + * @param {string} source source + * @param {OnChunk} onChunk on chunk + * @param {OnSource} _onSource on source + * @param {OnName} _onName on name + * @returns {GeneratedSourceInfo} source info + */ +const streamChunksOfRawSource = (source, onChunk, _onSource, _onName) => { + let line = 1; + const matches = splitIntoLines(source); + /** @type {undefined | string} */ + let match; + for (match of matches) { + onChunk(match, line, 0, -1, -1, -1, -1); + line++; + } + return matches.length === 0 || /** @type {string} */ (match).endsWith("\n") + ? { + generatedLine: matches.length + 1, + generatedColumn: 0, + } + : { + generatedLine: matches.length, + generatedColumn: /** @type {string} */ (match).length, + }; +}; + +/** + * @param {string} source source + * @param {OnChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} onName on name + * @param {boolean} finalSource is final source + * @returns {GeneratedSourceInfo} source info + */ +module.exports = (source, onChunk, onSource, onName, finalSource) => + finalSource + ? getGeneratedSourceInfo(source) + : streamChunksOfRawSource(source, onChunk, onSource, onName); diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js new file mode 100644 index 0000000000000000000000000000000000000000..f98f021970b03502c1d4aa240bd87103b0c9cecb --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js @@ -0,0 +1,499 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const getGeneratedSourceInfo = require("./getGeneratedSourceInfo"); +const getSource = require("./getSource"); +const readMappings = require("./readMappings"); +const splitIntoLines = require("./splitIntoLines"); + +/** @typedef {import("../Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./streamChunks").OnChunk} OnChunk */ +/** @typedef {import("./streamChunks").OnName} OnName */ +/** @typedef {import("./streamChunks").OnSource} OnSource */ + +/** + * @param {string} source source + * @param {RawSourceMap} sourceMap source map + * @param {OnChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} onName on name + * @returns {GeneratedSourceInfo} generated source info + */ +const streamChunksOfSourceMapFull = ( + source, + sourceMap, + onChunk, + onSource, + onName, +) => { + const lines = splitIntoLines(source); + if (lines.length === 0) { + return { + generatedLine: 1, + generatedColumn: 0, + }; + } + const { sources, sourcesContent, names, mappings } = sourceMap; + for (let i = 0; i < sources.length; i++) { + onSource( + i, + getSource(sourceMap, i), + (sourcesContent && sourcesContent[i]) || undefined, + ); + } + if (names) { + for (let i = 0; i < names.length; i++) { + onName(i, names[i]); + } + } + + const lastLine = lines[lines.length - 1]; + const lastNewLine = lastLine.endsWith("\n"); + const finalLine = lastNewLine ? lines.length + 1 : lines.length; + const finalColumn = lastNewLine ? 0 : lastLine.length; + + let currentGeneratedLine = 1; + let currentGeneratedColumn = 0; + + let mappingActive = false; + let activeMappingSourceIndex = -1; + let activeMappingOriginalLine = -1; + let activeMappingOriginalColumn = -1; + let activeMappingNameIndex = -1; + + /** + * @param {number} generatedLine generated line + * @param {number} generatedColumn generated column + * @param {number} sourceIndex source index + * @param {number} originalLine original line + * @param {number} originalColumn original column + * @param {number} nameIndex name index + * @returns {void} + */ + const onMapping = ( + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + if (mappingActive && currentGeneratedLine <= lines.length) { + let chunk; + const mappingLine = currentGeneratedLine; + const mappingColumn = currentGeneratedColumn; + const line = lines[currentGeneratedLine - 1]; + if (generatedLine !== currentGeneratedLine) { + chunk = line.slice(currentGeneratedColumn); + currentGeneratedLine++; + currentGeneratedColumn = 0; + } else { + chunk = line.slice(currentGeneratedColumn, generatedColumn); + currentGeneratedColumn = generatedColumn; + } + if (chunk) { + onChunk( + chunk, + mappingLine, + mappingColumn, + activeMappingSourceIndex, + activeMappingOriginalLine, + activeMappingOriginalColumn, + activeMappingNameIndex, + ); + } + mappingActive = false; + } + if (generatedLine > currentGeneratedLine && currentGeneratedColumn > 0) { + if (currentGeneratedLine <= lines.length) { + const chunk = lines[currentGeneratedLine - 1].slice( + currentGeneratedColumn, + ); + onChunk( + chunk, + currentGeneratedLine, + currentGeneratedColumn, + -1, + -1, + -1, + -1, + ); + } + currentGeneratedLine++; + currentGeneratedColumn = 0; + } + while (generatedLine > currentGeneratedLine) { + if (currentGeneratedLine <= lines.length) { + onChunk( + lines[currentGeneratedLine - 1], + currentGeneratedLine, + 0, + -1, + -1, + -1, + -1, + ); + } + currentGeneratedLine++; + } + if (generatedColumn > currentGeneratedColumn) { + if (currentGeneratedLine <= lines.length) { + const chunk = lines[currentGeneratedLine - 1].slice( + currentGeneratedColumn, + generatedColumn, + ); + onChunk( + chunk, + currentGeneratedLine, + currentGeneratedColumn, + -1, + -1, + -1, + -1, + ); + } + currentGeneratedColumn = generatedColumn; + } + if ( + sourceIndex >= 0 && + (generatedLine < finalLine || + (generatedLine === finalLine && generatedColumn < finalColumn)) + ) { + mappingActive = true; + activeMappingSourceIndex = sourceIndex; + activeMappingOriginalLine = originalLine; + activeMappingOriginalColumn = originalColumn; + activeMappingNameIndex = nameIndex; + } + }; + readMappings(mappings, onMapping); + onMapping(finalLine, finalColumn, -1, -1, -1, -1); + return { + generatedLine: finalLine, + generatedColumn: finalColumn, + }; +}; + +/** + * @param {string} source source + * @param {RawSourceMap} sourceMap source map + * @param {OnChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} _onName on name + * @returns {GeneratedSourceInfo} generated source info + */ +const streamChunksOfSourceMapLinesFull = ( + source, + sourceMap, + onChunk, + onSource, + _onName, +) => { + const lines = splitIntoLines(source); + if (lines.length === 0) { + return { + generatedLine: 1, + generatedColumn: 0, + }; + } + const { sources, sourcesContent, mappings } = sourceMap; + for (let i = 0; i < sources.length; i++) { + onSource( + i, + getSource(sourceMap, i), + (sourcesContent && sourcesContent[i]) || undefined, + ); + } + + let currentGeneratedLine = 1; + + /** + * @param {number} generatedLine generated line + * @param {number} _generatedColumn generated column + * @param {number} sourceIndex source index + * @param {number} originalLine original line + * @param {number} originalColumn original column + * @param {number} _nameIndex name index + * @returns {void} + */ + const onMapping = ( + generatedLine, + _generatedColumn, + sourceIndex, + originalLine, + originalColumn, + _nameIndex, + ) => { + if ( + sourceIndex < 0 || + generatedLine < currentGeneratedLine || + generatedLine > lines.length + ) { + return; + } + while (generatedLine > currentGeneratedLine) { + if (currentGeneratedLine <= lines.length) { + onChunk( + lines[currentGeneratedLine - 1], + currentGeneratedLine, + 0, + -1, + -1, + -1, + -1, + ); + } + currentGeneratedLine++; + } + if (generatedLine <= lines.length) { + onChunk( + lines[generatedLine - 1], + generatedLine, + 0, + sourceIndex, + originalLine, + originalColumn, + -1, + ); + currentGeneratedLine++; + } + }; + readMappings(mappings, onMapping); + for (; currentGeneratedLine <= lines.length; currentGeneratedLine++) { + onChunk( + lines[currentGeneratedLine - 1], + currentGeneratedLine, + 0, + -1, + -1, + -1, + -1, + ); + } + + const lastLine = lines[lines.length - 1]; + const lastNewLine = lastLine.endsWith("\n"); + + const finalLine = lastNewLine ? lines.length + 1 : lines.length; + const finalColumn = lastNewLine ? 0 : lastLine.length; + + return { + generatedLine: finalLine, + generatedColumn: finalColumn, + }; +}; + +/** + * @param {string} source source + * @param {RawSourceMap} sourceMap source map + * @param {OnChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} onName on name + * @returns {GeneratedSourceInfo} generated source info + */ +const streamChunksOfSourceMapFinal = ( + source, + sourceMap, + onChunk, + onSource, + onName, +) => { + const result = getGeneratedSourceInfo(source); + const { generatedLine: finalLine, generatedColumn: finalColumn } = result; + + if (finalLine === 1 && finalColumn === 0) return result; + const { sources, sourcesContent, names, mappings } = sourceMap; + for (let i = 0; i < sources.length; i++) { + onSource( + i, + getSource(sourceMap, i), + (sourcesContent && sourcesContent[i]) || undefined, + ); + } + if (names) { + for (let i = 0; i < names.length; i++) { + onName(i, names[i]); + } + } + + let mappingActiveLine = 0; + + /** + * @param {number} generatedLine generated line + * @param {number} generatedColumn generated column + * @param {number} sourceIndex source index + * @param {number} originalLine original line + * @param {number} originalColumn original column + * @param {number} nameIndex name index + * @returns {void} + */ + const onMapping = ( + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ) => { + if ( + generatedLine >= /** @type {number} */ (finalLine) && + (generatedColumn >= /** @type {number} */ (finalColumn) || + generatedLine > /** @type {number} */ (finalLine)) + ) { + return; + } + if (sourceIndex >= 0) { + onChunk( + undefined, + generatedLine, + generatedColumn, + sourceIndex, + originalLine, + originalColumn, + nameIndex, + ); + mappingActiveLine = generatedLine; + } else if (mappingActiveLine === generatedLine) { + onChunk(undefined, generatedLine, generatedColumn, -1, -1, -1, -1); + mappingActiveLine = 0; + } + }; + readMappings(mappings, onMapping); + return result; +}; + +/** + * @param {string} source source + * @param {RawSourceMap} sourceMap source map + * @param {OnChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} _onName on name + * @returns {GeneratedSourceInfo} generated source info + */ +const streamChunksOfSourceMapLinesFinal = ( + source, + sourceMap, + onChunk, + onSource, + _onName, +) => { + const result = getGeneratedSourceInfo(source); + const { generatedLine, generatedColumn } = result; + if (generatedLine === 1 && generatedColumn === 0) { + return { + generatedLine: 1, + generatedColumn: 0, + }; + } + + const { sources, sourcesContent, mappings } = sourceMap; + for (let i = 0; i < sources.length; i++) { + onSource( + i, + getSource(sourceMap, i), + (sourcesContent && sourcesContent[i]) || undefined, + ); + } + + const finalLine = + generatedColumn === 0 + ? /** @type {number} */ (generatedLine) - 1 + : /** @type {number} */ (generatedLine); + + let currentGeneratedLine = 1; + + /** + * @param {number} generatedLine generated line + * @param {number} _generatedColumn generated column + * @param {number} sourceIndex source index + * @param {number} originalLine original line + * @param {number} originalColumn original column + * @param {number} _nameIndex name index + * @returns {void} + */ + const onMapping = ( + generatedLine, + _generatedColumn, + sourceIndex, + originalLine, + originalColumn, + _nameIndex, + ) => { + if ( + sourceIndex >= 0 && + currentGeneratedLine <= generatedLine && + generatedLine <= finalLine + ) { + onChunk( + undefined, + generatedLine, + 0, + sourceIndex, + originalLine, + originalColumn, + -1, + ); + currentGeneratedLine = generatedLine + 1; + } + }; + readMappings(mappings, onMapping); + return result; +}; + +/** + * @param {string} source source + * @param {RawSourceMap} sourceMap source map + * @param {OnChunk} onChunk on chunk + * @param {OnSource} onSource on source + * @param {OnName} onName on name + * @param {boolean} finalSource final source + * @param {boolean} columns columns + * @returns {GeneratedSourceInfo} generated source info + */ +module.exports = ( + source, + sourceMap, + onChunk, + onSource, + onName, + finalSource, + columns, +) => { + if (columns) { + return finalSource + ? streamChunksOfSourceMapFinal( + source, + sourceMap, + onChunk, + onSource, + onName, + ) + : streamChunksOfSourceMapFull( + source, + sourceMap, + onChunk, + onSource, + onName, + ); + } + return finalSource + ? streamChunksOfSourceMapLinesFinal( + source, + sourceMap, + onChunk, + onSource, + onName, + ) + : streamChunksOfSourceMapLinesFull( + source, + sourceMap, + onChunk, + onSource, + onName, + ); +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/stringBufferUtils.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/stringBufferUtils.js new file mode 100644 index 0000000000000000000000000000000000000000..a64659ae1ba035d4081febaba82348bee58cbef1 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/helpers/stringBufferUtils.js @@ -0,0 +1,117 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Mark Knichel @mknichel +*/ + +"use strict"; + +let dualStringBufferCaching = true; + +/** + * @returns {boolean} Whether the optimization to cache copies of both the + * string and buffer version of source content is enabled. This is enabled by + * default to improve performance but can consume more memory since values are + * stored twice. + */ +function isDualStringBufferCachingEnabled() { + return dualStringBufferCaching; +} + +/** + * Enables an optimization to save both string and buffer in memory to avoid + * repeat conversions between the two formats when they are requested. This + * is enabled by default. This option can improve performance but can consume + * additional memory since values are stored twice. + * @returns {void} + */ +function enableDualStringBufferCaching() { + dualStringBufferCaching = true; +} + +/** + * Disables the optimization to save both string and buffer in memory. This + * may increase performance but should reduce memory usage in the Webpack + * compiler. + * @returns {void} + */ +function disableDualStringBufferCaching() { + dualStringBufferCaching = false; +} + +const interningStringMap = new Map(); + +let enableStringInterningRefCount = 0; + +/** + * @returns {boolean} value + */ +function isStringInterningEnabled() { + return enableStringInterningRefCount > 0; +} + +/** + * Starts a memory optimization to avoid repeat copies of the same string in + * memory by caching a single reference to the string. This can reduce memory + * usage if the same string is repeated many times in the compiler, such as + * when Webpack layers are used with the same files. + * + * {@link exitStringInterningRange} should be called when string interning is + * no longer necessary to free up the memory used by the interned strings. If + * {@link enterStringInterningRange} has been called multiple times, then + * this method may not immediately free all the memory until + * {@link exitStringInterningRange} has been called to end all string + * interning ranges. + * @returns {void} + */ +function enterStringInterningRange() { + enableStringInterningRefCount++; +} + +/** + * Stops the current string interning range. Once all string interning ranges + * have been exited, this method will free all the memory used by the interned + * strings. This method should be called once for each time that + * {@link enterStringInterningRange} was called. + * @returns {void} + */ +function exitStringInterningRange() { + if (--enableStringInterningRefCount <= 0) { + interningStringMap.clear(); + enableStringInterningRefCount = 0; + } +} + +/** + * Saves the string in a map to ensure that only one copy of the string exists + * in memory at a given time. This is controlled by {@link enableStringInterning} + * and {@link disableStringInterning}. Callers are expect to manage the memory + * of the interned strings by calling {@link disableStringInterning} after the + * compiler no longer needs to save the interned memory. + * @param {string} str A string to be interned. + * @returns {string} The original string or a reference to an existing string of the same value if it has already been interned. + */ +function internString(str) { + if ( + !isStringInterningEnabled() || + !str || + str.length < 128 || + typeof str !== "string" + ) { + return str; + } + let internedString = interningStringMap.get(str); + if (internedString === undefined) { + internedString = str; + interningStringMap.set(str, internedString); + } + return internedString; +} + +module.exports = { + disableDualStringBufferCaching, + enableDualStringBufferCaching, + internString, + isDualStringBufferCachingEnabled, + enterStringInterningRange, + exitStringInterningRange, +}; diff --git a/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/index.js b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..9f795ef7f03deda9888b099afd83164309bc05a0 --- /dev/null +++ b/novas/novacore-zephyr/groq-code-cli/node_modules/webpack-sources/lib/index.js @@ -0,0 +1,120 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +/** @typedef {import("./CachedSource").CachedData} CachedData */ +/** @typedef {import("./CompatSource").SourceLike} SourceLike */ +/** @typedef {import("./ConcatSource").Child} ConcatSourceChild */ +/** @typedef {import("./ReplaceSource").Replacement} Replacement */ +/** @typedef {import("./Source").HashLike} HashLike */ +/** @typedef {import("./Source").MapOptions} MapOptions */ +/** @typedef {import("./Source").RawSourceMap} RawSourceMap */ +/** @typedef {import("./Source").SourceAndMap} SourceAndMap */ +/** @typedef {import("./Source").SourceValue} SourceValue */ +/** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */ +/** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */ +/** @typedef {import("./helpers/streamChunks").OnName} OnName */ +/** @typedef {import("./helpers/streamChunks").OnSource} OnSource */ +/** @typedef {import("./helpers/streamChunks").Options} StreamChunksOptions */ + +/** + * @template T + * @param {() => T} fn memorized function + * @returns {() => T} new function + */ +const memoize = (fn) => { + let cache = false; + /** @type {T | undefined} */ + let result; + return () => { + if (cache) { + return /** @type {T} */ (result); + } + + result = fn(); + cache = true; + // Allow to clean up memory for fn + // and all dependent resources + /** @type {(() => T) | undefined} */ + (fn) = undefined; + return /** @type {T} */ (result); + }; +}; + +/** + * @template A + * @template B + * @param {A} obj input a + * @param {B} exports input b + * @returns {A & B} merged + */ +const mergeExports = (obj, exports) => { + const descriptors = Object.getOwnPropertyDescriptors(exports); + for (const name of Object.keys(descriptors)) { + const descriptor = descriptors[name]; + if (descriptor.get) { + const fn = descriptor.get; + Object.defineProperty(obj, name, { + configurable: false, + enumerable: true, + get: memoize(fn), + }); + } else if (typeof descriptor.value === "object") { + Object.defineProperty(obj, name, { + configurable: false, + enumerable: true, + writable: false, + value: mergeExports({}, descriptor.value), + }); + } else { + throw new Error( + "Exposed values must be either a getter or an nested object", + ); + } + } + return /** @type {A & B} */ (Object.freeze(obj)); +}; + +module.exports = mergeExports( + {}, + { + get Source() { + return require("./Source"); + }, + get RawSource() { + return require("./RawSource"); + }, + get OriginalSource() { + return require("./OriginalSource"); + }, + get SourceMapSource() { + return require("./SourceMapSource"); + }, + get CachedSource() { + return require("./CachedSource"); + }, + get ConcatSource() { + return require("./ConcatSource"); + }, + get ReplaceSource() { + return require("./ReplaceSource"); + }, + get PrefixSource() { + return require("./PrefixSource"); + }, + get SizeOnlySource() { + return require("./SizeOnlySource"); + }, + get CompatSource() { + return require("./CompatSource"); + }, + util: { + get stringBufferUtils() { + return require("./helpers/stringBufferUtils"); + }, + }, + }, +);