Addnew sheets (armor, weapons, malefica) and v13 support
BIN
assets/fonts/Minion Pro Regular.ttf
Normal file
BIN
assets/fonts/Supernatural_Knight.ttf
Normal file
BIN
assets/icons/equipment.webp
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
assets/icons/malefica.webp
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/perk.webp
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
assets/icons/ritual.webp
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/species-trait.webp
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
assets/icons/weapon.webp
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/ui/hellborn_logo.webp
Normal file
|
After Width: | Height: | Size: 13 KiB |
2505
css/fvtt-hellborn.css
Normal file
@@ -42,24 +42,26 @@ Hooks.once("init", function () {
|
||||
ritual: models.HellbornRitual,
|
||||
weapon: models.HellbornWeapon,
|
||||
perk: models.HellbornPerk,
|
||||
maleficias: models.HellbornMaleficias,
|
||||
malefica: models.HellbornMalefica,
|
||||
equipment: models.HellbornEquipment,
|
||||
armor: models.HellbornArmor,
|
||||
"species-trait": models.HellbornSpeciesTrait
|
||||
}
|
||||
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet)
|
||||
Actors.registerSheet("fvtt-hellborn", applications.HellbornCharacterSheet , { types: ["character"], makeDefault: true })
|
||||
Actors.registerSheet("fvtt-hellborn", applications.HellbornVehicleSheet, { types: ["vehicle"], makeDefault: true })
|
||||
Actors.registerSheet("fvtt-hellborn", applications.HellbornCreatureSheet, { types: ["creature"], makeDefault: true })
|
||||
foundry.documents.collections.Actors.unregisterSheet("core", foundry.appv1.sheets.ActorSheet)
|
||||
foundry.documents.collections.Actors.registerSheet("fvtt-hellborn", applications.HellbornCharacterSheet , { types: ["character"], makeDefault: true })
|
||||
foundry.documents.collections.Actors.registerSheet("fvtt-hellborn", applications.HellbornVehicleSheet, { types: ["vehicle"], makeDefault: true })
|
||||
foundry.documents.collections.Actors.registerSheet("fvtt-hellborn", applications.HellbornCreatureSheet, { types: ["creature"], makeDefault: true })
|
||||
|
||||
Items.unregisterSheet("core", ItemSheet)
|
||||
Items.registerSheet("fvtt-hellborn", applications.HellbornWeaponSheet, { types: ["weapon"], makeDefault: true })
|
||||
Items.registerSheet("fvtt-hellborn", applications.HellbornEquipmentSheet, { types: ["equipment"], makeDefault: true })
|
||||
Items.registerSheet("fvtt-hellborn", applications.HellbornRitualSheet, { types: ["ritual"], makeDefault: true })
|
||||
Items.registerSheet("fvtt-hellborn", applications.HellbornPerkSheet, { types: ["perk"], makeDefault: true })
|
||||
Items.registerSheet("fvtt-hellborn", applications.HellbornMaleficiasSheet, { types: ["maleficias"], makeDefault: true })
|
||||
Items.registerSheet("fvtt-hellborn", applications.HellbornSpeciesTraitSheet, { types: ["species-trait"], makeDefault: true })
|
||||
foundry.documents.collections.Items.unregisterSheet("core", foundry.appv1.sheets.ItemSheet)
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-hellborn", applications.HellbornWeaponSheet, { types: ["weapon"], makeDefault: true })
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-hellborn", applications.HellbornEquipmentSheet, { types: ["equipment"], makeDefault: true })
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-hellborn", applications.HellbornRitualSheet, { types: ["ritual"], makeDefault: true })
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-hellborn", applications.HellbornPerkSheet, { types: ["perk"], makeDefault: true })
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-hellborn", applications.HellbornMaleficaSheet, { types: ["malefica"], makeDefault: true })
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-hellborn", applications.HellbornSpeciesTraitSheet, { types: ["species-trait"], makeDefault: true })
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-hellborn", applications.HellbornArmorSheet, { types: ["armor"], makeDefault: true })
|
||||
|
||||
// Other Document Configuration
|
||||
CONFIG.ChatMessage.documentClass = documents.HellbornChatMessage
|
||||
@@ -107,7 +109,7 @@ Hooks.once("ready", function () {
|
||||
|
||||
})
|
||||
|
||||
Hooks.on("renderChatMessage", (message, html, data) => {
|
||||
Hooks.on("renderChatMessageHTML", (message, html, data) => {
|
||||
})
|
||||
|
||||
|
||||
|
||||
223
lang/en.json
@@ -1,24 +1,5 @@
|
||||
{
|
||||
"FTLNOMAD": {
|
||||
"Armor": {
|
||||
"FIELDS": {
|
||||
"cost": {
|
||||
"label": "Cost"
|
||||
},
|
||||
"description": {
|
||||
"label": "Description"
|
||||
},
|
||||
"enc": {
|
||||
"label": "Enc"
|
||||
},
|
||||
"protection": {
|
||||
"label": "Protection"
|
||||
},
|
||||
"techAge": {
|
||||
"label": "Tech Age"
|
||||
}
|
||||
}
|
||||
},
|
||||
"HELLBORN": {
|
||||
"Character": {
|
||||
"FIELDS": {
|
||||
"armor": {
|
||||
@@ -100,7 +81,7 @@
|
||||
},
|
||||
"rank": {
|
||||
"label": "Rank",
|
||||
"experienced": {
|
||||
"experienced": {
|
||||
"label": "Experienced"
|
||||
},
|
||||
"expert": {
|
||||
@@ -153,7 +134,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Chat": {},
|
||||
"Creature": {
|
||||
"Niche": {
|
||||
"Prey": "Prey",
|
||||
@@ -280,17 +260,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"CreatureAbility": {
|
||||
"FIELDS": {
|
||||
"description": {
|
||||
"label": "Description"
|
||||
},
|
||||
"isAdvantage": {
|
||||
"label": "Provide advantage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CreatureTrait": {
|
||||
"SpeciesTrait": {
|
||||
"FIELDS": {
|
||||
"description": {
|
||||
"label": "Description"
|
||||
@@ -319,7 +289,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Implant": {
|
||||
"Ritual": {
|
||||
"FIELDS": {
|
||||
"cost": {
|
||||
"label": "Cost"
|
||||
@@ -339,7 +309,7 @@
|
||||
"damages": "Damages",
|
||||
"modifications": "Modifications",
|
||||
"abilities": "Abilities",
|
||||
"Details": "Details",
|
||||
"Details": "Details",
|
||||
"traits": "Traits",
|
||||
"capacity" : "Capacity",
|
||||
"Agility" : "Agility",
|
||||
@@ -398,7 +368,7 @@
|
||||
"newLanguage": "New Language",
|
||||
"newPsionic": "New Psionic",
|
||||
"newCreatureAbility": "New Creature Ability",
|
||||
"newCreatureTrait": "New Creature Trait",
|
||||
"newCreatureTrait": "New Creature Trait",
|
||||
"notes": "Notes",
|
||||
"psionics": "Psionics",
|
||||
"rollView": "Roll View",
|
||||
@@ -408,7 +378,7 @@
|
||||
"status": "Status",
|
||||
"success": "Success",
|
||||
"talents": "Talents",
|
||||
"implants": "Implants",
|
||||
"implants": "Implants",
|
||||
"targetScore": "Target Score",
|
||||
"titleSkill": "Skill Roll",
|
||||
"titleWeapon": "Weapon Roll",
|
||||
@@ -416,21 +386,45 @@
|
||||
"totalScore": "Total Score",
|
||||
"weapons": "Weapons"
|
||||
},
|
||||
"Language": {
|
||||
"Notifications": {},
|
||||
"Armor": {
|
||||
"FIELDS": {
|
||||
"bonus": {
|
||||
"label": "Bonus"
|
||||
},
|
||||
"cost": {
|
||||
"label": "Cost"
|
||||
},
|
||||
"description": {
|
||||
"label": "Description"
|
||||
},
|
||||
"resilience": {
|
||||
"label": "Resilience"
|
||||
},
|
||||
"reduction": {
|
||||
"label": "Reduction"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Notifications": {},
|
||||
"Psionic": {
|
||||
"Malefica": {
|
||||
"FIELDS": {
|
||||
"description": {
|
||||
"label": "Description"
|
||||
},
|
||||
"isAdvantage": {
|
||||
"label": "Provide advantage"
|
||||
"time": {
|
||||
"label": "Time"
|
||||
},
|
||||
"range":{
|
||||
"label": "Range"
|
||||
},
|
||||
"target": {
|
||||
"label": "Target"
|
||||
},
|
||||
"level":{
|
||||
"label": "Level"
|
||||
},
|
||||
"domain": {
|
||||
"label": "Domain"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -439,121 +433,19 @@
|
||||
"roll": "Roll",
|
||||
"skill": "Skill"
|
||||
},
|
||||
"Skill": {
|
||||
"Combat": "Combat",
|
||||
"Knowledge": "Knowledge",
|
||||
"Physical": "Physical",
|
||||
"Social": "Social",
|
||||
"Stealth": "Stealth",
|
||||
"Technology": "Technology",
|
||||
"Vehicles": "Vehicles",
|
||||
"Perk": {
|
||||
"FIELDS": {
|
||||
"base": {
|
||||
"label": "Base"
|
||||
"level": {
|
||||
"label": "Level"
|
||||
},
|
||||
"bonus": {
|
||||
"label": "Bonus"
|
||||
"role": {
|
||||
"label": "Role"
|
||||
},
|
||||
"description": {
|
||||
"label": "Description"
|
||||
},
|
||||
"diceEvolved": {
|
||||
"label": "Can increase on failure"
|
||||
},
|
||||
"isAdversary": {
|
||||
"label": "Adversary"
|
||||
},
|
||||
"rollFailed": {
|
||||
"label": "Roll Failed"
|
||||
},
|
||||
"settings": {
|
||||
"label": "Settings era"
|
||||
}
|
||||
},
|
||||
"Firearms": "Firearms",
|
||||
"FirearmsBeams": "Firearms / Beam Weapons",
|
||||
"Melee": "Melee Weapons",
|
||||
"RangedWeapons": "Ranged Weapons",
|
||||
"UnarmedCombat": "Unarmed Combat",
|
||||
"Unnatural": "Unnatural"
|
||||
},
|
||||
"Starship": {
|
||||
"Hull": {
|
||||
"Pod": "Pod",
|
||||
"Micro": "Micro",
|
||||
"Small": "Small",
|
||||
"Scout": "Scout",
|
||||
"Picket": "Picket",
|
||||
"Destroyer": "Destroyer",
|
||||
"Cruiser": "Cruiser",
|
||||
"Battleship": "Battleship",
|
||||
"Carrier": "Carrier"
|
||||
},
|
||||
"FIELDS": {
|
||||
"monthlyCost": {
|
||||
"label": "Monthly Cost"
|
||||
},
|
||||
"hullType": {
|
||||
"label": "Hull Type"
|
||||
},
|
||||
"armor": {
|
||||
"label": "Armor"
|
||||
},
|
||||
"guns" : {
|
||||
"label": "Guns"
|
||||
},
|
||||
"travelMultiplier": {
|
||||
"label": "Travel Multiplier"
|
||||
},
|
||||
"agility": {
|
||||
"label": "Agility"
|
||||
},
|
||||
"endurance": {
|
||||
"label": "Endurance"
|
||||
},
|
||||
"cargo": {
|
||||
"label": "Cargo"
|
||||
},
|
||||
"cost": {
|
||||
"label": "Cost"
|
||||
},
|
||||
"crew": {
|
||||
"label": "Crew"
|
||||
},
|
||||
"description": {
|
||||
"label": "Description"
|
||||
},
|
||||
"value": {
|
||||
"label": "Value"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Talent": {
|
||||
"FIELDS": {
|
||||
"description": {
|
||||
"label": "Description"
|
||||
},
|
||||
"isAdvantage": {
|
||||
"label": "Provide advantage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TechAge": {
|
||||
"Cosmic": "Cosmic",
|
||||
"EarlyAtomic": "Early Atomic",
|
||||
"EarlyGalactic": "Early Galactic",
|
||||
"EarlyInterstellar": "Early Interstellar",
|
||||
"EarlyMechanical": "Early Mechanical",
|
||||
"EarlyPrimitive": "Early Primitive",
|
||||
"EarlySpace": "Early Space",
|
||||
"LateAtomic": "Late Atomic",
|
||||
"LateGalactic": "Late Galactic",
|
||||
"LateInterstellar": "Late Interstellar",
|
||||
"LateMechanical": "Late Mechanical",
|
||||
"LatePrimitive": "Late Primitive",
|
||||
"LateSpace": "Late Space",
|
||||
"NoTech": "No Tech"
|
||||
},
|
||||
"ToggleSheet": "Toggle Sheet",
|
||||
"Tooltip": {
|
||||
"addTalent" : "Add Talent",
|
||||
@@ -605,7 +497,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Warning": {},
|
||||
"Weapon": {
|
||||
"FIELDS": {
|
||||
"cost": {
|
||||
@@ -617,14 +508,17 @@
|
||||
"description": {
|
||||
"label": "Description"
|
||||
},
|
||||
"enc": {
|
||||
"label": "Enc"
|
||||
"subType": {
|
||||
"label": "Sub-Type"
|
||||
},
|
||||
"rangeType": {
|
||||
"range": {
|
||||
"label": "Range"
|
||||
},
|
||||
"techAge": {
|
||||
"label": "Tech Age"
|
||||
"properties": {
|
||||
"label": "Properties"
|
||||
},
|
||||
"ammo": {
|
||||
"label": "Ammo"
|
||||
},
|
||||
"weaponType": {
|
||||
"label": "Type"
|
||||
@@ -653,19 +547,20 @@
|
||||
"Actor": {
|
||||
"character": "Character",
|
||||
"creature": "Creature",
|
||||
"starship": "Starship",
|
||||
"vehicle": "Vehicle"
|
||||
},
|
||||
"Item": {
|
||||
"armor": "Armor",
|
||||
"creature-ability": "Creature Ability",
|
||||
"creature-trait": "Creature Trait",
|
||||
"species-trait": "Species Trait",
|
||||
"equipment": "Equipment",
|
||||
"implant": "Implant",
|
||||
"language": "Language",
|
||||
"psionic": "Psionic",
|
||||
"talent": "Talent",
|
||||
"weapon": "Weapon"
|
||||
"ritual": "Ritual",
|
||||
"malefica": "Malefica",
|
||||
"perk": "Perk",
|
||||
"weapon": "Weapon",
|
||||
"armor": "Armor"
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ export { default as HellbornEquipmentSheet } from "./sheets/equipment-sheet.mjs"
|
||||
export { default as HellbornCreatureSheet } from "./sheets/creature-sheet.mjs"
|
||||
export { default as HellbornRitualSheet } from "./sheets/ritual-sheet.mjs"
|
||||
export { default as HellbornItemSheet } from "./sheets/base-item-sheet.mjs"
|
||||
export { default as HellbornCreatureSheet } from "./sheets/creature-sheet.mjs"
|
||||
export { default as HellbornSpeciesTraitSheet } from "./sheets/species-trait-sheet.mjs"
|
||||
export { default as HellbornPerkSheet } from "./sheets/perk-sheet.mjs"
|
||||
export { default as HellbornMaleficiasSheet } from "./sheets/maleficias-sheet.mjs"
|
||||
export { default as HellbornMaleficaSheet } from "./sheets/malefica-sheet.mjs"
|
||||
export { default as HellbornArmorSheet } from "./sheets/armor-sheet.mjs"
|
||||
|
||||
28
module/applications/sheets/armor-sheet.mjs
Normal file
@@ -0,0 +1,28 @@
|
||||
import HellbornItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class HellbornArmorSheet extends HellbornItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["armor"],
|
||||
position: {
|
||||
width: 500,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["armor-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-hellborn/templates/armor.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.description, { async: true })
|
||||
return context
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ export default class HellbornItemSheet extends HandlebarsApplicationMixin(foundr
|
||||
item: this.document,
|
||||
system: this.document.system,
|
||||
source: this.document.toObject(),
|
||||
enrichedDescription: await TextEditor.enrichHTML(this.document.system.description, { async: true }),
|
||||
enrichedDescription: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.description, { async: true }),
|
||||
isEditMode: this.isEditMode,
|
||||
isPlayMode: this.isPlayMode,
|
||||
isEditable: this.isEditable,
|
||||
@@ -94,7 +94,7 @@ export default class HellbornItemSheet extends HandlebarsApplicationMixin(foundr
|
||||
dragover: this._onDragOver.bind(this),
|
||||
drop: this._onDrop.bind(this),
|
||||
}
|
||||
return new DragDrop(d)
|
||||
return new foundry.applications.ux.DragDrop.implementation(d)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ export default class HellbornEquipmentSheet extends HellbornItemSheet {
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["equipment"],
|
||||
position: {
|
||||
width: 600,
|
||||
width: 500,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["equipment-content"],
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import HellbornItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class HellbornMaleficiasSheet extends HellbornItemSheet {
|
||||
export default class HellbornMaleficaSheet extends HellbornItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["maleficias"],
|
||||
classes: ["malefica"],
|
||||
position: {
|
||||
width: 600,
|
||||
width: 500,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["maleficias-content"],
|
||||
contentClasses: ["malefica-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-hellborn/templates/maleficias.hbs",
|
||||
template: "systems/fvtt-hellborn/templates/malefica.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ export default class HellbornPerkSheet extends HellbornItemSheet {
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["perk"],
|
||||
position: {
|
||||
width: 600,
|
||||
width: 500,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["perk-content"],
|
||||
|
||||
@@ -1,63 +1,59 @@
|
||||
export const SYSTEM_ID = "fvtt-hellborn"
|
||||
|
||||
export const ASCII = `
|
||||
|
||||
░▒▓████████▓▒░▒▓████████▓▒░▒▓█▓▒░ ░▒▓███████▓▒░ ░▒▓██████▓▒░░▒▓██████████████▓▒░ ░▒▓██████▓▒░░▒▓███████▓▒░
|
||||
░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓██▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
|
||||
░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓██▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
|
||||
░▒▓██████▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░
|
||||
░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓██▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
|
||||
░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓██▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
|
||||
░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓████████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░
|
||||
|
||||
|
||||
░▒█░▒█░▒█▀▀▀░▒█░░░░▒█░░░░▒█▀▀▄░▒█▀▀▀█░▒█▀▀▄░▒█▄░▒█
|
||||
░▒█▀▀█░▒█▀▀▀░▒█░░░░▒█░░░░▒█▀▀▄░▒█░░▒█░▒█▄▄▀░▒█▒█▒█
|
||||
░▒█░▒█░▒█▄▄▄░▒█▄▄█░▒█▄▄█░▒█▄▄█░▒█▄▄▄█░▒█░▒█░▒█░░▀█
|
||||
|
||||
`
|
||||
|
||||
export const SKILLS = {
|
||||
"combat": { id: "combat", label: "HELLBORN.Skill.Combat" },
|
||||
"knowledge": { id: "knowledge", label: "HELLBORN.Skill.Knowledge" },
|
||||
"social": { id: "social", label: "HELLBORN.Skill.Social" },
|
||||
"physical": { id: "physical", label: "HELLBORN.Skill.Physical" },
|
||||
"stealth": { id: "stealth", label: "HELLBORN.Skill.Stealth" },
|
||||
"vehicles": { id: "vehicles", label: "HELLBORN.Skill.Vehicles" },
|
||||
"technology": { id: "technology", label: "HELLBORN.Skill.Technology" }
|
||||
export const PERK_ROLES = {
|
||||
"abbetor": { id: "abbetor", label: "Abbetor" },
|
||||
"blade": { id: "blade", label: "Blade" },
|
||||
"gunner": { id: "gunner", label: "Gunner" },
|
||||
"malefic": { id: "malefic", label: "Malefic" },
|
||||
"mastermind": { id: "mastermind", label: "Mastermind" },
|
||||
"sentinel": { id: "sentinel", label: "Sentinel" },
|
||||
"slayer": { id: "slayer", label: "Slayer" },
|
||||
"wretch": { id: "wretch", label: "Wretch" },
|
||||
}
|
||||
|
||||
export const TECH_AGES = {
|
||||
"notech": { id: "notech", level: 0, label: "HELLBORN.TechAge.NoTech" },
|
||||
"earlyprimitive": { id: "earlyprimitive", label: "HELLBORN.TechAge.EarlyPrimitive", level: 1 },
|
||||
"lateprimitive": { id: "lateprimitive", label: "HELLBORN.TechAge.LatePrimitive", level: 2 },
|
||||
"earlymechanical": { id: "earlymechanical", label: "HELLBORN.TechAge.EarlyMechanical", level: 3 },
|
||||
"latemechanical": { id: "latemechanical", label: "HELLBORN.TechAge.LateMechanical", level: 4 },
|
||||
"earlyatomic": { id: "earlyatomic", label: "HELLBORN.TechAge.EarlyAtomic", level: 5 },
|
||||
"lateatomic": { id: "lateatomic", label: "HELLBORN.TechAge.LateAtomic", level: 6 },
|
||||
"earlyspace": { id: "earlyspace", label: "HELLBORN.TechAge.EarlySpace", level: 7 },
|
||||
"latespace": { id: "latespace", label: "HELLBORN.TechAge.LateSpace", level: 8 },
|
||||
"earlyinterstellar": { id: "earlyinterstellar", label: "HELLBORN.TechAge.EarlyInterstellar", level: 9 },
|
||||
"lateinterstellar": { id: "lateinterstellar", label: "HELLBORN.TechAge.LateInterstellar", level: 10 },
|
||||
"earlygalactic": { id: "earlygalactic", label: "HELLBORN.TechAge.EarlyGalactic", level: 11 },
|
||||
"lategalactic": { id: "lategalactic", label: "HELLBORN.TechAge.LateGalactic", level: 12 },
|
||||
"cosmic": { id: "cosmic", label: "HELLBORN.TechAge.Cosmic", level: 13 }
|
||||
export const MALEFICA_DOMAINS = {
|
||||
"adfectus": { id: "adfectus", label: "Adfectus" },
|
||||
"divinus": { id: "divinus", label: "Divinus" },
|
||||
"ignis": { id: "ignis", label: "Ignis" },
|
||||
"iunctio": { id: "iunctio", label: "Iunctio" },
|
||||
"speculo": { id: "speculo", label: "Speculo" },
|
||||
"vinculum": { id: "vinculum", label: "Vinculum" },
|
||||
"vita": { id: "vita", label: "Vita" },
|
||||
}
|
||||
|
||||
export const PERK_LEVELS = {
|
||||
"1": { id: "1", label: "Level 1" },
|
||||
"2": { id: "2", label: "Level 2" },
|
||||
"3": { id: "3", label: "Level 3" },
|
||||
"mastery": { id: "mastery", label: "Mastery" },
|
||||
}
|
||||
|
||||
export const MALEFICA_LEVELS = {
|
||||
"1": { id: "1", label: "Level 1" },
|
||||
"2": { id: "2", label: "Level 2" },
|
||||
"3": { id: "3", label: "Level 3" },
|
||||
"highpowers": { id: "highpowers", label: "High Powers" },
|
||||
}
|
||||
|
||||
export const WEAPON_TYPES = {
|
||||
"melee": { id: "melee", label: "HELLBORN.Weapon.Types.Melee" },
|
||||
"projectile": { id: "projectile", label: "HELLBORN.Weapon.Types.Projectile" },
|
||||
"energy": { id: "energy", label: "HELLBORN.Weapon.Types.Energy" },
|
||||
"heavy": { id: "heavy", label: "HELLBORN.Weapon.Types.Heavy" },
|
||||
"grenade": { id: "grenade", label: "HELLBORN.Weapon.Types.Grenade" },
|
||||
"vehicle": { id: "vehicle", label: "HELLBORN.Weapon.Types.Vehicle" }
|
||||
"melee": { id: "melee", label: "Melee" },
|
||||
"ranged": { id: "ranged", label: "Ranged" },
|
||||
}
|
||||
|
||||
export const WEAPON_RANGE = {
|
||||
"handgun": { id: "handgun", label: "HELLBORN.Weapon.Range.Handgun", range: {close: 0, near:0, far:-2} },
|
||||
"assault": { id: "assault", label: "HELLBORN.Weapon.Range.Assault", range: {close: -2, near:0, far:-1, distant: -2} },
|
||||
"rifle": { id: "rifle", label: "HELLBORN.Weapon.Range.Rifle", range: {close: -3, near:0, far:0, distant: -1} },
|
||||
"melee": { id: "melee", label: "HELLBORN.Weapon.Range.Melee", range: {close: 0} },
|
||||
"heavyweapon": { id: "heavyweapon", label: "HELLBORN.Weapon.Range.HeavyWeapon", range: {near:-1, far:0, distant: 0} },
|
||||
"thrownweapon": { id: "thrownweapon", label: "HELLBORN.Weapon.Range.ThrownWeapon", range: {close: 0, near:-1} }
|
||||
export const RANGED_SUBTYPES = {
|
||||
"pistols": { id: "pistols", label: "Pistols" },
|
||||
"rifles": { id: "rifles", label: "Rifles" },
|
||||
"shotguns": { id: "shotguns", label: "Shotguns" },
|
||||
"submachineguns": { id: "submachineguns ", label: "Sub machine guns" },
|
||||
"grenades": { id: "grenades", label: "Grenades" },
|
||||
"heavy": { id: "heavy", label: "Heavy Weapons" },
|
||||
}
|
||||
|
||||
export const ATTACK_MODIFIERS = {
|
||||
@@ -139,16 +135,18 @@ export const STARSHIP_HULL = {
|
||||
*/
|
||||
export const SYSTEM = {
|
||||
id: SYSTEM_ID,
|
||||
PERK_ROLES,
|
||||
PERK_LEVELS,
|
||||
MALEFICA_LEVELS,
|
||||
MALEFICA_DOMAINS,
|
||||
MODIFIER_CHOICES,
|
||||
ATTACK_MODIFIERS,
|
||||
TECH_AGES,
|
||||
WEAPON_TYPES,
|
||||
WEAPON_RANGE,
|
||||
RANGED_SUBTYPES,
|
||||
TRIAGE_RESULTS,
|
||||
CREATURE_TERRAIN_TYPES,
|
||||
CREATURE_SIZES,
|
||||
CREATURE_NICHES,
|
||||
STARSHIP_HULL,
|
||||
SKILLS,
|
||||
ASCII
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
export const defaultItemImg = {
|
||||
weapon: "systems/fvtt-hellborn/assets/icons/icon_weapon.svg",
|
||||
equipment: "systems/fvtt-hellborn/assets/icons/icon_equipment.svg",
|
||||
ritual: "systems/fvtt-hellborn/assets/icons/icon_psionic.svg",
|
||||
maleficias: "systems/fvtt-hellborn/assets/icons/icon_talent.svg",
|
||||
perk: "systems/fvtt-hellborn/assets/icons/icon_language.svg",
|
||||
"species-trait": "systems/fvtt-hellborn/assets/icons/icon_creature_trait.svg"
|
||||
weapon: "systems/fvtt-hellborn/assets/icons/weapon.webp",
|
||||
equipment: "systems/fvtt-hellborn/assets/icons/equipment.webp",
|
||||
ritual: "systems/fvtt-hellborn/assets/icons/ritual.webp",
|
||||
malefica: "systems/fvtt-hellborn/assets/icons/malefica.webp",
|
||||
perk: "systems/fvtt-hellborn/assets/icons/perk.webp",
|
||||
"species-trait": "systems/fvtt-hellborn/assets/icons/species-trait.webp",
|
||||
armor: "systems/fvtt-hellborn/assets/icons/armor.webp",
|
||||
}
|
||||
|
||||
export default class HellbornItem extends Item {
|
||||
|
||||
@@ -4,6 +4,7 @@ export { default as HellbornCharacter } from "./character.mjs"
|
||||
export { default as HellbornEquipment } from "./equipment.mjs"
|
||||
export { default as HellbornRitual } from "./ritual.mjs"
|
||||
export { default as HellbornPerk } from "./perk.mjs"
|
||||
export { default as HellbornMaleficias } from "./maleficias.mjs"
|
||||
export { default as HellbornMalefica } from "./malefica.mjs"
|
||||
export { default as HellbornSpeciesTrait } from "./species-trait.mjs"
|
||||
export { default as HellbornWeapon } from "./weapon.mjs"
|
||||
export { default as HellbornArmor } from "./armor.mjs"
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import { SYSTEM } from "../config/system.mjs"
|
||||
|
||||
export default class HellbornMaleficias extends foundry.abstract.TypeDataModel {
|
||||
export default class HellbornArmor extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields
|
||||
const schema = {}
|
||||
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.bonus = new fields.NumberField({ required: true, initial: 0, min: 0 })
|
||||
schema.resilience = new fields.NumberField({ required: true, initial: 0, min: 0 })
|
||||
schema.reduction = new fields.NumberField({ required: true, initial: 0, min: 0 })
|
||||
|
||||
schema.techAge = new fields.StringField({ required: true, choices: SYSTEM.TECH_AGES, initial : "lateatomic" })
|
||||
|
||||
schema.enc = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
|
||||
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
|
||||
|
||||
return schema
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.Implant"]
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.Armor"]
|
||||
|
||||
}
|
||||
@@ -10,25 +10,11 @@ export default class HellbornActor extends foundry.abstract.TypeDataModel {
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.notes = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.name = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.concept = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.pronouns = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.species = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.archetype = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
|
||||
// Carac
|
||||
const skillField = (label) => {
|
||||
const schema = {
|
||||
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 5 }),
|
||||
label: new fields.StringField({ required: true, nullable: false, initial: label })
|
||||
}
|
||||
return new fields.SchemaField(schema, { label })
|
||||
}
|
||||
|
||||
schema.skills = new fields.SchemaField(
|
||||
Object.values(SYSTEM.SKILLS).reduce((obj, characteristic) => {
|
||||
obj[characteristic.id] = skillField(characteristic.label)
|
||||
return obj
|
||||
}, {}),
|
||||
)
|
||||
schema.trait = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.upright = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.reversed = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
|
||||
schema.heroPoints = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||
|
||||
@@ -77,30 +63,6 @@ export default class HellbornActor extends foundry.abstract.TypeDataModel {
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
|
||||
let encMax = 10 + (2*this.skills.physical.value)
|
||||
if (encMax !== this.enc.max) {
|
||||
this.enc.max = encMax
|
||||
}
|
||||
let enc = 0
|
||||
let armor = 0
|
||||
for (let i of this.parent.items) {
|
||||
if (i.system?.enc) {
|
||||
enc += i.system.enc
|
||||
}
|
||||
if ( i.system?.protection) {
|
||||
armor += i.system.protection
|
||||
}
|
||||
}
|
||||
if (enc !== this.enc.value) {
|
||||
this.enc.value = enc
|
||||
}
|
||||
if (armor !== this.armor.value) {
|
||||
this.armor.value = armor
|
||||
}
|
||||
let staminaMax = 14 + (3*this.skills.physical.value)
|
||||
if (staminaMax !== this.health.staminaMax) {
|
||||
this.health.staminaMax = staminaMax
|
||||
}
|
||||
}
|
||||
|
||||
isEncumbered() {
|
||||
@@ -125,7 +87,6 @@ export default class HellbornActor extends foundry.abstract.TypeDataModel {
|
||||
actorName: this.parent.name,
|
||||
actorImage: this.parent.img,
|
||||
talents: this.parent.items.filter(i => i.type === "talent" && i.system.isAdvantage),
|
||||
isEncumbered: this.isEncumbered(),
|
||||
hasTarget,
|
||||
target: opponentTarget
|
||||
})
|
||||
|
||||
@@ -7,22 +7,6 @@ export default class HellbornCreature extends foundry.abstract.TypeDataModel {
|
||||
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||
const schema = {}
|
||||
|
||||
// Carac
|
||||
const skillField = (label) => {
|
||||
const schema = {
|
||||
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 5 }),
|
||||
label: new fields.StringField({ required: true, nullable: false, initial: label }),
|
||||
enabled: new fields.BooleanField({ required: true, initial: true }),
|
||||
}
|
||||
return new fields.SchemaField(schema, { label })
|
||||
}
|
||||
|
||||
schema.skills = new fields.SchemaField(
|
||||
Object.values(SYSTEM.SKILLS).reduce((obj, characteristic) => {
|
||||
obj[characteristic.id] = skillField(characteristic.label)
|
||||
return obj
|
||||
}, {}),
|
||||
)
|
||||
|
||||
schema.terrain = new fields.StringField({ required: true, nullable: false, initial: "cave", choices: SYSTEM.CREATURE_TERRAIN_TYPES })
|
||||
schema.niche = new fields.StringField({ required: true, nullable: false, initial: "prey", choices: SYSTEM.CREATURE_NICHES })
|
||||
|
||||
@@ -8,9 +8,6 @@ export default class HellbornEquipment extends foundry.abstract.TypeDataModel {
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
schema.techAge = new fields.StringField({ required: true, choices: SYSTEM.TECH_AGES, initial : "lateatomic" })
|
||||
|
||||
schema.enc = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
|
||||
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
|
||||
|
||||
return schema
|
||||
|
||||
23
module/models/malefica.mjs
Normal file
@@ -0,0 +1,23 @@
|
||||
import { SYSTEM } from "../config/system.mjs"
|
||||
|
||||
export default class HellbornMalefica extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields
|
||||
const schema = {}
|
||||
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
schema.domain = new fields.StringField({ required: true, nullable: false, choices: SYSTEM.MALEFICA_DOMAINS, initial: "adfectus" })
|
||||
schema.level = new fields.StringField({ required: true, nullable: false, choices: SYSTEM.MALEFICA_LEVELS, initial: "1" })
|
||||
schema.time = new fields.StringField({ required: true, initial : "" })
|
||||
schema.range = new fields.StringField({ required: true, initial : "" })
|
||||
schema.target = new fields.StringField({ required: true, initial : "" })
|
||||
|
||||
return schema
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.Malefica"]
|
||||
|
||||
}
|
||||
@@ -6,12 +6,15 @@ export default class HellbornPerk extends foundry.abstract.TypeDataModel {
|
||||
const schema = {}
|
||||
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||
|
||||
schema.role = new fields.StringField({ required: true, nullable: false, choices: SYSTEM.PERK_ROLES, initial: "abbetor" })
|
||||
schema.level = new fields.StringField({ required: true, nullable: false, choices: SYSTEM.PERK_LEVELS, initial: "1" })
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
return schema
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.Psionic"]
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.Perk"]
|
||||
|
||||
}
|
||||
|
||||
@@ -16,5 +16,5 @@ export default class HellbornRitual extends foundry.abstract.TypeDataModel {
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.Language"]
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.Ritual"]
|
||||
}
|
||||
|
||||
@@ -5,12 +5,11 @@ export default class HellbornSpeciesTrait extends foundry.abstract.TypeDataModel
|
||||
const fields = foundry.data.fields;
|
||||
const schema = {};
|
||||
|
||||
schema.isAdvantage = new fields.BooleanField({ required: true, initial: false });
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.CreatureTrait"];
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.SpeciesTrait"];
|
||||
}
|
||||
@@ -8,30 +8,19 @@ export default class HellbornWeapon extends foundry.abstract.TypeDataModel {
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
schema.techAge = new fields.StringField({ required: true, choices: SYSTEM.TECH_AGES, initial : "lateatomic" })
|
||||
schema.weaponType = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_TYPES })
|
||||
schema.rangeType = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_RANGE })
|
||||
schema.subType = new fields.StringField({ required: false, initial: "pistols", choices: SYSTEM.RANGED_SUBTYPES })
|
||||
schema.properties = new fields.StringField({required: true, initial: ""})
|
||||
|
||||
schema.damage = new fields.StringField({required: true, initial: "1d6"})
|
||||
schema.magazine = new fields.NumberField({ required: true, initial: 1, min: 0 })
|
||||
|
||||
schema.range = new fields.SchemaField({
|
||||
close: new fields.NumberField({ ...requiredInteger, initial: 0 }),
|
||||
near: new fields.NumberField({ ...requiredInteger, initial: 0 }),
|
||||
far: new fields.NumberField({ ...requiredInteger, initial: 0 }),
|
||||
dist: new fields.NumberField({ ...requiredInteger, initial: 0 }),
|
||||
})
|
||||
|
||||
schema.enc = new fields.NumberField({ required: true, initial: 0, min: 0 })
|
||||
schema.aspect = new fields.StringField({ required: true, initial: ""})
|
||||
|
||||
schema.ammo = new fields.StringField({ required: false, initial: "" })
|
||||
schema.range = new fields.StringField({ required: false, initial: "" })
|
||||
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
|
||||
schema.ammoCost = new fields.NumberField({ required: true, initial: 0, min: 0 })
|
||||
|
||||
return schema
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["FTLNOMAD.Weapon"]
|
||||
static LOCALIZATION_PREFIXES = ["HELLBORN.Weapon"]
|
||||
|
||||
}
|
||||
|
||||
1
node_modules/.bin/acorn
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../acorn/bin/acorn
|
||||
1
node_modules/.bin/errno
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../errno/cli.js
|
||||
1
node_modules/.bin/eslint
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../eslint/bin/eslint.js
|
||||
1
node_modules/.bin/eslint-config-prettier
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../eslint-config-prettier/bin/cli.js
|
||||
1
node_modules/.bin/fvtt
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@foundryvtt/foundryvtt-cli/fvtt.mjs
|
||||
1
node_modules/.bin/gulp
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../gulp/bin/gulp.js
|
||||
1
node_modules/.bin/image-size
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../image-size/bin/image-size.js
|
||||
1
node_modules/.bin/js-yaml
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../js-yaml/bin/js-yaml.js
|
||||
1
node_modules/.bin/lessc
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../less/bin/lessc
|
||||
1
node_modules/.bin/mime
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mime/cli.js
|
||||
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mkdirp/dist/cjs/src/bin.js
|
||||
1
node_modules/.bin/needle
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../needle/bin/needle
|
||||
1
node_modules/.bin/node-gyp-build
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../node-gyp-build/bin.js
|
||||
1
node_modules/.bin/node-gyp-build-optional
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../node-gyp-build/optional.js
|
||||
1
node_modules/.bin/node-gyp-build-test
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../node-gyp-build/build-test.js
|
||||
1
node_modules/.bin/node-which
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../which/bin/node-which
|
||||
1
node_modules/.bin/prettier
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../prettier/bin/prettier.cjs
|
||||
1
node_modules/.bin/resolve
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../resolve/bin/resolve
|
||||
1
node_modules/.bin/semver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../semver/bin/semver.js
|
||||
3468
node_modules/.package-lock.json
generated
vendored
Normal file
589
node_modules/@es-joy/jsdoccomment/CHANGES.md
generated
vendored
Normal file
@@ -0,0 +1,589 @@
|
||||
# CHANGES for `@es-joy/jsdoccomment`
|
||||
|
||||
## 0.46.0
|
||||
|
||||
- chore: update esquery, drop bundling of types, update devDeps
|
||||
|
||||
## 0.45.0
|
||||
|
||||
- feat: get following comment (experimental)
|
||||
|
||||
## 0.44.0
|
||||
|
||||
- feat: add `getNonJsdocComment` for getting non-JSDoc comments above node
|
||||
|
||||
## 0.43.1
|
||||
|
||||
- fix: for `@template` name parsing, ensure (default-)bracketed name is not broken with internal spaces.
|
||||
|
||||
## 0.43.0
|
||||
|
||||
This release brings surgical round trip parsing to generated AST and reconstruction of JSDoc comment blocks via: `parseComment` ->
|
||||
`commentParserToESTree` -> `estreeToString`.
|
||||
|
||||
- feat: new option `spacing` for `commentParserToESTree`; the default is `compact` removing empty description lines.
|
||||
Set to `preserve` to retain empty description lines.
|
||||
- feat: new properties in the `JsdocBlock` generated AST `delimiterLineBreak` and `preterminalLineBreak` that encode
|
||||
any line break after the opening `delimiter` and before the closing `terminal` string. Values are either `\n` or an
|
||||
empty string.
|
||||
|
||||
- chore: update devDeps / switch to Vitest.
|
||||
|
||||
- New [API documentation](https://es-joy.github.io/jsdoccomment/).
|
||||
|
||||
Thanks:
|
||||
- [@typhonrt](https://github.com/typhonrt)
|
||||
|
||||
## 0.42.0
|
||||
|
||||
- feat: expand argument for `parseComment` to accept a comment token string ([@typhonrt](https://github.com/typhonrt))
|
||||
- chore: update devDeps.
|
||||
|
||||
## 0.41.0
|
||||
|
||||
- feat: look above surrounding parenthesis tokens for comment blocks, even if on a higher line than the corresponding AST structure
|
||||
- chore: update comment-parser and devDeps.
|
||||
|
||||
## 0.40.1
|
||||
|
||||
- chore(TS): fix path issue
|
||||
|
||||
## 0.40.0
|
||||
|
||||
- chore: update comment-parser and devDeps.
|
||||
- chore(TS): switch to NodeNext
|
||||
|
||||
## 0.39.4
|
||||
|
||||
- fix: include type exports for full inlineTags (and line) property support on blocks and tags
|
||||
|
||||
## 0.39.3
|
||||
|
||||
- fix: add type details for Node range and settings
|
||||
|
||||
## 0.39.2
|
||||
|
||||
- fix: export additional typedefs from index.js
|
||||
|
||||
## 0.39.1
|
||||
|
||||
- fix: typing export
|
||||
|
||||
## 0.39.0
|
||||
|
||||
- feat: types for test files and emit declaration files
|
||||
- fix(estreeToString): add `JsdodInlineTag` stringify support
|
||||
- refactor: lint
|
||||
- docs: add `JsdocInlineTag` to README
|
||||
- chore: update devDeps.
|
||||
|
||||
## 0.38.0
|
||||
|
||||
- feat: add parsing inline tags (#12); fixes #11
|
||||
|
||||
## 0.37.1
|
||||
|
||||
- chore: support Node 20
|
||||
- chore: update esquery, devDeps.
|
||||
|
||||
## 0.37.0
|
||||
## 0.37.0-pre.0
|
||||
|
||||
- fix: update `jsdoc-type-pratt-parser` (supports bracket indexes)
|
||||
|
||||
## 0.36.1
|
||||
|
||||
- fix(`getReducedASTNode`): stop checking for comment blocks at return
|
||||
statement
|
||||
|
||||
## 0.36.0
|
||||
|
||||
- feat: add `hasPreterminalTagDescription` property
|
||||
- fix: avoid description line properties if tag is present
|
||||
- fix: ensure description and description lines added to terminal multi-line tag
|
||||
|
||||
## 0.35.0
|
||||
|
||||
- feat: add `hasPreterminalDescription` property
|
||||
- fix: allow newline even for 1st line (after 0th)
|
||||
|
||||
## 0.34.0
|
||||
|
||||
- feat: add `descriptionStartLine` and `descriptionEndLine` properties
|
||||
- fix: avoid duplication with 0 line comments
|
||||
- chore: update devDeps.
|
||||
|
||||
## 0.33.4
|
||||
|
||||
- chore: republish as npm seems to have missed the release
|
||||
|
||||
## 0.33.3
|
||||
|
||||
- fix: ensure multi-line `description` includes newline except for
|
||||
initial line descriptions
|
||||
|
||||
## 0.33.2
|
||||
|
||||
- fix: avoid repetition within multi-line descriptions
|
||||
|
||||
## 0.33.1
|
||||
|
||||
- fix: add to default no types: `description`, `example`, `file`,
|
||||
`fileoverview`, `license`, `overview`, `see`, `summary`
|
||||
- fix: add to no names: `file`, `fileoverview, `overview`
|
||||
|
||||
## 0.33.0
|
||||
|
||||
- chore: add Node 19 to `engines` (@RodEsp)
|
||||
- chore: update devDeps. and build file accordingly
|
||||
|
||||
## 0.32.0
|
||||
|
||||
- feat: have comment checking stop at assignment patterns (comments for
|
||||
defaults should not rise to function itself)
|
||||
- chore: bump devDeps.
|
||||
|
||||
## 0.31.0
|
||||
|
||||
- feat: support default values with `@template` per
|
||||
<https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template>
|
||||
|
||||
## 0.30.0
|
||||
|
||||
- chore: bump `jsdoc-type-pratt-parser` and devDeps.
|
||||
|
||||
## 0.29.0
|
||||
|
||||
- fix: update `engines` as per current `getJSDocComment` behavior
|
||||
- chore: update devDeps.
|
||||
|
||||
## 0.28.1
|
||||
|
||||
- fix(`getReducedASTNode`): token checking
|
||||
- build: add Node 18 support (@WikiRik)
|
||||
|
||||
## 0.28.0
|
||||
|
||||
- chore: bump `engines` to support Node 18
|
||||
|
||||
## 0.27.0
|
||||
|
||||
- chore: bump `jsdoc-type-pratt-parser` and devDeps.
|
||||
|
||||
## 0.26.1
|
||||
|
||||
- fix(`estreeToString`): ensure `typeLines` may be picked up
|
||||
|
||||
## 0.26.0
|
||||
|
||||
- feat(`getJSDocComment`): allow function to detect comments just preceding a
|
||||
parenthesized expression (these have no special AST but their tokens
|
||||
have to be overpassed)
|
||||
|
||||
## 0.25.0
|
||||
|
||||
- feat(`parseComment`): properly support whitespace
|
||||
- fix(`estreeToString`): carriage return placement for ending of JSDoc block
|
||||
- fix(`commentParserToESTree`): avoid adding initial space before a tag if on
|
||||
a single line
|
||||
- test: make tests more accurate to jsdoc semantically
|
||||
|
||||
## 0.24.0
|
||||
|
||||
- feat(`estreeToString`): support stringification of `parsedType` but with
|
||||
a new `preferRawType` option allowing the old behavior of using `rawType`
|
||||
|
||||
## 0.23.6
|
||||
|
||||
- fix(`commentParserToESTree`): ensure `postType` added after multi-line type
|
||||
- fix(`estreeToString`): ensure `JsdocTypeLine` stringified with `initial` and
|
||||
that they are joined together with newlines
|
||||
|
||||
## 0.23.5
|
||||
|
||||
- fix(`commentParserToESTree`): avoid duplicating tag names
|
||||
|
||||
## 0.23.4
|
||||
|
||||
- fix(`estreeToString`): add `delimiter`, etc. if adding `JsdocDescriptionLine`
|
||||
for `JsdocBlock`
|
||||
- fix(`estreeToString`): add line break when tags are present (unless already
|
||||
ending in newline)
|
||||
|
||||
## 0.23.3
|
||||
|
||||
- fix(`estreeToString`): handle multi-line block descriptions followed by
|
||||
tags with line break
|
||||
|
||||
## 0.23.2
|
||||
|
||||
- fix: ensure JsdocBlock stringifier has any initial whitespace on end line
|
||||
|
||||
## 0.23.1
|
||||
|
||||
- docs(README): update
|
||||
|
||||
## 0.23.0
|
||||
|
||||
- BREAKING CHANGE(`commentParserToESTree`): rename `start` and `end` to
|
||||
`initial` and `terminal` to avoid any conflicts with Acorn-style parsers
|
||||
- feat: add `initial` and `terminal` on `JsdocBlock`
|
||||
|
||||
## 0.22.2
|
||||
|
||||
- fix: preserve type tokens
|
||||
- perf: cache tokenizers
|
||||
|
||||
## 0.22.1
|
||||
|
||||
- fix: ensure `getJSDocComment` does not treat block comments as JSDoc unless
|
||||
their first asterisk is followed by whitespace
|
||||
|
||||
## 0.22.0
|
||||
|
||||
- fix: update dep. `jsdoc-type-pratt-parser`
|
||||
- chore: update `comment-parser` and simplify as possible
|
||||
|
||||
## 0.21.2
|
||||
|
||||
- fix: only throw if the raw type is not empty
|
||||
|
||||
## 0.21.1
|
||||
|
||||
- fix: provide clearer error message for `throwOnTypeParsingErrors`
|
||||
|
||||
## 0.21.0
|
||||
|
||||
- feat: add `throwOnTypeParsingErrors` to receive run-time type parsing errors
|
||||
for `parsedType`
|
||||
- chore: update jsdoc-type-pratt-parser and devDeps.; also lints
|
||||
|
||||
## 0.20.1
|
||||
|
||||
- fix: resume catching bad parsed type (at least until
|
||||
`jsdoc-type-pratt-parser` may support all expected types)
|
||||
|
||||
## 0.20.0
|
||||
|
||||
- feat: add estree stringifer
|
||||
- fix: properly supports `name`/`postName` for multi-line type
|
||||
- fix: allow pratt parser to fail (unless empty)
|
||||
- fix: don't add tag postDelimiter when on 0 description line
|
||||
- fix: avoid adding extra line when only name and no succeeding description
|
||||
- docs: clarify re: `kind`
|
||||
- test: add `parsedType` with correct mode; add tests
|
||||
- chore: updates jsdoc-type-pratt-parser
|
||||
- chore: updates devDeps.
|
||||
|
||||
## 0.19.0
|
||||
|
||||
### User-impacting
|
||||
|
||||
- feat: treat `@kind` as having no name
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- docs: jsdoc
|
||||
- test: begin checking `jsdoccomment`
|
||||
- test: adds lcov reporter and open script for it
|
||||
- chore: update devDeps.
|
||||
|
||||
## 0.18.0
|
||||
|
||||
### User-impacting
|
||||
|
||||
- feat: add non-visitable `endLine` property (so can detect line number
|
||||
when no description present)
|
||||
- feat: supply `indent` default for `parseComment`
|
||||
- fix: ensure `postName` gets a space for `@template` with a description
|
||||
- fix: converting JSDoc comment with tag on same line as end (e.g., single
|
||||
line) to AST
|
||||
- chore: update `jsdoc-type-pratt-parser`
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- docs: add jsdoc blocks internally
|
||||
- chore: update devDeps.
|
||||
- test: avoid need for `expect`
|
||||
- test: complete coverage for `commentHandler`, `parseComment` tests
|
||||
|
||||
## 0.17.0
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Enhancement: Re-export `jsdoc-type-pratt-parser`
|
||||
- Update: `jsdoc-type-pratt-parser` to 2.2.1
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.16.0
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Update: `jsdoc-type-pratt-parser` to 2.2.0
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.15.0
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Update: `jsdoc-type-pratt-parser` to 2.1.0
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.14.2
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Fix: Find comments previous to parentheses (used commonly in TypeScript)
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.14.1
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Update: `jsdoc-type-pratt-parser` to 2.0.2
|
||||
|
||||
## 0.14.0
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Update: `jsdoc-type-pratt-parser` to 2.0.1
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.13.0
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Update: `comment-parser` to 1.3.0
|
||||
- Fix: Allow comment on `ExportDefaultDeclaration`
|
||||
|
||||
## 0.12.0
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Update: `jsdoc-type-pratt-parser` to 2.0.0
|
||||
- Enhancement: Support Node 17 (@timgates42)
|
||||
- Docs: Typo (@timgates42)
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- Linting: As per latest ash-nazg
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.11.0
|
||||
|
||||
- Update: For `@typescript/eslint-parser@5`, add `PropertyDefinition`
|
||||
|
||||
## 0.10.8
|
||||
|
||||
### User-impacting
|
||||
|
||||
- npm: Liberalize `engines` as per `comment-parser` change
|
||||
- npm: Bump `comment-parser`
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- Linting: As per latest ash-nazg
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.10.7
|
||||
|
||||
- npm: Update comment-parser with CJS fix and re-exports
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.10.6
|
||||
|
||||
- Fix: Ensure copying latest build of `comment-parser`'s ESM utils
|
||||
|
||||
## 0.10.5
|
||||
|
||||
- npm: Bump fixed `jsdoc-type-pratt-parser` and devDeps.
|
||||
|
||||
## 0.10.4
|
||||
|
||||
- Fix: Bundle `comment-parser` nested imports so that IDEs (like Atom)
|
||||
bundling older Node versions can still work. Still mirroring the
|
||||
stricter `comment-parser` `engines` for now, however.
|
||||
|
||||
## 0.10.3
|
||||
|
||||
- npm: Avoid exporting nested subpaths for sake of older Node versions
|
||||
|
||||
## 0.10.2
|
||||
|
||||
- npm: Specify exact supported range: `^12.20 || ^14.14.0 || ^16`
|
||||
|
||||
## 0.10.1
|
||||
|
||||
- npm: Apply patch version of `comment-parser`
|
||||
|
||||
## 0.10.0
|
||||
|
||||
- npm: Point to stable `comment-parser`
|
||||
|
||||
## 0.9.0-alpha.6
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Update: For `comment-parser` update, add `lineEnd`
|
||||
|
||||
## 0.9.0-alpha.5
|
||||
|
||||
### User-impacting
|
||||
|
||||
- npm: Bump `comment-parser` (for true ESM)
|
||||
- Update: Remove extensions for packages for native ESM in `comment-parser` fix
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.9.0-alpha.4
|
||||
|
||||
- Docs: Update repo info in `package.json`
|
||||
|
||||
## 0.9.0-alpha.3
|
||||
|
||||
- Fix: Due to `comment-parser` still needing changes, revert for now to alpha.1
|
||||
|
||||
## 0.9.0-alpha.2
|
||||
|
||||
### User-impacting
|
||||
|
||||
- npm: Bump `comment-parser` (for true ESM)
|
||||
- Update: Remove extensions for packages for native ESM in `comment-parser` fix
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.9.0-alpha.1
|
||||
|
||||
### User-impacting
|
||||
|
||||
- Breaking change: Indicate minimum for `engines` as Node >= 12
|
||||
- npm: Bump `comment-parser`
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- npm: Lint cjs files
|
||||
- npm: Fix eslint script
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.8.0
|
||||
|
||||
### User-impacting
|
||||
|
||||
- npm: Update `jsdoc-type-pratt-parser` (prerelease to stable patch)
|
||||
|
||||
### Dev-impacting
|
||||
|
||||
- npm: Update devDeps.
|
||||
|
||||
## 0.8.0-alpha.2
|
||||
|
||||
- Fix: Avoid erring with missing `typeLines`
|
||||
|
||||
## 0.8.0-alpha.1
|
||||
|
||||
- Breaking change: Export globally as `JsdocComment`
|
||||
- Breaking change: Change `JSDoc` prefixes of all node types to `Jsdoc`
|
||||
- Breaking change: Drop `jsdoctypeparserToESTree`
|
||||
- Breaking enhancement: Switch to `jsdoc-type-pratt-parser` (toward greater
|
||||
TypeScript expressivity and compatibility/support with catharsis)
|
||||
- Enhancement: Export `jsdocTypeVisitorKeys` (from `jsdoc-type-pratt-parser`)
|
||||
|
||||
## 0.7.2
|
||||
|
||||
- Fix: Add `@description` to `noNames`
|
||||
|
||||
## 0.7.1
|
||||
|
||||
- Fix: Add `@summary` to `noNames`
|
||||
|
||||
## 0.7.0
|
||||
|
||||
- Enhancement: Allow specifying `noNames` and `noTypes` on `parseComment`
|
||||
to override (or add to) tags which should have no names or types.
|
||||
- Enhancement: Export `hasSeeWithLink` utility and `defaultNoTypes` and
|
||||
`defaultNoNames`.
|
||||
|
||||
## 0.6.0
|
||||
|
||||
- Change `comment-parser` `tag` AST to avoid initial `@`
|
||||
|
||||
## 0.5.1
|
||||
|
||||
- Fix: Avoid setting `variation` name (just the description) (including in
|
||||
dist)
|
||||
- npm: Add `prepublishOnly` script
|
||||
|
||||
## 0.5.0
|
||||
|
||||
- Fix: Avoid setting `variation` name (just the description)
|
||||
|
||||
## 0.4.4
|
||||
|
||||
- Fix: Avoid setting `name` and `description` for simple `@template SomeName`
|
||||
|
||||
## 0.4.3
|
||||
|
||||
- npm: Ignores Github file
|
||||
|
||||
## 0.4.2
|
||||
|
||||
- Fix: Ensure replacement of camel-casing (used in `jsdoctypeparser` nodes and
|
||||
visitor keys is global. The practical effect is that
|
||||
`JSDocTypeNamed_parameter` -> `JSDocTypeNamedParameter`,
|
||||
`JSDocTypeRecord_entry` -> `JSDocTypeRecordEntry`
|
||||
`JSDocTypeNot_nullable` -> `JSDocTypeNotNullable`
|
||||
`JSDocTypeInner_member` -> `JSDocTypeInnerMember`
|
||||
`JSDocTypeInstance_member` -> `JSDocTypeInstanceMember`
|
||||
`JSDocTypeString_value` -> `JSDocTypeStringValue`
|
||||
`JSDocTypeNumber_value` -> `JSDocTypeNumberValue`
|
||||
`JSDocTypeFile_path` -> `JSDocTypeFilePath`
|
||||
`JSDocTypeType_query` -> `JSDocTypeTypeQuery`
|
||||
`JSDocTypeKey_query` -> `JSDocTypeKeyQuery`
|
||||
- Fix: Add missing `JSDocTypeLine` to visitor keys
|
||||
- Docs: Explain AST structure/differences
|
||||
|
||||
## 0.4.1
|
||||
|
||||
- Docs: Indicate available methods with brief summary on README
|
||||
|
||||
## 0.4.0
|
||||
|
||||
- Enhancement: Expose `parseComment` and `getTokenizers`.
|
||||
|
||||
## 0.3.0
|
||||
|
||||
- Enhancement: Expose `toCamelCase` as new method rather than within a
|
||||
utility file.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
- Enhancement: Exposes new methods: `commentHandler`,
|
||||
`commentParserToESTree`, `jsdocVisitorKeys`, `jsdoctypeparserToESTree`,
|
||||
`jsdocTypeVisitorKeys`,
|
||||
|
||||
## 0.1.1
|
||||
|
||||
- Build: Add Babel to work with earlier Node
|
||||
|
||||
## 0.1.0
|
||||
|
||||
- Initial version
|
||||
20
node_modules/@es-joy/jsdoccomment/LICENSE-MIT.txt
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright JS Foundation and other contributors, https://js.foundation
|
||||
Copyright (c) 2021 Brett Zamir
|
||||
|
||||
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.
|
||||
241
node_modules/@es-joy/jsdoccomment/README.md
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
# @es-joy/jsdoccomment
|
||||
|
||||
[](https://www.npmjs.com/package/@es-joy/jsdoccomment)
|
||||
[](https://github.com/es-joy/jsdoccomment/blob/main/LICENSE-MIT.txt)
|
||||
[](#)
|
||||
[](https://es-joy.github.io/jsdoccomment/)
|
||||
|
||||
|
||||
This project aims to preserve and expand upon the
|
||||
`SourceCode#getJSDocComment` functionality of the deprecated ESLint method.
|
||||
|
||||
It also exports a number of functions currently for working with JSDoc:
|
||||
|
||||
## API
|
||||
|
||||
### `parseComment`
|
||||
|
||||
For parsing `comment-parser` in a JSDoc-specific manner.
|
||||
Might wish to have tags with or without tags, etc. derived from a split off
|
||||
JSON file.
|
||||
|
||||
### `commentParserToESTree`
|
||||
|
||||
Converts [comment-parser](https://github.com/syavorsky/comment-parser)
|
||||
AST to ESTree/ESLint/Babel friendly AST. See the "ESLint AST..." section below.
|
||||
|
||||
### `estreeToString`
|
||||
|
||||
Stringifies. In addition to the node argument, it accepts an optional second
|
||||
options object with a single `preferRawType` key. If you don't need to modify
|
||||
JSDoc type AST, you might wish to set this to `true` to get the benefits of
|
||||
preserving the raw form, but for AST-based stringification of JSDoc types,
|
||||
keep it `false` (the default).
|
||||
|
||||
### `jsdocVisitorKeys`
|
||||
|
||||
The [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)
|
||||
for `JsdocBlock`, `JsdocDescriptionLine`, and `JsdocTag`. More likely to be
|
||||
subject to change or dropped in favor of another type parser.
|
||||
|
||||
### `jsdocTypeVisitorKeys`
|
||||
|
||||
Just a re-export of [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)
|
||||
from [`jsdoc-type-pratt-parser`](https://github.com/simonseyock/jsdoc-type-pratt-parser/).
|
||||
|
||||
### `getDefaultTagStructureForMode`
|
||||
|
||||
Provides info on JSDoc tags:
|
||||
|
||||
- `nameContents` ('namepath-referencing'|'namepath-defining'|
|
||||
'dual-namepath-referencing'|false) - Whether and how a name is allowed
|
||||
following any type. Tags without a proper name (value `false`) may still
|
||||
have a description (which can appear like a name); `descriptionAllowed`
|
||||
in such cases would be `true`.
|
||||
The presence of a truthy `nameContents` value is therefore only intended
|
||||
to signify whether separate parsing should occur for a name vs. a
|
||||
description, and what its nature should be.
|
||||
- `nameRequired` (boolean) - Whether a name must be present following any type.
|
||||
- `descriptionAllowed` (boolean) - Whether a description (following any name)
|
||||
is allowed.
|
||||
- `typeAllowed` (boolean) - Whether the tag accepts a curly bracketed portion.
|
||||
Even without a type, a tag may still have a name and/or description.
|
||||
- `typeRequired` (boolean) - Whether a curly bracketed type must be present.
|
||||
- `typeOrNameRequired` (boolean) - Whether either a curly bracketed type is
|
||||
required or a name, but not necessarily both.
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
Also currently exports these utilities:
|
||||
|
||||
- `getTokenizers` - Used with `parseComment` (its main core).
|
||||
- `hasSeeWithLink` - A utility to detect if a tag is `@see` and has a `@link`.
|
||||
- `commentHandler` - Used by `eslint-plugin-jsdoc`.
|
||||
- `commentParserToESTree`- Converts [comment-parser](https://github.com/syavorsky/comment-parser)
|
||||
AST to ESTree/ESLint/Babel friendly AST.
|
||||
- `jsdocVisitorKeys` - The [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)
|
||||
for `JSDocBlock`, `JSDocDescriptionLine`, and `JSDocTag`.
|
||||
- `jsdocTypeVisitorKeys` - [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)
|
||||
for `jsdoc-type-pratt-parser`.
|
||||
- `defaultNoTypes` = The tags which allow no types by default:
|
||||
`default`, `defaultvalue`, `description`, `example`, `file`,
|
||||
`fileoverview`, `license`, `overview`, `see`, `summary`
|
||||
- `defaultNoNames` - The tags which allow no names by default:
|
||||
`access`, `author`, `default`, `defaultvalue`, `description`, `example`,
|
||||
`exception`, `file`, `fileoverview`, `kind`, `license`, `overview`,
|
||||
`return`, `returns`, `since`, `summary`, `throws`, `version`, `variation`
|
||||
|
||||
## ESLint AST produced for `comment-parser` nodes (`JsdocBlock`, `JsdocTag`, and `JsdocDescriptionLine`)
|
||||
|
||||
Note: Although not added in this package, `@es-joy/jsdoc-eslint-parser` adds
|
||||
a `jsdoc` property to other ES nodes (using this project's `getJSDocComment`
|
||||
to determine the specific comment-block that will be attached as AST).
|
||||
|
||||
### `JsdocBlock`
|
||||
|
||||
Has the following visitable properties:
|
||||
|
||||
1. `descriptionLines` (an array of `JsdocDescriptionLine` for multiline
|
||||
descriptions).
|
||||
2. `tags` (an array of `JsdocTag`; see below)
|
||||
3. `inlineTags` (an array of `JsdocInlineTag`; see below)
|
||||
|
||||
Has the following custom non-visitable property:
|
||||
|
||||
1. `delimiterLineBreak` - A string containing any line break after `delimiter`.
|
||||
2. `lastDescriptionLine` - A number
|
||||
3. `endLine` - A number representing the line number with `end`/`terminal`
|
||||
4. `descriptionStartLine` - A 0+ number indicating the line where any
|
||||
description begins
|
||||
5. `descriptionEndLine` - A 0+ number indicating the line where the description
|
||||
ends
|
||||
6. `hasPreterminalDescription` - Set to 0 or 1. On if has a block description
|
||||
on the same line as the terminal `*/`.
|
||||
7. `hasPreterminalTagDescription` - Set to 0 or 1. On if has a tag description
|
||||
on the same line as the terminal `*/`.
|
||||
8. `preterminalLineBreak` - A string containing any line break before `terminal`.
|
||||
|
||||
May also have the following non-visitable properties from `comment-parser`:
|
||||
|
||||
1. `description` - Same as `descriptionLines` but as a string with newlines.
|
||||
2. `delimiter`
|
||||
3. `postDelimiter`
|
||||
4. `lineEnd`
|
||||
5. `initial` (from `start`)
|
||||
6. `terminal` (from `end`)
|
||||
|
||||
### `JsdocTag`
|
||||
|
||||
Has the following visitable properties:
|
||||
|
||||
1. `parsedType` (the `jsdoc-type-pratt-parser` AST representation of the tag's
|
||||
type (see the `jsdoc-type-pratt-parser` section below)).
|
||||
2. `typeLines` (an array of `JsdocTypeLine` for multiline type strings)
|
||||
3. `descriptionLines` (an array of `JsdocDescriptionLine` for multiline
|
||||
descriptions)
|
||||
4. `inlineTags` (an array of `JsdocInlineTag`)
|
||||
|
||||
May also have the following non-visitable properties from `comment-parser`
|
||||
(note that all are included from `comment-parser` except `end` as that is only
|
||||
for JSDoc blocks and note that `type` is renamed to `rawType` and `start` to
|
||||
`initial`):
|
||||
|
||||
1. `description` - Same as `descriptionLines` but as a string with newlines.
|
||||
2. `rawType` - `comment-parser` has this named as `type`, but because of a
|
||||
conflict with ESTree using `type` for Node type, we renamed it to
|
||||
`rawType`. It is otherwise the same as in `comment-parser`, i.e., a string
|
||||
with newlines, though with the initial `{` and final `}` stripped out.
|
||||
See `typeLines` for the array version of this property.
|
||||
3. `initial` - Renamed from `start` to avoid potential conflicts with
|
||||
Acorn-style parser processing tools
|
||||
4. `delimiter`
|
||||
5. `postDelimiter`
|
||||
6. `tag` (this does differ from `comment-parser` now in terms of our stripping
|
||||
the initial `@`)
|
||||
7. `postTag`
|
||||
8. `name`
|
||||
9. `postName`
|
||||
10. `postType`
|
||||
|
||||
### `JsdocDescriptionLine`
|
||||
|
||||
No visitable properties.
|
||||
|
||||
May also have the following non-visitable properties from `comment-parser`:
|
||||
|
||||
1. `delimiter`
|
||||
2. `postDelimiter`
|
||||
3. `initial` (from `start`)
|
||||
4. `description`
|
||||
|
||||
### `JsdocTypeLine`
|
||||
|
||||
No visitable properties.
|
||||
|
||||
May also have the following non-visitable properties from `comment-parser`:
|
||||
|
||||
1. `delimiter`
|
||||
2. `postDelimiter`
|
||||
3. `initial` (from `start`)
|
||||
4. `rawType` - Renamed from `comment-parser` to avoid a conflict. See
|
||||
explanation under `JsdocTag`
|
||||
|
||||
### `JsdocInlineTag`
|
||||
|
||||
No visitable properties.
|
||||
|
||||
Has the following non-visitable properties:
|
||||
|
||||
1. `format`: 'pipe' | 'plain' | 'prefix' | 'space'. These follow the styles of [link](https://jsdoc.app/tags-inline-link.html) or [tutorial](https://jsdoc.app/tags-inline-tutorial.html).
|
||||
1. `pipe`: `{@link namepathOrURL|link text}`
|
||||
2. `plain`: `{@link namepathOrURL}`
|
||||
3. `prefix`: `[link text]{@link namepathOrURL}`
|
||||
4. `space`: `{@link namepathOrURL link text (after the first space)}`
|
||||
2. `namepathOrURL`: string
|
||||
3. `tag`: string. The standard allows `tutorial` or `link`
|
||||
4. `text`: string
|
||||
|
||||
## ESLint AST produced for `jsdoc-type-pratt-parser`
|
||||
|
||||
The AST, including `type`, remains as is from [jsdoc-type-pratt-parser](https://github.com/simonseyock/jsdoc-type-pratt-parser/).
|
||||
|
||||
The type will always begin with a `JsdocType` prefix added, along with a
|
||||
camel-cased type name, e.g., `JsdocTypeUnion`.
|
||||
|
||||
The `jsdoc-type-pratt-parser` visitor keys are also preserved without change.
|
||||
|
||||
You can get a sense of the structure of these types using the parser's
|
||||
[tester](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/).
|
||||
|
||||
## Installation
|
||||
|
||||
```shell
|
||||
npm i @es-joy/jsdoccomment
|
||||
```
|
||||
|
||||
## Changelog
|
||||
|
||||
The changelog can be found on the [CHANGES.md](https://github.com/es-joy/jsdoccomment/blob/main/CHANGES.md).
|
||||
<!--## Contributing
|
||||
|
||||
Everyone is welcome to contribute. Please take a moment to review the [contributing guidelines](CONTRIBUTING.md).
|
||||
-->
|
||||
## Authors and license
|
||||
|
||||
[Brett Zamir](http://brett-zamir.me/) and
|
||||
[contributors](https://github.com/es-joy/jsdoccomment/graphs/contributors).
|
||||
|
||||
MIT License, see the included [LICENSE-MIT.txt](https://github.com/es-joy/jsdoccomment/blob/main/LICENSE-MIT.txt) file.
|
||||
|
||||
## To-dos
|
||||
|
||||
1. Get complete code coverage
|
||||
1. Given that `esquery` expects a `right` property to search for `>` (the
|
||||
child selector), we should perhaps insist, for example, that params are
|
||||
the child property for `JsdocBlock` or such. Where `:has()` is currently
|
||||
needed, one could thus instead just use `>`.
|
||||
1. Might add `trailing` for `JsdocBlock` to know whether it is followed by a
|
||||
line break or what not; `comment-parser` does not provide, however
|
||||
1. Fix and properly utilize `indent` argument (challenging for
|
||||
`eslint-plugin-jsdoc` but needed for `jsdoc-eslint-parser` stringifiers
|
||||
to be more faithful); should also then use the proposed `trailing` as well
|
||||
1333
node_modules/@es-joy/jsdoccomment/dist/index.cjs.cjs
generated
vendored
Normal file
361
node_modules/@es-joy/jsdoccomment/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,361 @@
|
||||
import * as comment_parser from 'comment-parser';
|
||||
import * as jsdoc_type_pratt_parser from 'jsdoc-type-pratt-parser';
|
||||
export * from 'jsdoc-type-pratt-parser';
|
||||
export { visitorKeys as jsdocTypeVisitorKeys } from 'jsdoc-type-pratt-parser';
|
||||
import * as _typescript_eslint_types from '@typescript-eslint/types';
|
||||
import * as estree from 'estree';
|
||||
import * as eslint from 'eslint';
|
||||
|
||||
type JsdocTypeLine = {
|
||||
delimiter: string;
|
||||
postDelimiter: string;
|
||||
rawType: string;
|
||||
initial: string;
|
||||
type: 'JsdocTypeLine';
|
||||
};
|
||||
type JsdocDescriptionLine = {
|
||||
delimiter: string;
|
||||
description: string;
|
||||
postDelimiter: string;
|
||||
initial: string;
|
||||
type: 'JsdocDescriptionLine';
|
||||
};
|
||||
type JsdocInlineTagNoType = {
|
||||
format: 'pipe' | 'plain' | 'prefix' | 'space';
|
||||
namepathOrURL: string;
|
||||
tag: string;
|
||||
text: string;
|
||||
};
|
||||
type JsdocInlineTag = JsdocInlineTagNoType & {
|
||||
type: 'JsdocInlineTag';
|
||||
};
|
||||
type JsdocTag = {
|
||||
delimiter: string;
|
||||
description: string;
|
||||
descriptionLines: JsdocDescriptionLine[];
|
||||
initial: string;
|
||||
inlineTags: JsdocInlineTag[];
|
||||
name: string;
|
||||
postDelimiter: string;
|
||||
postName: string;
|
||||
postTag: string;
|
||||
postType: string;
|
||||
rawType: string;
|
||||
parsedType: jsdoc_type_pratt_parser.RootResult | null;
|
||||
tag: string;
|
||||
type: 'JsdocTag';
|
||||
typeLines: JsdocTypeLine[];
|
||||
};
|
||||
type Integer = number;
|
||||
type JsdocBlock = {
|
||||
delimiter: string;
|
||||
delimiterLineBreak: string;
|
||||
description: string;
|
||||
descriptionEndLine?: Integer;
|
||||
descriptionLines: JsdocDescriptionLine[];
|
||||
descriptionStartLine?: Integer;
|
||||
hasPreterminalDescription: 0 | 1;
|
||||
hasPreterminalTagDescription?: 1;
|
||||
initial: string;
|
||||
inlineTags: JsdocInlineTag[];
|
||||
lastDescriptionLine?: Integer;
|
||||
endLine: Integer;
|
||||
lineEnd: string;
|
||||
postDelimiter: string;
|
||||
tags: JsdocTag[];
|
||||
terminal: string;
|
||||
preterminalLineBreak: string;
|
||||
type: 'JsdocBlock';
|
||||
};
|
||||
/**
|
||||
* Converts comment parser AST to ESTree format.
|
||||
* @param {import('.').JsdocBlockWithInline} jsdoc
|
||||
* @param {import('jsdoc-type-pratt-parser').ParseMode} mode
|
||||
* @param {object} opts
|
||||
* @param {'compact'|'preserve'} [opts.spacing] By default, empty lines are
|
||||
* compacted; set to 'preserve' to preserve empty comment lines.
|
||||
* @param {boolean} [opts.throwOnTypeParsingErrors]
|
||||
* @returns {JsdocBlock}
|
||||
*/
|
||||
declare function commentParserToESTree(
|
||||
jsdoc: JsdocBlockWithInline,
|
||||
mode: jsdoc_type_pratt_parser.ParseMode,
|
||||
{
|
||||
spacing,
|
||||
throwOnTypeParsingErrors,
|
||||
}?: {
|
||||
spacing?: 'compact' | 'preserve';
|
||||
throwOnTypeParsingErrors?: boolean;
|
||||
},
|
||||
): JsdocBlock;
|
||||
declare namespace jsdocVisitorKeys {
|
||||
let JsdocBlock: string[];
|
||||
let JsdocDescriptionLine: any[];
|
||||
let JsdocTypeLine: any[];
|
||||
let JsdocTag: string[];
|
||||
let JsdocInlineTag: any[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{[name: string]: any}} settings
|
||||
* @returns {import('.').CommentHandler}
|
||||
*/
|
||||
declare function commentHandler(settings: { [name: string]: any }): CommentHandler;
|
||||
|
||||
/**
|
||||
* @todo convert for use by escodegen (until may be patched to support
|
||||
* custom entries?).
|
||||
* @param {import('./commentParserToESTree').JsdocBlock|
|
||||
* import('./commentParserToESTree').JsdocDescriptionLine|
|
||||
* import('./commentParserToESTree').JsdocTypeLine|
|
||||
* import('./commentParserToESTree').JsdocTag|
|
||||
* import('./commentParserToESTree').JsdocInlineTag|
|
||||
* import('jsdoc-type-pratt-parser').RootResult
|
||||
* } node
|
||||
* @param {import('.').ESTreeToStringOptions} opts
|
||||
* @throws {Error}
|
||||
* @returns {string}
|
||||
*/
|
||||
declare function estreeToString(
|
||||
node:
|
||||
| JsdocBlock
|
||||
| JsdocDescriptionLine
|
||||
| JsdocTypeLine
|
||||
| JsdocTag
|
||||
| JsdocInlineTag
|
||||
| jsdoc_type_pratt_parser.RootResult,
|
||||
opts?: ESTreeToStringOptions,
|
||||
): string;
|
||||
|
||||
type Token =
|
||||
| eslint.AST.Token
|
||||
| estree.Comment
|
||||
| {
|
||||
type: eslint.AST.TokenType | 'Line' | 'Block' | 'Shebang';
|
||||
range: [number, number];
|
||||
value: string;
|
||||
};
|
||||
type ESLintOrTSNode = eslint.Rule.Node | _typescript_eslint_types.TSESTree.Node;
|
||||
type int = number;
|
||||
/**
|
||||
* Reduces the provided node to the appropriate node for evaluating
|
||||
* JSDoc comment status.
|
||||
*
|
||||
* @param {ESLintOrTSNode} node An AST node.
|
||||
* @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode.
|
||||
* @returns {ESLintOrTSNode} The AST node that
|
||||
* can be evaluated for appropriate JSDoc comments.
|
||||
*/
|
||||
declare function getReducedASTNode(node: ESLintOrTSNode, sourceCode: eslint.SourceCode): ESLintOrTSNode;
|
||||
/**
|
||||
* Retrieves the JSDoc comment for a given node.
|
||||
*
|
||||
* @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode
|
||||
* @param {import('eslint').Rule.Node} node The AST node to get
|
||||
* the comment for.
|
||||
* @param {{maxLines: int, minLines: int, [name: string]: any}} settings The
|
||||
* settings in context
|
||||
* @returns {Token|null} The Block comment
|
||||
* token containing the JSDoc comment for the given node or
|
||||
* null if not found.
|
||||
* @public
|
||||
*/
|
||||
declare function getJSDocComment(
|
||||
sourceCode: eslint.SourceCode,
|
||||
node: eslint.Rule.Node,
|
||||
settings: {
|
||||
maxLines: int;
|
||||
minLines: int;
|
||||
[name: string]: any;
|
||||
},
|
||||
): Token | null;
|
||||
/**
|
||||
* Retrieves the comment preceding a given node.
|
||||
*
|
||||
* @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode
|
||||
* @param {ESLintOrTSNode} node The AST node to get
|
||||
* the comment for.
|
||||
* @param {{maxLines: int, minLines: int, [name: string]: any}} settings The
|
||||
* settings in context
|
||||
* @returns {Token|null} The Block comment
|
||||
* token containing the JSDoc comment for the given node or
|
||||
* null if not found.
|
||||
* @public
|
||||
*/
|
||||
declare function getNonJsdocComment(
|
||||
sourceCode: eslint.SourceCode,
|
||||
node: ESLintOrTSNode,
|
||||
settings: {
|
||||
maxLines: int;
|
||||
minLines: int;
|
||||
[name: string]: any;
|
||||
},
|
||||
): Token | null;
|
||||
/**
|
||||
* @param {(ESLintOrTSNode|import('estree').Comment) & {
|
||||
* declaration?: any,
|
||||
* decorators?: any[],
|
||||
* parent?: import('eslint').Rule.Node & {
|
||||
* decorators?: any[]
|
||||
* }
|
||||
* }} node
|
||||
* @returns {import('@typescript-eslint/types').TSESTree.Decorator|undefined}
|
||||
*/
|
||||
declare function getDecorator(
|
||||
node: (ESLintOrTSNode | estree.Comment) & {
|
||||
declaration?: any;
|
||||
decorators?: any[];
|
||||
parent?: eslint.Rule.Node & {
|
||||
decorators?: any[];
|
||||
};
|
||||
},
|
||||
): _typescript_eslint_types.TSESTree.Decorator | undefined;
|
||||
/**
|
||||
* Checks for the presence of a JSDoc comment for the given node and returns it.
|
||||
*
|
||||
* @param {ESLintOrTSNode} astNode The AST node to get
|
||||
* the comment for.
|
||||
* @param {import('eslint').SourceCode} sourceCode
|
||||
* @param {{maxLines: int, minLines: int, [name: string]: any}} settings
|
||||
* @param {{nonJSDoc?: boolean}} [opts]
|
||||
* @returns {Token|null} The Block comment token containing the JSDoc comment
|
||||
* for the given node or null if not found.
|
||||
*/
|
||||
declare function findJSDocComment(
|
||||
astNode: ESLintOrTSNode,
|
||||
sourceCode: eslint.SourceCode,
|
||||
settings: {
|
||||
maxLines: int;
|
||||
minLines: int;
|
||||
[name: string]: any;
|
||||
},
|
||||
opts?: {
|
||||
nonJSDoc?: boolean;
|
||||
},
|
||||
): Token | null;
|
||||
/**
|
||||
* Checks for the presence of a comment following the given node and
|
||||
* returns it.
|
||||
*
|
||||
* This method is experimental.
|
||||
*
|
||||
* @param {import('eslint').SourceCode} sourceCode
|
||||
* @param {ESLintOrTSNode} astNode The AST node to get
|
||||
* the comment for.
|
||||
* @returns {Token|null} The comment token containing the comment
|
||||
* for the given node or null if not found.
|
||||
*/
|
||||
declare function getFollowingComment(sourceCode: eslint.SourceCode, astNode: ESLintOrTSNode): Token | null;
|
||||
|
||||
declare function hasSeeWithLink(spec: comment_parser.Spec): boolean;
|
||||
declare const defaultNoTypes: string[];
|
||||
declare const defaultNoNames: string[];
|
||||
/**
|
||||
* Can't import `comment-parser/es6/parser/tokenizers/index.js`,
|
||||
* so we redefine here.
|
||||
*/
|
||||
type CommentParserTokenizer = (spec: comment_parser.Spec) => comment_parser.Spec;
|
||||
/**
|
||||
* Can't import `comment-parser/es6/parser/tokenizers/index.js`,
|
||||
* so we redefine here.
|
||||
* @typedef {(spec: import('comment-parser').Spec) =>
|
||||
* import('comment-parser').Spec} CommentParserTokenizer
|
||||
*/
|
||||
/**
|
||||
* @param {object} [cfg]
|
||||
* @param {string[]} [cfg.noTypes]
|
||||
* @param {string[]} [cfg.noNames]
|
||||
* @returns {CommentParserTokenizer[]}
|
||||
*/
|
||||
declare function getTokenizers({
|
||||
noTypes,
|
||||
noNames,
|
||||
}?: {
|
||||
noTypes?: string[];
|
||||
noNames?: string[];
|
||||
}): CommentParserTokenizer[];
|
||||
/**
|
||||
* Accepts a comment token or complete comment string and converts it into
|
||||
* `comment-parser` AST.
|
||||
* @param {string | {value: string}} commentOrNode
|
||||
* @param {string} [indent] Whitespace
|
||||
* @returns {import('.').JsdocBlockWithInline}
|
||||
*/
|
||||
declare function parseComment(
|
||||
commentOrNode:
|
||||
| string
|
||||
| {
|
||||
value: string;
|
||||
},
|
||||
indent?: string,
|
||||
): JsdocBlockWithInline;
|
||||
|
||||
/**
|
||||
* Splits the `{@prefix}` from remaining `Spec.lines[].token.description`
|
||||
* into the `inlineTags` tokens, and populates `spec.inlineTags`
|
||||
* @param {import('comment-parser').Block} block
|
||||
* @returns {import('.').JsdocBlockWithInline}
|
||||
*/
|
||||
declare function parseInlineTags(block: comment_parser.Block): JsdocBlockWithInline;
|
||||
|
||||
type InlineTag = JsdocInlineTagNoType & {
|
||||
start: number;
|
||||
end: number;
|
||||
};
|
||||
type JsdocTagWithInline = comment_parser.Spec & {
|
||||
line?: Integer;
|
||||
inlineTags: (JsdocInlineTagNoType & {
|
||||
line?: Integer;
|
||||
})[];
|
||||
};
|
||||
/**
|
||||
* Expands on comment-parser's `Block` interface.
|
||||
*/
|
||||
type JsdocBlockWithInline = {
|
||||
description: string;
|
||||
source: comment_parser.Line[];
|
||||
problems: comment_parser.Problem[];
|
||||
tags: JsdocTagWithInline[];
|
||||
inlineTags: (JsdocInlineTagNoType & {
|
||||
line?: Integer;
|
||||
})[];
|
||||
};
|
||||
type ESTreeToStringOptions = {
|
||||
preferRawType?: boolean;
|
||||
};
|
||||
type CommentHandler = (commentSelector: string, jsdoc: JsdocBlockWithInline) => boolean;
|
||||
|
||||
export {
|
||||
type CommentHandler,
|
||||
type CommentParserTokenizer,
|
||||
type ESLintOrTSNode,
|
||||
type ESTreeToStringOptions,
|
||||
type InlineTag,
|
||||
type Integer,
|
||||
JsdocBlock,
|
||||
type JsdocBlockWithInline,
|
||||
JsdocDescriptionLine,
|
||||
JsdocInlineTag,
|
||||
type JsdocInlineTagNoType,
|
||||
JsdocTag,
|
||||
type JsdocTagWithInline,
|
||||
JsdocTypeLine,
|
||||
type Token,
|
||||
commentHandler,
|
||||
commentParserToESTree,
|
||||
defaultNoNames,
|
||||
defaultNoTypes,
|
||||
estreeToString,
|
||||
findJSDocComment,
|
||||
getDecorator,
|
||||
getFollowingComment,
|
||||
getJSDocComment,
|
||||
getNonJsdocComment,
|
||||
getReducedASTNode,
|
||||
getTokenizers,
|
||||
hasSeeWithLink,
|
||||
type int,
|
||||
jsdocVisitorKeys,
|
||||
parseComment,
|
||||
parseInlineTags,
|
||||
};
|
||||
106
node_modules/@es-joy/jsdoccomment/package.json
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"name": "@es-joy/jsdoccomment",
|
||||
"version": "0.46.0",
|
||||
"author": "Brett Zamir <brettz9@yahoo.com>",
|
||||
"contributors": [],
|
||||
"description": "Maintained replacement for ESLint's deprecated SourceCode#getJSDocComment along with other jsdoc utilities",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"ast",
|
||||
"comment",
|
||||
"estree",
|
||||
"jsdoc",
|
||||
"parser",
|
||||
"eslint",
|
||||
"sourcecode"
|
||||
],
|
||||
"type": "module",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.js",
|
||||
"require": "./dist/index.cjs.cjs"
|
||||
},
|
||||
"browserslist": [
|
||||
"cover 100%"
|
||||
],
|
||||
"typedocOptions": {
|
||||
"dmtLinksService": {
|
||||
"GitHub": "https://github.com/es-joy/jsdoccomment",
|
||||
"NPM": "https://www.npmjs.com/package/@es-joy/jsdoccomment"
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/es-joy/jsdoccomment.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/es-joy/jsdoccomment/issues"
|
||||
},
|
||||
"homepage": "https://github.com/es-joy/jsdoccomment",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"dependencies": {
|
||||
"comment-parser": "1.4.1",
|
||||
"esquery": "^1.6.0",
|
||||
"jsdoc-type-pratt-parser": "~4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.24.7",
|
||||
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
||||
"@babel/preset-env": "^7.24.7",
|
||||
"@brettz9/eslint-plugin": "^1.0.4",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@types/eslint": "^8.56.10",
|
||||
"@types/esquery": "^1.5.4",
|
||||
"@types/estraverse": "^5.1.7",
|
||||
"@types/estree": "^1.0.5",
|
||||
"@typescript-eslint/types": "^7.16.0",
|
||||
"@typescript-eslint/visitor-keys": "^7.16.0",
|
||||
"@typhonjs-build-test/esm-d-ts": "0.3.0-next.1",
|
||||
"@typhonjs-typedoc/typedoc-pkg": "^0.0.5",
|
||||
"@vitest/coverage-v8": "^2.0.1",
|
||||
"@vitest/ui": "^2.0.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-ash-nazg": "35.3.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-plugin-array-func": "^4.0.0",
|
||||
"eslint-plugin-compat": "^4.2.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-html": "^7.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-jsdoc": "^48.0.4",
|
||||
"eslint-plugin-markdown": "^3.0.1",
|
||||
"eslint-plugin-n": "^16.6.2",
|
||||
"eslint-plugin-no-unsanitized": "^4.0.2",
|
||||
"eslint-plugin-no-use-extend-native": "^0.5.0",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-sonarjs": "^0.23.0",
|
||||
"eslint-plugin-unicorn": "^50.0.1",
|
||||
"espree": "^10.1.0",
|
||||
"estraverse": "^5.3.0",
|
||||
"rollup": "^4.18.1",
|
||||
"typescript": "^5.5.3",
|
||||
"typescript-eslint": "^7.16.0",
|
||||
"vitest": "^2.0.1"
|
||||
},
|
||||
"files": [
|
||||
"/dist",
|
||||
"/src",
|
||||
"CHANGES.md",
|
||||
"LICENSE-MIT.txt"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rollup -c && npm run types",
|
||||
"docs": "typedoc-pkg --api-link es",
|
||||
"eslint": "eslint --ext=js,cjs,md,html .",
|
||||
"lint": "npm run eslint --",
|
||||
"open": "open ./coverage/index.html",
|
||||
"test": "npm run lint && npm run build && npm run test-ui",
|
||||
"test-ui": "vitest --ui --coverage",
|
||||
"test-cov": "vitest --coverage",
|
||||
"tsc": "tsc",
|
||||
"types": "esm-d-ts gen ./src/index.js --output ./dist/index.d.ts"
|
||||
}
|
||||
}
|
||||
39
node_modules/@es-joy/jsdoccomment/src/commentHandler.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import esquery from 'esquery';
|
||||
|
||||
import {
|
||||
visitorKeys as jsdocTypePrattParserVisitorKeys
|
||||
} from 'jsdoc-type-pratt-parser';
|
||||
|
||||
import {
|
||||
commentParserToESTree, jsdocVisitorKeys
|
||||
} from './commentParserToESTree.js';
|
||||
|
||||
/**
|
||||
* @param {{[name: string]: any}} settings
|
||||
* @returns {import('.').CommentHandler}
|
||||
*/
|
||||
const commentHandler = (settings) => {
|
||||
/**
|
||||
* @type {import('.').CommentHandler}
|
||||
*/
|
||||
return (commentSelector, jsdoc) => {
|
||||
const {mode} = settings;
|
||||
|
||||
const selector = esquery.parse(commentSelector);
|
||||
|
||||
const ast = commentParserToESTree(jsdoc, mode);
|
||||
|
||||
const _ast = /** @type {unknown} */ (ast);
|
||||
|
||||
return esquery.matches(/** @type {import('estree').Node} */ (
|
||||
_ast
|
||||
), selector, undefined, {
|
||||
visitorKeys: {
|
||||
...jsdocTypePrattParserVisitorKeys,
|
||||
...jsdocVisitorKeys
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export {commentHandler};
|
||||
504
node_modules/@es-joy/jsdoccomment/src/commentParserToESTree.js
generated
vendored
Normal file
@@ -0,0 +1,504 @@
|
||||
import {parse as jsdocTypePrattParse} from 'jsdoc-type-pratt-parser';
|
||||
|
||||
/**
|
||||
* Removes initial and ending brackets from `rawType`
|
||||
* @param {JsdocTypeLine[]|JsdocTag} container
|
||||
* @param {boolean} [isArr]
|
||||
* @returns {void}
|
||||
*/
|
||||
const stripEncapsulatingBrackets = (container, isArr) => {
|
||||
if (isArr) {
|
||||
const firstItem = /** @type {JsdocTypeLine[]} */ (container)[0];
|
||||
firstItem.rawType = firstItem.rawType.replace(
|
||||
/^\{/u, ''
|
||||
);
|
||||
|
||||
const lastItem = /** @type {JsdocTypeLine} */ (
|
||||
/** @type {JsdocTypeLine[]} */ (
|
||||
container
|
||||
).at(-1)
|
||||
);
|
||||
lastItem.rawType = lastItem.rawType.replace(/\}$/u, '');
|
||||
|
||||
return;
|
||||
}
|
||||
/** @type {JsdocTag} */ (container).rawType =
|
||||
/** @type {JsdocTag} */ (container).rawType.replace(
|
||||
/^\{/u, ''
|
||||
).replace(/\}$/u, '');
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* delimiter: string,
|
||||
* postDelimiter: string,
|
||||
* rawType: string,
|
||||
* initial: string,
|
||||
* type: "JsdocTypeLine"
|
||||
* }} JsdocTypeLine
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* delimiter: string,
|
||||
* description: string,
|
||||
* postDelimiter: string,
|
||||
* initial: string,
|
||||
* type: "JsdocDescriptionLine"
|
||||
* }} JsdocDescriptionLine
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* format: 'pipe' | 'plain' | 'prefix' | 'space',
|
||||
* namepathOrURL: string,
|
||||
* tag: string,
|
||||
* text: string,
|
||||
* }} JsdocInlineTagNoType
|
||||
*/
|
||||
/**
|
||||
* @typedef {JsdocInlineTagNoType & {
|
||||
* type: "JsdocInlineTag"
|
||||
* }} JsdocInlineTag
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* delimiter: string,
|
||||
* description: string,
|
||||
* descriptionLines: JsdocDescriptionLine[],
|
||||
* initial: string,
|
||||
* inlineTags: JsdocInlineTag[]
|
||||
* name: string,
|
||||
* postDelimiter: string,
|
||||
* postName: string,
|
||||
* postTag: string,
|
||||
* postType: string,
|
||||
* rawType: string,
|
||||
* parsedType: import('jsdoc-type-pratt-parser').RootResult|null
|
||||
* tag: string,
|
||||
* type: "JsdocTag",
|
||||
* typeLines: JsdocTypeLine[],
|
||||
* }} JsdocTag
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {number} Integer
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* delimiter: string,
|
||||
* delimiterLineBreak: string,
|
||||
* description: string,
|
||||
* descriptionEndLine?: Integer,
|
||||
* descriptionLines: JsdocDescriptionLine[],
|
||||
* descriptionStartLine?: Integer,
|
||||
* hasPreterminalDescription: 0|1,
|
||||
* hasPreterminalTagDescription?: 1,
|
||||
* initial: string,
|
||||
* inlineTags: JsdocInlineTag[]
|
||||
* lastDescriptionLine?: Integer,
|
||||
* endLine: Integer,
|
||||
* lineEnd: string,
|
||||
* postDelimiter: string,
|
||||
* tags: JsdocTag[],
|
||||
* terminal: string,
|
||||
* preterminalLineBreak: string,
|
||||
* type: "JsdocBlock",
|
||||
* }} JsdocBlock
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {object} cfg
|
||||
* @param {string} cfg.text
|
||||
* @param {string} cfg.tag
|
||||
* @param {'pipe' | 'plain' | 'prefix' | 'space'} cfg.format
|
||||
* @param {string} cfg.namepathOrURL
|
||||
* @returns {JsdocInlineTag}
|
||||
*/
|
||||
const inlineTagToAST = ({text, tag, format, namepathOrURL}) => ({
|
||||
text,
|
||||
tag,
|
||||
format,
|
||||
namepathOrURL,
|
||||
type: 'JsdocInlineTag'
|
||||
});
|
||||
|
||||
/**
|
||||
* Converts comment parser AST to ESTree format.
|
||||
* @param {import('.').JsdocBlockWithInline} jsdoc
|
||||
* @param {import('jsdoc-type-pratt-parser').ParseMode} mode
|
||||
* @param {object} opts
|
||||
* @param {'compact'|'preserve'} [opts.spacing] By default, empty lines are
|
||||
* compacted; set to 'preserve' to preserve empty comment lines.
|
||||
* @param {boolean} [opts.throwOnTypeParsingErrors]
|
||||
* @returns {JsdocBlock}
|
||||
*/
|
||||
const commentParserToESTree = (jsdoc, mode, {
|
||||
spacing = 'compact',
|
||||
throwOnTypeParsingErrors = false
|
||||
} = {}) => {
|
||||
/**
|
||||
* Strips brackets from a tag's `rawType` values and adds `parsedType`
|
||||
* @param {JsdocTag} lastTag
|
||||
* @returns {void}
|
||||
*/
|
||||
const cleanUpLastTag = (lastTag) => {
|
||||
// Strip out `}` that encapsulates and is not part of
|
||||
// the type
|
||||
stripEncapsulatingBrackets(lastTag);
|
||||
|
||||
if (lastTag.typeLines.length) {
|
||||
stripEncapsulatingBrackets(lastTag.typeLines, true);
|
||||
}
|
||||
|
||||
// Remove single empty line description.
|
||||
if (lastTag.descriptionLines.length === 1 &&
|
||||
lastTag.descriptionLines[0].description === '') {
|
||||
lastTag.descriptionLines.length = 0;
|
||||
}
|
||||
|
||||
// With even a multiline type now in full, add parsing
|
||||
let parsedType = null;
|
||||
|
||||
try {
|
||||
parsedType = jsdocTypePrattParse(lastTag.rawType, mode);
|
||||
} catch (err) {
|
||||
// Ignore
|
||||
if (lastTag.rawType && throwOnTypeParsingErrors) {
|
||||
/** @type {Error} */ (
|
||||
err
|
||||
).message = `Tag @${lastTag.tag} with raw type ` +
|
||||
`\`${lastTag.rawType}\` had parsing error: ${
|
||||
/** @type {Error} */ (err).message}`;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
lastTag.parsedType = parsedType;
|
||||
};
|
||||
|
||||
const {source, inlineTags: blockInlineTags} = jsdoc;
|
||||
|
||||
const {tokens: {
|
||||
delimiter: delimiterRoot,
|
||||
lineEnd: lineEndRoot,
|
||||
postDelimiter: postDelimiterRoot,
|
||||
start: startRoot,
|
||||
end: endRoot
|
||||
}} = source[0];
|
||||
|
||||
const endLine = source.length - 1;
|
||||
|
||||
/** @type {JsdocBlock} */
|
||||
const ast = {
|
||||
delimiter: delimiterRoot,
|
||||
delimiterLineBreak: '\n',
|
||||
description: '',
|
||||
|
||||
descriptionLines: [],
|
||||
inlineTags: blockInlineTags.map((t) => inlineTagToAST(t)),
|
||||
|
||||
initial: startRoot,
|
||||
tags: [],
|
||||
// `terminal` will be overwritten if there are other entries
|
||||
terminal: endRoot,
|
||||
preterminalLineBreak: '\n',
|
||||
hasPreterminalDescription: 0,
|
||||
endLine,
|
||||
postDelimiter: postDelimiterRoot,
|
||||
lineEnd: lineEndRoot,
|
||||
|
||||
type: 'JsdocBlock'
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {JsdocTag[]}
|
||||
*/
|
||||
const tags = [];
|
||||
|
||||
/** @type {Integer|undefined} */
|
||||
let lastDescriptionLine;
|
||||
|
||||
/** @type {JsdocTag|null} */
|
||||
let lastTag = null;
|
||||
|
||||
// Tracks when first valid tag description line is seen.
|
||||
let tagDescriptionSeen = false;
|
||||
|
||||
let descLineStateOpen = true;
|
||||
|
||||
source.forEach((info, idx) => {
|
||||
const {tokens} = info;
|
||||
const {
|
||||
delimiter,
|
||||
description,
|
||||
postDelimiter,
|
||||
start: initial,
|
||||
tag,
|
||||
end,
|
||||
type: rawType
|
||||
} = tokens;
|
||||
|
||||
if (!tag && description && descLineStateOpen) {
|
||||
if (ast.descriptionStartLine === undefined) {
|
||||
ast.descriptionStartLine = idx;
|
||||
}
|
||||
ast.descriptionEndLine = idx;
|
||||
}
|
||||
|
||||
if (tag || end) {
|
||||
descLineStateOpen = false;
|
||||
if (lastDescriptionLine === undefined) {
|
||||
lastDescriptionLine = idx;
|
||||
}
|
||||
|
||||
// Clean-up with last tag before end or new tag
|
||||
if (lastTag) {
|
||||
cleanUpLastTag(lastTag);
|
||||
}
|
||||
|
||||
// Stop the iteration when we reach the end
|
||||
// but only when there is no tag earlier in the line
|
||||
// to still process
|
||||
if (end && !tag) {
|
||||
ast.terminal = end;
|
||||
|
||||
// Check if there are any description lines and if not then this is a
|
||||
// one line comment block.
|
||||
const isDelimiterLine = ast.descriptionLines.length === 0 &&
|
||||
delimiter === '/**';
|
||||
|
||||
// Remove delimiter line break for one line comments blocks.
|
||||
if (isDelimiterLine) {
|
||||
ast.delimiterLineBreak = '';
|
||||
}
|
||||
|
||||
if (description) {
|
||||
// Remove terminal line break at end when description is defined.
|
||||
if (ast.terminal === '*/') {
|
||||
ast.preterminalLineBreak = '';
|
||||
}
|
||||
|
||||
if (lastTag) {
|
||||
ast.hasPreterminalTagDescription = 1;
|
||||
} else {
|
||||
ast.hasPreterminalDescription = 1;
|
||||
}
|
||||
|
||||
const holder = lastTag || ast;
|
||||
holder.description += (holder.description ? '\n' : '') + description;
|
||||
|
||||
// Do not include `delimiter` / `postDelimiter` for opening
|
||||
// delimiter line.
|
||||
|
||||
holder.descriptionLines.push({
|
||||
delimiter: isDelimiterLine ? '' : delimiter,
|
||||
description,
|
||||
postDelimiter: isDelimiterLine ? '' : postDelimiter,
|
||||
initial,
|
||||
type: 'JsdocDescriptionLine'
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
// eslint-disable-next-line no-unused-vars -- Discarding
|
||||
end: ed,
|
||||
delimiter: de,
|
||||
postDelimiter: pd,
|
||||
start: init,
|
||||
...tkns
|
||||
} = tokens;
|
||||
|
||||
if (!tokens.name) {
|
||||
let i = 1;
|
||||
while (source[idx + i]) {
|
||||
const {tokens: {
|
||||
name,
|
||||
postName,
|
||||
postType,
|
||||
tag: tg
|
||||
}} = source[idx + i];
|
||||
if (tg) {
|
||||
break;
|
||||
}
|
||||
if (name) {
|
||||
tkns.postType = postType;
|
||||
tkns.name = name;
|
||||
tkns.postName = postName;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {JsdocInlineTag[]}
|
||||
*/
|
||||
let tagInlineTags = [];
|
||||
if (tag) {
|
||||
// Assuming the tags from `source` are in the same order as `jsdoc.tags`
|
||||
// we can use the `tags` length as index into the parser result tags.
|
||||
tagInlineTags =
|
||||
/**
|
||||
* @type {import('comment-parser').Spec & {
|
||||
* inlineTags: JsdocInlineTagNoType[]
|
||||
* }}
|
||||
*/ (
|
||||
jsdoc.tags[tags.length]
|
||||
).inlineTags.map(
|
||||
(t) => inlineTagToAST(t)
|
||||
);
|
||||
}
|
||||
|
||||
/** @type {JsdocTag} */
|
||||
const tagObj = {
|
||||
...tkns,
|
||||
initial: endLine ? init : '',
|
||||
postDelimiter: lastDescriptionLine ? pd : '',
|
||||
delimiter: lastDescriptionLine ? de : '',
|
||||
descriptionLines: [],
|
||||
inlineTags: tagInlineTags,
|
||||
parsedType: null,
|
||||
rawType: '',
|
||||
type: 'JsdocTag',
|
||||
typeLines: []
|
||||
};
|
||||
tagObj.tag = tagObj.tag.replace(/^@/u, '');
|
||||
|
||||
lastTag = tagObj;
|
||||
tagDescriptionSeen = false;
|
||||
|
||||
tags.push(tagObj);
|
||||
}
|
||||
|
||||
if (rawType) {
|
||||
// Will strip rawType brackets after this tag
|
||||
/** @type {JsdocTag} */ (lastTag).typeLines.push(
|
||||
/** @type {JsdocTag} */ (lastTag).typeLines.length
|
||||
? {
|
||||
delimiter,
|
||||
postDelimiter,
|
||||
rawType,
|
||||
initial,
|
||||
type: 'JsdocTypeLine'
|
||||
}
|
||||
: {
|
||||
delimiter: '',
|
||||
postDelimiter: '',
|
||||
rawType,
|
||||
initial: '',
|
||||
type: 'JsdocTypeLine'
|
||||
}
|
||||
);
|
||||
/** @type {JsdocTag} */ (lastTag).rawType += /** @type {JsdocTag} */ (
|
||||
lastTag
|
||||
).rawType
|
||||
? '\n' + rawType
|
||||
: rawType;
|
||||
}
|
||||
|
||||
// In `compact` mode skip processing if `description` is an empty string
|
||||
// unless lastTag is being processed.
|
||||
//
|
||||
// In `preserve` mode process when `description` is not the `empty string
|
||||
// or the `delimiter` is not `/**` ensuring empty lines are preserved.
|
||||
if (((spacing === 'compact' && description) || lastTag) ||
|
||||
(spacing === 'preserve' && (description || delimiter !== '/**'))) {
|
||||
const holder = lastTag || ast;
|
||||
|
||||
// Check if there are any description lines and if not then this is a
|
||||
// multi-line comment block with description on 0th line. Treat
|
||||
// `delimiter` / `postDelimiter` / `initial` as being on a new line.
|
||||
const isDelimiterLine = holder.descriptionLines.length === 0 &&
|
||||
delimiter === '/**';
|
||||
|
||||
// Remove delimiter line break for one line comments blocks.
|
||||
if (isDelimiterLine) {
|
||||
ast.delimiterLineBreak = '';
|
||||
}
|
||||
|
||||
// Track when the first description line is seen to avoid adding empty
|
||||
// description lines for tag type lines.
|
||||
tagDescriptionSeen ||= Boolean(lastTag &&
|
||||
(rawType === '' || rawType?.endsWith('}')));
|
||||
|
||||
if (lastTag) {
|
||||
if (tagDescriptionSeen) {
|
||||
// The first tag description line is a continuation after type /
|
||||
// name parsing.
|
||||
const isFirstDescriptionLine = holder.descriptionLines.length === 0;
|
||||
|
||||
// For `compact` spacing must allow through first description line.
|
||||
if ((spacing === 'compact' &&
|
||||
(description || isFirstDescriptionLine)) ||
|
||||
spacing === 'preserve') {
|
||||
holder.descriptionLines.push({
|
||||
delimiter: isFirstDescriptionLine ? '' : delimiter,
|
||||
description,
|
||||
postDelimiter: isFirstDescriptionLine ? '' : postDelimiter,
|
||||
initial: isFirstDescriptionLine ? '' : initial,
|
||||
type: 'JsdocDescriptionLine'
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
holder.descriptionLines.push({
|
||||
delimiter: isDelimiterLine ? '' : delimiter,
|
||||
description,
|
||||
postDelimiter: isDelimiterLine ? '' : postDelimiter,
|
||||
initial: isDelimiterLine ? `` : initial,
|
||||
type: 'JsdocDescriptionLine'
|
||||
});
|
||||
}
|
||||
|
||||
if (!tag) {
|
||||
if (lastTag) {
|
||||
// For `compact` spacing must filter out any empty description lines
|
||||
// after the initial `holder.description` has content.
|
||||
if (tagDescriptionSeen && !(spacing === 'compact' &&
|
||||
holder.description && description === '')) {
|
||||
holder.description += !holder.description
|
||||
? description
|
||||
: '\n' + description;
|
||||
}
|
||||
} else {
|
||||
holder.description += !holder.description
|
||||
? description
|
||||
: '\n' + description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clean-up where last line itself has tag content
|
||||
if (end && tag) {
|
||||
ast.terminal = end;
|
||||
ast.hasPreterminalTagDescription = 1;
|
||||
|
||||
// Remove terminal line break at end when tag is defined on last line.
|
||||
if (ast.terminal === '*/') {
|
||||
ast.preterminalLineBreak = '';
|
||||
}
|
||||
|
||||
cleanUpLastTag(/** @type {JsdocTag} */ (lastTag));
|
||||
}
|
||||
});
|
||||
|
||||
ast.lastDescriptionLine = lastDescriptionLine;
|
||||
ast.tags = tags;
|
||||
|
||||
return ast;
|
||||
};
|
||||
|
||||
const jsdocVisitorKeys = {
|
||||
JsdocBlock: ['descriptionLines', 'tags', 'inlineTags'],
|
||||
JsdocDescriptionLine: [],
|
||||
JsdocTypeLine: [],
|
||||
JsdocTag: ['parsedType', 'typeLines', 'descriptionLines', 'inlineTags'],
|
||||
JsdocInlineTag: []
|
||||
};
|
||||
|
||||
export {commentParserToESTree, jsdocVisitorKeys};
|
||||
179
node_modules/@es-joy/jsdoccomment/src/estreeToString.js
generated
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
import {stringify as prattStringify} from 'jsdoc-type-pratt-parser';
|
||||
|
||||
/** @type {Record<string, Function>} */
|
||||
const stringifiers = {
|
||||
JsdocBlock,
|
||||
|
||||
/**
|
||||
* @param {import('./commentParserToESTree').JsdocDescriptionLine} node
|
||||
* @returns {string}
|
||||
*/
|
||||
JsdocDescriptionLine ({
|
||||
initial, delimiter, postDelimiter, description
|
||||
}) {
|
||||
return `${initial}${delimiter}${postDelimiter}${description}`;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {import('./commentParserToESTree').JsdocTypeLine} node
|
||||
* @returns {string}
|
||||
*/
|
||||
JsdocTypeLine ({
|
||||
initial, delimiter, postDelimiter, rawType
|
||||
}) {
|
||||
return `${initial}${delimiter}${postDelimiter}${rawType}`;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {import('./commentParserToESTree').JsdocInlineTag} node
|
||||
*/
|
||||
JsdocInlineTag ({format, namepathOrURL, tag, text}) {
|
||||
return format === 'pipe'
|
||||
? `{@${tag} ${namepathOrURL}|${text}}`
|
||||
: format === 'plain'
|
||||
? `{@${tag} ${namepathOrURL}}`
|
||||
: format === 'prefix'
|
||||
? `[${text}]{@${tag} ${namepathOrURL}}`
|
||||
// "space"
|
||||
: `{@${tag} ${namepathOrURL} ${text}}`;
|
||||
},
|
||||
|
||||
JsdocTag
|
||||
};
|
||||
|
||||
/**
|
||||
* @todo convert for use by escodegen (until may be patched to support
|
||||
* custom entries?).
|
||||
* @param {import('./commentParserToESTree').JsdocBlock|
|
||||
* import('./commentParserToESTree').JsdocDescriptionLine|
|
||||
* import('./commentParserToESTree').JsdocTypeLine|
|
||||
* import('./commentParserToESTree').JsdocTag|
|
||||
* import('./commentParserToESTree').JsdocInlineTag|
|
||||
* import('jsdoc-type-pratt-parser').RootResult
|
||||
* } node
|
||||
* @param {import('.').ESTreeToStringOptions} opts
|
||||
* @throws {Error}
|
||||
* @returns {string}
|
||||
*/
|
||||
function estreeToString (node, opts = {}) {
|
||||
if (Object.prototype.hasOwnProperty.call(stringifiers, node.type)) {
|
||||
return stringifiers[
|
||||
/**
|
||||
* @type {import('./commentParserToESTree').JsdocBlock|
|
||||
* import('./commentParserToESTree').JsdocDescriptionLine|
|
||||
* import('./commentParserToESTree').JsdocTypeLine|
|
||||
* import('./commentParserToESTree').JsdocTag}
|
||||
*/
|
||||
(node).type
|
||||
](
|
||||
node,
|
||||
opts
|
||||
);
|
||||
}
|
||||
|
||||
// We use raw type instead but it is a key as other apps may wish to traverse
|
||||
if (node.type.startsWith('JsdocType')) {
|
||||
return opts.preferRawType
|
||||
? ''
|
||||
: `{${prattStringify(
|
||||
/** @type {import('jsdoc-type-pratt-parser').RootResult} */ (
|
||||
node
|
||||
)
|
||||
)}}`;
|
||||
}
|
||||
|
||||
throw new Error(`Unhandled node type: ${node.type}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./commentParserToESTree').JsdocBlock} node
|
||||
* @param {import('.').ESTreeToStringOptions} opts
|
||||
* @returns {string}
|
||||
*/
|
||||
function JsdocBlock (node, opts) {
|
||||
const {delimiter, delimiterLineBreak, descriptionLines,
|
||||
initial, postDelimiter, preterminalLineBreak, tags, terminal} = node;
|
||||
|
||||
const terminalPrepend = preterminalLineBreak !== ''
|
||||
? `${preterminalLineBreak}${initial} `
|
||||
: '';
|
||||
|
||||
let result = `${initial}${delimiter}${postDelimiter}${delimiterLineBreak}`;
|
||||
|
||||
for (let i = 0; i < descriptionLines.length; i++) {
|
||||
result += estreeToString(descriptionLines[i]);
|
||||
|
||||
if (i !== descriptionLines.length - 1 || tags.length) {
|
||||
result += '\n';
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < tags.length; i++) {
|
||||
result += estreeToString(tags[i], opts);
|
||||
|
||||
if (i !== tags.length - 1) {
|
||||
result += '\n';
|
||||
}
|
||||
}
|
||||
|
||||
result += `${terminalPrepend}${terminal}`;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./commentParserToESTree').JsdocTag} node
|
||||
* @param {import('.').ESTreeToStringOptions} opts
|
||||
* @returns {string}
|
||||
*/
|
||||
function JsdocTag (node, opts) {
|
||||
const {
|
||||
delimiter, descriptionLines, initial, name, parsedType, postDelimiter,
|
||||
postName, postTag, postType, tag, typeLines
|
||||
} = node;
|
||||
|
||||
let result = `${initial}${delimiter}${postDelimiter}@${tag}${postTag}`;
|
||||
|
||||
// Could do `rawType` but may have been changed; could also do
|
||||
// `typeLines` but not as likely to be changed
|
||||
// parsedType
|
||||
// Comment this out later in favor of `parsedType`
|
||||
// We can't use raw `typeLines` as first argument has delimiter on it
|
||||
if (opts.preferRawType || !parsedType) {
|
||||
if (typeLines.length) {
|
||||
result += '{';
|
||||
|
||||
for (let i = 0; i < typeLines.length; i++) {
|
||||
result += estreeToString(typeLines[i]);
|
||||
|
||||
if (i !== typeLines.length - 1) {
|
||||
result += '\n';
|
||||
}
|
||||
}
|
||||
|
||||
result += '}';
|
||||
}
|
||||
} else if (parsedType?.type.startsWith('JsdocType')) {
|
||||
result += `{${prattStringify(
|
||||
/** @type {import('jsdoc-type-pratt-parser').RootResult} */ (
|
||||
parsedType
|
||||
)
|
||||
)}}`;
|
||||
}
|
||||
|
||||
result += name ? `${postType}${name}${postName}` : postType;
|
||||
|
||||
for (let i = 0; i < descriptionLines.length; i++) {
|
||||
const descriptionLine = descriptionLines[i];
|
||||
|
||||
result += estreeToString(descriptionLine);
|
||||
|
||||
if (i !== descriptionLines.length - 1) {
|
||||
result += '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export {estreeToString};
|
||||
50
node_modules/@es-joy/jsdoccomment/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @typedef {import('./commentParserToESTree').JsdocInlineTagNoType & {
|
||||
* start: number,
|
||||
* end: number,
|
||||
* }} InlineTag
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('comment-parser').Spec & {
|
||||
* line?: import('./commentParserToESTree').Integer,
|
||||
* inlineTags: (import('./commentParserToESTree').JsdocInlineTagNoType & {
|
||||
* line?: import('./commentParserToESTree').Integer
|
||||
* })[]
|
||||
* }} JsdocTagWithInline
|
||||
*/
|
||||
|
||||
/**
|
||||
* Expands on comment-parser's `Block` interface.
|
||||
* @typedef {{
|
||||
* description: string,
|
||||
* source: import('comment-parser').Line[],
|
||||
* problems: import('comment-parser').Problem[],
|
||||
* tags: JsdocTagWithInline[],
|
||||
* inlineTags: (import('./commentParserToESTree').JsdocInlineTagNoType & {
|
||||
* line?: import('./commentParserToESTree').Integer
|
||||
* })[]
|
||||
* }} JsdocBlockWithInline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {{preferRawType?: boolean}} ESTreeToStringOptions
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback CommentHandler
|
||||
* @param {string} commentSelector
|
||||
* @param {import('.').JsdocBlockWithInline} jsdoc
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
export {visitorKeys as jsdocTypeVisitorKeys} from 'jsdoc-type-pratt-parser';
|
||||
|
||||
export * from 'jsdoc-type-pratt-parser';
|
||||
|
||||
export * from './commentHandler.js';
|
||||
export * from './commentParserToESTree.js';
|
||||
export * from './estreeToString.js';
|
||||
export * from './jsdoccomment.js';
|
||||
export * from './parseComment.js';
|
||||
export * from './parseInlineTags.js';
|
||||
487
node_modules/@es-joy/jsdoccomment/src/jsdoccomment.js
generated
vendored
Normal file
@@ -0,0 +1,487 @@
|
||||
/**
|
||||
* Obtained originally from {@link https://github.com/eslint/eslint/blob/master/lib/util/source-code.js#L313}.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('eslint').AST.Token | import('estree').Comment | {
|
||||
* type: import('eslint').AST.TokenType|"Line"|"Block"|"Shebang",
|
||||
* range: [number, number],
|
||||
* value: string
|
||||
* }} Token
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('eslint').Rule.Node|
|
||||
* import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {number} int
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks if the given token is a comment token or not.
|
||||
*
|
||||
* @param {Token} token - The token to check.
|
||||
* @returns {boolean} `true` if the token is a comment token.
|
||||
*/
|
||||
const isCommentToken = (token) => {
|
||||
return token.type === 'Line' || token.type === 'Block' ||
|
||||
token.type === 'Shebang';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {(ESLintOrTSNode|import('estree').Comment) & {
|
||||
* declaration?: any,
|
||||
* decorators?: any[],
|
||||
* parent?: import('eslint').Rule.Node & {
|
||||
* decorators?: any[]
|
||||
* }
|
||||
* }} node
|
||||
* @returns {import('@typescript-eslint/types').TSESTree.Decorator|undefined}
|
||||
*/
|
||||
const getDecorator = (node) => {
|
||||
return node?.declaration?.decorators?.[0] || node?.decorators?.[0] ||
|
||||
node?.parent?.decorators?.[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* Check to see if it is a ES6 export declaration.
|
||||
*
|
||||
* @param {ESLintOrTSNode} astNode An AST node.
|
||||
* @returns {boolean} whether the given node represents an export declaration.
|
||||
* @private
|
||||
*/
|
||||
const looksLikeExport = function (astNode) {
|
||||
return astNode.type === 'ExportDefaultDeclaration' ||
|
||||
astNode.type === 'ExportNamedDeclaration' ||
|
||||
astNode.type === 'ExportAllDeclaration' ||
|
||||
astNode.type === 'ExportSpecifier';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ESLintOrTSNode} astNode
|
||||
* @returns {ESLintOrTSNode}
|
||||
*/
|
||||
const getTSFunctionComment = function (astNode) {
|
||||
const {parent} = astNode;
|
||||
/* v8 ignore next 3 */
|
||||
if (!parent) {
|
||||
return astNode;
|
||||
}
|
||||
const grandparent = parent.parent;
|
||||
/* v8 ignore next 3 */
|
||||
if (!grandparent) {
|
||||
return astNode;
|
||||
}
|
||||
const greatGrandparent = grandparent.parent;
|
||||
const greatGreatGrandparent = greatGrandparent && greatGrandparent.parent;
|
||||
|
||||
/* v8 ignore next 3 */
|
||||
if (/** @type {ESLintOrTSNode} */ (parent).type !== 'TSTypeAnnotation') {
|
||||
return astNode;
|
||||
}
|
||||
|
||||
switch (/** @type {ESLintOrTSNode} */ (grandparent).type) {
|
||||
// @ts-expect-error -- For `ClassProperty`.
|
||||
case 'PropertyDefinition': case 'ClassProperty':
|
||||
case 'TSDeclareFunction':
|
||||
case 'TSMethodSignature':
|
||||
case 'TSPropertySignature':
|
||||
return grandparent;
|
||||
case 'ArrowFunctionExpression':
|
||||
/* v8 ignore next 3 */
|
||||
if (!greatGrandparent) {
|
||||
return astNode;
|
||||
}
|
||||
|
||||
if (
|
||||
greatGrandparent.type === 'VariableDeclarator'
|
||||
|
||||
// && greatGreatGrandparent.parent.type === 'VariableDeclaration'
|
||||
) {
|
||||
/* v8 ignore next 3 */
|
||||
if (!greatGreatGrandparent || !greatGreatGrandparent.parent) {
|
||||
return astNode;
|
||||
}
|
||||
return greatGreatGrandparent.parent;
|
||||
}
|
||||
/* v8 ignore next */
|
||||
return astNode;
|
||||
case 'FunctionExpression':
|
||||
/* v8 ignore next 3 */
|
||||
if (!greatGreatGrandparent) {
|
||||
return astNode;
|
||||
}
|
||||
if (greatGrandparent.type === 'MethodDefinition') {
|
||||
return greatGrandparent;
|
||||
}
|
||||
|
||||
// Fallthrough
|
||||
default:
|
||||
/* v8 ignore next 3 */
|
||||
if (grandparent.type !== 'Identifier') {
|
||||
return astNode;
|
||||
}
|
||||
}
|
||||
|
||||
/* v8 ignore next 3 */
|
||||
if (!greatGreatGrandparent) {
|
||||
return astNode;
|
||||
}
|
||||
|
||||
switch (greatGrandparent.type) {
|
||||
case 'ArrowFunctionExpression':
|
||||
if (
|
||||
greatGreatGrandparent.type === 'VariableDeclarator' &&
|
||||
greatGreatGrandparent.parent.type === 'VariableDeclaration'
|
||||
) {
|
||||
return greatGreatGrandparent.parent;
|
||||
}
|
||||
|
||||
return astNode;
|
||||
case 'FunctionDeclaration':
|
||||
return greatGrandparent;
|
||||
case 'VariableDeclarator':
|
||||
if (greatGreatGrandparent.type === 'VariableDeclaration') {
|
||||
return greatGreatGrandparent;
|
||||
}
|
||||
/* v8 ignore next 2 */
|
||||
// Fallthrough
|
||||
default:
|
||||
/* v8 ignore next 3 */
|
||||
return astNode;
|
||||
}
|
||||
};
|
||||
|
||||
const invokedExpression = new Set(
|
||||
['CallExpression', 'OptionalCallExpression', 'NewExpression']
|
||||
);
|
||||
const allowableCommentNode = new Set([
|
||||
'AssignmentPattern',
|
||||
'VariableDeclaration',
|
||||
'ExpressionStatement',
|
||||
'MethodDefinition',
|
||||
'Property',
|
||||
'ObjectProperty',
|
||||
'ClassProperty',
|
||||
'PropertyDefinition',
|
||||
'ExportDefaultDeclaration',
|
||||
'ReturnStatement'
|
||||
]);
|
||||
|
||||
/**
|
||||
* Reduces the provided node to the appropriate node for evaluating
|
||||
* JSDoc comment status.
|
||||
*
|
||||
* @param {ESLintOrTSNode} node An AST node.
|
||||
* @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode.
|
||||
* @returns {ESLintOrTSNode} The AST node that
|
||||
* can be evaluated for appropriate JSDoc comments.
|
||||
*/
|
||||
const getReducedASTNode = function (node, sourceCode) {
|
||||
let {parent} = node;
|
||||
|
||||
switch (/** @type {ESLintOrTSNode} */ (node).type) {
|
||||
case 'TSFunctionType':
|
||||
return getTSFunctionComment(node);
|
||||
case 'TSInterfaceDeclaration':
|
||||
case 'TSTypeAliasDeclaration':
|
||||
case 'TSEnumDeclaration':
|
||||
case 'ClassDeclaration':
|
||||
case 'FunctionDeclaration':
|
||||
/* v8 ignore next 3 */
|
||||
if (!parent) {
|
||||
return node;
|
||||
}
|
||||
return looksLikeExport(parent) ? parent : node;
|
||||
|
||||
case 'TSDeclareFunction':
|
||||
case 'ClassExpression':
|
||||
case 'ObjectExpression':
|
||||
case 'ArrowFunctionExpression':
|
||||
case 'TSEmptyBodyFunctionExpression':
|
||||
case 'FunctionExpression':
|
||||
/* v8 ignore next 3 */
|
||||
if (!parent) {
|
||||
return node;
|
||||
}
|
||||
if (
|
||||
!invokedExpression.has(parent.type)
|
||||
) {
|
||||
/**
|
||||
* @type {ESLintOrTSNode|Token|null}
|
||||
*/
|
||||
let token = node;
|
||||
do {
|
||||
token = sourceCode.getTokenBefore(
|
||||
/** @type {import('eslint').Rule.Node|import('eslint').AST.Token} */ (
|
||||
token
|
||||
),
|
||||
{includeComments: true}
|
||||
);
|
||||
} while (token && token.type === 'Punctuator' && token.value === '(');
|
||||
if (token && token.type === 'Block') {
|
||||
return node;
|
||||
}
|
||||
|
||||
if (sourceCode.getCommentsBefore(
|
||||
/** @type {import('eslint').Rule.Node} */
|
||||
(node)
|
||||
).length) {
|
||||
return node;
|
||||
}
|
||||
|
||||
while (
|
||||
!sourceCode.getCommentsBefore(
|
||||
/** @type {import('eslint').Rule.Node} */
|
||||
(parent)
|
||||
).length &&
|
||||
!(/Function/u).test(parent.type) &&
|
||||
!allowableCommentNode.has(parent.type)
|
||||
) {
|
||||
({parent} = parent);
|
||||
|
||||
if (!parent) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (parent && parent.type !== 'FunctionDeclaration' &&
|
||||
parent.type !== 'Program'
|
||||
) {
|
||||
if (parent.parent && parent.parent.type === 'ExportNamedDeclaration') {
|
||||
return parent.parent;
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
|
||||
default:
|
||||
return node;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks for the presence of a JSDoc comment for the given node and returns it.
|
||||
*
|
||||
* @param {ESLintOrTSNode} astNode The AST node to get
|
||||
* the comment for.
|
||||
* @param {import('eslint').SourceCode} sourceCode
|
||||
* @param {{maxLines: int, minLines: int, [name: string]: any}} settings
|
||||
* @param {{nonJSDoc?: boolean}} [opts]
|
||||
* @returns {Token|null} The Block comment token containing the JSDoc comment
|
||||
* for the given node or null if not found.
|
||||
*/
|
||||
const findJSDocComment = (astNode, sourceCode, settings, opts = {}) => {
|
||||
const {nonJSDoc} = opts;
|
||||
const {minLines, maxLines} = settings;
|
||||
|
||||
/** @type {ESLintOrTSNode|import('estree').Comment} */
|
||||
let currentNode = astNode;
|
||||
let tokenBefore = null;
|
||||
let parenthesisToken = null;
|
||||
|
||||
while (currentNode) {
|
||||
const decorator = getDecorator(
|
||||
/** @type {import('eslint').Rule.Node} */
|
||||
(currentNode)
|
||||
);
|
||||
if (decorator) {
|
||||
const dec = /** @type {unknown} */ (decorator);
|
||||
currentNode = /** @type {import('eslint').Rule.Node} */ (dec);
|
||||
}
|
||||
tokenBefore = sourceCode.getTokenBefore(
|
||||
/** @type {import('eslint').Rule.Node} */
|
||||
(currentNode),
|
||||
{includeComments: true}
|
||||
);
|
||||
if (
|
||||
tokenBefore && tokenBefore.type === 'Punctuator' &&
|
||||
tokenBefore.value === '('
|
||||
) {
|
||||
parenthesisToken = tokenBefore;
|
||||
[tokenBefore] = sourceCode.getTokensBefore(
|
||||
/** @type {import('eslint').Rule.Node} */
|
||||
(currentNode),
|
||||
{
|
||||
count: 2,
|
||||
includeComments: true
|
||||
}
|
||||
);
|
||||
}
|
||||
if (!tokenBefore || !isCommentToken(tokenBefore)) {
|
||||
return null;
|
||||
}
|
||||
if (!nonJSDoc && tokenBefore.type === 'Line') {
|
||||
currentNode = tokenBefore;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* v8 ignore next 3 */
|
||||
if (!tokenBefore || !currentNode.loc || !tokenBefore.loc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (
|
||||
(
|
||||
(nonJSDoc && (tokenBefore.type !== 'Block' ||
|
||||
!(/^\*\s/u).test(tokenBefore.value))) ||
|
||||
(!nonJSDoc && tokenBefore.type === 'Block' &&
|
||||
(/^\*\s/u).test(tokenBefore.value))
|
||||
) &&
|
||||
currentNode.loc.start.line - (
|
||||
/** @type {import('eslint').AST.Token} */
|
||||
(parenthesisToken ?? tokenBefore)
|
||||
).loc.end.line >= minLines &&
|
||||
currentNode.loc.start.line - (
|
||||
/** @type {import('eslint').AST.Token} */
|
||||
(parenthesisToken ?? tokenBefore)
|
||||
).loc.end.line <= maxLines
|
||||
) {
|
||||
return tokenBefore;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the JSDoc comment for a given node.
|
||||
*
|
||||
* @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode
|
||||
* @param {import('eslint').Rule.Node} node The AST node to get
|
||||
* the comment for.
|
||||
* @param {{maxLines: int, minLines: int, [name: string]: any}} settings The
|
||||
* settings in context
|
||||
* @returns {Token|null} The Block comment
|
||||
* token containing the JSDoc comment for the given node or
|
||||
* null if not found.
|
||||
* @public
|
||||
*/
|
||||
const getJSDocComment = function (sourceCode, node, settings) {
|
||||
const reducedNode = getReducedASTNode(node, sourceCode);
|
||||
|
||||
return findJSDocComment(reducedNode, sourceCode, settings);
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the comment preceding a given node.
|
||||
*
|
||||
* @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode
|
||||
* @param {ESLintOrTSNode} node The AST node to get
|
||||
* the comment for.
|
||||
* @param {{maxLines: int, minLines: int, [name: string]: any}} settings The
|
||||
* settings in context
|
||||
* @returns {Token|null} The Block comment
|
||||
* token containing the JSDoc comment for the given node or
|
||||
* null if not found.
|
||||
* @public
|
||||
*/
|
||||
const getNonJsdocComment = function (sourceCode, node, settings) {
|
||||
const reducedNode = getReducedASTNode(node, sourceCode);
|
||||
|
||||
return findJSDocComment(reducedNode, sourceCode, settings, {
|
||||
nonJSDoc: true
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ESLintOrTSNode|import('eslint').AST.Token|
|
||||
* import('estree').Comment
|
||||
* } nodeA The AST node or token to compare
|
||||
* @param {ESLintOrTSNode|import('eslint').AST.Token|
|
||||
* import('estree').Comment} nodeB The
|
||||
* AST node or token to compare
|
||||
*/
|
||||
const compareLocEndToStart = (nodeA, nodeB) => {
|
||||
/* v8 ignore next */
|
||||
return (nodeA.loc?.end.line ?? 0) === (nodeB.loc?.start.line ?? 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks for the presence of a comment following the given node and
|
||||
* returns it.
|
||||
*
|
||||
* This method is experimental.
|
||||
*
|
||||
* @param {import('eslint').SourceCode} sourceCode
|
||||
* @param {ESLintOrTSNode} astNode The AST node to get
|
||||
* the comment for.
|
||||
* @returns {Token|null} The comment token containing the comment
|
||||
* for the given node or null if not found.
|
||||
*/
|
||||
const getFollowingComment = function (sourceCode, astNode) {
|
||||
/**
|
||||
* @param {ESLintOrTSNode} node The
|
||||
* AST node to get the comment for.
|
||||
*/
|
||||
const getTokensAfterIgnoringSemis = (node) => {
|
||||
let tokenAfter = sourceCode.getTokenAfter(
|
||||
/** @type {import('eslint').Rule.Node} */
|
||||
(node),
|
||||
{includeComments: true}
|
||||
);
|
||||
|
||||
while (
|
||||
tokenAfter && tokenAfter.type === 'Punctuator' &&
|
||||
// tokenAfter.value === ')' // Don't apparently need to ignore
|
||||
tokenAfter.value === ';'
|
||||
) {
|
||||
[tokenAfter] = sourceCode.getTokensAfter(tokenAfter, {
|
||||
includeComments: true
|
||||
});
|
||||
}
|
||||
return tokenAfter;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ESLintOrTSNode} node The
|
||||
* AST node to get the comment for.
|
||||
*/
|
||||
const tokenAfterIgnoringSemis = (node) => {
|
||||
const tokenAfter = getTokensAfterIgnoringSemis(node);
|
||||
return (
|
||||
tokenAfter &&
|
||||
isCommentToken(tokenAfter) &&
|
||||
compareLocEndToStart(node, tokenAfter)
|
||||
)
|
||||
? tokenAfter
|
||||
: null;
|
||||
};
|
||||
|
||||
let tokenAfter = tokenAfterIgnoringSemis(astNode);
|
||||
|
||||
if (!tokenAfter) {
|
||||
switch (astNode.type) {
|
||||
case 'FunctionDeclaration':
|
||||
tokenAfter = tokenAfterIgnoringSemis(
|
||||
/** @type {ESLintOrTSNode} */
|
||||
(astNode.body)
|
||||
);
|
||||
break;
|
||||
case 'ExpressionStatement':
|
||||
tokenAfter = tokenAfterIgnoringSemis(
|
||||
/** @type {ESLintOrTSNode} */
|
||||
(astNode.expression)
|
||||
);
|
||||
break;
|
||||
|
||||
/* v8 ignore next 3 */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return tokenAfter;
|
||||
};
|
||||
|
||||
export {
|
||||
getReducedASTNode, getJSDocComment, getNonJsdocComment,
|
||||
getDecorator, findJSDocComment, getFollowingComment
|
||||
};
|
||||
190
node_modules/@es-joy/jsdoccomment/src/parseComment.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
/* eslint-disable prefer-named-capture-group -- Temporary */
|
||||
import {
|
||||
parse as commentParser,
|
||||
tokenizers
|
||||
} from 'comment-parser';
|
||||
|
||||
import {parseInlineTags} from './parseInlineTags.js';
|
||||
|
||||
const {
|
||||
name: nameTokenizer,
|
||||
tag: tagTokenizer,
|
||||
type: typeTokenizer,
|
||||
description: descriptionTokenizer
|
||||
} = tokenizers;
|
||||
|
||||
/**
|
||||
* @param {import('comment-parser').Spec} spec
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export const hasSeeWithLink = (spec) => {
|
||||
return spec.tag === 'see' && (/\{@link.+?\}/u).test(spec.source[0].source);
|
||||
};
|
||||
|
||||
export const defaultNoTypes = [
|
||||
'default', 'defaultvalue', 'description', 'example',
|
||||
'file', 'fileoverview', 'license',
|
||||
'overview', 'see', 'summary'
|
||||
];
|
||||
|
||||
export const defaultNoNames = [
|
||||
'access', 'author',
|
||||
'default', 'defaultvalue',
|
||||
'description',
|
||||
'example', 'exception', 'file', 'fileoverview',
|
||||
'kind',
|
||||
'license', 'overview',
|
||||
'return', 'returns',
|
||||
'since', 'summary',
|
||||
'throws',
|
||||
'version', 'variation'
|
||||
];
|
||||
|
||||
const optionalBrackets = /^\[(?<name>[^=]*)=[^\]]*\]/u;
|
||||
const preserveTypeTokenizer = typeTokenizer('preserve');
|
||||
const preserveDescriptionTokenizer = descriptionTokenizer('preserve');
|
||||
const plainNameTokenizer = nameTokenizer();
|
||||
|
||||
/**
|
||||
* Can't import `comment-parser/es6/parser/tokenizers/index.js`,
|
||||
* so we redefine here.
|
||||
* @typedef {(spec: import('comment-parser').Spec) =>
|
||||
* import('comment-parser').Spec} CommentParserTokenizer
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {object} [cfg]
|
||||
* @param {string[]} [cfg.noTypes]
|
||||
* @param {string[]} [cfg.noNames]
|
||||
* @returns {CommentParserTokenizer[]}
|
||||
*/
|
||||
const getTokenizers = ({
|
||||
noTypes = defaultNoTypes,
|
||||
noNames = defaultNoNames
|
||||
} = {}) => {
|
||||
// trim
|
||||
return [
|
||||
// Tag
|
||||
tagTokenizer(),
|
||||
|
||||
/**
|
||||
* Type tokenizer.
|
||||
* @param {import('comment-parser').Spec} spec
|
||||
* @returns {import('comment-parser').Spec}
|
||||
*/
|
||||
(spec) => {
|
||||
if (noTypes.includes(spec.tag)) {
|
||||
return spec;
|
||||
}
|
||||
|
||||
return preserveTypeTokenizer(spec);
|
||||
},
|
||||
|
||||
/**
|
||||
* Name tokenizer.
|
||||
* @param {import('comment-parser').Spec} spec
|
||||
* @returns {import('comment-parser').Spec}
|
||||
*/
|
||||
(spec) => {
|
||||
if (spec.tag === 'template') {
|
||||
// const preWS = spec.postTag;
|
||||
const remainder = spec.source[0].tokens.description;
|
||||
|
||||
let pos;
|
||||
if (remainder.startsWith('[') && remainder.includes(']')) {
|
||||
const endingBracketPos = remainder.indexOf(']');
|
||||
pos = remainder.slice(endingBracketPos).search(/(?<![\s,])\s/u);
|
||||
if (pos > -1) { // Add offset to starting point if space found
|
||||
pos += endingBracketPos;
|
||||
}
|
||||
} else {
|
||||
pos = remainder.search(/(?<![\s,])\s/u);
|
||||
}
|
||||
|
||||
let name = pos === -1 ? remainder : remainder.slice(0, pos);
|
||||
const extra = remainder.slice(pos);
|
||||
let postName = '', description = '', lineEnd = '';
|
||||
if (pos > -1) {
|
||||
[, postName, description, lineEnd] = /** @type {RegExpMatchArray} */ (
|
||||
extra.match(/(\s*)([^\r]*)(\r)?/u)
|
||||
);
|
||||
}
|
||||
|
||||
if (optionalBrackets.test(name)) {
|
||||
name = /** @type {string} */ (
|
||||
/** @type {RegExpMatchArray} */ (
|
||||
name.match(optionalBrackets)
|
||||
)?.groups?.name
|
||||
);
|
||||
spec.optional = true;
|
||||
} else {
|
||||
spec.optional = false;
|
||||
}
|
||||
|
||||
spec.name = name;
|
||||
const {tokens} = spec.source[0];
|
||||
tokens.name = name;
|
||||
tokens.postName = postName;
|
||||
tokens.description = description;
|
||||
tokens.lineEnd = lineEnd || '';
|
||||
|
||||
return spec;
|
||||
}
|
||||
|
||||
if (noNames.includes(spec.tag) || hasSeeWithLink(spec)) {
|
||||
return spec;
|
||||
}
|
||||
|
||||
return plainNameTokenizer(spec);
|
||||
},
|
||||
|
||||
/**
|
||||
* Description tokenizer.
|
||||
* @param {import('comment-parser').Spec} spec
|
||||
* @returns {import('comment-parser').Spec}
|
||||
*/
|
||||
(spec) => {
|
||||
return preserveDescriptionTokenizer(spec);
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* Accepts a comment token or complete comment string and converts it into
|
||||
* `comment-parser` AST.
|
||||
* @param {string | {value: string}} commentOrNode
|
||||
* @param {string} [indent] Whitespace
|
||||
* @returns {import('.').JsdocBlockWithInline}
|
||||
*/
|
||||
const parseComment = (commentOrNode, indent = '') => {
|
||||
let block;
|
||||
|
||||
switch (typeof commentOrNode) {
|
||||
case 'string':
|
||||
// Preserve JSDoc block start/end indentation.
|
||||
[block] = commentParser(`${indent}${commentOrNode}`, {
|
||||
// @see https://github.com/yavorskiy/comment-parser/issues/21
|
||||
tokenizers: getTokenizers()
|
||||
});
|
||||
break;
|
||||
|
||||
case 'object':
|
||||
if (commentOrNode === null) {
|
||||
throw new TypeError(`'commentOrNode' is not a string or object.`);
|
||||
}
|
||||
|
||||
// Preserve JSDoc block start/end indentation.
|
||||
[block] = commentParser(`${indent}/*${commentOrNode.value}*/`, {
|
||||
// @see https://github.com/yavorskiy/comment-parser/issues/21
|
||||
tokenizers: getTokenizers()
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new TypeError(`'commentOrNode' is not a string or object.`);
|
||||
}
|
||||
|
||||
return parseInlineTags(block);
|
||||
};
|
||||
|
||||
export {getTokenizers, parseComment};
|
||||
108
node_modules/@es-joy/jsdoccomment/src/parseInlineTags.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* @param {RegExpMatchArray & {
|
||||
* indices: {
|
||||
* groups: {
|
||||
* [key: string]: [number, number]
|
||||
* }
|
||||
* }
|
||||
* groups: {[key: string]: string}
|
||||
* }} match An inline tag regexp match.
|
||||
* @returns {'pipe' | 'plain' | 'prefix' | 'space'}
|
||||
*/
|
||||
function determineFormat (match) {
|
||||
const {separator, text} = match.groups;
|
||||
const [, textEnd] = match.indices.groups.text;
|
||||
const [tagStart] = match.indices.groups.tag;
|
||||
if (!text) {
|
||||
return 'plain';
|
||||
} else if (separator === '|') {
|
||||
return 'pipe';
|
||||
} else if (textEnd < tagStart) {
|
||||
return 'prefix';
|
||||
}
|
||||
return 'space';
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts inline tags from a description.
|
||||
* @param {string} description
|
||||
* @returns {import('.').InlineTag[]} Array of inline tags from the description.
|
||||
*/
|
||||
function parseDescription (description) {
|
||||
/** @type {import('.').InlineTag[]} */
|
||||
const result = [];
|
||||
|
||||
// This could have been expressed in a single pattern,
|
||||
// but having two avoids a potentially exponential time regex.
|
||||
|
||||
const prefixedTextPattern = new RegExp(/(?:\[(?<text>[^\]]+)\])\{@(?<tag>[^}\s]+)\s?(?<namepathOrURL>[^}\s|]*)\}/gu, 'gud');
|
||||
// The pattern used to match for text after tag uses a negative lookbehind
|
||||
// on the ']' char to avoid matching the prefixed case too.
|
||||
const suffixedAfterPattern = new RegExp(/(?<!\])\{@(?<tag>[^}\s]+)\s?(?<namepathOrURL>[^}\s|]*)\s*(?<separator>[\s|])?\s*(?<text>[^}]*)\}/gu, 'gud');
|
||||
|
||||
const matches = [
|
||||
...description.matchAll(prefixedTextPattern),
|
||||
...description.matchAll(suffixedAfterPattern)
|
||||
];
|
||||
|
||||
for (const mtch of matches) {
|
||||
const match = /**
|
||||
* @type {RegExpMatchArray & {
|
||||
* indices: {
|
||||
* groups: {
|
||||
* [key: string]: [number, number]
|
||||
* }
|
||||
* }
|
||||
* groups: {[key: string]: string}
|
||||
* }}
|
||||
*/ (
|
||||
mtch
|
||||
);
|
||||
const {tag, namepathOrURL, text} = match.groups;
|
||||
const [start, end] = match.indices[0];
|
||||
const format = determineFormat(match);
|
||||
|
||||
result.push({
|
||||
tag,
|
||||
namepathOrURL,
|
||||
text,
|
||||
format,
|
||||
start,
|
||||
end
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits the `{@prefix}` from remaining `Spec.lines[].token.description`
|
||||
* into the `inlineTags` tokens, and populates `spec.inlineTags`
|
||||
* @param {import('comment-parser').Block} block
|
||||
* @returns {import('.').JsdocBlockWithInline}
|
||||
*/
|
||||
export function parseInlineTags (block) {
|
||||
const inlineTags =
|
||||
/**
|
||||
* @type {(import('./commentParserToESTree').JsdocInlineTagNoType & {
|
||||
* line?: import('./commentParserToESTree').Integer
|
||||
* })[]}
|
||||
*/ (
|
||||
parseDescription(block.description)
|
||||
);
|
||||
|
||||
/** @type {import('.').JsdocBlockWithInline} */ (
|
||||
block
|
||||
).inlineTags = inlineTags;
|
||||
|
||||
for (const tag of block.tags) {
|
||||
/**
|
||||
* @type {import('.').JsdocTagWithInline}
|
||||
*/ (tag).inlineTags = parseDescription(tag.description);
|
||||
}
|
||||
return (
|
||||
/**
|
||||
* @type {import('.').JsdocBlockWithInline}
|
||||
*/ (block)
|
||||
);
|
||||
}
|
||||
13
node_modules/@es-joy/jsdoccomment/src/toCamelCase.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @param {string} str
|
||||
* @returns {string}
|
||||
*/
|
||||
const toCamelCase = (str) => {
|
||||
return str.toLowerCase().replaceAll(/^[a-z]/gu, (init) => {
|
||||
return init.toUpperCase();
|
||||
}).replaceAll(/_(?<wordInit>[a-z])/gu, (_, n1, o, s, {wordInit}) => {
|
||||
return wordInit.toUpperCase();
|
||||
});
|
||||
};
|
||||
|
||||
export {toCamelCase};
|
||||
21
node_modules/@eslint-community/eslint-utils/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Toru Nagashima
|
||||
|
||||
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.
|
||||
37
node_modules/@eslint-community/eslint-utils/README.md
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# @eslint-community/eslint-utils
|
||||
|
||||
[](https://www.npmjs.com/package/@eslint-community/eslint-utils)
|
||||
[](http://www.npmtrends.com/@eslint-community/eslint-utils)
|
||||
[](https://github.com/eslint-community/eslint-utils/actions)
|
||||
[](https://codecov.io/gh/eslint-community/eslint-utils)
|
||||
|
||||
## 🏁 Goal
|
||||
|
||||
This package provides utility functions and classes for make ESLint custom rules.
|
||||
|
||||
For examples:
|
||||
|
||||
- [`getStaticValue`](https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getstaticvalue) evaluates static value on AST.
|
||||
- [`ReferenceTracker`](https://eslint-community.github.io/eslint-utils/api/scope-utils.html#referencetracker-class) checks the members of modules/globals as handling assignments and destructuring.
|
||||
|
||||
## 📖 Usage
|
||||
|
||||
See [documentation](https://eslint-community.github.io/eslint-utils).
|
||||
|
||||
## 📰 Changelog
|
||||
|
||||
See [releases](https://github.com/eslint-community/eslint-utils/releases).
|
||||
|
||||
## ❤️ Contributing
|
||||
|
||||
Welcome contributing!
|
||||
|
||||
Please use GitHub's Issues/PRs.
|
||||
|
||||
### Development Tools
|
||||
|
||||
- `npm test` runs tests and measures coverage.
|
||||
- `npm run clean` removes the coverage result of `npm test` command.
|
||||
- `npm run coverage` shows the coverage result of the last `npm test` command.
|
||||
- `npm run lint` runs ESLint.
|
||||
- `npm run watch` runs tests on each file change.
|
||||
2059
node_modules/@eslint-community/eslint-utils/index.js
generated
vendored
Normal file
1
node_modules/@eslint-community/eslint-utils/index.js.map
generated
vendored
Normal file
2018
node_modules/@eslint-community/eslint-utils/index.mjs
generated
vendored
Normal file
1
node_modules/@eslint-community/eslint-utils/index.mjs.map
generated
vendored
Normal file
201
node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
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 contributors
|
||||
|
||||
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.
|
||||
105
node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/README.md
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
# eslint-visitor-keys
|
||||
|
||||
[](https://www.npmjs.com/package/eslint-visitor-keys)
|
||||
[](http://www.npmtrends.com/eslint-visitor-keys)
|
||||
[](https://github.com/eslint/eslint-visitor-keys/actions)
|
||||
|
||||
Constants and utilities about visitor keys to traverse AST.
|
||||
|
||||
## 💿 Installation
|
||||
|
||||
Use [npm] to install.
|
||||
|
||||
```bash
|
||||
$ npm install eslint-visitor-keys
|
||||
```
|
||||
|
||||
### Requirements
|
||||
|
||||
- [Node.js] `^12.22.0`, `^14.17.0`, or `>=16.0.0`
|
||||
|
||||
|
||||
## 📖 Usage
|
||||
|
||||
To use in an ESM file:
|
||||
|
||||
```js
|
||||
import * as evk from "eslint-visitor-keys"
|
||||
```
|
||||
|
||||
To use in a CommonJS file:
|
||||
|
||||
```js
|
||||
const evk = require("eslint-visitor-keys")
|
||||
```
|
||||
|
||||
### evk.KEYS
|
||||
|
||||
> type: `{ [type: string]: string[] | undefined }`
|
||||
|
||||
Visitor keys. This keys are frozen.
|
||||
|
||||
This is an object. Keys are the type of [ESTree] nodes. Their values are an array of property names which have child nodes.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
console.log(evk.KEYS.AssignmentExpression) // → ["left", "right"]
|
||||
```
|
||||
|
||||
### evk.getKeys(node)
|
||||
|
||||
> type: `(node: object) => string[]`
|
||||
|
||||
Get the visitor keys of a given AST node.
|
||||
|
||||
This is similar to `Object.keys(node)` of ES Standard, but some keys are excluded: `parent`, `leadingComments`, `trailingComments`, and names which start with `_`.
|
||||
|
||||
This will be used to traverse unknown nodes.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
const node = {
|
||||
type: "AssignmentExpression",
|
||||
left: { type: "Identifier", name: "foo" },
|
||||
right: { type: "Literal", value: 0 }
|
||||
}
|
||||
console.log(evk.getKeys(node)) // → ["type", "left", "right"]
|
||||
```
|
||||
|
||||
### evk.unionWith(additionalKeys)
|
||||
|
||||
> type: `(additionalKeys: object) => { [type: string]: string[] | undefined }`
|
||||
|
||||
Make the union set with `evk.KEYS` and the given keys.
|
||||
|
||||
- The order of keys is, `additionalKeys` is at first, then `evk.KEYS` is concatenated after that.
|
||||
- It removes duplicated keys as keeping the first one.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
console.log(evk.unionWith({
|
||||
MethodDefinition: ["decorators"]
|
||||
})) // → { ..., MethodDefinition: ["decorators", "key", "value"], ... }
|
||||
```
|
||||
|
||||
## 📰 Change log
|
||||
|
||||
See [GitHub releases](https://github.com/eslint/eslint-visitor-keys/releases).
|
||||
|
||||
## 🍻 Contributing
|
||||
|
||||
Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer-guide/contributing/).
|
||||
|
||||
### Development commands
|
||||
|
||||
- `npm test` runs tests and measures code coverage.
|
||||
- `npm run lint` checks source codes with ESLint.
|
||||
- `npm run test:open-coverage` opens the code coverage report of the previous test with your default browser.
|
||||
|
||||
|
||||
[npm]: https://www.npmjs.com/
|
||||
[Node.js]: https://nodejs.org/
|
||||
[ESTree]: https://github.com/estree/estree
|
||||
384
node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs
generated
vendored
Normal file
@@ -0,0 +1,384 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/**
|
||||
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {VisitorKeys}
|
||||
*/
|
||||
const KEYS = {
|
||||
ArrayExpression: [
|
||||
"elements"
|
||||
],
|
||||
ArrayPattern: [
|
||||
"elements"
|
||||
],
|
||||
ArrowFunctionExpression: [
|
||||
"params",
|
||||
"body"
|
||||
],
|
||||
AssignmentExpression: [
|
||||
"left",
|
||||
"right"
|
||||
],
|
||||
AssignmentPattern: [
|
||||
"left",
|
||||
"right"
|
||||
],
|
||||
AwaitExpression: [
|
||||
"argument"
|
||||
],
|
||||
BinaryExpression: [
|
||||
"left",
|
||||
"right"
|
||||
],
|
||||
BlockStatement: [
|
||||
"body"
|
||||
],
|
||||
BreakStatement: [
|
||||
"label"
|
||||
],
|
||||
CallExpression: [
|
||||
"callee",
|
||||
"arguments"
|
||||
],
|
||||
CatchClause: [
|
||||
"param",
|
||||
"body"
|
||||
],
|
||||
ChainExpression: [
|
||||
"expression"
|
||||
],
|
||||
ClassBody: [
|
||||
"body"
|
||||
],
|
||||
ClassDeclaration: [
|
||||
"id",
|
||||
"superClass",
|
||||
"body"
|
||||
],
|
||||
ClassExpression: [
|
||||
"id",
|
||||
"superClass",
|
||||
"body"
|
||||
],
|
||||
ConditionalExpression: [
|
||||
"test",
|
||||
"consequent",
|
||||
"alternate"
|
||||
],
|
||||
ContinueStatement: [
|
||||
"label"
|
||||
],
|
||||
DebuggerStatement: [],
|
||||
DoWhileStatement: [
|
||||
"body",
|
||||
"test"
|
||||
],
|
||||
EmptyStatement: [],
|
||||
ExperimentalRestProperty: [
|
||||
"argument"
|
||||
],
|
||||
ExperimentalSpreadProperty: [
|
||||
"argument"
|
||||
],
|
||||
ExportAllDeclaration: [
|
||||
"exported",
|
||||
"source"
|
||||
],
|
||||
ExportDefaultDeclaration: [
|
||||
"declaration"
|
||||
],
|
||||
ExportNamedDeclaration: [
|
||||
"declaration",
|
||||
"specifiers",
|
||||
"source"
|
||||
],
|
||||
ExportSpecifier: [
|
||||
"exported",
|
||||
"local"
|
||||
],
|
||||
ExpressionStatement: [
|
||||
"expression"
|
||||
],
|
||||
ForInStatement: [
|
||||
"left",
|
||||
"right",
|
||||
"body"
|
||||
],
|
||||
ForOfStatement: [
|
||||
"left",
|
||||
"right",
|
||||
"body"
|
||||
],
|
||||
ForStatement: [
|
||||
"init",
|
||||
"test",
|
||||
"update",
|
||||
"body"
|
||||
],
|
||||
FunctionDeclaration: [
|
||||
"id",
|
||||
"params",
|
||||
"body"
|
||||
],
|
||||
FunctionExpression: [
|
||||
"id",
|
||||
"params",
|
||||
"body"
|
||||
],
|
||||
Identifier: [],
|
||||
IfStatement: [
|
||||
"test",
|
||||
"consequent",
|
||||
"alternate"
|
||||
],
|
||||
ImportDeclaration: [
|
||||
"specifiers",
|
||||
"source"
|
||||
],
|
||||
ImportDefaultSpecifier: [
|
||||
"local"
|
||||
],
|
||||
ImportExpression: [
|
||||
"source"
|
||||
],
|
||||
ImportNamespaceSpecifier: [
|
||||
"local"
|
||||
],
|
||||
ImportSpecifier: [
|
||||
"imported",
|
||||
"local"
|
||||
],
|
||||
JSXAttribute: [
|
||||
"name",
|
||||
"value"
|
||||
],
|
||||
JSXClosingElement: [
|
||||
"name"
|
||||
],
|
||||
JSXClosingFragment: [],
|
||||
JSXElement: [
|
||||
"openingElement",
|
||||
"children",
|
||||
"closingElement"
|
||||
],
|
||||
JSXEmptyExpression: [],
|
||||
JSXExpressionContainer: [
|
||||
"expression"
|
||||
],
|
||||
JSXFragment: [
|
||||
"openingFragment",
|
||||
"children",
|
||||
"closingFragment"
|
||||
],
|
||||
JSXIdentifier: [],
|
||||
JSXMemberExpression: [
|
||||
"object",
|
||||
"property"
|
||||
],
|
||||
JSXNamespacedName: [
|
||||
"namespace",
|
||||
"name"
|
||||
],
|
||||
JSXOpeningElement: [
|
||||
"name",
|
||||
"attributes"
|
||||
],
|
||||
JSXOpeningFragment: [],
|
||||
JSXSpreadAttribute: [
|
||||
"argument"
|
||||
],
|
||||
JSXSpreadChild: [
|
||||
"expression"
|
||||
],
|
||||
JSXText: [],
|
||||
LabeledStatement: [
|
||||
"label",
|
||||
"body"
|
||||
],
|
||||
Literal: [],
|
||||
LogicalExpression: [
|
||||
"left",
|
||||
"right"
|
||||
],
|
||||
MemberExpression: [
|
||||
"object",
|
||||
"property"
|
||||
],
|
||||
MetaProperty: [
|
||||
"meta",
|
||||
"property"
|
||||
],
|
||||
MethodDefinition: [
|
||||
"key",
|
||||
"value"
|
||||
],
|
||||
NewExpression: [
|
||||
"callee",
|
||||
"arguments"
|
||||
],
|
||||
ObjectExpression: [
|
||||
"properties"
|
||||
],
|
||||
ObjectPattern: [
|
||||
"properties"
|
||||
],
|
||||
PrivateIdentifier: [],
|
||||
Program: [
|
||||
"body"
|
||||
],
|
||||
Property: [
|
||||
"key",
|
||||
"value"
|
||||
],
|
||||
PropertyDefinition: [
|
||||
"key",
|
||||
"value"
|
||||
],
|
||||
RestElement: [
|
||||
"argument"
|
||||
],
|
||||
ReturnStatement: [
|
||||
"argument"
|
||||
],
|
||||
SequenceExpression: [
|
||||
"expressions"
|
||||
],
|
||||
SpreadElement: [
|
||||
"argument"
|
||||
],
|
||||
StaticBlock: [
|
||||
"body"
|
||||
],
|
||||
Super: [],
|
||||
SwitchCase: [
|
||||
"test",
|
||||
"consequent"
|
||||
],
|
||||
SwitchStatement: [
|
||||
"discriminant",
|
||||
"cases"
|
||||
],
|
||||
TaggedTemplateExpression: [
|
||||
"tag",
|
||||
"quasi"
|
||||
],
|
||||
TemplateElement: [],
|
||||
TemplateLiteral: [
|
||||
"quasis",
|
||||
"expressions"
|
||||
],
|
||||
ThisExpression: [],
|
||||
ThrowStatement: [
|
||||
"argument"
|
||||
],
|
||||
TryStatement: [
|
||||
"block",
|
||||
"handler",
|
||||
"finalizer"
|
||||
],
|
||||
UnaryExpression: [
|
||||
"argument"
|
||||
],
|
||||
UpdateExpression: [
|
||||
"argument"
|
||||
],
|
||||
VariableDeclaration: [
|
||||
"declarations"
|
||||
],
|
||||
VariableDeclarator: [
|
||||
"id",
|
||||
"init"
|
||||
],
|
||||
WhileStatement: [
|
||||
"test",
|
||||
"body"
|
||||
],
|
||||
WithStatement: [
|
||||
"object",
|
||||
"body"
|
||||
],
|
||||
YieldExpression: [
|
||||
"argument"
|
||||
]
|
||||
};
|
||||
|
||||
// Types.
|
||||
const NODE_TYPES = Object.keys(KEYS);
|
||||
|
||||
// Freeze the keys.
|
||||
for (const type of NODE_TYPES) {
|
||||
Object.freeze(KEYS[type]);
|
||||
}
|
||||
Object.freeze(KEYS);
|
||||
|
||||
/**
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
|
||||
*/
|
||||
|
||||
// List to ignore keys.
|
||||
const KEY_BLACKLIST = new Set([
|
||||
"parent",
|
||||
"leadingComments",
|
||||
"trailingComments"
|
||||
]);
|
||||
|
||||
/**
|
||||
* Check whether a given key should be used or not.
|
||||
* @param {string} key The key to check.
|
||||
* @returns {boolean} `true` if the key should be used.
|
||||
*/
|
||||
function filterKey(key) {
|
||||
return !KEY_BLACKLIST.has(key) && key[0] !== "_";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get visitor keys of a given node.
|
||||
* @param {object} node The AST node to get keys.
|
||||
* @returns {readonly string[]} Visitor keys of the node.
|
||||
*/
|
||||
function getKeys(node) {
|
||||
return Object.keys(node).filter(filterKey);
|
||||
}
|
||||
|
||||
// Disable valid-jsdoc rule because it reports syntax error on the type of @returns.
|
||||
// eslint-disable-next-line valid-jsdoc
|
||||
/**
|
||||
* Make the union set with `KEYS` and given keys.
|
||||
* @param {VisitorKeys} additionalKeys The additional keys.
|
||||
* @returns {VisitorKeys} The union set.
|
||||
*/
|
||||
function unionWith(additionalKeys) {
|
||||
const retv = /** @type {{
|
||||
[type: string]: ReadonlyArray<string>
|
||||
}} */ (Object.assign({}, KEYS));
|
||||
|
||||
for (const type of Object.keys(additionalKeys)) {
|
||||
if (Object.prototype.hasOwnProperty.call(retv, type)) {
|
||||
const keys = new Set(additionalKeys[type]);
|
||||
|
||||
for (const key of retv[type]) {
|
||||
keys.add(key);
|
||||
}
|
||||
|
||||
retv[type] = Object.freeze(Array.from(keys));
|
||||
} else {
|
||||
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
|
||||
}
|
||||
}
|
||||
|
||||
return Object.freeze(retv);
|
||||
}
|
||||
|
||||
exports.KEYS = KEYS;
|
||||
exports.getKeys = getKeys;
|
||||
exports.unionWith = unionWith;
|
||||
27
node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
type VisitorKeys$1 = {
|
||||
readonly [type: string]: readonly string[];
|
||||
};
|
||||
/**
|
||||
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
|
||||
*/
|
||||
/**
|
||||
* @type {VisitorKeys}
|
||||
*/
|
||||
declare const KEYS: VisitorKeys$1;
|
||||
|
||||
/**
|
||||
* Get visitor keys of a given node.
|
||||
* @param {object} node The AST node to get keys.
|
||||
* @returns {readonly string[]} Visitor keys of the node.
|
||||
*/
|
||||
declare function getKeys(node: object): readonly string[];
|
||||
/**
|
||||
* Make the union set with `KEYS` and given keys.
|
||||
* @param {VisitorKeys} additionalKeys The additional keys.
|
||||
* @returns {VisitorKeys} The union set.
|
||||
*/
|
||||
declare function unionWith(additionalKeys: VisitorKeys): VisitorKeys;
|
||||
|
||||
type VisitorKeys = VisitorKeys$1;
|
||||
|
||||
export { KEYS, VisitorKeys, getKeys, unionWith };
|
||||
16
node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Get visitor keys of a given node.
|
||||
* @param {object} node The AST node to get keys.
|
||||
* @returns {readonly string[]} Visitor keys of the node.
|
||||
*/
|
||||
export function getKeys(node: object): readonly string[];
|
||||
/**
|
||||
* Make the union set with `KEYS` and given keys.
|
||||
* @param {VisitorKeys} additionalKeys The additional keys.
|
||||
* @returns {VisitorKeys} The union set.
|
||||
*/
|
||||
export function unionWith(additionalKeys: VisitorKeys): VisitorKeys;
|
||||
export { KEYS };
|
||||
export type VisitorKeys = import('./visitor-keys.js').VisitorKeys;
|
||||
import KEYS from "./visitor-keys.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
12
node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export default KEYS;
|
||||
export type VisitorKeys = {
|
||||
readonly [type: string]: readonly string[];
|
||||
};
|
||||
/**
|
||||
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
|
||||
*/
|
||||
/**
|
||||
* @type {VisitorKeys}
|
||||
*/
|
||||
declare const KEYS: VisitorKeys;
|
||||
//# sourceMappingURL=visitor-keys.d.ts.map
|
||||
65
node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
import KEYS from "./visitor-keys.js";
|
||||
|
||||
/**
|
||||
* @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
|
||||
*/
|
||||
|
||||
// List to ignore keys.
|
||||
const KEY_BLACKLIST = new Set([
|
||||
"parent",
|
||||
"leadingComments",
|
||||
"trailingComments"
|
||||
]);
|
||||
|
||||
/**
|
||||
* Check whether a given key should be used or not.
|
||||
* @param {string} key The key to check.
|
||||
* @returns {boolean} `true` if the key should be used.
|
||||
*/
|
||||
function filterKey(key) {
|
||||
return !KEY_BLACKLIST.has(key) && key[0] !== "_";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get visitor keys of a given node.
|
||||
* @param {object} node The AST node to get keys.
|
||||
* @returns {readonly string[]} Visitor keys of the node.
|
||||
*/
|
||||
export function getKeys(node) {
|
||||
return Object.keys(node).filter(filterKey);
|
||||
}
|
||||
|
||||
// Disable valid-jsdoc rule because it reports syntax error on the type of @returns.
|
||||
// eslint-disable-next-line valid-jsdoc
|
||||
/**
|
||||
* Make the union set with `KEYS` and given keys.
|
||||
* @param {VisitorKeys} additionalKeys The additional keys.
|
||||
* @returns {VisitorKeys} The union set.
|
||||
*/
|
||||
export function unionWith(additionalKeys) {
|
||||
const retv = /** @type {{
|
||||
[type: string]: ReadonlyArray<string>
|
||||
}} */ (Object.assign({}, KEYS));
|
||||
|
||||
for (const type of Object.keys(additionalKeys)) {
|
||||
if (Object.prototype.hasOwnProperty.call(retv, type)) {
|
||||
const keys = new Set(additionalKeys[type]);
|
||||
|
||||
for (const key of retv[type]) {
|
||||
keys.add(key);
|
||||
}
|
||||
|
||||
retv[type] = Object.freeze(Array.from(keys));
|
||||
} else {
|
||||
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
|
||||
}
|
||||
}
|
||||
|
||||
return Object.freeze(retv);
|
||||
}
|
||||
|
||||
export { KEYS };
|
||||
315
node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.js
generated
vendored
Normal file
@@ -0,0 +1,315 @@
|
||||
/**
|
||||
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {VisitorKeys}
|
||||
*/
|
||||
const KEYS = {
|
||||
ArrayExpression: [
|
||||
"elements"
|
||||
],
|
||||
ArrayPattern: [
|
||||
"elements"
|
||||
],
|
||||
ArrowFunctionExpression: [
|
||||
"params",
|
||||
"body"
|
||||
],
|
||||
AssignmentExpression: [
|
||||
"left",
|
||||
"right"
|
||||
],
|
||||
AssignmentPattern: [
|
||||
"left",
|
||||
"right"
|
||||
],
|
||||
AwaitExpression: [
|
||||
"argument"
|
||||
],
|
||||
BinaryExpression: [
|
||||
"left",
|
||||
"right"
|
||||
],
|
||||
BlockStatement: [
|
||||
"body"
|
||||
],
|
||||
BreakStatement: [
|
||||
"label"
|
||||
],
|
||||
CallExpression: [
|
||||
"callee",
|
||||
"arguments"
|
||||
],
|
||||
CatchClause: [
|
||||
"param",
|
||||
"body"
|
||||
],
|
||||
ChainExpression: [
|
||||
"expression"
|
||||
],
|
||||
ClassBody: [
|
||||
"body"
|
||||
],
|
||||
ClassDeclaration: [
|
||||
"id",
|
||||
"superClass",
|
||||
"body"
|
||||
],
|
||||
ClassExpression: [
|
||||
"id",
|
||||
"superClass",
|
||||
"body"
|
||||
],
|
||||
ConditionalExpression: [
|
||||
"test",
|
||||
"consequent",
|
||||
"alternate"
|
||||
],
|
||||
ContinueStatement: [
|
||||
"label"
|
||||
],
|
||||
DebuggerStatement: [],
|
||||
DoWhileStatement: [
|
||||
"body",
|
||||
"test"
|
||||
],
|
||||
EmptyStatement: [],
|
||||
ExperimentalRestProperty: [
|
||||
"argument"
|
||||
],
|
||||
ExperimentalSpreadProperty: [
|
||||
"argument"
|
||||
],
|
||||
ExportAllDeclaration: [
|
||||
"exported",
|
||||
"source"
|
||||
],
|
||||
ExportDefaultDeclaration: [
|
||||
"declaration"
|
||||
],
|
||||
ExportNamedDeclaration: [
|
||||
"declaration",
|
||||
"specifiers",
|
||||
"source"
|
||||
],
|
||||
ExportSpecifier: [
|
||||
"exported",
|
||||
"local"
|
||||
],
|
||||
ExpressionStatement: [
|
||||
"expression"
|
||||
],
|
||||
ForInStatement: [
|
||||
"left",
|
||||
"right",
|
||||
"body"
|
||||
],
|
||||
ForOfStatement: [
|
||||
"left",
|
||||
"right",
|
||||
"body"
|
||||
],
|
||||
ForStatement: [
|
||||
"init",
|
||||
"test",
|
||||
"update",
|
||||
"body"
|
||||
],
|
||||
FunctionDeclaration: [
|
||||
"id",
|
||||
"params",
|
||||
"body"
|
||||
],
|
||||
FunctionExpression: [
|
||||
"id",
|
||||
"params",
|
||||
"body"
|
||||
],
|
||||
Identifier: [],
|
||||
IfStatement: [
|
||||
"test",
|
||||
"consequent",
|
||||
"alternate"
|
||||
],
|
||||
ImportDeclaration: [
|
||||
"specifiers",
|
||||
"source"
|
||||
],
|
||||
ImportDefaultSpecifier: [
|
||||
"local"
|
||||
],
|
||||
ImportExpression: [
|
||||
"source"
|
||||
],
|
||||
ImportNamespaceSpecifier: [
|
||||
"local"
|
||||
],
|
||||
ImportSpecifier: [
|
||||
"imported",
|
||||
"local"
|
||||
],
|
||||
JSXAttribute: [
|
||||
"name",
|
||||
"value"
|
||||
],
|
||||
JSXClosingElement: [
|
||||
"name"
|
||||
],
|
||||
JSXClosingFragment: [],
|
||||
JSXElement: [
|
||||
"openingElement",
|
||||
"children",
|
||||
"closingElement"
|
||||
],
|
||||
JSXEmptyExpression: [],
|
||||
JSXExpressionContainer: [
|
||||
"expression"
|
||||
],
|
||||
JSXFragment: [
|
||||
"openingFragment",
|
||||
"children",
|
||||
"closingFragment"
|
||||
],
|
||||
JSXIdentifier: [],
|
||||
JSXMemberExpression: [
|
||||
"object",
|
||||
"property"
|
||||
],
|
||||
JSXNamespacedName: [
|
||||
"namespace",
|
||||
"name"
|
||||
],
|
||||
JSXOpeningElement: [
|
||||
"name",
|
||||
"attributes"
|
||||
],
|
||||
JSXOpeningFragment: [],
|
||||
JSXSpreadAttribute: [
|
||||
"argument"
|
||||
],
|
||||
JSXSpreadChild: [
|
||||
"expression"
|
||||
],
|
||||
JSXText: [],
|
||||
LabeledStatement: [
|
||||
"label",
|
||||
"body"
|
||||
],
|
||||
Literal: [],
|
||||
LogicalExpression: [
|
||||
"left",
|
||||
"right"
|
||||
],
|
||||
MemberExpression: [
|
||||
"object",
|
||||
"property"
|
||||
],
|
||||
MetaProperty: [
|
||||
"meta",
|
||||
"property"
|
||||
],
|
||||
MethodDefinition: [
|
||||
"key",
|
||||
"value"
|
||||
],
|
||||
NewExpression: [
|
||||
"callee",
|
||||
"arguments"
|
||||
],
|
||||
ObjectExpression: [
|
||||
"properties"
|
||||
],
|
||||
ObjectPattern: [
|
||||
"properties"
|
||||
],
|
||||
PrivateIdentifier: [],
|
||||
Program: [
|
||||
"body"
|
||||
],
|
||||
Property: [
|
||||
"key",
|
||||
"value"
|
||||
],
|
||||
PropertyDefinition: [
|
||||
"key",
|
||||
"value"
|
||||
],
|
||||
RestElement: [
|
||||
"argument"
|
||||
],
|
||||
ReturnStatement: [
|
||||
"argument"
|
||||
],
|
||||
SequenceExpression: [
|
||||
"expressions"
|
||||
],
|
||||
SpreadElement: [
|
||||
"argument"
|
||||
],
|
||||
StaticBlock: [
|
||||
"body"
|
||||
],
|
||||
Super: [],
|
||||
SwitchCase: [
|
||||
"test",
|
||||
"consequent"
|
||||
],
|
||||
SwitchStatement: [
|
||||
"discriminant",
|
||||
"cases"
|
||||
],
|
||||
TaggedTemplateExpression: [
|
||||
"tag",
|
||||
"quasi"
|
||||
],
|
||||
TemplateElement: [],
|
||||
TemplateLiteral: [
|
||||
"quasis",
|
||||
"expressions"
|
||||
],
|
||||
ThisExpression: [],
|
||||
ThrowStatement: [
|
||||
"argument"
|
||||
],
|
||||
TryStatement: [
|
||||
"block",
|
||||
"handler",
|
||||
"finalizer"
|
||||
],
|
||||
UnaryExpression: [
|
||||
"argument"
|
||||
],
|
||||
UpdateExpression: [
|
||||
"argument"
|
||||
],
|
||||
VariableDeclaration: [
|
||||
"declarations"
|
||||
],
|
||||
VariableDeclarator: [
|
||||
"id",
|
||||
"init"
|
||||
],
|
||||
WhileStatement: [
|
||||
"test",
|
||||
"body"
|
||||
],
|
||||
WithStatement: [
|
||||
"object",
|
||||
"body"
|
||||
],
|
||||
YieldExpression: [
|
||||
"argument"
|
||||
]
|
||||
};
|
||||
|
||||
// Types.
|
||||
const NODE_TYPES = Object.keys(KEYS);
|
||||
|
||||
// Freeze the keys.
|
||||
for (const type of NODE_TYPES) {
|
||||
Object.freeze(KEYS[type]);
|
||||
}
|
||||
Object.freeze(KEYS);
|
||||
|
||||
export default KEYS;
|
||||
74
node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/package.json
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "eslint-visitor-keys",
|
||||
"version": "3.4.3",
|
||||
"description": "Constants and utilities about visitor keys to traverse AST.",
|
||||
"type": "module",
|
||||
"main": "dist/eslint-visitor-keys.cjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./lib/index.js",
|
||||
"require": "./dist/eslint-visitor-keys.cjs"
|
||||
},
|
||||
"./dist/eslint-visitor-keys.cjs"
|
||||
],
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.d.ts",
|
||||
"dist/visitor-keys.d.ts",
|
||||
"dist/eslint-visitor-keys.cjs",
|
||||
"dist/eslint-visitor-keys.d.cts",
|
||||
"lib"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/estree": "^0.0.51",
|
||||
"@types/estree-jsx": "^0.0.1",
|
||||
"@typescript-eslint/parser": "^5.14.0",
|
||||
"c8": "^7.11.0",
|
||||
"chai": "^4.3.6",
|
||||
"eslint": "^7.29.0",
|
||||
"eslint-config-eslint": "^7.0.0",
|
||||
"eslint-plugin-jsdoc": "^35.4.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-release": "^3.2.0",
|
||||
"esquery": "^1.4.0",
|
||||
"json-diff": "^0.7.3",
|
||||
"mocha": "^9.2.1",
|
||||
"opener": "^1.5.2",
|
||||
"rollup": "^2.70.0",
|
||||
"rollup-plugin-dts": "^4.2.3",
|
||||
"tsd": "^0.19.1",
|
||||
"typescript": "^4.6.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:cjs && npm run build:types",
|
||||
"build:cjs": "rollup -c",
|
||||
"build:debug": "npm run build:cjs -- -m && npm run build:types",
|
||||
"build:keys": "node tools/build-keys-from-ts",
|
||||
"build:types": "tsc",
|
||||
"lint": "eslint .",
|
||||
"prepare": "npm run build",
|
||||
"release:generate:latest": "eslint-generate-release",
|
||||
"release:generate:alpha": "eslint-generate-prerelease alpha",
|
||||
"release:generate:beta": "eslint-generate-prerelease beta",
|
||||
"release:generate:rc": "eslint-generate-prerelease rc",
|
||||
"release:publish": "eslint-publish-release",
|
||||
"test": "mocha tests/lib/**/*.cjs && c8 mocha tests/lib/**/*.js && npm run test:types",
|
||||
"test:open-coverage": "c8 report --reporter lcov && opener coverage/lcov-report/index.html",
|
||||
"test:types": "tsd"
|
||||
},
|
||||
"repository": "eslint/eslint-visitor-keys",
|
||||
"funding": "https://opencollective.com/eslint",
|
||||
"keywords": [],
|
||||
"author": "Toru Nagashima (https://github.com/mysticatea)",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/eslint-visitor-keys/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/eslint-visitor-keys#readme"
|
||||
}
|
||||
80
node_modules/@eslint-community/eslint-utils/package.json
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "@eslint-community/eslint-utils",
|
||||
"version": "4.4.1",
|
||||
"description": "Utilities for ESLint plugins.",
|
||||
"keywords": [
|
||||
"eslint"
|
||||
],
|
||||
"homepage": "https://github.com/eslint-community/eslint-utils#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint-community/eslint-utils/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/eslint-community/eslint-utils"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Toru Nagashima",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./index.mjs",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "index",
|
||||
"module": "index.mjs",
|
||||
"files": [
|
||||
"index.*"
|
||||
],
|
||||
"scripts": {
|
||||
"prebuild": "npm run -s clean",
|
||||
"build": "rollup -c",
|
||||
"clean": "rimraf .nyc_output coverage index.*",
|
||||
"coverage": "opener ./coverage/lcov-report/index.html",
|
||||
"docs:build": "vitepress build docs",
|
||||
"docs:watch": "vitepress dev docs",
|
||||
"format": "npm run -s format:prettier -- --write",
|
||||
"format:prettier": "prettier .",
|
||||
"format:check": "npm run -s format:prettier -- --check",
|
||||
"lint:eslint": "eslint .",
|
||||
"lint:format": "npm run -s format:check",
|
||||
"lint:installed-check": "installed-check -v -i installed-check -i npm-run-all2 -i knip",
|
||||
"lint:knip": "knip",
|
||||
"lint": "run-p lint:*",
|
||||
"test": "c8 mocha --reporter dot \"test/*.mjs\"",
|
||||
"preversion": "npm test && npm run -s build",
|
||||
"postversion": "git push && git push --tags",
|
||||
"prewatch": "npm run -s clean",
|
||||
"watch": "warun \"{src,test}/**/*.mjs\" -- npm run -s test:mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"eslint-visitor-keys": "^3.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-mysticatea": "^15.6.1",
|
||||
"c8": "^8.0.1",
|
||||
"dot-prop": "^7.2.0",
|
||||
"eslint": "^8.57.1",
|
||||
"installed-check": "^8.0.1",
|
||||
"knip": "^5.33.3",
|
||||
"mocha": "^9.2.2",
|
||||
"npm-run-all2": "^6.2.3",
|
||||
"opener": "^1.5.2",
|
||||
"prettier": "2.8.8",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.79.2",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"semver": "^7.6.3",
|
||||
"vitepress": "^1.4.1",
|
||||
"warun": "^1.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": "https://opencollective.com/eslint"
|
||||
}
|
||||
21
node_modules/@eslint-community/regexpp/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Toru Nagashima
|
||||
|
||||
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.
|
||||
177
node_modules/@eslint-community/regexpp/README.md
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
# @eslint-community/regexpp
|
||||
|
||||
[](https://www.npmjs.com/package/@eslint-community/regexpp)
|
||||
[](http://www.npmtrends.com/@eslint-community/regexpp)
|
||||
[](https://github.com/eslint-community/regexpp/actions)
|
||||
[](https://codecov.io/gh/eslint-community/regexpp)
|
||||
|
||||
A regular expression parser for ECMAScript.
|
||||
|
||||
## 💿 Installation
|
||||
|
||||
```bash
|
||||
$ npm install @eslint-community/regexpp
|
||||
```
|
||||
|
||||
- require Node@^12.0.0 || ^14.0.0 || >=16.0.0.
|
||||
|
||||
## 📖 Usage
|
||||
|
||||
```ts
|
||||
import {
|
||||
AST,
|
||||
RegExpParser,
|
||||
RegExpValidator,
|
||||
RegExpVisitor,
|
||||
parseRegExpLiteral,
|
||||
validateRegExpLiteral,
|
||||
visitRegExpAST
|
||||
} from "@eslint-community/regexpp"
|
||||
```
|
||||
|
||||
### parseRegExpLiteral(source, options?)
|
||||
|
||||
Parse a given regular expression literal then make AST object.
|
||||
|
||||
This is equivalent to `new RegExpParser(options).parseLiteral(source)`.
|
||||
|
||||
- **Parameters:**
|
||||
- `source` (`string | RegExp`) The source code to parse.
|
||||
- `options?` ([`RegExpParser.Options`]) The options to parse.
|
||||
- **Return:**
|
||||
- The AST of the regular expression.
|
||||
|
||||
### validateRegExpLiteral(source, options?)
|
||||
|
||||
Validate a given regular expression literal.
|
||||
|
||||
This is equivalent to `new RegExpValidator(options).validateLiteral(source)`.
|
||||
|
||||
- **Parameters:**
|
||||
- `source` (`string`) The source code to validate.
|
||||
- `options?` ([`RegExpValidator.Options`]) The options to validate.
|
||||
|
||||
### visitRegExpAST(ast, handlers)
|
||||
|
||||
Visit each node of a given AST.
|
||||
|
||||
This is equivalent to `new RegExpVisitor(handlers).visit(ast)`.
|
||||
|
||||
- **Parameters:**
|
||||
- `ast` ([`AST.Node`]) The AST to visit.
|
||||
- `handlers` ([`RegExpVisitor.Handlers`]) The callbacks.
|
||||
|
||||
### RegExpParser
|
||||
|
||||
#### new RegExpParser(options?)
|
||||
|
||||
- **Parameters:**
|
||||
- `options?` ([`RegExpParser.Options`]) The options to parse.
|
||||
|
||||
#### parser.parseLiteral(source, start?, end?)
|
||||
|
||||
Parse a regular expression literal.
|
||||
|
||||
- **Parameters:**
|
||||
- `source` (`string`) The source code to parse. E.g. `"/abc/g"`.
|
||||
- `start?` (`number`) The start index in the source code. Default is `0`.
|
||||
- `end?` (`number`) The end index in the source code. Default is `source.length`.
|
||||
- **Return:**
|
||||
- The AST of the regular expression.
|
||||
|
||||
#### parser.parsePattern(source, start?, end?, flags?)
|
||||
|
||||
Parse a regular expression pattern.
|
||||
|
||||
- **Parameters:**
|
||||
- `source` (`string`) The source code to parse. E.g. `"abc"`.
|
||||
- `start?` (`number`) The start index in the source code. Default is `0`.
|
||||
- `end?` (`number`) The end index in the source code. Default is `source.length`.
|
||||
- `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode.
|
||||
- **Return:**
|
||||
- The AST of the regular expression pattern.
|
||||
|
||||
#### parser.parseFlags(source, start?, end?)
|
||||
|
||||
Parse a regular expression flags.
|
||||
|
||||
- **Parameters:**
|
||||
- `source` (`string`) The source code to parse. E.g. `"gim"`.
|
||||
- `start?` (`number`) The start index in the source code. Default is `0`.
|
||||
- `end?` (`number`) The end index in the source code. Default is `source.length`.
|
||||
- **Return:**
|
||||
- The AST of the regular expression flags.
|
||||
|
||||
### RegExpValidator
|
||||
|
||||
#### new RegExpValidator(options)
|
||||
|
||||
- **Parameters:**
|
||||
- `options` ([`RegExpValidator.Options`]) The options to validate.
|
||||
|
||||
#### validator.validateLiteral(source, start, end)
|
||||
|
||||
Validate a regular expression literal.
|
||||
|
||||
- **Parameters:**
|
||||
- `source` (`string`) The source code to validate.
|
||||
- `start?` (`number`) The start index in the source code. Default is `0`.
|
||||
- `end?` (`number`) The end index in the source code. Default is `source.length`.
|
||||
|
||||
#### validator.validatePattern(source, start, end, flags)
|
||||
|
||||
Validate a regular expression pattern.
|
||||
|
||||
- **Parameters:**
|
||||
- `source` (`string`) The source code to validate.
|
||||
- `start?` (`number`) The start index in the source code. Default is `0`.
|
||||
- `end?` (`number`) The end index in the source code. Default is `source.length`.
|
||||
- `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode.
|
||||
|
||||
#### validator.validateFlags(source, start, end)
|
||||
|
||||
Validate a regular expression flags.
|
||||
|
||||
- **Parameters:**
|
||||
- `source` (`string`) The source code to validate.
|
||||
- `start?` (`number`) The start index in the source code. Default is `0`.
|
||||
- `end?` (`number`) The end index in the source code. Default is `source.length`.
|
||||
|
||||
### RegExpVisitor
|
||||
|
||||
#### new RegExpVisitor(handlers)
|
||||
|
||||
- **Parameters:**
|
||||
- `handlers` ([`RegExpVisitor.Handlers`]) The callbacks.
|
||||
|
||||
#### visitor.visit(ast)
|
||||
|
||||
Validate a regular expression literal.
|
||||
|
||||
- **Parameters:**
|
||||
- `ast` ([`AST.Node`]) The AST to visit.
|
||||
|
||||
## 📰 Changelog
|
||||
|
||||
- [GitHub Releases](https://github.com/eslint-community/regexpp/releases)
|
||||
|
||||
## 🍻 Contributing
|
||||
|
||||
Welcome contributing!
|
||||
|
||||
Please use GitHub's Issues/PRs.
|
||||
|
||||
### Development Tools
|
||||
|
||||
- `npm test` runs tests and measures coverage.
|
||||
- `npm run build` compiles TypeScript source code to `index.js`, `index.js.map`, and `index.d.ts`.
|
||||
- `npm run clean` removes the temporary files which are created by `npm test` and `npm run build`.
|
||||
- `npm run lint` runs ESLint.
|
||||
- `npm run update:test` updates test fixtures.
|
||||
- `npm run update:ids` updates `src/unicode/ids.ts`.
|
||||
- `npm run watch` runs tests with `--watch` option.
|
||||
|
||||
[`AST.Node`]: src/ast.ts#L4
|
||||
[`RegExpParser.Options`]: src/parser.ts#L743
|
||||
[`RegExpValidator.Options`]: src/validator.ts#L220
|
||||
[`RegExpVisitor.Handlers`]: src/visitor.ts#L291
|
||||
1163
node_modules/@eslint-community/regexpp/index.d.ts
generated
vendored
Normal file
3037
node_modules/@eslint-community/regexpp/index.js
generated
vendored
Normal file
1
node_modules/@eslint-community/regexpp/index.js.map
generated
vendored
Normal file
3027
node_modules/@eslint-community/regexpp/index.mjs
generated
vendored
Normal file
1
node_modules/@eslint-community/regexpp/index.mjs.map
generated
vendored
Normal file
91
node_modules/@eslint-community/regexpp/package.json
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"name": "@eslint-community/regexpp",
|
||||
"version": "4.12.1",
|
||||
"description": "Regular expression parser for ECMAScript.",
|
||||
"keywords": [
|
||||
"regexp",
|
||||
"regular",
|
||||
"expression",
|
||||
"parser",
|
||||
"validator",
|
||||
"ast",
|
||||
"abstract",
|
||||
"syntax",
|
||||
"tree",
|
||||
"ecmascript",
|
||||
"es2015",
|
||||
"es2016",
|
||||
"es2017",
|
||||
"es2018",
|
||||
"es2019",
|
||||
"es2020",
|
||||
"es2021",
|
||||
"annexB"
|
||||
],
|
||||
"homepage": "https://github.com/eslint-community/regexpp#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint-community/regexpp/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/eslint-community/regexpp"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Toru Nagashima",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.mjs",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "index",
|
||||
"files": [
|
||||
"index.*"
|
||||
],
|
||||
"scripts": {
|
||||
"prebuild": "npm run -s clean",
|
||||
"build": "run-s build:*",
|
||||
"build:tsc": "tsc --module es2015",
|
||||
"build:rollup": "rollup -c",
|
||||
"build:dts": "npm run -s build:tsc -- --removeComments false && dts-bundle --name @eslint-community/regexpp --main .temp/index.d.ts --out ../index.d.ts && prettier --write index.d.ts",
|
||||
"clean": "rimraf .temp index.*",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"test": "nyc _mocha \"test/*.ts\" --reporter dot --timeout 10000",
|
||||
"debug": "mocha --require ts-node/register/transpile-only \"test/*.ts\" --reporter dot --timeout 10000",
|
||||
"update:test": "ts-node scripts/update-fixtures.ts",
|
||||
"update:unicode": "run-s update:unicode:*",
|
||||
"update:unicode:ids": "ts-node scripts/update-unicode-ids.ts",
|
||||
"update:unicode:props": "ts-node scripts/update-unicode-properties.ts",
|
||||
"update:test262:extract": "ts-node -T scripts/extract-test262.ts",
|
||||
"preversion": "npm test && npm run -s build",
|
||||
"postversion": "git push && git push --tags",
|
||||
"prewatch": "npm run -s clean",
|
||||
"watch": "_mocha \"test/*.ts\" --require ts-node/register --reporter dot --timeout 10000 --watch-extensions ts --watch --growl"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-mysticatea": "^15.5.1",
|
||||
"@rollup/plugin-node-resolve": "^14.1.0",
|
||||
"@types/eslint": "^8.44.3",
|
||||
"@types/jsdom": "^16.2.15",
|
||||
"@types/mocha": "^9.1.1",
|
||||
"@types/node": "^12.20.55",
|
||||
"dts-bundle": "^0.7.3",
|
||||
"eslint": "^8.50.0",
|
||||
"js-tokens": "^8.0.2",
|
||||
"jsdom": "^19.0.0",
|
||||
"mocha": "^9.2.2",
|
||||
"npm-run-all2": "^6.2.2",
|
||||
"nyc": "^14.1.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.79.1",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "~5.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
|
||||
}
|
||||
}
|
||||
201
node_modules/@eslint/config-array/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
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.
|
||||
358
node_modules/@eslint/config-array/README.md
generated
vendored
Normal file
@@ -0,0 +1,358 @@
|
||||
# Config Array
|
||||
|
||||
## Description
|
||||
|
||||
A config array is a way of managing configurations that are based on glob pattern matching of filenames. Each config array contains the information needed to determine the correct configuration for any file based on the filename.
|
||||
|
||||
**Note:** This is a generic package that can be used outside of ESLint. It contains no ESLint-specific functionality.
|
||||
|
||||
## Installation
|
||||
|
||||
For Node.js and compatible runtimes:
|
||||
|
||||
```shell
|
||||
npm install @eslint/config-array
|
||||
# or
|
||||
yarn add @eslint/config-array
|
||||
# or
|
||||
pnpm install @eslint/config-array
|
||||
# or
|
||||
bun install @eslint/config-array
|
||||
```
|
||||
|
||||
For Deno:
|
||||
|
||||
```shell
|
||||
deno add @eslint/config-array
|
||||
```
|
||||
|
||||
## Background
|
||||
|
||||
The basic idea is that all configuration, including overrides, can be represented by a single array where each item in the array is a config object. Config objects appearing later in the array override config objects appearing earlier in the array. You can calculate a config for a given file by traversing all config objects in the array to find the ones that match the filename. Matching is done by specifying glob patterns in `files` and `ignores` properties on each config object. Here's an example:
|
||||
|
||||
```js
|
||||
export default [
|
||||
// match all JSON files
|
||||
{
|
||||
name: "JSON Handler",
|
||||
files: ["**/*.json"],
|
||||
handler: jsonHandler,
|
||||
},
|
||||
|
||||
// match only package.json
|
||||
{
|
||||
name: "package.json Handler",
|
||||
files: ["package.json"],
|
||||
handler: packageJsonHandler,
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
In this example, there are two config objects: the first matches all JSON files in all directories and the second matches just `package.json` in the base path directory (all the globs are evaluated as relative to a base path that can be specified). When you retrieve a configuration for `foo.json`, only the first config object matches so `handler` is equal to `jsonHandler`; when you retrieve a configuration for `package.json`, `handler` is equal to `packageJsonHandler` (because both config objects match, the second one wins).
|
||||
|
||||
## Usage
|
||||
|
||||
First, import the `ConfigArray` constructor:
|
||||
|
||||
```js
|
||||
import { ConfigArray } from "@eslint/config-array";
|
||||
|
||||
// or using CommonJS
|
||||
|
||||
const { ConfigArray } = require("@eslint/config-array");
|
||||
```
|
||||
|
||||
When you create a new instance of `ConfigArray`, you must pass in two arguments: an array of configs and an options object. The array of configs is most likely read in from a configuration file, so here's a typical example:
|
||||
|
||||
```js
|
||||
const configFilename = path.resolve(process.cwd(), "my.config.js");
|
||||
const { default: rawConfigs } = await import(configFilename);
|
||||
const configs = new ConfigArray(rawConfigs, {
|
||||
// the path to match filenames from
|
||||
basePath: process.cwd(),
|
||||
|
||||
// additional items in each config
|
||||
schema: mySchema,
|
||||
});
|
||||
```
|
||||
|
||||
This example reads in an object or array from `my.config.js` and passes it into the `ConfigArray` constructor as the first argument. The second argument is an object specifying the `basePath` (the directory in which `my.config.js` is found) and a `schema` to define the additional properties of a config object beyond `files`, `ignores`, and `name`.
|
||||
|
||||
### Specifying a Schema
|
||||
|
||||
The `schema` option is required for you to use additional properties in config objects. The schema is an object that follows the format of an [`ObjectSchema`](https://npmjs.com/package/@eslint/object-schema). The schema specifies both validation and merge rules that the `ConfigArray` instance needs to combine configs when there are multiple matches. Here's an example:
|
||||
|
||||
```js
|
||||
const configFilename = path.resolve(process.cwd(), "my.config.js");
|
||||
const { default: rawConfigs } = await import(configFilename);
|
||||
|
||||
const mySchema = {
|
||||
|
||||
// define the handler key in configs
|
||||
handler: {
|
||||
required: true,
|
||||
merge(a, b) {
|
||||
if (!b) return a;
|
||||
if (!a) return b;
|
||||
},
|
||||
validate(value) {
|
||||
if (typeof value !== "function") {
|
||||
throw new TypeError("Function expected.");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const configs = new ConfigArray(rawConfigs, {
|
||||
|
||||
// the path to match filenames from
|
||||
basePath: process.cwd(),
|
||||
|
||||
// additional item schemas in each config
|
||||
schema: mySchema,
|
||||
|
||||
// additional config types supported (default: [])
|
||||
extraConfigTypes: ["array", "function"];
|
||||
});
|
||||
```
|
||||
|
||||
### Config Arrays
|
||||
|
||||
Config arrays can be multidimensional, so it's possible for a config array to contain another config array when `extraConfigTypes` contains `"array"`, such as:
|
||||
|
||||
```js
|
||||
export default [
|
||||
// JS config
|
||||
{
|
||||
files: ["**/*.js"],
|
||||
handler: jsHandler,
|
||||
},
|
||||
|
||||
// JSON configs
|
||||
[
|
||||
// match all JSON files
|
||||
{
|
||||
name: "JSON Handler",
|
||||
files: ["**/*.json"],
|
||||
handler: jsonHandler,
|
||||
},
|
||||
|
||||
// match only package.json
|
||||
{
|
||||
name: "package.json Handler",
|
||||
files: ["package.json"],
|
||||
handler: packageJsonHandler,
|
||||
},
|
||||
],
|
||||
|
||||
// filename must match function
|
||||
{
|
||||
files: [filePath => filePath.endsWith(".md")],
|
||||
handler: markdownHandler,
|
||||
},
|
||||
|
||||
// filename must match all patterns in subarray
|
||||
{
|
||||
files: [["*.test.*", "*.js"]],
|
||||
handler: jsTestHandler,
|
||||
},
|
||||
|
||||
// filename must not match patterns beginning with !
|
||||
{
|
||||
name: "Non-JS files",
|
||||
files: ["!*.js"],
|
||||
settings: {
|
||||
js: false,
|
||||
},
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
In this example, the array contains both config objects and a config array. When a config array is normalized (see details below), it is flattened so only config objects remain. However, the order of evaluation remains the same.
|
||||
|
||||
If the `files` array contains a function, then that function is called with the path of the file as it was passed in. The function is expected to return `true` if there is a match and `false` if not. (The `ignores` array can also contain functions.)
|
||||
|
||||
If the `files` array contains an item that is an array of strings and functions, then all patterns must match in order for the config to match. In the preceding examples, both `*.test.*` and `*.js` must match in order for the config object to be used.
|
||||
|
||||
If a pattern in the files array begins with `!` then it excludes that pattern. In the preceding example, any filename that doesn't end with `.js` will automatically get a `settings.js` property set to `false`.
|
||||
|
||||
You can also specify an `ignores` key that will force files matching those patterns to not be included. If the `ignores` key is in a config object without any other keys, then those ignores will always be applied; otherwise those ignores act as exclusions. Here's an example:
|
||||
|
||||
```js
|
||||
export default [
|
||||
|
||||
// Always ignored
|
||||
{
|
||||
ignores: ["**/.git/**", "**/node_modules/**"]
|
||||
},
|
||||
|
||||
// .eslintrc.js file is ignored only when .js file matches
|
||||
{
|
||||
files: ["**/*.js"],
|
||||
ignores: [".eslintrc.js"]
|
||||
handler: jsHandler
|
||||
}
|
||||
];
|
||||
```
|
||||
|
||||
You can use negated patterns in `ignores` to exclude a file that was already ignored, such as:
|
||||
|
||||
```js
|
||||
export default [
|
||||
// Ignore all JSON files except tsconfig.json
|
||||
{
|
||||
files: ["**/*"],
|
||||
ignores: ["**/*.json", "!tsconfig.json"],
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
### Config Functions
|
||||
|
||||
Config arrays can also include config functions when `extraConfigTypes` contains `"function"`. A config function accepts a single parameter, `context` (defined by you), and must return either a config object or a config array (it cannot return another function). Config functions allow end users to execute code in the creation of appropriate config objects. Here's an example:
|
||||
|
||||
```js
|
||||
export default [
|
||||
// JS config
|
||||
{
|
||||
files: ["**/*.js"],
|
||||
handler: jsHandler,
|
||||
},
|
||||
|
||||
// JSON configs
|
||||
function (context) {
|
||||
return [
|
||||
// match all JSON files
|
||||
{
|
||||
name: context.name + " JSON Handler",
|
||||
files: ["**/*.json"],
|
||||
handler: jsonHandler,
|
||||
},
|
||||
|
||||
// match only package.json
|
||||
{
|
||||
name: context.name + " package.json Handler",
|
||||
files: ["package.json"],
|
||||
handler: packageJsonHandler,
|
||||
},
|
||||
];
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
When a config array is normalized, each function is executed and replaced in the config array with the return value.
|
||||
|
||||
**Note:** Config functions can also be async.
|
||||
|
||||
### Normalizing Config Arrays
|
||||
|
||||
Once a config array has been created and loaded with all of the raw config data, it must be normalized before it can be used. The normalization process goes through and flattens the config array as well as executing all config functions to get their final values.
|
||||
|
||||
To normalize a config array, call the `normalize()` method and pass in a context object:
|
||||
|
||||
```js
|
||||
await configs.normalize({
|
||||
name: "MyApp",
|
||||
});
|
||||
```
|
||||
|
||||
The `normalize()` method returns a promise, so be sure to use the `await` operator. The config array instance is normalized in-place, so you don't need to create a new variable.
|
||||
|
||||
If you want to disallow async config functions, you can call `normalizeSync()` instead. This method is completely synchronous and does not require using the `await` operator as it does not return a promise:
|
||||
|
||||
```js
|
||||
await configs.normalizeSync({
|
||||
name: "MyApp",
|
||||
});
|
||||
```
|
||||
|
||||
**Important:** Once a `ConfigArray` is normalized, it cannot be changed further. You can, however, create a new `ConfigArray` and pass in the normalized instance to create an unnormalized copy.
|
||||
|
||||
### Getting Config for a File
|
||||
|
||||
To get the config for a file, use the `getConfig()` method on a normalized config array and pass in the filename to get a config for:
|
||||
|
||||
```js
|
||||
// pass in filename
|
||||
const fileConfig = configs.getConfig(
|
||||
path.resolve(process.cwd(), "package.json"),
|
||||
);
|
||||
```
|
||||
|
||||
The config array always returns an object, even if there are no configs matching the given filename. You can then inspect the returned config object to determine how to proceed.
|
||||
|
||||
A few things to keep in mind:
|
||||
|
||||
- If a filename is not an absolute path, it will be resolved relative to the base path directory.
|
||||
- The returned config object never has `files`, `ignores`, or `name` properties; the only properties on the object will be the other configuration options specified.
|
||||
- The config array caches configs, so subsequent calls to `getConfig()` with the same filename will return in a fast lookup rather than another calculation.
|
||||
- A config will only be generated if the filename matches an entry in a `files` key. A config will not be generated without matching a `files` key (configs without a `files` key are only applied when another config with a `files` key is applied; configs without `files` are never applied on their own). Any config with a `files` key entry that is `*` or ends with `/**` or `/*` will only be applied if another entry in the same `files` key matches or another config matches.
|
||||
|
||||
## Determining Ignored Paths
|
||||
|
||||
You can determine if a file is ignored by using the `isFileIgnored()` method and passing in the path of any file, as in this example:
|
||||
|
||||
```js
|
||||
const ignored = configs.isFileIgnored("/foo/bar/baz.txt");
|
||||
```
|
||||
|
||||
A file is considered ignored if any of the following is true:
|
||||
|
||||
- **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/a.js` is considered ignored.
|
||||
- **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/baz/a.js` is considered ignored.
|
||||
- **It matches an ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
|
||||
- **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
|
||||
- **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored.
|
||||
|
||||
For directories, use the `isDirectoryIgnored()` method and pass in the path of any directory, as in this example:
|
||||
|
||||
```js
|
||||
const ignored = configs.isDirectoryIgnored("/foo/bar/");
|
||||
```
|
||||
|
||||
A directory is considered ignored if any of the following is true:
|
||||
|
||||
- **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/baz` is considered ignored.
|
||||
- **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/bar/baz/a.js` is considered ignored.
|
||||
- **It matches and ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
|
||||
- **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
|
||||
- **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored.
|
||||
|
||||
**Important:** A pattern such as `foo/**` means that `foo` and `foo/` are _not_ ignored whereas `foo/bar` is ignored. If you want to ignore `foo` and all of its subdirectories, use the pattern `foo` or `foo/` in `ignores`.
|
||||
|
||||
## Caching Mechanisms
|
||||
|
||||
Each `ConfigArray` aggressively caches configuration objects to avoid unnecessary work. This caching occurs in two ways:
|
||||
|
||||
1. **File-based Caching.** For each filename that is passed into a method, the resulting config is cached against that filename so you're always guaranteed to get the same object returned from `getConfig()` whenever you pass the same filename in.
|
||||
2. **Index-based Caching.** Whenever a config is calculated, the config elements that were used to create the config are also cached. So if a given filename matches elements 1, 5, and 7, the resulting config is cached with a key of `1,5,7`. That way, if another file is passed that matches the same config elements, the result is already known and doesn't have to be recalculated. That means two files that match all the same elements will return the same config from `getConfig()`.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
The design of this project was influenced by feedback on the ESLint RFC, and incorporates ideas from:
|
||||
|
||||
- Teddy Katz (@not-an-aardvark)
|
||||
- Toru Nagashima (@mysticatea)
|
||||
- Kai Cataldo (@kaicataldo)
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
|
||||
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
||||
<!--sponsorsstart-->
|
||||
|
||||
## Sponsors
|
||||
|
||||
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
|
||||
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
||||
|
||||
<h3>Platinum Sponsors</h3>
|
||||
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p>
|
||||
<h3>Technology Sponsors</h3>
|
||||
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
|
||||
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
||||
1304
node_modules/@eslint/config-array/dist/cjs/index.cjs
generated
vendored
Normal file
141
node_modules/@eslint/config-array/dist/cjs/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
export { ObjectSchema } from "@eslint/object-schema";
|
||||
export type PropertyDefinition = import("@eslint/object-schema").PropertyDefinition;
|
||||
export type ObjectDefinition = import("@eslint/object-schema").ObjectDefinition;
|
||||
export type ConfigObject = import("./types.ts").ConfigObject;
|
||||
export type IMinimatchStatic = import("minimatch").IMinimatchStatic;
|
||||
export type IMinimatch = import("minimatch").IMinimatch;
|
||||
export type PathImpl = typeof import("@jsr/std__path");
|
||||
export type ObjectSchemaInstance = import("@eslint/object-schema").ObjectSchema;
|
||||
/**
|
||||
* Represents an array of config objects and provides method for working with
|
||||
* those config objects.
|
||||
*/
|
||||
export class ConfigArray extends Array<any> {
|
||||
/**
|
||||
* Creates a new instance of ConfigArray.
|
||||
* @param {Iterable|Function|Object} configs An iterable yielding config
|
||||
* objects, or a config function, or a config object.
|
||||
* @param {Object} options The options for the ConfigArray.
|
||||
* @param {string} [options.basePath="/"] The absolute path of the config file directory.
|
||||
* Defaults to `"/"`.
|
||||
* @param {boolean} [options.normalized=false] Flag indicating if the
|
||||
* configs have already been normalized.
|
||||
* @param {Object} [options.schema] The additional schema
|
||||
* definitions to use for the ConfigArray schema.
|
||||
* @param {Array<string>} [options.extraConfigTypes] List of config types supported.
|
||||
*/
|
||||
constructor(configs: Iterable<any> | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: {
|
||||
basePath?: string;
|
||||
normalized?: boolean;
|
||||
schema?: any;
|
||||
extraConfigTypes?: Array<string>;
|
||||
});
|
||||
/**
|
||||
* The path of the config file that this array was loaded from.
|
||||
* This is used to calculate filename matches.
|
||||
* @property basePath
|
||||
* @type {string}
|
||||
*/
|
||||
basePath: string;
|
||||
/**
|
||||
* The supported config types.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
extraConfigTypes: Array<string>;
|
||||
/**
|
||||
* Returns the `files` globs from every config object in the array.
|
||||
* This can be used to determine which files will be matched by a
|
||||
* config array or to use as a glob pattern when no patterns are provided
|
||||
* for a command line interface.
|
||||
* @returns {Array<string|Function>} An array of matchers.
|
||||
*/
|
||||
get files(): (string | Function)[];
|
||||
/**
|
||||
* Returns ignore matchers that should always be ignored regardless of
|
||||
* the matching `files` fields in any configs. This is necessary to mimic
|
||||
* the behavior of things like .gitignore and .eslintignore, allowing a
|
||||
* globbing operation to be faster.
|
||||
* @returns {string[]} An array of string patterns and functions to be ignored.
|
||||
*/
|
||||
get ignores(): string[];
|
||||
/**
|
||||
* Indicates if the config array has been normalized.
|
||||
* @returns {boolean} True if the config array is normalized, false if not.
|
||||
*/
|
||||
isNormalized(): boolean;
|
||||
/**
|
||||
* Normalizes a config array by flattening embedded arrays and executing
|
||||
* config functions.
|
||||
* @param {Object} [context] The context object for config functions.
|
||||
* @returns {Promise<ConfigArray>} The current ConfigArray instance.
|
||||
*/
|
||||
normalize(context?: any): Promise<ConfigArray>;
|
||||
/**
|
||||
* Normalizes a config array by flattening embedded arrays and executing
|
||||
* config functions.
|
||||
* @param {Object} [context] The context object for config functions.
|
||||
* @returns {ConfigArray} The current ConfigArray instance.
|
||||
*/
|
||||
normalizeSync(context?: any): ConfigArray;
|
||||
/**
|
||||
* Returns the config object for a given file path and a status that can be used to determine why a file has no config.
|
||||
* @param {string} filePath The path of a file to get a config for.
|
||||
* @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }}
|
||||
* An object with an optional property `config` and property `status`.
|
||||
* `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig},
|
||||
* `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}.
|
||||
*/
|
||||
getConfigWithStatus(filePath: string): {
|
||||
config?: any;
|
||||
status: "ignored" | "external" | "unconfigured" | "matched";
|
||||
};
|
||||
/**
|
||||
* Returns the config object for a given file path.
|
||||
* @param {string} filePath The path of a file to get a config for.
|
||||
* @returns {Object|undefined} The config object for this file or `undefined`.
|
||||
*/
|
||||
getConfig(filePath: string): any | undefined;
|
||||
/**
|
||||
* Determines whether a file has a config or why it doesn't.
|
||||
* @param {string} filePath The path of the file to check.
|
||||
* @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values:
|
||||
* * `"ignored"`: the file is ignored
|
||||
* * `"external"`: the file is outside the base path
|
||||
* * `"unconfigured"`: the file is not matched by any config
|
||||
* * `"matched"`: the file has a matching config
|
||||
*/
|
||||
getConfigStatus(filePath: string): "ignored" | "external" | "unconfigured" | "matched";
|
||||
/**
|
||||
* Determines if the given filepath is ignored based on the configs.
|
||||
* @param {string} filePath The path of a file to check.
|
||||
* @returns {boolean} True if the path is ignored, false if not.
|
||||
* @deprecated Use `isFileIgnored` instead.
|
||||
*/
|
||||
isIgnored(filePath: string): boolean;
|
||||
/**
|
||||
* Determines if the given filepath is ignored based on the configs.
|
||||
* @param {string} filePath The path of a file to check.
|
||||
* @returns {boolean} True if the path is ignored, false if not.
|
||||
*/
|
||||
isFileIgnored(filePath: string): boolean;
|
||||
/**
|
||||
* Determines if the given directory is ignored based on the configs.
|
||||
* This checks only default `ignores` that don't have `files` in the
|
||||
* same config. A pattern such as `/foo` be considered to ignore the directory
|
||||
* while a pattern such as `/foo/**` is not considered to ignore the
|
||||
* directory because it is matching files.
|
||||
* @param {string} directoryPath The path of a directory to check.
|
||||
* @returns {boolean} True if the directory is ignored, false if not. Will
|
||||
* return true for any directory that is not inside of `basePath`.
|
||||
* @throws {Error} When the `ConfigArray` is not normalized.
|
||||
*/
|
||||
isDirectoryIgnored(directoryPath: string): boolean;
|
||||
#private;
|
||||
}
|
||||
export namespace ConfigArraySymbol {
|
||||
let isNormalized: symbol;
|
||||
let configCache: symbol;
|
||||
let schema: symbol;
|
||||
let finalizeConfig: symbol;
|
||||
let preprocessConfig: symbol;
|
||||
}
|
||||