Added Dockerfile and CI/CD for Imapsync
Added Core Functionality for Imapsync
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
.idea
|
||||
/test/csvparser/data.csv
|
||||
/test/imaps/.env
|
||||
|
||||
@@ -17,6 +17,19 @@ build-web:
|
||||
- docker build -t $IMAGE_TAG spaces
|
||||
- docker push $IMAGE_TAG
|
||||
|
||||
build-imapsync:
|
||||
stage: build
|
||||
tags:
|
||||
- shell
|
||||
- docker-daemon
|
||||
variables:
|
||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-IMAPSYNC
|
||||
script:
|
||||
- echo $IMAGE_TAG
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
- docker build -t $IMAGE_TAG tools/imapsync
|
||||
- docker push $IMAGE_TAG
|
||||
|
||||
#build-backend:
|
||||
# stage: build
|
||||
# tags:
|
||||
|
||||
@@ -5,7 +5,8 @@ export default defineNuxtConfig({
|
||||
'@pinia/nuxt',
|
||||
'@nuxt/ui',
|
||||
'@nuxtjs/strapi',
|
||||
'@nuxtjs/supabase'
|
||||
'@nuxtjs/supabase',
|
||||
"nuxt-editorjs"
|
||||
],
|
||||
routeRules: {
|
||||
'/printing': {ssr:false}
|
||||
@@ -14,7 +15,12 @@ export default defineNuxtConfig({
|
||||
supabase: {
|
||||
key: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV3cHB2Y3hmbHJjc2lidXpzYmlsIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDA5MzgxOTQsImV4cCI6MjAxNjUxNDE5NH0.CkxYSQH0uLfwx9GVUlO6AYMU2FMLAxGMrwEKvyPv7Oo",
|
||||
url: "https://uwppvcxflrcsibuzsbil.supabase.co"
|
||||
}
|
||||
},
|
||||
vite: {
|
||||
optimizeDeps: {
|
||||
include: ["@editorjs/editorjs"],
|
||||
},
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
|
||||
87
spaces/package-lock.json
generated
87
spaces/package-lock.json
generated
@@ -18,6 +18,7 @@
|
||||
"csv-parser": "^3.0.0",
|
||||
"jsprintmanager": "^6.0.3",
|
||||
"neat-csv": "^7.0.0",
|
||||
"nuxt-editorjs": "^1.0.4",
|
||||
"papaparse": "^5.4.1",
|
||||
"pinia": "^2.1.7",
|
||||
"uuidv4": "^6.2.13",
|
||||
@@ -794,6 +795,11 @@
|
||||
"mime": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codexteam/icons": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.0.5.tgz",
|
||||
"integrity": "sha512-s6H2KXhLz2rgbMZSkRm8dsMJvyUNZsEjxobBEg9ztdrb1B2H3pEzY6iTwI4XUPJWJ3c3qRKwV4TrO3J5jUdoQA=="
|
||||
},
|
||||
"node_modules/@css-render/plugin-bem": {
|
||||
"version": "0.15.12",
|
||||
"resolved": "https://registry.npmjs.org/@css-render/plugin-bem/-/plugin-bem-0.15.12.tgz",
|
||||
@@ -892,6 +898,32 @@
|
||||
"postcss-selector-parser": "^6.0.13"
|
||||
}
|
||||
},
|
||||
"node_modules/@editorjs/editorjs": {
|
||||
"version": "2.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/editorjs/-/editorjs-2.28.2.tgz",
|
||||
"integrity": "sha512-g6V0Nd3W9IIWMpvxDNTssQ6e4kxBp1Y0W4GIf8cXRlmcBp3TUjrgCYJQmNy3l2a6ZzhyBAoVSe8krJEq4g7PQw=="
|
||||
},
|
||||
"node_modules/@editorjs/header": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/header/-/header-2.8.1.tgz",
|
||||
"integrity": "sha512-y0HVXRP7m2W617CWo3fsb5HhXmSLaRpb9GzFx0Vkp/HEm9Dz5YO1s8tC7R8JD3MskwoYh7V0hRFQt39io/r6hA==",
|
||||
"dependencies": {
|
||||
"@codexteam/icons": "^0.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@editorjs/list": {
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/list/-/list-1.9.0.tgz",
|
||||
"integrity": "sha512-BQEvZW4vi0O0dBvGNljiKxiE89vMSHoM2Tu2OzKUndoj7pY9AxqpgCh1qvwIVsJAlG4Lbt/vBFQilnoStMmI6A==",
|
||||
"dependencies": {
|
||||
"@codexteam/icons": "^0.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@editorjs/list/node_modules/@codexteam/icons": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.0.4.tgz",
|
||||
"integrity": "sha512-V8N/TY2TGyas4wLrPIFq7bcow68b3gu8DfDt1+rrHPtXxcexadKauRJL6eQgfG7Z0LCrN4boLRawR4S9gjIh/Q=="
|
||||
},
|
||||
"node_modules/@egoist/tailwindcss-icons": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@egoist/tailwindcss-icons/-/tailwindcss-icons-1.4.0.tgz",
|
||||
@@ -8936,6 +8968,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/nuxt-editorjs": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/nuxt-editorjs/-/nuxt-editorjs-1.0.4.tgz",
|
||||
"integrity": "sha512-ibINkIDIuwq0MaP0WjICAWEOsM/5AqZ4na7w/ui6atPo9t5FWwUaWQqrz3hcMie96YzI2gmYqaYdDREAu0A27Q==",
|
||||
"dependencies": {
|
||||
"@editorjs/editorjs": "^2.25.0",
|
||||
"@editorjs/header": "^2.6.2",
|
||||
"@editorjs/list": "^1.7.0",
|
||||
"@nuxt/kit": "^3.0.0-rc.4"
|
||||
}
|
||||
},
|
||||
"node_modules/nuxt/node_modules/acorn": {
|
||||
"version": "8.10.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
|
||||
@@ -14235,6 +14278,11 @@
|
||||
"mime": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"@codexteam/icons": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.0.5.tgz",
|
||||
"integrity": "sha512-s6H2KXhLz2rgbMZSkRm8dsMJvyUNZsEjxobBEg9ztdrb1B2H3pEzY6iTwI4XUPJWJ3c3qRKwV4TrO3J5jUdoQA=="
|
||||
},
|
||||
"@css-render/plugin-bem": {
|
||||
"version": "0.15.12",
|
||||
"resolved": "https://registry.npmjs.org/@css-render/plugin-bem/-/plugin-bem-0.15.12.tgz",
|
||||
@@ -14270,6 +14318,34 @@
|
||||
"integrity": "sha512-hBI9tfBtuPIi885ZsZ32IMEU/5nlZH/KOVYJCOh7gyMxaVLGmLedYqFN6Ui1LXkI8JlC8IsuC0rF0btcRZKd5g==",
|
||||
"requires": {}
|
||||
},
|
||||
"@editorjs/editorjs": {
|
||||
"version": "2.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/editorjs/-/editorjs-2.28.2.tgz",
|
||||
"integrity": "sha512-g6V0Nd3W9IIWMpvxDNTssQ6e4kxBp1Y0W4GIf8cXRlmcBp3TUjrgCYJQmNy3l2a6ZzhyBAoVSe8krJEq4g7PQw=="
|
||||
},
|
||||
"@editorjs/header": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/header/-/header-2.8.1.tgz",
|
||||
"integrity": "sha512-y0HVXRP7m2W617CWo3fsb5HhXmSLaRpb9GzFx0Vkp/HEm9Dz5YO1s8tC7R8JD3MskwoYh7V0hRFQt39io/r6hA==",
|
||||
"requires": {
|
||||
"@codexteam/icons": "^0.0.5"
|
||||
}
|
||||
},
|
||||
"@editorjs/list": {
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/list/-/list-1.9.0.tgz",
|
||||
"integrity": "sha512-BQEvZW4vi0O0dBvGNljiKxiE89vMSHoM2Tu2OzKUndoj7pY9AxqpgCh1qvwIVsJAlG4Lbt/vBFQilnoStMmI6A==",
|
||||
"requires": {
|
||||
"@codexteam/icons": "^0.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@codexteam/icons": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.0.4.tgz",
|
||||
"integrity": "sha512-V8N/TY2TGyas4wLrPIFq7bcow68b3gu8DfDt1+rrHPtXxcexadKauRJL6eQgfG7Z0LCrN4boLRawR4S9gjIh/Q=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@egoist/tailwindcss-icons": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@egoist/tailwindcss-icons/-/tailwindcss-icons-1.4.0.tgz",
|
||||
@@ -20066,6 +20142,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"nuxt-editorjs": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/nuxt-editorjs/-/nuxt-editorjs-1.0.4.tgz",
|
||||
"integrity": "sha512-ibINkIDIuwq0MaP0WjICAWEOsM/5AqZ4na7w/ui6atPo9t5FWwUaWQqrz3hcMie96YzI2gmYqaYdDREAu0A27Q==",
|
||||
"requires": {
|
||||
"@editorjs/editorjs": "^2.25.0",
|
||||
"@editorjs/header": "^2.6.2",
|
||||
"@editorjs/list": "^1.7.0",
|
||||
"@nuxt/kit": "^3.0.0-rc.4"
|
||||
}
|
||||
},
|
||||
"nypm": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/nypm/-/nypm-0.3.3.tgz",
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"csv-parser": "^3.0.0",
|
||||
"jsprintmanager": "^6.0.3",
|
||||
"neat-csv": "^7.0.0",
|
||||
"nuxt-editorjs": "^1.0.4",
|
||||
"papaparse": "^5.4.1",
|
||||
"pinia": "^2.1.7",
|
||||
"uuidv4": "^6.2.13",
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
import * as JSPM from 'jsprintmanager'
|
||||
|
||||
let printers = []
|
||||
let scanners = []
|
||||
|
||||
const doScanning = () => {
|
||||
|
||||
}
|
||||
|
||||
const doPrintZPL = () => {
|
||||
/*if(this.selected_printer === '' && !this.print2default) {
|
||||
@@ -44,6 +48,18 @@ const getPrinters = () => {
|
||||
} else { console.warn("JSPM WS not open"); ok(printers); }
|
||||
});
|
||||
}
|
||||
const getScanners = () => {
|
||||
return new Promise((ok, err) => {
|
||||
let scanners = [];
|
||||
if(JSPM.JSPrintManager.websocket_status === JSPM.WSStatus.Open) {
|
||||
JSPM.JSPrintManager.getScanners().then(function (myScanners) {
|
||||
printers = myScanners;
|
||||
console.log(scanners);
|
||||
ok(scanners);
|
||||
}).catch((e)=>err(e));
|
||||
} else { console.warn("JSPM WS not open"); ok(printers); }
|
||||
});
|
||||
}
|
||||
const initJSPM = () => {
|
||||
JSPM.JSPrintManager.auto_reconnect = true
|
||||
JSPM.JSPrintManager.start();
|
||||
@@ -51,6 +67,8 @@ const initJSPM = () => {
|
||||
JSPM.JSPrintManager.WS.onStatusChanged = () => {
|
||||
console.log("Status Changed")
|
||||
getPrinters().then(p => printers = p)
|
||||
getScanners().then(s => scanners = s)
|
||||
|
||||
}
|
||||
}
|
||||
initJSPM()
|
||||
@@ -58,6 +76,7 @@ initJSPM()
|
||||
|
||||
<template>
|
||||
{{printers}}
|
||||
{{scanners}}
|
||||
|
||||
|
||||
<UButton @click="doPrintZPL">Print</UButton>
|
||||
|
||||
@@ -3,9 +3,9 @@ definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const {find, findOne,create, update} = useStrapi4()
|
||||
//const {find, findOne,create, update} = useStrapi4()
|
||||
const route = useRoute()
|
||||
let project = (await findOne('projects',route.params.id)).data
|
||||
//let project = (await findOne('projects',route.params.id)).data
|
||||
const tabItems = [
|
||||
{
|
||||
key: "phases",
|
||||
@@ -13,6 +13,9 @@ const tabItems = [
|
||||
},{
|
||||
key: "forms",
|
||||
label: "Formulare"
|
||||
},{
|
||||
key: "description",
|
||||
label: "Dokumentation"
|
||||
},{
|
||||
key: "timetracking",
|
||||
label: "Zeiterfassung"
|
||||
@@ -22,8 +25,110 @@ const selectedPhase = ref({})
|
||||
const changesSaved = ref(true)
|
||||
|
||||
|
||||
const default_data = {
|
||||
time: 1660335428612,
|
||||
blocks: [
|
||||
{
|
||||
id: "MnGi61oxdF",
|
||||
type: "header",
|
||||
data: {
|
||||
text: "Welcome to nuxt-editorjs!",
|
||||
level: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "b_Ju7U6wPl",
|
||||
type: "paragraph",
|
||||
data: {
|
||||
text: "This is a nuxt3 plugin for editorjs.",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "R3o5BpI-r9",
|
||||
type: "paragraph",
|
||||
data: {
|
||||
text: "<b>A paragraph of text:</b> Lorem ipsum dolor sit amet consectetur adipisicing elit. Labore perspiciatis molestias neque autem cumque provident? Laudantium ad, quisquam quos nulla amet, perferendis recusandae voluptates eligendi cupiditate consectetur veniam! Ipsum, ullam?",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "b9mkw6ZO92",
|
||||
type: "header",
|
||||
data: {
|
||||
text: "Heading 1",
|
||||
level: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "P2PZsHo2lq",
|
||||
type: "header",
|
||||
data: {
|
||||
text: "Heading 2",
|
||||
level: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "hHJZjkW-TO",
|
||||
type: "header",
|
||||
data: {
|
||||
text: "Heading 3",
|
||||
level: 3,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "k8EDwa0oVG",
|
||||
type: "header",
|
||||
data: {
|
||||
text: "Heading 4",
|
||||
level: 4,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "62ciFnEFjZ",
|
||||
type: "header",
|
||||
data: {
|
||||
text: "Heading 5",
|
||||
level: 5,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "YCBcKhNqib",
|
||||
type: "header",
|
||||
data: {
|
||||
text: "Heading 6",
|
||||
level: 6,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "s_J3d5U8DA",
|
||||
type: "list",
|
||||
data: {
|
||||
style: "ordered",
|
||||
items: [
|
||||
"An ordered list item",
|
||||
"Another ordered list item",
|
||||
"One more",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "kMyQbO156y",
|
||||
type: "list",
|
||||
data: {
|
||||
style: "unordered",
|
||||
items: ["An unordered list item!", "In italics?", "Or bold?"],
|
||||
},
|
||||
},
|
||||
],
|
||||
version: "2.25.0",
|
||||
};
|
||||
const dat = ref(default_data);
|
||||
const save = () => {
|
||||
console.log(foo);
|
||||
};
|
||||
|
||||
|
||||
const updatePhases = async () => {
|
||||
await update('projects', route.params.id, {phases: project.attributes.phases})
|
||||
//await update('projects', route.params.id, {phases: project.attributes.phases})
|
||||
changesSaved.value = true
|
||||
console.log("Updated")
|
||||
}
|
||||
@@ -33,7 +138,7 @@ const phaseInfo = ref({
|
||||
notes: ""
|
||||
})
|
||||
|
||||
const addPhase = async (phaseBefore) => {
|
||||
/*const addPhase = async (phaseBefore) => {
|
||||
|
||||
|
||||
let posBefore = phaseBefore.position
|
||||
@@ -48,7 +153,7 @@ const addPhase = async (phaseBefore) => {
|
||||
|
||||
await updatePhases()
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
</script>
|
||||
@@ -60,7 +165,7 @@ const addPhase = async (phaseBefore) => {
|
||||
<div v-if="item.key === 'phases'" class="space-y-3">
|
||||
<div id="phaseList">
|
||||
<a
|
||||
v-for="phase in project.attributes.phases"
|
||||
v-for="phase in []"
|
||||
@click="selectedPhase = phase"
|
||||
>
|
||||
<div
|
||||
@@ -80,6 +185,9 @@ const addPhase = async (phaseBefore) => {
|
||||
<div v-else-if="item.key === 'password'" class="space-y-3">
|
||||
|
||||
</div>
|
||||
<div v-else-if="item.key === 'description'" class="space-y-3">
|
||||
<client-only><editor-js v-model="dat" /></client-only>
|
||||
</div>
|
||||
</template>
|
||||
</UTabs>
|
||||
<!-- <div id="left">
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,143 +0,0 @@
|
||||
var Imap = require('node-imap'),
|
||||
inspect = require('util').inspect;
|
||||
var fs = require('fs');
|
||||
var base64 = require('base64-stream');
|
||||
const {simpleParser} = require('mailparser');
|
||||
|
||||
var imap = new Imap({
|
||||
user: "info@federspiel.tech",
|
||||
password: "fpGUpbQG34",
|
||||
host: "imap.strato.de", //this may differ if you are using some other mail services like yahoo
|
||||
port: 993,
|
||||
tls: true,
|
||||
connTimeout: 10000, // Default by node-imap
|
||||
authTimeout: 5000, // Default by node-imap,
|
||||
debug: null, // Or your custom function with only one incoming argument. Default: null
|
||||
tlsOptions: { rejectUnauthorized: false },
|
||||
mailbox: "INBOX", // mailbox to monitor
|
||||
searchFilter: ["UNSEEN", "FLAGGED"], // the search filter being used after an IDLE notification has been retrieved
|
||||
markSeen: true, // all fetched email willbe marked as seen and not fetched next time
|
||||
fetchUnreadOnStart: true, // use it only if you want to get all unread email on lib start. Default is `false`,
|
||||
mailParserOptions: { streamAttachments: true }, // options to be passed to mailParser lib.
|
||||
attachments: true, // download attachments as they are encountered to the project directory
|
||||
attachmentOptions: { directory: "attachments/" } // specify a download directory for attachments
|
||||
});
|
||||
|
||||
function openInbox(cb) {
|
||||
imap.openBox('INBOX', false, cb);
|
||||
}
|
||||
|
||||
let email_array = [];
|
||||
|
||||
imap.once('ready', function() {
|
||||
console.log("start open inbox");
|
||||
try{
|
||||
openInbox(function (err, box) {
|
||||
imap.search([ 'UNSEEN', ['SINCE', "1 January 2023"] ], function(err, results) {
|
||||
if(!results || !results.length){
|
||||
console.log("The server didn't find any emails matching the specified criteria")
|
||||
imap.end();return;
|
||||
}
|
||||
|
||||
var f = imap.fetch(results,{ //you can set amount range like '1:2' or 'results' for all results
|
||||
bodies: '',
|
||||
struct: true
|
||||
})
|
||||
|
||||
f.on('message', function(msg, seqno) {
|
||||
console.log('Message #%d', seqno);
|
||||
var prefix = '(#' + seqno + ') ';
|
||||
msg.on('body', function(stream, info) {
|
||||
//Retrieve the 'from' header and buffer the entire body of the newest message:
|
||||
if (info.which === 'TEXT')
|
||||
|
||||
var buffer = '', count = 0;
|
||||
|
||||
stream.on('data', async function(chunk) {
|
||||
count += chunk.length;
|
||||
buffer += chunk.toString('utf8');
|
||||
});
|
||||
|
||||
stream.once('end', async function() {
|
||||
let attach = null
|
||||
//console.log((await simpleParser(buffer))) -> to see entire data of email
|
||||
|
||||
if(((await simpleParser(buffer)).attachments).length != 0) {
|
||||
attach = (await simpleParser(buffer)).attachments[0].content //to get attachments
|
||||
let file = (await simpleParser(buffer)).attachments[0]
|
||||
fs.writeFile(file.filename,file.content, "binary", (err) => {
|
||||
if(!err) console.log("Success")
|
||||
})
|
||||
}
|
||||
|
||||
if (info.which !== 'TEXT'){
|
||||
dataheader = Imap.parseHeader(buffer)
|
||||
|
||||
//start -> set data, that you want to save on your DB
|
||||
let emails_data = {
|
||||
"date": dataheader.date[0],
|
||||
"subject": dataheader.subject[0],
|
||||
"from": dataheader.from[0],
|
||||
"to": dataheader.to[0],
|
||||
"content": (await simpleParser(buffer)).text,
|
||||
"attachment": attach
|
||||
}
|
||||
console.log(emails_data)
|
||||
//end -> set data
|
||||
|
||||
email_array.push(emails_data)
|
||||
}
|
||||
else
|
||||
console.log(prefix + 'Body [%s] Finished', inspect(info.which));
|
||||
});
|
||||
});
|
||||
|
||||
//mark attributes email as read
|
||||
msg.once('attributes', function(attrs) {
|
||||
let uid = attrs.uid;
|
||||
imap.addFlags(uid, ['\\Seen'], function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log("Done, marked email as read!")
|
||||
}
|
||||
});
|
||||
});
|
||||
msg.once('end', function() {
|
||||
console.log(prefix + 'Finished');
|
||||
});
|
||||
});
|
||||
|
||||
f.once('error', function(err) {
|
||||
console.log('Fetch error: ' + err);
|
||||
});
|
||||
|
||||
f.once('end', function() {
|
||||
console.log('Done fetching all messages!');
|
||||
imap.end();
|
||||
});
|
||||
|
||||
})
|
||||
});} catch (err){
|
||||
console.log("Error when request open inbox mail",err)
|
||||
}
|
||||
});
|
||||
|
||||
imap.once('error', function(err) {
|
||||
console.log("Error when connection to IMAP", err);
|
||||
});
|
||||
|
||||
imap.once('close', function() {
|
||||
console.log('Connection ended');
|
||||
});
|
||||
|
||||
imap.connect();
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
imap.once('close', async function () { //maybe, someone asking whether to use end or close and the author of the module says that close is always emitted so you should use that.
|
||||
resolve(email_array);
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
console.log(email_array)
|
||||
Binary file not shown.
1
test/imaps/node_modules/.bin/he
generated
vendored
1
test/imaps/node_modules/.bin/he
generated
vendored
@@ -1 +0,0 @@
|
||||
../he/bin/he
|
||||
1
test/imaps/node_modules/.bin/semver
generated
vendored
1
test/imaps/node_modules/.bin/semver
generated
vendored
@@ -1 +0,0 @@
|
||||
../semver/bin/semver
|
||||
1
test/imaps/node_modules/.bin/tlds
generated
vendored
1
test/imaps/node_modules/.bin/tlds
generated
vendored
@@ -1 +0,0 @@
|
||||
../tlds/bin.js
|
||||
364
test/imaps/node_modules/.package-lock.json
generated
vendored
364
test/imaps/node_modules/.package-lock.json
generated
vendored
@@ -1,364 +0,0 @@
|
||||
{
|
||||
"name": "imaps",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@selderee/plugin-htmlparser2": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@selderee/plugin-htmlparser2/-/plugin-htmlparser2-0.11.0.tgz",
|
||||
"integrity": "sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ==",
|
||||
"dependencies": {
|
||||
"domhandler": "^5.0.3",
|
||||
"selderee": "^0.11.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://ko-fi.com/killymxi"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/base64-stream/-/base64-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-BQQZftaO48FcE1Kof9CmXMFaAdqkcNorgc8CxesZv9nMbbTF1EFyQe89UOuh//QMmdtfUDXyO8rgUalemL5ODA=="
|
||||
},
|
||||
"node_modules/deepmerge": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
|
||||
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dom-serializer": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
|
||||
"integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.2",
|
||||
"entities": "^4.2.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/domelementtype": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
|
||||
"integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/domhandler": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
|
||||
"integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/domhandler?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/domutils": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz",
|
||||
"integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==",
|
||||
"dependencies": {
|
||||
"dom-serializer": "^2.0.0",
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.3"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/domutils?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/encoding-japanese": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/encoding-japanese/-/encoding-japanese-2.0.0.tgz",
|
||||
"integrity": "sha512-++P0RhebUC8MJAwJOsT93dT+5oc5oPImp1HubZpAuCZ5kTLnhuuBhKHj2jJeO/Gj93idPBWmIuQ9QWMe5rX3pQ==",
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/he": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
|
||||
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
|
||||
"bin": {
|
||||
"he": "bin/he"
|
||||
}
|
||||
},
|
||||
"node_modules/html-to-text": {
|
||||
"version": "9.0.5",
|
||||
"resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-9.0.5.tgz",
|
||||
"integrity": "sha512-qY60FjREgVZL03vJU6IfMV4GDjGBIoOyvuFdpBDIX9yTlDw0TjxVBQp+P8NvpdIXNJvfWBTNul7fsAQJq2FNpg==",
|
||||
"dependencies": {
|
||||
"@selderee/plugin-htmlparser2": "^0.11.0",
|
||||
"deepmerge": "^4.3.1",
|
||||
"dom-serializer": "^2.0.0",
|
||||
"htmlparser2": "^8.0.2",
|
||||
"selderee": "^0.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/htmlparser2": {
|
||||
"version": "8.0.2",
|
||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
|
||||
"integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==",
|
||||
"funding": [
|
||||
"https://github.com/fb55/htmlparser2?sponsor=1",
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.3",
|
||||
"domutils": "^3.0.1",
|
||||
"entities": "^4.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/leac": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/leac/-/leac-0.6.0.tgz",
|
||||
"integrity": "sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==",
|
||||
"funding": {
|
||||
"url": "https://ko-fi.com/killymxi"
|
||||
}
|
||||
},
|
||||
"node_modules/libbase64": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/libbase64/-/libbase64-1.2.1.tgz",
|
||||
"integrity": "sha512-l+nePcPbIG1fNlqMzrh68MLkX/gTxk/+vdvAb388Ssi7UuUN31MI44w4Yf33mM3Cm4xDfw48mdf3rkdHszLNew=="
|
||||
},
|
||||
"node_modules/libmime": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/libmime/-/libmime-5.2.1.tgz",
|
||||
"integrity": "sha512-A0z9O4+5q+ZTj7QwNe/Juy1KARNb4WaviO4mYeFC4b8dBT2EEqK2pkM+GC8MVnkOjqhl5nYQxRgnPYRRTNmuSQ==",
|
||||
"dependencies": {
|
||||
"encoding-japanese": "2.0.0",
|
||||
"iconv-lite": "0.6.3",
|
||||
"libbase64": "1.2.1",
|
||||
"libqp": "2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/libqp": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/libqp/-/libqp-2.0.1.tgz",
|
||||
"integrity": "sha512-Ka0eC5LkF3IPNQHJmYBWljJsw0UvM6j+QdKRbWyCdTmYwvIDE6a7bCm0UkTAL/K+3KXK5qXT/ClcInU01OpdLg=="
|
||||
},
|
||||
"node_modules/linkify-it": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
|
||||
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
|
||||
"dependencies": {
|
||||
"uc.micro": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/mailparser": {
|
||||
"version": "3.6.5",
|
||||
"resolved": "https://registry.npmjs.org/mailparser/-/mailparser-3.6.5.tgz",
|
||||
"integrity": "sha512-nteTpF0Khm5JLOnt4sigmzNdUH/6mO7PZ4KEnvxf4mckyXYFFhrtAWZzbq/V5aQMH+049gA7ZjfLdh+QiX2Uqg==",
|
||||
"dependencies": {
|
||||
"encoding-japanese": "2.0.0",
|
||||
"he": "1.2.0",
|
||||
"html-to-text": "9.0.5",
|
||||
"iconv-lite": "0.6.3",
|
||||
"libmime": "5.2.1",
|
||||
"linkify-it": "4.0.1",
|
||||
"mailsplit": "5.4.0",
|
||||
"nodemailer": "6.9.3",
|
||||
"tlds": "1.240.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mailsplit": {
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/mailsplit/-/mailsplit-5.4.0.tgz",
|
||||
"integrity": "sha512-wnYxX5D5qymGIPYLwnp6h8n1+6P6vz/MJn5AzGjZ8pwICWssL+CCQjWBIToOVHASmATot4ktvlLo6CyLfOXWYA==",
|
||||
"dependencies": {
|
||||
"libbase64": "1.2.1",
|
||||
"libmime": "5.2.0",
|
||||
"libqp": "2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/mailsplit/node_modules/libmime": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/libmime/-/libmime-5.2.0.tgz",
|
||||
"integrity": "sha512-X2U5Wx0YmK0rXFbk67ASMeqYIkZ6E5vY7pNWRKtnNzqjvdYYG8xtPDpCnuUEnPU9vlgNev+JoSrcaKSUaNvfsw==",
|
||||
"dependencies": {
|
||||
"encoding-japanese": "2.0.0",
|
||||
"iconv-lite": "0.6.3",
|
||||
"libbase64": "1.2.1",
|
||||
"libqp": "2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/node-imap": {
|
||||
"version": "0.9.6",
|
||||
"resolved": "https://registry.npmjs.org/node-imap/-/node-imap-0.9.6.tgz",
|
||||
"integrity": "sha512-pYQ2AtjQwrSvILq8EYInv3E3svrJwrTOxzW7uBGpP//AkCs/pMdO+O6KEgUlSchh/0/N0MSWs5io3xZhxJ9yLg==",
|
||||
"dependencies": {
|
||||
"readable-stream": "^3.6.0",
|
||||
"utf7": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "6.9.3",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.3.tgz",
|
||||
"integrity": "sha512-fy9v3NgTzBngrMFkDsKEj0r02U7jm6XfC3b52eoNV+GCrGj+s8pt5OqhiJdWKuw51zCTdiNR/IUD1z33LIIGpg==",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/parseley": {
|
||||
"version": "0.12.1",
|
||||
"resolved": "https://registry.npmjs.org/parseley/-/parseley-0.12.1.tgz",
|
||||
"integrity": "sha512-e6qHKe3a9HWr0oMRVDTRhKce+bRO8VGQR3NyVwcjwrbhMmFCX9KszEV35+rn4AdilFAq9VPxP/Fe1wC9Qjd2lw==",
|
||||
"dependencies": {
|
||||
"leac": "^0.6.0",
|
||||
"peberminta": "^0.9.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://ko-fi.com/killymxi"
|
||||
}
|
||||
},
|
||||
"node_modules/peberminta": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/peberminta/-/peberminta-0.9.0.tgz",
|
||||
"integrity": "sha512-XIxfHpEuSJbITd1H3EeQwpcZbTLHc+VVr8ANI9t5sit565tsI4/xK3KWTUFE2e6QiangUkh3B0jihzmGnNrRsQ==",
|
||||
"funding": {
|
||||
"url": "https://ko-fi.com/killymxi"
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/selderee": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/selderee/-/selderee-0.11.0.tgz",
|
||||
"integrity": "sha512-5TF+l7p4+OsnP8BCCvSyZiSPc4x4//p5uPwK8TCnVPJYRmU2aYKMpOXvw8zM5a5JvuuCGN1jmsMwuU2W02ukfA==",
|
||||
"dependencies": {
|
||||
"parseley": "^0.12.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://ko-fi.com/killymxi"
|
||||
}
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
|
||||
"integrity": "sha512-mfmm3/H9+67MCVix1h+IXTpDwL6710LyHuk7+cWC9T1mE0qz4iHhh6r4hU2wrIT9iTsAAC2XQRvfblL028cpLw==",
|
||||
"bin": {
|
||||
"semver": "bin/semver"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tlds": {
|
||||
"version": "1.240.0",
|
||||
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.240.0.tgz",
|
||||
"integrity": "sha512-1OYJQenswGZSOdRw7Bql5Qu7uf75b+F3HFBXbqnG/ifHa0fev1XcG+3pJf3pA/KC6RtHQzfKgIf1vkMlMG7mtQ==",
|
||||
"bin": {
|
||||
"tlds": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/uc.micro": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
|
||||
},
|
||||
"node_modules/utf7": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/utf7/-/utf7-1.0.2.tgz",
|
||||
"integrity": "sha512-qQrPtYLLLl12NF4DrM9CvfkxkYI97xOb5dsnGZHE3teFr0tWiEZ9UdgMPczv24vl708cYMpe6mGXGHrotIp3Bw==",
|
||||
"dependencies": {
|
||||
"semver": "~5.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
33
test/imaps/node_modules/@selderee/plugin-htmlparser2/CHANGELOG.md
generated
vendored
33
test/imaps/node_modules/@selderee/plugin-htmlparser2/CHANGELOG.md
generated
vendored
@@ -1,33 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## Version 0.11.0
|
||||
|
||||
* (`selderee`) Escape sequences in selectors.
|
||||
|
||||
## Version 0.10.0
|
||||
|
||||
* Targeting Node.js version 14 and ES2020;
|
||||
* Bump dependencies.
|
||||
|
||||
## Version 0.9.0
|
||||
|
||||
* Bump dependencies - fix "./core module cannot be found" issue.
|
||||
|
||||
## Version 0.8.1
|
||||
|
||||
* Sync with `selderee` package version. Now all dependencies are TypeScript, dual CommonJS/ES module packages;
|
||||
* Use `rollup-plugin-cleanup` to condition published files.
|
||||
|
||||
## Version 0.7.0
|
||||
|
||||
* Drop Node.js version 10 support. At least 12.22.x is required.
|
||||
|
||||
## Version 0.6.0
|
||||
|
||||
* `selderee` 0.6.0 - [changelog](https://github.com/mxxii/selderee/blob/main/packages/selderee/CHANGELOG.md).
|
||||
|
||||
## Version 0.5.0
|
||||
|
||||
Initial release.
|
||||
|
||||
Aiming at Node.js version 10 and up.
|
||||
21
test/imaps/node_modules/@selderee/plugin-htmlparser2/LICENSE
generated
vendored
21
test/imaps/node_modules/@selderee/plugin-htmlparser2/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-2022 KillyMXI <killy@mxii.eu.org>
|
||||
|
||||
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.
|
||||
15
test/imaps/node_modules/@selderee/plugin-htmlparser2/README.md
generated
vendored
15
test/imaps/node_modules/@selderee/plugin-htmlparser2/README.md
generated
vendored
@@ -1,15 +0,0 @@
|
||||
# selderee
|
||||
|
||||

|
||||

|
||||
[](https://github.com/mxxii/selderee/blob/main/LICENSE)
|
||||
|
||||
[selderee](https://github.com/mxxii/selderee) plugin - selectors decision tree builder for [htmlparser2](https://github.com/fb55/htmlparser2) DOM AST.
|
||||
|
||||
(Technically, the package depends not on `htmlparser2` but on [domhandler](https://github.com/fb55/domhandler), underlying package of `htmlparser2`.)
|
||||
|
||||
----
|
||||
|
||||
[Changelog](https://github.com/mxxii/selderee/blob/main/packages/plugin-htmlparser2/CHANGELOG.md).
|
||||
|
||||
See [main README file](https://github.com/mxxii/selderee/blob/main/README.md) for more info.
|
||||
94
test/imaps/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.cjs
generated
vendored
94
test/imaps/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.cjs
generated
vendored
@@ -1,94 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var domhandler = require('domhandler');
|
||||
var selderee = require('selderee');
|
||||
|
||||
function hp2Builder(nodes) {
|
||||
return new selderee.Picker(handleArray(nodes));
|
||||
}
|
||||
function handleArray(nodes) {
|
||||
const matchers = nodes.map(handleNode);
|
||||
return (el, ...tail) => matchers.flatMap(m => m(el, ...tail));
|
||||
}
|
||||
function handleNode(node) {
|
||||
switch (node.type) {
|
||||
case 'terminal': {
|
||||
const result = [node.valueContainer];
|
||||
return (el, ...tail) => result;
|
||||
}
|
||||
case 'tagName':
|
||||
return handleTagName(node);
|
||||
case 'attrValue':
|
||||
return handleAttrValueName(node);
|
||||
case 'attrPresence':
|
||||
return handleAttrPresenceName(node);
|
||||
case 'pushElement':
|
||||
return handlePushElementNode(node);
|
||||
case 'popElement':
|
||||
return handlePopElementNode(node);
|
||||
}
|
||||
}
|
||||
function handleTagName(node) {
|
||||
const variants = {};
|
||||
for (const variant of node.variants) {
|
||||
variants[variant.value] = handleArray(variant.cont);
|
||||
}
|
||||
return (el, ...tail) => {
|
||||
const continuation = variants[el.name];
|
||||
return (continuation) ? continuation(el, ...tail) : [];
|
||||
};
|
||||
}
|
||||
function handleAttrPresenceName(node) {
|
||||
const attrName = node.name;
|
||||
const continuation = handleArray(node.cont);
|
||||
return (el, ...tail) => (Object.prototype.hasOwnProperty.call(el.attribs, attrName))
|
||||
? continuation(el, ...tail)
|
||||
: [];
|
||||
}
|
||||
function handleAttrValueName(node) {
|
||||
const callbacks = [];
|
||||
for (const matcher of node.matchers) {
|
||||
const predicate = matcher.predicate;
|
||||
const continuation = handleArray(matcher.cont);
|
||||
callbacks.push((attr, el, ...tail) => (predicate(attr) ? continuation(el, ...tail) : []));
|
||||
}
|
||||
const attrName = node.name;
|
||||
return (el, ...tail) => {
|
||||
const attr = el.attribs[attrName];
|
||||
return (attr || attr === '')
|
||||
? callbacks.flatMap(cb => cb(attr, el, ...tail))
|
||||
: [];
|
||||
};
|
||||
}
|
||||
function handlePushElementNode(node) {
|
||||
const continuation = handleArray(node.cont);
|
||||
const leftElementGetter = (node.combinator === '+')
|
||||
? getPrecedingElement
|
||||
: getParentElement;
|
||||
return (el, ...tail) => {
|
||||
const next = leftElementGetter(el);
|
||||
if (next === null) {
|
||||
return [];
|
||||
}
|
||||
return continuation(next, el, ...tail);
|
||||
};
|
||||
}
|
||||
const getPrecedingElement = (el) => {
|
||||
const prev = el.prev;
|
||||
if (prev === null) {
|
||||
return null;
|
||||
}
|
||||
return (domhandler.isTag(prev)) ? prev : getPrecedingElement(prev);
|
||||
};
|
||||
const getParentElement = (el) => {
|
||||
const parent = el.parent;
|
||||
return (parent && domhandler.isTag(parent)) ? parent : null;
|
||||
};
|
||||
function handlePopElementNode(node) {
|
||||
const continuation = handleArray(node.cont);
|
||||
return (el, next, ...tail) => continuation(next, ...tail);
|
||||
}
|
||||
|
||||
exports.hp2Builder = hp2Builder;
|
||||
16
test/imaps/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.d.ts
generated
vendored
16
test/imaps/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.d.ts
generated
vendored
@@ -1,16 +0,0 @@
|
||||
import { Element } from 'domhandler';
|
||||
import { Picker, Ast } from 'selderee';
|
||||
/**
|
||||
* A {@link BuilderFunction} implementation.
|
||||
*
|
||||
* Creates a function (in a {@link Picker} wrapper) that can run
|
||||
* the decision tree against `htmlparser2` `Element` nodes.
|
||||
*
|
||||
* @typeParam V - the type of values associated with selectors.
|
||||
*
|
||||
* @param nodes - nodes ({@link DecisionTreeNode})
|
||||
* from the root level of the decision tree.
|
||||
*
|
||||
* @returns a {@link Picker} object.
|
||||
*/
|
||||
export declare function hp2Builder<V>(nodes: Ast.DecisionTreeNode<V>[]): Picker<Element, V>;
|
||||
90
test/imaps/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.mjs
generated
vendored
90
test/imaps/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.mjs
generated
vendored
@@ -1,90 +0,0 @@
|
||||
import { isTag } from 'domhandler';
|
||||
import { Picker } from 'selderee';
|
||||
|
||||
function hp2Builder(nodes) {
|
||||
return new Picker(handleArray(nodes));
|
||||
}
|
||||
function handleArray(nodes) {
|
||||
const matchers = nodes.map(handleNode);
|
||||
return (el, ...tail) => matchers.flatMap(m => m(el, ...tail));
|
||||
}
|
||||
function handleNode(node) {
|
||||
switch (node.type) {
|
||||
case 'terminal': {
|
||||
const result = [node.valueContainer];
|
||||
return (el, ...tail) => result;
|
||||
}
|
||||
case 'tagName':
|
||||
return handleTagName(node);
|
||||
case 'attrValue':
|
||||
return handleAttrValueName(node);
|
||||
case 'attrPresence':
|
||||
return handleAttrPresenceName(node);
|
||||
case 'pushElement':
|
||||
return handlePushElementNode(node);
|
||||
case 'popElement':
|
||||
return handlePopElementNode(node);
|
||||
}
|
||||
}
|
||||
function handleTagName(node) {
|
||||
const variants = {};
|
||||
for (const variant of node.variants) {
|
||||
variants[variant.value] = handleArray(variant.cont);
|
||||
}
|
||||
return (el, ...tail) => {
|
||||
const continuation = variants[el.name];
|
||||
return (continuation) ? continuation(el, ...tail) : [];
|
||||
};
|
||||
}
|
||||
function handleAttrPresenceName(node) {
|
||||
const attrName = node.name;
|
||||
const continuation = handleArray(node.cont);
|
||||
return (el, ...tail) => (Object.prototype.hasOwnProperty.call(el.attribs, attrName))
|
||||
? continuation(el, ...tail)
|
||||
: [];
|
||||
}
|
||||
function handleAttrValueName(node) {
|
||||
const callbacks = [];
|
||||
for (const matcher of node.matchers) {
|
||||
const predicate = matcher.predicate;
|
||||
const continuation = handleArray(matcher.cont);
|
||||
callbacks.push((attr, el, ...tail) => (predicate(attr) ? continuation(el, ...tail) : []));
|
||||
}
|
||||
const attrName = node.name;
|
||||
return (el, ...tail) => {
|
||||
const attr = el.attribs[attrName];
|
||||
return (attr || attr === '')
|
||||
? callbacks.flatMap(cb => cb(attr, el, ...tail))
|
||||
: [];
|
||||
};
|
||||
}
|
||||
function handlePushElementNode(node) {
|
||||
const continuation = handleArray(node.cont);
|
||||
const leftElementGetter = (node.combinator === '+')
|
||||
? getPrecedingElement
|
||||
: getParentElement;
|
||||
return (el, ...tail) => {
|
||||
const next = leftElementGetter(el);
|
||||
if (next === null) {
|
||||
return [];
|
||||
}
|
||||
return continuation(next, el, ...tail);
|
||||
};
|
||||
}
|
||||
const getPrecedingElement = (el) => {
|
||||
const prev = el.prev;
|
||||
if (prev === null) {
|
||||
return null;
|
||||
}
|
||||
return (isTag(prev)) ? prev : getPrecedingElement(prev);
|
||||
};
|
||||
const getParentElement = (el) => {
|
||||
const parent = el.parent;
|
||||
return (parent && isTag(parent)) ? parent : null;
|
||||
};
|
||||
function handlePopElementNode(node) {
|
||||
const continuation = handleArray(node.cont);
|
||||
return (el, next, ...tail) => continuation(next, ...tail);
|
||||
}
|
||||
|
||||
export { hp2Builder };
|
||||
47
test/imaps/node_modules/@selderee/plugin-htmlparser2/package.json
generated
vendored
47
test/imaps/node_modules/@selderee/plugin-htmlparser2/package.json
generated
vendored
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"name": "@selderee/plugin-htmlparser2",
|
||||
"version": "0.11.0",
|
||||
"description": "selderee plugin - selectors decision tree builder for htmlparser2 DOM.",
|
||||
"keywords": [
|
||||
"htmlparser2",
|
||||
"selderee",
|
||||
"plugin",
|
||||
"selderee plugin"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mxxii/selderee.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mxxii/selderee/issues"
|
||||
},
|
||||
"homepage": "https://github.com/mxxii/selderee",
|
||||
"author": "KillyMXI",
|
||||
"funding": "https://ko-fi.com/killymxi",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
"import": "./lib/hp2-builder.mjs",
|
||||
"require": "./lib/hp2-builder.cjs"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "./lib/hp2-builder.cjs",
|
||||
"module": "./lib/hp2-builder.mjs",
|
||||
"types": "./lib/hp2-builder.d.ts",
|
||||
"typedocMain": "./src/hp2-builder.ts",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build:rollup": "rollup -c",
|
||||
"build:types": "tsc -d --emitDeclarationOnly --declarationDir ./lib",
|
||||
"build": "npm run clean && npm run build:rollup && npm run build:types",
|
||||
"clean": "rimraf lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"domhandler": "^5.0.3",
|
||||
"selderee": "^0.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"htmlparser2": "^8.0.1"
|
||||
}
|
||||
}
|
||||
60
test/imaps/node_modules/base64-stream/README.md
generated
vendored
60
test/imaps/node_modules/base64-stream/README.md
generated
vendored
@@ -1,60 +0,0 @@
|
||||
# Introduction
|
||||
|
||||
While Node.js has built-in support for Base64 data, it does not come with the ability to encode / decode data in a stream.
|
||||
|
||||
This library contains a streaming Base64 encoder and a streaming Base64 decoder for use with Node.js. These classes are written using the Node.js [stream interfaces](http://nodejs.org/api/stream.html) and are well covered with unit tests.
|
||||
|
||||
# Usage
|
||||
|
||||
## Installation
|
||||
|
||||
To install base64-stream
|
||||
|
||||
npm install base64-stream
|
||||
|
||||
## Examples
|
||||
This example encodes an image and pipes it to stdout.
|
||||
|
||||
```javascript
|
||||
var http = require('http');
|
||||
var {Base64Encode} = require('base64-stream');
|
||||
|
||||
var img = 'http://farm3.staticflickr.com/2433/3973241798_86ddfa642b_o.jpg';
|
||||
http.get(img, function(res) {
|
||||
if (res.statusCode === 200)
|
||||
res.pipe(new Base64Encode()).pipe(process.stdout);
|
||||
});
|
||||
```
|
||||
|
||||
This example takes in Base64 encoded data on stdin, decodes it, an pipes it to stdout.
|
||||
```javascript
|
||||
var {Base64Encode} = require('base64-stream');
|
||||
process.stdin.pipe(new Base64Encode()).pipe(process.stdout);
|
||||
```
|
||||
|
||||
## options:
|
||||
|
||||
`Base64Encode` can take an optional object `{lineLength: number, prefix: string}`
|
||||
The prefix is useful for prepending for example `data:image/png;base64,` to make a base64 URL.
|
||||
This example proxies an image url, and send the base64 string in response.
|
||||
|
||||
```
|
||||
app.get('/i/*', function(req, res){ // using express for example
|
||||
fetch(req.params[0]) // using node-fetch
|
||||
.then(r=>r.body.pipe(new Base64Encode({prefix:`data:${r.headers.get('content-type')};base64,`})).pipe(res))
|
||||
.catch(console.error);
|
||||
});
|
||||
```
|
||||
|
||||
# Requirements
|
||||
|
||||
This module currently requires Node 6.0.0 or higher.
|
||||
|
||||
# Testing
|
||||
|
||||
To run the unit tests
|
||||
|
||||
npm test
|
||||
|
||||
# License
|
||||
MIT
|
||||
7
test/imaps/node_modules/base64-stream/index.js
generated
vendored
7
test/imaps/node_modules/base64-stream/index.js
generated
vendored
@@ -1,7 +0,0 @@
|
||||
const Base64Encode = require('./lib/encode');
|
||||
const Base64Decode = require('./lib/decode');
|
||||
|
||||
module.exports = {
|
||||
Base64Encode,
|
||||
Base64Decode
|
||||
};
|
||||
56
test/imaps/node_modules/base64-stream/lib/decode.js
generated
vendored
56
test/imaps/node_modules/base64-stream/lib/decode.js
generated
vendored
@@ -1,56 +0,0 @@
|
||||
const { Transform } = require('stream');
|
||||
|
||||
/**
|
||||
* Decodes a Base64 data stream, coming in as a string or Buffer of UTF-8 text, into binary Buffers.
|
||||
* @extends Transform
|
||||
*/
|
||||
module.exports = class Base64Decode extends Transform {
|
||||
/**
|
||||
* Create a Base64Decode
|
||||
*/
|
||||
constructor() {
|
||||
super({ decodeStrings: false });
|
||||
// Any extra chars from the last chunk
|
||||
this.extra = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a Base64 data stream, coming in as a string or Buffer of UTF-8 text, into binary Buffers.
|
||||
* @param {Buffer|string} chunk
|
||||
* @param encoding
|
||||
* @param cb
|
||||
* @private
|
||||
*/
|
||||
_transform(chunk, encoding, cb) {
|
||||
// Convert chunk to a string
|
||||
chunk = '' + chunk;
|
||||
|
||||
// Add previous extra and remove any newline characters
|
||||
chunk = this.extra + chunk.replace(/(\r\n|\n|\r)/gm, '');
|
||||
|
||||
// 4 characters represent 3 bytes, so we can only decode in groups of 4 chars
|
||||
const remaining = chunk.length % 4;
|
||||
|
||||
// Store the extra chars for later
|
||||
this.extra = chunk.slice(chunk.length - remaining);
|
||||
chunk = chunk.slice(0, chunk.length - remaining);
|
||||
|
||||
// Create the new buffer and push
|
||||
const buf = Buffer.from(chunk, 'base64');
|
||||
this.push(buf);
|
||||
cb();
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits 1, 2, or 3 extra characters of base64 data.
|
||||
* @param cb
|
||||
* @private
|
||||
*/
|
||||
_flush(cb) {
|
||||
if (this.extra.length) {
|
||||
this.push(Buffer.from(this.extra, 'base64'));
|
||||
}
|
||||
|
||||
cb();
|
||||
}
|
||||
};
|
||||
116
test/imaps/node_modules/base64-stream/lib/encode.js
generated
vendored
116
test/imaps/node_modules/base64-stream/lib/encode.js
generated
vendored
@@ -1,116 +0,0 @@
|
||||
const { Transform } = require('stream');
|
||||
|
||||
/**
|
||||
* Transforms a Buffer stream of binary data to a stream of Base64 text. Note that this will
|
||||
* also work on a stream of pure strings, as the Writeable base class will automatically decode
|
||||
* text string chunks into Buffers.
|
||||
* You can pass optionally a line length or a prefix
|
||||
* @extends Transform
|
||||
*/
|
||||
module.exports = class Base64Encode extends Transform {
|
||||
/**
|
||||
* Creates a Base64Encode
|
||||
* @param {Object=} options - Options for stream creation. Passed to Transform constructor as-is.
|
||||
* @param {string=} options.inputEncoding - The input chunk format. Default is 'utf8'. No effect on Buffer input chunks.
|
||||
* @param {string=} options.outputEncoding - The output chunk format. Default is 'utf8'. Pass `null` for Buffer chunks.
|
||||
* @param {number=} options.lineLength - The max line-length of the output stream.
|
||||
* @param {string=} options.prefix - Prefix for output string.
|
||||
*/
|
||||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
// Any extra chars from the last chunk
|
||||
this.extra = null;
|
||||
this.lineLength = options && options.lineLength;
|
||||
this.currLineLength = 0;
|
||||
if (options && options.prefix) {
|
||||
this.push(options.prefix);
|
||||
}
|
||||
|
||||
// Default string input to be treated as 'utf8'
|
||||
const encIn = options && options.inputEncoding;
|
||||
this.setDefaultEncoding(encIn || 'utf8');
|
||||
|
||||
// Default output to be strings
|
||||
const encOut = options && options.outputEncoding;
|
||||
if (encOut !== null) {
|
||||
this.setEncoding(encOut || 'utf8');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds \r\n as needed to the data chunk to ensure that the output Base64 string meets
|
||||
* the maximum line length requirement.
|
||||
* @param {string} chunk
|
||||
* @returns {string}
|
||||
* @private
|
||||
*/
|
||||
_fixLineLength(chunk) {
|
||||
// If we care about line length, add line breaks
|
||||
if (!this.lineLength) {
|
||||
return chunk;
|
||||
}
|
||||
|
||||
const size = chunk.length;
|
||||
const needed = this.lineLength - this.currLineLength;
|
||||
let start, end;
|
||||
|
||||
let _chunk = '';
|
||||
for (start = 0, end = needed; end < size; start = end, end += this.lineLength) {
|
||||
_chunk += chunk.slice(start, end);
|
||||
_chunk += '\r\n';
|
||||
}
|
||||
|
||||
const left = chunk.slice(start);
|
||||
this.currLineLength = left.length;
|
||||
|
||||
_chunk += left;
|
||||
|
||||
return _chunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a Buffer chunk of data to a Base64 string chunk.
|
||||
* @param {Buffer} chunk
|
||||
* @param {string} encoding - unused since chunk is always a Buffer
|
||||
* @param cb
|
||||
* @private
|
||||
*/
|
||||
_transform(chunk, encoding, cb) {
|
||||
// Add any previous extra bytes to the chunk
|
||||
if (this.extra) {
|
||||
chunk = Buffer.concat([this.extra, chunk]);
|
||||
this.extra = null;
|
||||
}
|
||||
|
||||
// 3 bytes are represented by 4 characters, so we can only encode in groups of 3 bytes
|
||||
const remaining = chunk.length % 3;
|
||||
|
||||
if (remaining !== 0) {
|
||||
// Store the extra bytes for later
|
||||
this.extra = chunk.slice(chunk.length - remaining);
|
||||
chunk = chunk.slice(0, chunk.length - remaining);
|
||||
}
|
||||
|
||||
// Convert chunk to a base 64 string
|
||||
chunk = chunk.toString('base64');
|
||||
|
||||
// Push the chunk
|
||||
this.push(Buffer.from(this._fixLineLength(chunk)));
|
||||
cb();
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits 0 or 4 extra characters of Base64 data.
|
||||
* @param cb
|
||||
* @private
|
||||
*/
|
||||
_flush(cb) {
|
||||
if (this.extra) {
|
||||
this.push(Buffer.from(this._fixLineLength(this.extra.toString('base64'))));
|
||||
}
|
||||
|
||||
cb();
|
||||
}
|
||||
|
||||
};
|
||||
34
test/imaps/node_modules/base64-stream/package.json
generated
vendored
34
test/imaps/node_modules/base64-stream/package.json
generated
vendored
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "base64-stream",
|
||||
"description": "Contains new Node.js v0.10 style stream classes for encoding / decoding Base64 data",
|
||||
"keywords": [
|
||||
"Base64",
|
||||
"stream",
|
||||
"streaming",
|
||||
"piping",
|
||||
"node",
|
||||
"node.js",
|
||||
"encode",
|
||||
"decode"
|
||||
],
|
||||
"author": "Ross Johnson <ross@mazira.com>",
|
||||
"version": "1.0.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/mazira/base64-stream"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"lib",
|
||||
"index.js"
|
||||
],
|
||||
"engine": "node >= 0.8.0"
|
||||
}
|
||||
7
test/imaps/node_modules/deepmerge/.editorconfig
generated
vendored
7
test/imaps/node_modules/deepmerge/.editorconfig
generated
vendored
@@ -1,7 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
1
test/imaps/node_modules/deepmerge/.eslintcache
generated
vendored
1
test/imaps/node_modules/deepmerge/.eslintcache
generated
vendored
@@ -1 +0,0 @@
|
||||
[{"/Users/joshduff/code/deepmerge/test/custom-is-mergeable-object.js":"1"},{"size":1990,"mtime":1679007485753,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ktjd5k","/Users/joshduff/code/deepmerge/test/custom-is-mergeable-object.js",[],[]]
|
||||
167
test/imaps/node_modules/deepmerge/changelog.md
generated
vendored
167
test/imaps/node_modules/deepmerge/changelog.md
generated
vendored
@@ -1,167 +0,0 @@
|
||||
# [4.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.1)
|
||||
|
||||
- Fix type definition for arrayMerge options. [#239](https://github.com/TehShrike/deepmerge/pull/239)
|
||||
|
||||
# [4.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.0)
|
||||
|
||||
- Avoid thrown errors if the target doesn't have `propertyIsEnumerable`. [#252](https://github.com/TehShrike/deepmerge/pull/252)
|
||||
|
||||
# [4.2.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.2)
|
||||
|
||||
- `isMergeableObject` is now only called if there are two values that could be merged. [a34dd4d2](https://github.com/TehShrike/deepmerge/commit/a34dd4d25bf5e250653540a2022bc832c7b00a19)
|
||||
|
||||
# [4.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.1)
|
||||
|
||||
- Fix: falsey values can now be merged. [#170](https://github.com/TehShrike/deepmerge/issues/170)
|
||||
|
||||
# [4.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.0)
|
||||
|
||||
- Properties are now only overwritten if they exist on the target object and are enumerable. [#164](https://github.com/TehShrike/deepmerge/pull/164)
|
||||
|
||||
Technically this could probably be a patch release since "which properties get overwritten" wasn't documented and accidentally overwriting a built-in function or some function up the property chain would almost certainly be undesirable, but it feels like a gray area, so here we are with a feature version bump.
|
||||
|
||||
# [4.1.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.2)
|
||||
|
||||
- Rolled back #167 since `Object.assign` breaks ES5 support. [55067352](https://github.com/TehShrike/deepmerge/commit/55067352a92c65a6c44a5165f3387720aae1e192)
|
||||
|
||||
# [4.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.1)
|
||||
|
||||
- The `options` argument is no longer mutated [#167](https://github.com/TehShrike/deepmerge/pull/167)
|
||||
|
||||
# [4.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.0)
|
||||
|
||||
- `cloneUnlessOtherwiseSpecified` is now exposed to the `arrayMerge` function [#165](https://github.com/TehShrike/deepmerge/pull/165)
|
||||
|
||||
# [4.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.0.0)
|
||||
|
||||
- The `main` entry point in `package.json` is now a CommonJS module instead of a UMD module [#155](https://github.com/TehShrike/deepmerge/pull/155)
|
||||
|
||||
# [3.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.3.0)
|
||||
|
||||
- Enumerable Symbol properties are now copied [#151](https://github.com/TehShrike/deepmerge/pull/151)
|
||||
|
||||
# [3.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.1)
|
||||
|
||||
- bumping dev dependency versions to try to shut up bogus security warnings from Github/npm [#149](https://github.com/TehShrike/deepmerge/pull/149)
|
||||
|
||||
# [3.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.0)
|
||||
|
||||
- feature: added the [`customMerge`](https://github.com/TehShrike/deepmerge#custommerge) option [#133](https://github.com/TehShrike/deepmerge/pull/133)
|
||||
|
||||
# [3.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.1.0)
|
||||
|
||||
- typescript typing: make the `all` function generic [#129](https://github.com/TehShrike/deepmerge/pull/129)
|
||||
|
||||
# [3.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.0.0)
|
||||
|
||||
- drop ES module build [#123](https://github.com/TehShrike/deepmerge/issues/123)
|
||||
|
||||
# [2.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.1)
|
||||
|
||||
- bug: typescript export type was wrong [#121](https://github.com/TehShrike/deepmerge/pull/121)
|
||||
|
||||
# [2.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.0)
|
||||
|
||||
- feature: added TypeScript typings [#119](https://github.com/TehShrike/deepmerge/pull/119)
|
||||
|
||||
# [2.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.1)
|
||||
|
||||
- documentation: Rename "methods" to "api", note ESM syntax [#103](https://github.com/TehShrike/deepmerge/pull/103)
|
||||
- documentation: Fix grammar [#107](https://github.com/TehShrike/deepmerge/pull/107)
|
||||
- documentation: Restructure headers for clarity + some wording tweaks [108](https://github.com/TehShrike/deepmerge/pull/108) + [109](https://github.com/TehShrike/deepmerge/pull/109)
|
||||
|
||||
|
||||
# [2.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.0)
|
||||
|
||||
- feature: Support a custom `isMergeableObject` function [#96](https://github.com/TehShrike/deepmerge/pull/96)
|
||||
- documentation: note a Webpack bug that some users might need to work around [#100](https://github.com/TehShrike/deepmerge/pull/100)
|
||||
|
||||
# [2.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.1)
|
||||
|
||||
- documentation: fix the old array merge algorithm in the readme. [#84](https://github.com/TehShrike/deepmerge/pull/84)
|
||||
|
||||
# [2.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.0)
|
||||
|
||||
- breaking: the array merge algorithm has changed from a complicated thing to `target.concat(source).map(element => cloneUnlessOtherwiseSpecified(element, optionsArgument))`
|
||||
- breaking: The `clone` option now defaults to `true`
|
||||
- feature: `merge.all` now accepts an array of any size, even 0 or 1 elements
|
||||
|
||||
See [pull request 77](https://github.com/TehShrike/deepmerge/pull/77).
|
||||
|
||||
# [1.5.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.2)
|
||||
|
||||
- fix: no longer attempts to merge React elements [#76](https://github.com/TehShrike/deepmerge/issues/76)
|
||||
|
||||
# [1.5.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.1)
|
||||
|
||||
- bower support: officially dropping bower support. If you use bower, please depend on the [unpkg distribution](https://unpkg.com/deepmerge/dist/umd.js). See [#63](https://github.com/TehShrike/deepmerge/issues/63)
|
||||
|
||||
# [1.5.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.0)
|
||||
|
||||
- bug fix: merging objects into arrays was allowed, and doesn't make any sense. [#65](https://github.com/TehShrike/deepmerge/issues/65) published as a feature release instead of a patch because it is a decent behavior change.
|
||||
|
||||
# [1.4.4](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.4)
|
||||
|
||||
- bower support: updated `main` in bower.json
|
||||
|
||||
# [1.4.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.3)
|
||||
|
||||
- bower support: inline is-mergeable-object in a new CommonJS build, so that people using both bower and CommonJS can bundle the library [0b34e6](https://github.com/TehShrike/deepmerge/commit/0b34e6e95f989f2fc8091d25f0d291c08f3d2d24)
|
||||
|
||||
# [1.4.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.2)
|
||||
|
||||
- performance: bump is-mergeable-object dependency version for a slight performance improvement [5906c7](https://github.com/TehShrike/deepmerge/commit/5906c765d691d48e83d76efbb0d4b9ca150dc12c)
|
||||
|
||||
# [1.4.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.1)
|
||||
|
||||
- documentation: fix unpkg link [acc45b](https://github.com/TehShrike/deepmerge/commit/acc45be85519c1df906a72ecb24764b622d18d47)
|
||||
|
||||
# [1.4.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.0)
|
||||
|
||||
- api: instead of only exporting a UMD module, expose a UMD module with `pkg.main`, a CJS module with `pkg.browser`, and an ES module with `pkg.module` [#62](https://github.com/TehShrike/deepmerge/pull/62)
|
||||
|
||||
# [1.3.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.2)
|
||||
|
||||
- documentation: note the minified/gzipped file sizes [56](https://github.com/TehShrike/deepmerge/pull/56)
|
||||
- documentation: make data structures more readable in merge example: pull request [57](https://github.com/TehShrike/deepmerge/pull/57)
|
||||
|
||||
# [1.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.1)
|
||||
|
||||
- documentation: clarify and test some array merging documentation: pull request [51](https://github.com/TehShrike/deepmerge/pull/51)
|
||||
|
||||
# [1.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.0)
|
||||
|
||||
- feature: `merge.all`, a merge function that merges any number of objects: pull request [50](https://github.com/TehShrike/deepmerge/pull/50)
|
||||
|
||||
# [1.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.2.0)
|
||||
|
||||
- fix: an error that would be thrown when an array would be merged onto a truthy non-array value: pull request [46](https://github.com/TehShrike/deepmerge/pull/46)
|
||||
- feature: the ability to clone: Issue [28](https://github.com/TehShrike/deepmerge/issues/28), pull requests [44](https://github.com/TehShrike/deepmerge/pull/44) and [48](https://github.com/TehShrike/deepmerge/pull/48)
|
||||
- maintenance: added tests + travis to `.npmignore`: pull request [47](https://github.com/TehShrike/deepmerge/pull/47)
|
||||
|
||||
# [1.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.1)
|
||||
|
||||
- fix an issue where an error was thrown when merging an array onto a non-array: [Pull request 46](https://github.com/TehShrike/deepmerge/pull/46)
|
||||
|
||||
# [1.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.0)
|
||||
|
||||
- allow consumers to specify their own array merging algorithm: [Pull request 37](https://github.com/TehShrike/deepmerge/pull/37)
|
||||
|
||||
# [1.0.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.3)
|
||||
|
||||
- adding bower.json back: [Issue 38](https://github.com/TehShrike/deepmerge/pull/38)
|
||||
- updating keywords and Github links in package.json [bc3898e](https://github.com/TehShrike/deepmerge/commit/bc3898e587a56f74591328f40f656b0152c1d5eb)
|
||||
|
||||
# [1.0.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.2)
|
||||
|
||||
- Updating the readme: dropping bower, testing that the example works: [7102fc](https://github.com/TehShrike/deepmerge/commit/7102fcc4ddec11e2d33205866f9f18df14e5aeb5)
|
||||
|
||||
# [1.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.1)
|
||||
|
||||
- `null`, dates, and regular expressions are now properly merged in arrays: [Issue 18](https://github.com/TehShrike/deepmerge/pull/18), plus commit: [ef1c6b](https://github.com/TehShrike/deepmerge/commit/ef1c6bac8350ba12a24966f0bc7da02560827586)
|
||||
|
||||
# 1.0.0
|
||||
|
||||
- Should only be a patch change, because this module is READY. [Issue 15](https://github.com/TehShrike/deepmerge/issues/15)
|
||||
- Regular expressions are now treated like primitive values when merging: [Issue 30](https://github.com/TehShrike/deepmerge/pull/30)
|
||||
- Dates are now treated like primitives when merging: [Issue 31](https://github.com/TehShrike/deepmerge/issues/31)
|
||||
133
test/imaps/node_modules/deepmerge/dist/cjs.js
generated
vendored
133
test/imaps/node_modules/deepmerge/dist/cjs.js
generated
vendored
@@ -1,133 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var isMergeableObject = function isMergeableObject(value) {
|
||||
return isNonNullObject(value)
|
||||
&& !isSpecial(value)
|
||||
};
|
||||
|
||||
function isNonNullObject(value) {
|
||||
return !!value && typeof value === 'object'
|
||||
}
|
||||
|
||||
function isSpecial(value) {
|
||||
var stringValue = Object.prototype.toString.call(value);
|
||||
|
||||
return stringValue === '[object RegExp]'
|
||||
|| stringValue === '[object Date]'
|
||||
|| isReactElement(value)
|
||||
}
|
||||
|
||||
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
||||
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
||||
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
||||
|
||||
function isReactElement(value) {
|
||||
return value.$$typeof === REACT_ELEMENT_TYPE
|
||||
}
|
||||
|
||||
function emptyTarget(val) {
|
||||
return Array.isArray(val) ? [] : {}
|
||||
}
|
||||
|
||||
function cloneUnlessOtherwiseSpecified(value, options) {
|
||||
return (options.clone !== false && options.isMergeableObject(value))
|
||||
? deepmerge(emptyTarget(value), value, options)
|
||||
: value
|
||||
}
|
||||
|
||||
function defaultArrayMerge(target, source, options) {
|
||||
return target.concat(source).map(function(element) {
|
||||
return cloneUnlessOtherwiseSpecified(element, options)
|
||||
})
|
||||
}
|
||||
|
||||
function getMergeFunction(key, options) {
|
||||
if (!options.customMerge) {
|
||||
return deepmerge
|
||||
}
|
||||
var customMerge = options.customMerge(key);
|
||||
return typeof customMerge === 'function' ? customMerge : deepmerge
|
||||
}
|
||||
|
||||
function getEnumerableOwnPropertySymbols(target) {
|
||||
return Object.getOwnPropertySymbols
|
||||
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
||||
return Object.propertyIsEnumerable.call(target, symbol)
|
||||
})
|
||||
: []
|
||||
}
|
||||
|
||||
function getKeys(target) {
|
||||
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
||||
}
|
||||
|
||||
function propertyIsOnObject(object, property) {
|
||||
try {
|
||||
return property in object
|
||||
} catch(_) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
||||
function propertyIsUnsafe(target, key) {
|
||||
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
||||
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
||||
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
||||
}
|
||||
|
||||
function mergeObject(target, source, options) {
|
||||
var destination = {};
|
||||
if (options.isMergeableObject(target)) {
|
||||
getKeys(target).forEach(function(key) {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
||||
});
|
||||
}
|
||||
getKeys(source).forEach(function(key) {
|
||||
if (propertyIsUnsafe(target, key)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
||||
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
||||
} else {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
||||
}
|
||||
});
|
||||
return destination
|
||||
}
|
||||
|
||||
function deepmerge(target, source, options) {
|
||||
options = options || {};
|
||||
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
||||
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
||||
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
||||
// implementations can use it. The caller may not replace it.
|
||||
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
||||
|
||||
var sourceIsArray = Array.isArray(source);
|
||||
var targetIsArray = Array.isArray(target);
|
||||
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
||||
|
||||
if (!sourceAndTargetTypesMatch) {
|
||||
return cloneUnlessOtherwiseSpecified(source, options)
|
||||
} else if (sourceIsArray) {
|
||||
return options.arrayMerge(target, source, options)
|
||||
} else {
|
||||
return mergeObject(target, source, options)
|
||||
}
|
||||
}
|
||||
|
||||
deepmerge.all = function deepmergeAll(array, options) {
|
||||
if (!Array.isArray(array)) {
|
||||
throw new Error('first argument should be an array')
|
||||
}
|
||||
|
||||
return array.reduce(function(prev, next) {
|
||||
return deepmerge(prev, next, options)
|
||||
}, {})
|
||||
};
|
||||
|
||||
var deepmerge_1 = deepmerge;
|
||||
|
||||
module.exports = deepmerge_1;
|
||||
139
test/imaps/node_modules/deepmerge/dist/umd.js
generated
vendored
139
test/imaps/node_modules/deepmerge/dist/umd.js
generated
vendored
@@ -1,139 +0,0 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.deepmerge = factory());
|
||||
}(this, function () { 'use strict';
|
||||
|
||||
var isMergeableObject = function isMergeableObject(value) {
|
||||
return isNonNullObject(value)
|
||||
&& !isSpecial(value)
|
||||
};
|
||||
|
||||
function isNonNullObject(value) {
|
||||
return !!value && typeof value === 'object'
|
||||
}
|
||||
|
||||
function isSpecial(value) {
|
||||
var stringValue = Object.prototype.toString.call(value);
|
||||
|
||||
return stringValue === '[object RegExp]'
|
||||
|| stringValue === '[object Date]'
|
||||
|| isReactElement(value)
|
||||
}
|
||||
|
||||
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
||||
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
||||
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
||||
|
||||
function isReactElement(value) {
|
||||
return value.$$typeof === REACT_ELEMENT_TYPE
|
||||
}
|
||||
|
||||
function emptyTarget(val) {
|
||||
return Array.isArray(val) ? [] : {}
|
||||
}
|
||||
|
||||
function cloneUnlessOtherwiseSpecified(value, options) {
|
||||
return (options.clone !== false && options.isMergeableObject(value))
|
||||
? deepmerge(emptyTarget(value), value, options)
|
||||
: value
|
||||
}
|
||||
|
||||
function defaultArrayMerge(target, source, options) {
|
||||
return target.concat(source).map(function(element) {
|
||||
return cloneUnlessOtherwiseSpecified(element, options)
|
||||
})
|
||||
}
|
||||
|
||||
function getMergeFunction(key, options) {
|
||||
if (!options.customMerge) {
|
||||
return deepmerge
|
||||
}
|
||||
var customMerge = options.customMerge(key);
|
||||
return typeof customMerge === 'function' ? customMerge : deepmerge
|
||||
}
|
||||
|
||||
function getEnumerableOwnPropertySymbols(target) {
|
||||
return Object.getOwnPropertySymbols
|
||||
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
||||
return Object.propertyIsEnumerable.call(target, symbol)
|
||||
})
|
||||
: []
|
||||
}
|
||||
|
||||
function getKeys(target) {
|
||||
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
||||
}
|
||||
|
||||
function propertyIsOnObject(object, property) {
|
||||
try {
|
||||
return property in object
|
||||
} catch(_) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
||||
function propertyIsUnsafe(target, key) {
|
||||
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
||||
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
||||
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
||||
}
|
||||
|
||||
function mergeObject(target, source, options) {
|
||||
var destination = {};
|
||||
if (options.isMergeableObject(target)) {
|
||||
getKeys(target).forEach(function(key) {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
||||
});
|
||||
}
|
||||
getKeys(source).forEach(function(key) {
|
||||
if (propertyIsUnsafe(target, key)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
||||
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
||||
} else {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
||||
}
|
||||
});
|
||||
return destination
|
||||
}
|
||||
|
||||
function deepmerge(target, source, options) {
|
||||
options = options || {};
|
||||
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
||||
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
||||
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
||||
// implementations can use it. The caller may not replace it.
|
||||
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
||||
|
||||
var sourceIsArray = Array.isArray(source);
|
||||
var targetIsArray = Array.isArray(target);
|
||||
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
||||
|
||||
if (!sourceAndTargetTypesMatch) {
|
||||
return cloneUnlessOtherwiseSpecified(source, options)
|
||||
} else if (sourceIsArray) {
|
||||
return options.arrayMerge(target, source, options)
|
||||
} else {
|
||||
return mergeObject(target, source, options)
|
||||
}
|
||||
}
|
||||
|
||||
deepmerge.all = function deepmergeAll(array, options) {
|
||||
if (!Array.isArray(array)) {
|
||||
throw new Error('first argument should be an array')
|
||||
}
|
||||
|
||||
return array.reduce(function(prev, next) {
|
||||
return deepmerge(prev, next, options)
|
||||
}, {})
|
||||
};
|
||||
|
||||
var deepmerge_1 = deepmerge;
|
||||
|
||||
return deepmerge_1;
|
||||
|
||||
}));
|
||||
20
test/imaps/node_modules/deepmerge/index.d.ts
generated
vendored
20
test/imaps/node_modules/deepmerge/index.d.ts
generated
vendored
@@ -1,20 +0,0 @@
|
||||
declare function deepmerge<T>(x: Partial<T>, y: Partial<T>, options?: deepmerge.Options): T;
|
||||
declare function deepmerge<T1, T2>(x: Partial<T1>, y: Partial<T2>, options?: deepmerge.Options): T1 & T2;
|
||||
|
||||
declare namespace deepmerge {
|
||||
export interface Options {
|
||||
arrayMerge?(target: any[], source: any[], options?: ArrayMergeOptions): any[];
|
||||
clone?: boolean;
|
||||
customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined;
|
||||
isMergeableObject?(value: object): boolean;
|
||||
}
|
||||
export interface ArrayMergeOptions {
|
||||
isMergeableObject(value: object): boolean;
|
||||
cloneUnlessOtherwiseSpecified(value: object, options?: Options): object;
|
||||
}
|
||||
|
||||
export function all (objects: object[], options?: Options): object;
|
||||
export function all<T> (objects: Partial<T>[], options?: Options): T;
|
||||
}
|
||||
|
||||
export = deepmerge;
|
||||
106
test/imaps/node_modules/deepmerge/index.js
generated
vendored
106
test/imaps/node_modules/deepmerge/index.js
generated
vendored
@@ -1,106 +0,0 @@
|
||||
var defaultIsMergeableObject = require('is-mergeable-object')
|
||||
|
||||
function emptyTarget(val) {
|
||||
return Array.isArray(val) ? [] : {}
|
||||
}
|
||||
|
||||
function cloneUnlessOtherwiseSpecified(value, options) {
|
||||
return (options.clone !== false && options.isMergeableObject(value))
|
||||
? deepmerge(emptyTarget(value), value, options)
|
||||
: value
|
||||
}
|
||||
|
||||
function defaultArrayMerge(target, source, options) {
|
||||
return target.concat(source).map(function(element) {
|
||||
return cloneUnlessOtherwiseSpecified(element, options)
|
||||
})
|
||||
}
|
||||
|
||||
function getMergeFunction(key, options) {
|
||||
if (!options.customMerge) {
|
||||
return deepmerge
|
||||
}
|
||||
var customMerge = options.customMerge(key)
|
||||
return typeof customMerge === 'function' ? customMerge : deepmerge
|
||||
}
|
||||
|
||||
function getEnumerableOwnPropertySymbols(target) {
|
||||
return Object.getOwnPropertySymbols
|
||||
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
||||
return Object.propertyIsEnumerable.call(target, symbol)
|
||||
})
|
||||
: []
|
||||
}
|
||||
|
||||
function getKeys(target) {
|
||||
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
||||
}
|
||||
|
||||
function propertyIsOnObject(object, property) {
|
||||
try {
|
||||
return property in object
|
||||
} catch(_) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
||||
function propertyIsUnsafe(target, key) {
|
||||
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
||||
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
||||
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
||||
}
|
||||
|
||||
function mergeObject(target, source, options) {
|
||||
var destination = {}
|
||||
if (options.isMergeableObject(target)) {
|
||||
getKeys(target).forEach(function(key) {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)
|
||||
})
|
||||
}
|
||||
getKeys(source).forEach(function(key) {
|
||||
if (propertyIsUnsafe(target, key)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
||||
destination[key] = getMergeFunction(key, options)(target[key], source[key], options)
|
||||
} else {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options)
|
||||
}
|
||||
})
|
||||
return destination
|
||||
}
|
||||
|
||||
function deepmerge(target, source, options) {
|
||||
options = options || {}
|
||||
options.arrayMerge = options.arrayMerge || defaultArrayMerge
|
||||
options.isMergeableObject = options.isMergeableObject || defaultIsMergeableObject
|
||||
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
||||
// implementations can use it. The caller may not replace it.
|
||||
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified
|
||||
|
||||
var sourceIsArray = Array.isArray(source)
|
||||
var targetIsArray = Array.isArray(target)
|
||||
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray
|
||||
|
||||
if (!sourceAndTargetTypesMatch) {
|
||||
return cloneUnlessOtherwiseSpecified(source, options)
|
||||
} else if (sourceIsArray) {
|
||||
return options.arrayMerge(target, source, options)
|
||||
} else {
|
||||
return mergeObject(target, source, options)
|
||||
}
|
||||
}
|
||||
|
||||
deepmerge.all = function deepmergeAll(array, options) {
|
||||
if (!Array.isArray(array)) {
|
||||
throw new Error('first argument should be an array')
|
||||
}
|
||||
|
||||
return array.reduce(function(prev, next) {
|
||||
return deepmerge(prev, next, options)
|
||||
}, {})
|
||||
}
|
||||
|
||||
module.exports = deepmerge
|
||||
21
test/imaps/node_modules/deepmerge/license.txt
generated
vendored
21
test/imaps/node_modules/deepmerge/license.txt
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
|
||||
|
||||
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.
|
||||
42
test/imaps/node_modules/deepmerge/package.json
generated
vendored
42
test/imaps/node_modules/deepmerge/package.json
generated
vendored
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "deepmerge",
|
||||
"description": "A library for deep (recursive) merging of Javascript objects",
|
||||
"keywords": [
|
||||
"merge",
|
||||
"deep",
|
||||
"extend",
|
||||
"copy",
|
||||
"clone",
|
||||
"recursive"
|
||||
],
|
||||
"version": "4.3.1",
|
||||
"homepage": "https://github.com/TehShrike/deepmerge",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TehShrike/deepmerge.git"
|
||||
},
|
||||
"main": "dist/cjs.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"test": "npm run build && tape test/*.js && jsmd readme.md && npm run test:typescript",
|
||||
"test:typescript": "tsc --noEmit test/typescript.ts && ts-node test/typescript.ts",
|
||||
"size": "npm run build && uglifyjs --compress --mangle -- ./dist/umd.js | gzip -c | wc -c"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^8.10.54",
|
||||
"is-mergeable-object": "1.1.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"jsmd": "^1.0.2",
|
||||
"rollup": "^1.23.1",
|
||||
"rollup-plugin-commonjs": "^10.1.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"tape": "^4.11.0",
|
||||
"ts-node": "7.0.1",
|
||||
"typescript": "=2.2.2",
|
||||
"uglify-js": "^3.6.1"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
264
test/imaps/node_modules/deepmerge/readme.md
generated
vendored
264
test/imaps/node_modules/deepmerge/readme.md
generated
vendored
@@ -1,264 +0,0 @@
|
||||
# deepmerge
|
||||
|
||||
Merges the enumerable properties of two or more objects deeply.
|
||||
|
||||
> UMD bundle is 723B minified+gzipped
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Example Usage
|
||||
<!--js
|
||||
const merge = require('./')
|
||||
-->
|
||||
|
||||
```js
|
||||
const x = {
|
||||
foo: { bar: 3 },
|
||||
array: [{
|
||||
does: 'work',
|
||||
too: [ 1, 2, 3 ]
|
||||
}]
|
||||
}
|
||||
|
||||
const y = {
|
||||
foo: { baz: 4 },
|
||||
quux: 5,
|
||||
array: [{
|
||||
does: 'work',
|
||||
too: [ 4, 5, 6 ]
|
||||
}, {
|
||||
really: 'yes'
|
||||
}]
|
||||
}
|
||||
|
||||
const output = {
|
||||
foo: {
|
||||
bar: 3,
|
||||
baz: 4
|
||||
},
|
||||
array: [{
|
||||
does: 'work',
|
||||
too: [ 1, 2, 3 ]
|
||||
}, {
|
||||
does: 'work',
|
||||
too: [ 4, 5, 6 ]
|
||||
}, {
|
||||
really: 'yes'
|
||||
}],
|
||||
quux: 5
|
||||
}
|
||||
|
||||
merge(x, y) // => output
|
||||
```
|
||||
|
||||
|
||||
### Installation
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```sh
|
||||
npm install deepmerge
|
||||
```
|
||||
|
||||
deepmerge can be used directly in the browser without the use of package managers/bundlers as well: [UMD version from unpkg.com](https://unpkg.com/deepmerge/dist/umd.js).
|
||||
|
||||
|
||||
### Include
|
||||
|
||||
deepmerge exposes a CommonJS entry point:
|
||||
|
||||
```
|
||||
const merge = require('deepmerge')
|
||||
```
|
||||
|
||||
The ESM entry point was dropped due to a [Webpack bug](https://github.com/webpack/webpack/issues/6584).
|
||||
|
||||
# API
|
||||
|
||||
|
||||
## `merge(x, y, [options])`
|
||||
|
||||
Merge two objects `x` and `y` deeply, returning a new merged object with the
|
||||
elements from both `x` and `y`.
|
||||
|
||||
If an element at the same key is present for both `x` and `y`, the value from
|
||||
`y` will appear in the result.
|
||||
|
||||
Merging creates a new object, so that neither `x` or `y` is modified.
|
||||
|
||||
**Note:** By default, arrays are merged by concatenating them.
|
||||
|
||||
## `merge.all(arrayOfObjects, [options])`
|
||||
|
||||
Merges any number of objects into a single result object.
|
||||
|
||||
```js
|
||||
const foobar = { foo: { bar: 3 } }
|
||||
const foobaz = { foo: { baz: 4 } }
|
||||
const bar = { bar: 'yay!' }
|
||||
|
||||
merge.all([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' }
|
||||
```
|
||||
|
||||
|
||||
## Options
|
||||
|
||||
### `arrayMerge`
|
||||
|
||||
There are multiple ways to merge two arrays, below are a few examples but you can also create your own custom function.
|
||||
|
||||
Your `arrayMerge` function will be called with three arguments: a `target` array, the `source` array, and an `options` object with these properties:
|
||||
|
||||
- `isMergeableObject(value)`
|
||||
- `cloneUnlessOtherwiseSpecified(value, options)`
|
||||
|
||||
#### `arrayMerge` example: overwrite target array
|
||||
|
||||
Overwrites the existing array values completely rather than concatenating them:
|
||||
|
||||
```js
|
||||
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray
|
||||
|
||||
merge(
|
||||
[1, 2, 3],
|
||||
[3, 2, 1],
|
||||
{ arrayMerge: overwriteMerge }
|
||||
) // => [3, 2, 1]
|
||||
```
|
||||
|
||||
#### `arrayMerge` example: combine arrays
|
||||
|
||||
Combines objects at the same index in the two arrays.
|
||||
|
||||
This was the default array merging algorithm pre-version-2.0.0.
|
||||
|
||||
```js
|
||||
const combineMerge = (target, source, options) => {
|
||||
const destination = target.slice()
|
||||
|
||||
source.forEach((item, index) => {
|
||||
if (typeof destination[index] === 'undefined') {
|
||||
destination[index] = options.cloneUnlessOtherwiseSpecified(item, options)
|
||||
} else if (options.isMergeableObject(item)) {
|
||||
destination[index] = merge(target[index], item, options)
|
||||
} else if (target.indexOf(item) === -1) {
|
||||
destination.push(item)
|
||||
}
|
||||
})
|
||||
return destination
|
||||
}
|
||||
|
||||
merge(
|
||||
[{ a: true }],
|
||||
[{ b: true }, 'ah yup'],
|
||||
{ arrayMerge: combineMerge }
|
||||
) // => [{ a: true, b: true }, 'ah yup']
|
||||
```
|
||||
|
||||
### `isMergeableObject`
|
||||
|
||||
By default, deepmerge clones every property from almost every kind of object.
|
||||
|
||||
You may not want this, if your objects are of special types, and you want to copy the whole object instead of just copying its properties.
|
||||
|
||||
You can accomplish this by passing in a function for the `isMergeableObject` option.
|
||||
|
||||
If you only want to clone properties of plain objects, and ignore all "special" kinds of instantiated objects, you probably want to drop in [`is-plain-object`](https://github.com/jonschlinkert/is-plain-object).
|
||||
|
||||
```js
|
||||
const { isPlainObject } = require('is-plain-object')
|
||||
|
||||
function SuperSpecial() {
|
||||
this.special = 'oh yeah man totally'
|
||||
}
|
||||
|
||||
const instantiatedSpecialObject = new SuperSpecial()
|
||||
|
||||
const target = {
|
||||
someProperty: {
|
||||
cool: 'oh for sure'
|
||||
}
|
||||
}
|
||||
|
||||
const source = {
|
||||
someProperty: instantiatedSpecialObject
|
||||
}
|
||||
|
||||
const defaultOutput = merge(target, source)
|
||||
|
||||
defaultOutput.someProperty.cool // => 'oh for sure'
|
||||
defaultOutput.someProperty.special // => 'oh yeah man totally'
|
||||
defaultOutput.someProperty instanceof SuperSpecial // => false
|
||||
|
||||
const customMergeOutput = merge(target, source, {
|
||||
isMergeableObject: isPlainObject
|
||||
})
|
||||
|
||||
customMergeOutput.someProperty.cool // => undefined
|
||||
customMergeOutput.someProperty.special // => 'oh yeah man totally'
|
||||
customMergeOutput.someProperty instanceof SuperSpecial // => true
|
||||
```
|
||||
|
||||
### `customMerge`
|
||||
|
||||
Specifies a function which can be used to override the default merge behavior for a property, based on the property name.
|
||||
|
||||
The `customMerge` function will be passed the key for each property, and should return the function which should be used to merge the values for that property.
|
||||
|
||||
It may also return undefined, in which case the default merge behaviour will be used.
|
||||
|
||||
```js
|
||||
const alex = {
|
||||
name: {
|
||||
first: 'Alex',
|
||||
last: 'Alexson'
|
||||
},
|
||||
pets: ['Cat', 'Parrot']
|
||||
}
|
||||
|
||||
const tony = {
|
||||
name: {
|
||||
first: 'Tony',
|
||||
last: 'Tonison'
|
||||
},
|
||||
pets: ['Dog']
|
||||
}
|
||||
|
||||
const mergeNames = (nameA, nameB) => `${nameA.first} and ${nameB.first}`
|
||||
|
||||
const options = {
|
||||
customMerge: (key) => {
|
||||
if (key === 'name') {
|
||||
return mergeNames
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const result = merge(alex, tony, options)
|
||||
|
||||
result.name // => 'Alex and Tony'
|
||||
result.pets // => ['Cat', 'Parrot', 'Dog']
|
||||
```
|
||||
|
||||
|
||||
### `clone`
|
||||
|
||||
*Deprecated.*
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
If `clone` is `false` then child objects will be copied directly instead of being cloned. This was the default behavior before version 2.x.
|
||||
|
||||
|
||||
# Testing
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
|
||||
|
||||
# License
|
||||
|
||||
MIT
|
||||
22
test/imaps/node_modules/deepmerge/rollup.config.js
generated
vendored
22
test/imaps/node_modules/deepmerge/rollup.config.js
generated
vendored
@@ -1,22 +0,0 @@
|
||||
import resolve from 'rollup-plugin-node-resolve'
|
||||
import commonjs from 'rollup-plugin-commonjs'
|
||||
import pkg from './package.json'
|
||||
|
||||
export default {
|
||||
input: `index.js`,
|
||||
plugins: [
|
||||
commonjs(),
|
||||
resolve(),
|
||||
],
|
||||
output: [
|
||||
{
|
||||
file: pkg.main,
|
||||
format: `cjs`
|
||||
},
|
||||
{
|
||||
name: 'deepmerge',
|
||||
file: 'dist/umd.js',
|
||||
format: `umd`
|
||||
},
|
||||
],
|
||||
}
|
||||
11
test/imaps/node_modules/dom-serializer/LICENSE
generated
vendored
11
test/imaps/node_modules/dom-serializer/LICENSE
generated
vendored
@@ -1,11 +0,0 @@
|
||||
License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 The cheeriojs contributors
|
||||
|
||||
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.
|
||||
109
test/imaps/node_modules/dom-serializer/README.md
generated
vendored
109
test/imaps/node_modules/dom-serializer/README.md
generated
vendored
@@ -1,109 +0,0 @@
|
||||
# dom-serializer [](https://travis-ci.com/cheeriojs/dom-serializer)
|
||||
|
||||
Renders a [domhandler](https://github.com/fb55/domhandler) DOM node or an array of domhandler DOM nodes to a string.
|
||||
|
||||
```js
|
||||
import render from "dom-serializer";
|
||||
|
||||
// OR
|
||||
|
||||
const render = require("dom-serializer").default;
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
## `render`
|
||||
|
||||
▸ **render**(`node`: Node \| Node[], `options?`: [_Options_](#Options)): _string_
|
||||
|
||||
Renders a DOM node or an array of DOM nodes to a string.
|
||||
|
||||
Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
|
||||
|
||||
#### Parameters:
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :-------- | :--------------------------------- | :------------ | :----------------------------- |
|
||||
| `node` | Node \| Node[] | - | Node to be rendered. |
|
||||
| `options` | [_DomSerializerOptions_](#Options) | {} | Changes serialization behavior |
|
||||
|
||||
**Returns:** _string_
|
||||
|
||||
## Options
|
||||
|
||||
### `encodeEntities`
|
||||
|
||||
• `Optional` **decodeEntities**: _boolean | "utf8"_
|
||||
|
||||
Encode characters that are either reserved in HTML or XML.
|
||||
|
||||
If `xmlMode` is `true` or the value not `'utf8'`, characters outside of the utf8 range will be encoded as well.
|
||||
|
||||
**`default`** `decodeEntities`
|
||||
|
||||
---
|
||||
|
||||
### `decodeEntities`
|
||||
|
||||
• `Optional` **decodeEntities**: _boolean_
|
||||
|
||||
Option inherited from parsing; will be used as the default value for `encodeEntities`.
|
||||
|
||||
**`default`** true
|
||||
|
||||
---
|
||||
|
||||
### `emptyAttrs`
|
||||
|
||||
• `Optional` **emptyAttrs**: _boolean_
|
||||
|
||||
Print an empty attribute's value.
|
||||
|
||||
**`default`** xmlMode
|
||||
|
||||
**`example`** With <code>emptyAttrs: false</code>: <code><input checked></code>
|
||||
|
||||
**`example`** With <code>emptyAttrs: true</code>: <code><input checked=""></code>
|
||||
|
||||
---
|
||||
|
||||
### `selfClosingTags`
|
||||
|
||||
• `Optional` **selfClosingTags**: _boolean_
|
||||
|
||||
Print self-closing tags for tags without contents.
|
||||
|
||||
**`default`** xmlMode
|
||||
|
||||
**`example`** With <code>selfClosingTags: false</code>: <code><foo></foo></code>
|
||||
|
||||
**`example`** With <code>selfClosingTags: true</code>: <code><foo /></code>
|
||||
|
||||
---
|
||||
|
||||
### `xmlMode`
|
||||
|
||||
• `Optional` **xmlMode**: _boolean_ \| _"foreign"_
|
||||
|
||||
Treat the input as an XML document; enables the `emptyAttrs` and `selfClosingTags` options.
|
||||
|
||||
If the value is `"foreign"`, it will try to correct mixed-case attribute names.
|
||||
|
||||
**`default`** false
|
||||
|
||||
---
|
||||
|
||||
## Ecosystem
|
||||
|
||||
| Name | Description |
|
||||
| ------------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| [htmlparser2](https://github.com/fb55/htmlparser2) | Fast & forgiving HTML/XML parser |
|
||||
| [domhandler](https://github.com/fb55/domhandler) | Handler for htmlparser2 that turns documents into a DOM |
|
||||
| [domutils](https://github.com/fb55/domutils) | Utilities for working with domhandler's DOM |
|
||||
| [css-select](https://github.com/fb55/css-select) | CSS selector engine, compatible with domhandler's DOM |
|
||||
| [cheerio](https://github.com/cheeriojs/cheerio) | The jQuery API for domhandler's DOM |
|
||||
| [dom-serializer](https://github.com/cheeriojs/dom-serializer) | Serializer for domhandler's DOM |
|
||||
|
||||
---
|
||||
|
||||
LICENSE: MIT
|
||||
3
test/imaps/node_modules/dom-serializer/lib/esm/foreignNames.d.ts
generated
vendored
3
test/imaps/node_modules/dom-serializer/lib/esm/foreignNames.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
export declare const elementNames: Map<string, string>;
|
||||
export declare const attributeNames: Map<string, string>;
|
||||
//# sourceMappingURL=foreignNames.d.ts.map
|
||||
1
test/imaps/node_modules/dom-serializer/lib/esm/foreignNames.d.ts.map
generated
vendored
1
test/imaps/node_modules/dom-serializer/lib/esm/foreignNames.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"foreignNames.d.ts","sourceRoot":"","sources":["../../src/foreignNames.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,qBAwCxB,CAAC;AACF,eAAO,MAAM,cAAc,qBA8D1B,CAAC"}
|
||||
100
test/imaps/node_modules/dom-serializer/lib/esm/foreignNames.js
generated
vendored
100
test/imaps/node_modules/dom-serializer/lib/esm/foreignNames.js
generated
vendored
@@ -1,100 +0,0 @@
|
||||
export const elementNames = new Map([
|
||||
"altGlyph",
|
||||
"altGlyphDef",
|
||||
"altGlyphItem",
|
||||
"animateColor",
|
||||
"animateMotion",
|
||||
"animateTransform",
|
||||
"clipPath",
|
||||
"feBlend",
|
||||
"feColorMatrix",
|
||||
"feComponentTransfer",
|
||||
"feComposite",
|
||||
"feConvolveMatrix",
|
||||
"feDiffuseLighting",
|
||||
"feDisplacementMap",
|
||||
"feDistantLight",
|
||||
"feDropShadow",
|
||||
"feFlood",
|
||||
"feFuncA",
|
||||
"feFuncB",
|
||||
"feFuncG",
|
||||
"feFuncR",
|
||||
"feGaussianBlur",
|
||||
"feImage",
|
||||
"feMerge",
|
||||
"feMergeNode",
|
||||
"feMorphology",
|
||||
"feOffset",
|
||||
"fePointLight",
|
||||
"feSpecularLighting",
|
||||
"feSpotLight",
|
||||
"feTile",
|
||||
"feTurbulence",
|
||||
"foreignObject",
|
||||
"glyphRef",
|
||||
"linearGradient",
|
||||
"radialGradient",
|
||||
"textPath",
|
||||
].map((val) => [val.toLowerCase(), val]));
|
||||
export const attributeNames = new Map([
|
||||
"definitionURL",
|
||||
"attributeName",
|
||||
"attributeType",
|
||||
"baseFrequency",
|
||||
"baseProfile",
|
||||
"calcMode",
|
||||
"clipPathUnits",
|
||||
"diffuseConstant",
|
||||
"edgeMode",
|
||||
"filterUnits",
|
||||
"glyphRef",
|
||||
"gradientTransform",
|
||||
"gradientUnits",
|
||||
"kernelMatrix",
|
||||
"kernelUnitLength",
|
||||
"keyPoints",
|
||||
"keySplines",
|
||||
"keyTimes",
|
||||
"lengthAdjust",
|
||||
"limitingConeAngle",
|
||||
"markerHeight",
|
||||
"markerUnits",
|
||||
"markerWidth",
|
||||
"maskContentUnits",
|
||||
"maskUnits",
|
||||
"numOctaves",
|
||||
"pathLength",
|
||||
"patternContentUnits",
|
||||
"patternTransform",
|
||||
"patternUnits",
|
||||
"pointsAtX",
|
||||
"pointsAtY",
|
||||
"pointsAtZ",
|
||||
"preserveAlpha",
|
||||
"preserveAspectRatio",
|
||||
"primitiveUnits",
|
||||
"refX",
|
||||
"refY",
|
||||
"repeatCount",
|
||||
"repeatDur",
|
||||
"requiredExtensions",
|
||||
"requiredFeatures",
|
||||
"specularConstant",
|
||||
"specularExponent",
|
||||
"spreadMethod",
|
||||
"startOffset",
|
||||
"stdDeviation",
|
||||
"stitchTiles",
|
||||
"surfaceScale",
|
||||
"systemLanguage",
|
||||
"tableValues",
|
||||
"targetX",
|
||||
"targetY",
|
||||
"textLength",
|
||||
"viewBox",
|
||||
"viewTarget",
|
||||
"xChannelSelector",
|
||||
"yChannelSelector",
|
||||
"zoomAndPan",
|
||||
].map((val) => [val.toLowerCase(), val]));
|
||||
52
test/imaps/node_modules/dom-serializer/lib/esm/index.d.ts
generated
vendored
52
test/imaps/node_modules/dom-serializer/lib/esm/index.d.ts
generated
vendored
@@ -1,52 +0,0 @@
|
||||
import type { AnyNode } from "domhandler";
|
||||
export interface DomSerializerOptions {
|
||||
/**
|
||||
* Print an empty attribute's value.
|
||||
*
|
||||
* @default xmlMode
|
||||
* @example With <code>emptyAttrs: false</code>: <code><input checked></code>
|
||||
* @example With <code>emptyAttrs: true</code>: <code><input checked=""></code>
|
||||
*/
|
||||
emptyAttrs?: boolean;
|
||||
/**
|
||||
* Print self-closing tags for tags without contents.
|
||||
*
|
||||
* @default xmlMode
|
||||
* @example With <code>selfClosingTags: false</code>: <code><foo></foo></code>
|
||||
* @example With <code>selfClosingTags: true</code>: <code><foo /></code>
|
||||
*/
|
||||
selfClosingTags?: boolean;
|
||||
/**
|
||||
* Treat the input as an XML document; enables the `emptyAttrs` and `selfClosingTags` options.
|
||||
*
|
||||
* If the value is `"foreign"`, it will try to correct mixed-case attribute names.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
xmlMode?: boolean | "foreign";
|
||||
/**
|
||||
* Encode characters that are either reserved in HTML or XML.
|
||||
*
|
||||
* If `xmlMode` is `true` or the value not `'utf8'`, characters outside of the utf8 range will be encoded as well.
|
||||
*
|
||||
* @default `decodeEntities`
|
||||
*/
|
||||
encodeEntities?: boolean | "utf8";
|
||||
/**
|
||||
* Option inherited from parsing; will be used as the default value for `encodeEntities`.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
decodeEntities?: boolean;
|
||||
}
|
||||
/**
|
||||
* Renders a DOM node or an array of DOM nodes to a string.
|
||||
*
|
||||
* Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
|
||||
*
|
||||
* @param node Node to be rendered.
|
||||
* @param options Changes serialization behavior
|
||||
*/
|
||||
export declare function render(node: AnyNode | ArrayLike<AnyNode>, options?: DomSerializerOptions): string;
|
||||
export default render;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
test/imaps/node_modules/dom-serializer/lib/esm/index.d.ts.map
generated
vendored
1
test/imaps/node_modules/dom-serializer/lib/esm/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA4ED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,EAClC,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAUR;AAED,eAAe,MAAM,CAAC"}
|
||||
190
test/imaps/node_modules/dom-serializer/lib/esm/index.js
generated
vendored
190
test/imaps/node_modules/dom-serializer/lib/esm/index.js
generated
vendored
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
* Module dependencies
|
||||
*/
|
||||
import * as ElementType from "domelementtype";
|
||||
import { encodeXML, escapeAttribute, escapeText } from "entities";
|
||||
/**
|
||||
* Mixed-case SVG and MathML tags & attributes
|
||||
* recognized by the HTML parser.
|
||||
*
|
||||
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
|
||||
*/
|
||||
import { elementNames, attributeNames } from "./foreignNames.js";
|
||||
const unencodedElements = new Set([
|
||||
"style",
|
||||
"script",
|
||||
"xmp",
|
||||
"iframe",
|
||||
"noembed",
|
||||
"noframes",
|
||||
"plaintext",
|
||||
"noscript",
|
||||
]);
|
||||
function replaceQuotes(value) {
|
||||
return value.replace(/"/g, """);
|
||||
}
|
||||
/**
|
||||
* Format attributes
|
||||
*/
|
||||
function formatAttributes(attributes, opts) {
|
||||
var _a;
|
||||
if (!attributes)
|
||||
return;
|
||||
const encode = ((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) === false
|
||||
? replaceQuotes
|
||||
: opts.xmlMode || opts.encodeEntities !== "utf8"
|
||||
? encodeXML
|
||||
: escapeAttribute;
|
||||
return Object.keys(attributes)
|
||||
.map((key) => {
|
||||
var _a, _b;
|
||||
const value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : "";
|
||||
if (opts.xmlMode === "foreign") {
|
||||
/* Fix up mixed-case attribute names */
|
||||
key = (_b = attributeNames.get(key)) !== null && _b !== void 0 ? _b : key;
|
||||
}
|
||||
if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
|
||||
return key;
|
||||
}
|
||||
return `${key}="${encode(value)}"`;
|
||||
})
|
||||
.join(" ");
|
||||
}
|
||||
/**
|
||||
* Self-enclosing tags
|
||||
*/
|
||||
const singleTag = new Set([
|
||||
"area",
|
||||
"base",
|
||||
"basefont",
|
||||
"br",
|
||||
"col",
|
||||
"command",
|
||||
"embed",
|
||||
"frame",
|
||||
"hr",
|
||||
"img",
|
||||
"input",
|
||||
"isindex",
|
||||
"keygen",
|
||||
"link",
|
||||
"meta",
|
||||
"param",
|
||||
"source",
|
||||
"track",
|
||||
"wbr",
|
||||
]);
|
||||
/**
|
||||
* Renders a DOM node or an array of DOM nodes to a string.
|
||||
*
|
||||
* Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
|
||||
*
|
||||
* @param node Node to be rendered.
|
||||
* @param options Changes serialization behavior
|
||||
*/
|
||||
export function render(node, options = {}) {
|
||||
const nodes = "length" in node ? node : [node];
|
||||
let output = "";
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
output += renderNode(nodes[i], options);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
export default render;
|
||||
function renderNode(node, options) {
|
||||
switch (node.type) {
|
||||
case ElementType.Root:
|
||||
return render(node.children, options);
|
||||
// @ts-expect-error We don't use `Doctype` yet
|
||||
case ElementType.Doctype:
|
||||
case ElementType.Directive:
|
||||
return renderDirective(node);
|
||||
case ElementType.Comment:
|
||||
return renderComment(node);
|
||||
case ElementType.CDATA:
|
||||
return renderCdata(node);
|
||||
case ElementType.Script:
|
||||
case ElementType.Style:
|
||||
case ElementType.Tag:
|
||||
return renderTag(node, options);
|
||||
case ElementType.Text:
|
||||
return renderText(node, options);
|
||||
}
|
||||
}
|
||||
const foreignModeIntegrationPoints = new Set([
|
||||
"mi",
|
||||
"mo",
|
||||
"mn",
|
||||
"ms",
|
||||
"mtext",
|
||||
"annotation-xml",
|
||||
"foreignObject",
|
||||
"desc",
|
||||
"title",
|
||||
]);
|
||||
const foreignElements = new Set(["svg", "math"]);
|
||||
function renderTag(elem, opts) {
|
||||
var _a;
|
||||
// Handle SVG / MathML in HTML
|
||||
if (opts.xmlMode === "foreign") {
|
||||
/* Fix up mixed-case element names */
|
||||
elem.name = (_a = elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name;
|
||||
/* Exit foreign mode at integration points */
|
||||
if (elem.parent &&
|
||||
foreignModeIntegrationPoints.has(elem.parent.name)) {
|
||||
opts = { ...opts, xmlMode: false };
|
||||
}
|
||||
}
|
||||
if (!opts.xmlMode && foreignElements.has(elem.name)) {
|
||||
opts = { ...opts, xmlMode: "foreign" };
|
||||
}
|
||||
let tag = `<${elem.name}`;
|
||||
const attribs = formatAttributes(elem.attribs, opts);
|
||||
if (attribs) {
|
||||
tag += ` ${attribs}`;
|
||||
}
|
||||
if (elem.children.length === 0 &&
|
||||
(opts.xmlMode
|
||||
? // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags
|
||||
opts.selfClosingTags !== false
|
||||
: // User explicitly asked for self-closing tags, even in HTML mode
|
||||
opts.selfClosingTags && singleTag.has(elem.name))) {
|
||||
if (!opts.xmlMode)
|
||||
tag += " ";
|
||||
tag += "/>";
|
||||
}
|
||||
else {
|
||||
tag += ">";
|
||||
if (elem.children.length > 0) {
|
||||
tag += render(elem.children, opts);
|
||||
}
|
||||
if (opts.xmlMode || !singleTag.has(elem.name)) {
|
||||
tag += `</${elem.name}>`;
|
||||
}
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
function renderDirective(elem) {
|
||||
return `<${elem.data}>`;
|
||||
}
|
||||
function renderText(elem, opts) {
|
||||
var _a;
|
||||
let data = elem.data || "";
|
||||
// If entities weren't decoded, no need to encode them back
|
||||
if (((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) !== false &&
|
||||
!(!opts.xmlMode &&
|
||||
elem.parent &&
|
||||
unencodedElements.has(elem.parent.name))) {
|
||||
data =
|
||||
opts.xmlMode || opts.encodeEntities !== "utf8"
|
||||
? encodeXML(data)
|
||||
: escapeText(data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
function renderCdata(elem) {
|
||||
return `<![CDATA[${elem.children[0].data}]]>`;
|
||||
}
|
||||
function renderComment(elem) {
|
||||
return `<!--${elem.data}-->`;
|
||||
}
|
||||
1
test/imaps/node_modules/dom-serializer/lib/esm/package.json
generated
vendored
1
test/imaps/node_modules/dom-serializer/lib/esm/package.json
generated
vendored
@@ -1 +0,0 @@
|
||||
{"type":"module"}
|
||||
3
test/imaps/node_modules/dom-serializer/lib/foreignNames.d.ts
generated
vendored
3
test/imaps/node_modules/dom-serializer/lib/foreignNames.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
export declare const elementNames: Map<string, string>;
|
||||
export declare const attributeNames: Map<string, string>;
|
||||
//# sourceMappingURL=foreignNames.d.ts.map
|
||||
1
test/imaps/node_modules/dom-serializer/lib/foreignNames.d.ts.map
generated
vendored
1
test/imaps/node_modules/dom-serializer/lib/foreignNames.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"foreignNames.d.ts","sourceRoot":"","sources":["../src/foreignNames.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,qBAwCxB,CAAC;AACF,eAAO,MAAM,cAAc,qBA8D1B,CAAC"}
|
||||
103
test/imaps/node_modules/dom-serializer/lib/foreignNames.js
generated
vendored
103
test/imaps/node_modules/dom-serializer/lib/foreignNames.js
generated
vendored
@@ -1,103 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.attributeNames = exports.elementNames = void 0;
|
||||
exports.elementNames = new Map([
|
||||
"altGlyph",
|
||||
"altGlyphDef",
|
||||
"altGlyphItem",
|
||||
"animateColor",
|
||||
"animateMotion",
|
||||
"animateTransform",
|
||||
"clipPath",
|
||||
"feBlend",
|
||||
"feColorMatrix",
|
||||
"feComponentTransfer",
|
||||
"feComposite",
|
||||
"feConvolveMatrix",
|
||||
"feDiffuseLighting",
|
||||
"feDisplacementMap",
|
||||
"feDistantLight",
|
||||
"feDropShadow",
|
||||
"feFlood",
|
||||
"feFuncA",
|
||||
"feFuncB",
|
||||
"feFuncG",
|
||||
"feFuncR",
|
||||
"feGaussianBlur",
|
||||
"feImage",
|
||||
"feMerge",
|
||||
"feMergeNode",
|
||||
"feMorphology",
|
||||
"feOffset",
|
||||
"fePointLight",
|
||||
"feSpecularLighting",
|
||||
"feSpotLight",
|
||||
"feTile",
|
||||
"feTurbulence",
|
||||
"foreignObject",
|
||||
"glyphRef",
|
||||
"linearGradient",
|
||||
"radialGradient",
|
||||
"textPath",
|
||||
].map(function (val) { return [val.toLowerCase(), val]; }));
|
||||
exports.attributeNames = new Map([
|
||||
"definitionURL",
|
||||
"attributeName",
|
||||
"attributeType",
|
||||
"baseFrequency",
|
||||
"baseProfile",
|
||||
"calcMode",
|
||||
"clipPathUnits",
|
||||
"diffuseConstant",
|
||||
"edgeMode",
|
||||
"filterUnits",
|
||||
"glyphRef",
|
||||
"gradientTransform",
|
||||
"gradientUnits",
|
||||
"kernelMatrix",
|
||||
"kernelUnitLength",
|
||||
"keyPoints",
|
||||
"keySplines",
|
||||
"keyTimes",
|
||||
"lengthAdjust",
|
||||
"limitingConeAngle",
|
||||
"markerHeight",
|
||||
"markerUnits",
|
||||
"markerWidth",
|
||||
"maskContentUnits",
|
||||
"maskUnits",
|
||||
"numOctaves",
|
||||
"pathLength",
|
||||
"patternContentUnits",
|
||||
"patternTransform",
|
||||
"patternUnits",
|
||||
"pointsAtX",
|
||||
"pointsAtY",
|
||||
"pointsAtZ",
|
||||
"preserveAlpha",
|
||||
"preserveAspectRatio",
|
||||
"primitiveUnits",
|
||||
"refX",
|
||||
"refY",
|
||||
"repeatCount",
|
||||
"repeatDur",
|
||||
"requiredExtensions",
|
||||
"requiredFeatures",
|
||||
"specularConstant",
|
||||
"specularExponent",
|
||||
"spreadMethod",
|
||||
"startOffset",
|
||||
"stdDeviation",
|
||||
"stitchTiles",
|
||||
"surfaceScale",
|
||||
"systemLanguage",
|
||||
"tableValues",
|
||||
"targetX",
|
||||
"targetY",
|
||||
"textLength",
|
||||
"viewBox",
|
||||
"viewTarget",
|
||||
"xChannelSelector",
|
||||
"yChannelSelector",
|
||||
"zoomAndPan",
|
||||
].map(function (val) { return [val.toLowerCase(), val]; }));
|
||||
52
test/imaps/node_modules/dom-serializer/lib/index.d.ts
generated
vendored
52
test/imaps/node_modules/dom-serializer/lib/index.d.ts
generated
vendored
@@ -1,52 +0,0 @@
|
||||
import type { AnyNode } from "domhandler";
|
||||
export interface DomSerializerOptions {
|
||||
/**
|
||||
* Print an empty attribute's value.
|
||||
*
|
||||
* @default xmlMode
|
||||
* @example With <code>emptyAttrs: false</code>: <code><input checked></code>
|
||||
* @example With <code>emptyAttrs: true</code>: <code><input checked=""></code>
|
||||
*/
|
||||
emptyAttrs?: boolean;
|
||||
/**
|
||||
* Print self-closing tags for tags without contents.
|
||||
*
|
||||
* @default xmlMode
|
||||
* @example With <code>selfClosingTags: false</code>: <code><foo></foo></code>
|
||||
* @example With <code>selfClosingTags: true</code>: <code><foo /></code>
|
||||
*/
|
||||
selfClosingTags?: boolean;
|
||||
/**
|
||||
* Treat the input as an XML document; enables the `emptyAttrs` and `selfClosingTags` options.
|
||||
*
|
||||
* If the value is `"foreign"`, it will try to correct mixed-case attribute names.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
xmlMode?: boolean | "foreign";
|
||||
/**
|
||||
* Encode characters that are either reserved in HTML or XML.
|
||||
*
|
||||
* If `xmlMode` is `true` or the value not `'utf8'`, characters outside of the utf8 range will be encoded as well.
|
||||
*
|
||||
* @default `decodeEntities`
|
||||
*/
|
||||
encodeEntities?: boolean | "utf8";
|
||||
/**
|
||||
* Option inherited from parsing; will be used as the default value for `encodeEntities`.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
decodeEntities?: boolean;
|
||||
}
|
||||
/**
|
||||
* Renders a DOM node or an array of DOM nodes to a string.
|
||||
*
|
||||
* Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
|
||||
*
|
||||
* @param node Node to be rendered.
|
||||
* @param options Changes serialization behavior
|
||||
*/
|
||||
export declare function render(node: AnyNode | ArrayLike<AnyNode>, options?: DomSerializerOptions): string;
|
||||
export default render;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
test/imaps/node_modules/dom-serializer/lib/index.d.ts.map
generated
vendored
1
test/imaps/node_modules/dom-serializer/lib/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA4ED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,EAClC,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAUR;AAED,eAAe,MAAM,CAAC"}
|
||||
229
test/imaps/node_modules/dom-serializer/lib/index.js
generated
vendored
229
test/imaps/node_modules/dom-serializer/lib/index.js
generated
vendored
@@ -1,229 +0,0 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.render = void 0;
|
||||
/*
|
||||
* Module dependencies
|
||||
*/
|
||||
var ElementType = __importStar(require("domelementtype"));
|
||||
var entities_1 = require("entities");
|
||||
/**
|
||||
* Mixed-case SVG and MathML tags & attributes
|
||||
* recognized by the HTML parser.
|
||||
*
|
||||
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
|
||||
*/
|
||||
var foreignNames_js_1 = require("./foreignNames.js");
|
||||
var unencodedElements = new Set([
|
||||
"style",
|
||||
"script",
|
||||
"xmp",
|
||||
"iframe",
|
||||
"noembed",
|
||||
"noframes",
|
||||
"plaintext",
|
||||
"noscript",
|
||||
]);
|
||||
function replaceQuotes(value) {
|
||||
return value.replace(/"/g, """);
|
||||
}
|
||||
/**
|
||||
* Format attributes
|
||||
*/
|
||||
function formatAttributes(attributes, opts) {
|
||||
var _a;
|
||||
if (!attributes)
|
||||
return;
|
||||
var encode = ((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) === false
|
||||
? replaceQuotes
|
||||
: opts.xmlMode || opts.encodeEntities !== "utf8"
|
||||
? entities_1.encodeXML
|
||||
: entities_1.escapeAttribute;
|
||||
return Object.keys(attributes)
|
||||
.map(function (key) {
|
||||
var _a, _b;
|
||||
var value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : "";
|
||||
if (opts.xmlMode === "foreign") {
|
||||
/* Fix up mixed-case attribute names */
|
||||
key = (_b = foreignNames_js_1.attributeNames.get(key)) !== null && _b !== void 0 ? _b : key;
|
||||
}
|
||||
if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
|
||||
return key;
|
||||
}
|
||||
return "".concat(key, "=\"").concat(encode(value), "\"");
|
||||
})
|
||||
.join(" ");
|
||||
}
|
||||
/**
|
||||
* Self-enclosing tags
|
||||
*/
|
||||
var singleTag = new Set([
|
||||
"area",
|
||||
"base",
|
||||
"basefont",
|
||||
"br",
|
||||
"col",
|
||||
"command",
|
||||
"embed",
|
||||
"frame",
|
||||
"hr",
|
||||
"img",
|
||||
"input",
|
||||
"isindex",
|
||||
"keygen",
|
||||
"link",
|
||||
"meta",
|
||||
"param",
|
||||
"source",
|
||||
"track",
|
||||
"wbr",
|
||||
]);
|
||||
/**
|
||||
* Renders a DOM node or an array of DOM nodes to a string.
|
||||
*
|
||||
* Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
|
||||
*
|
||||
* @param node Node to be rendered.
|
||||
* @param options Changes serialization behavior
|
||||
*/
|
||||
function render(node, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var nodes = "length" in node ? node : [node];
|
||||
var output = "";
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
output += renderNode(nodes[i], options);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
exports.render = render;
|
||||
exports.default = render;
|
||||
function renderNode(node, options) {
|
||||
switch (node.type) {
|
||||
case ElementType.Root:
|
||||
return render(node.children, options);
|
||||
// @ts-expect-error We don't use `Doctype` yet
|
||||
case ElementType.Doctype:
|
||||
case ElementType.Directive:
|
||||
return renderDirective(node);
|
||||
case ElementType.Comment:
|
||||
return renderComment(node);
|
||||
case ElementType.CDATA:
|
||||
return renderCdata(node);
|
||||
case ElementType.Script:
|
||||
case ElementType.Style:
|
||||
case ElementType.Tag:
|
||||
return renderTag(node, options);
|
||||
case ElementType.Text:
|
||||
return renderText(node, options);
|
||||
}
|
||||
}
|
||||
var foreignModeIntegrationPoints = new Set([
|
||||
"mi",
|
||||
"mo",
|
||||
"mn",
|
||||
"ms",
|
||||
"mtext",
|
||||
"annotation-xml",
|
||||
"foreignObject",
|
||||
"desc",
|
||||
"title",
|
||||
]);
|
||||
var foreignElements = new Set(["svg", "math"]);
|
||||
function renderTag(elem, opts) {
|
||||
var _a;
|
||||
// Handle SVG / MathML in HTML
|
||||
if (opts.xmlMode === "foreign") {
|
||||
/* Fix up mixed-case element names */
|
||||
elem.name = (_a = foreignNames_js_1.elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name;
|
||||
/* Exit foreign mode at integration points */
|
||||
if (elem.parent &&
|
||||
foreignModeIntegrationPoints.has(elem.parent.name)) {
|
||||
opts = __assign(__assign({}, opts), { xmlMode: false });
|
||||
}
|
||||
}
|
||||
if (!opts.xmlMode && foreignElements.has(elem.name)) {
|
||||
opts = __assign(__assign({}, opts), { xmlMode: "foreign" });
|
||||
}
|
||||
var tag = "<".concat(elem.name);
|
||||
var attribs = formatAttributes(elem.attribs, opts);
|
||||
if (attribs) {
|
||||
tag += " ".concat(attribs);
|
||||
}
|
||||
if (elem.children.length === 0 &&
|
||||
(opts.xmlMode
|
||||
? // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags
|
||||
opts.selfClosingTags !== false
|
||||
: // User explicitly asked for self-closing tags, even in HTML mode
|
||||
opts.selfClosingTags && singleTag.has(elem.name))) {
|
||||
if (!opts.xmlMode)
|
||||
tag += " ";
|
||||
tag += "/>";
|
||||
}
|
||||
else {
|
||||
tag += ">";
|
||||
if (elem.children.length > 0) {
|
||||
tag += render(elem.children, opts);
|
||||
}
|
||||
if (opts.xmlMode || !singleTag.has(elem.name)) {
|
||||
tag += "</".concat(elem.name, ">");
|
||||
}
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
function renderDirective(elem) {
|
||||
return "<".concat(elem.data, ">");
|
||||
}
|
||||
function renderText(elem, opts) {
|
||||
var _a;
|
||||
var data = elem.data || "";
|
||||
// If entities weren't decoded, no need to encode them back
|
||||
if (((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) !== false &&
|
||||
!(!opts.xmlMode &&
|
||||
elem.parent &&
|
||||
unencodedElements.has(elem.parent.name))) {
|
||||
data =
|
||||
opts.xmlMode || opts.encodeEntities !== "utf8"
|
||||
? (0, entities_1.encodeXML)(data)
|
||||
: (0, entities_1.escapeText)(data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
function renderCdata(elem) {
|
||||
return "<![CDATA[".concat(elem.children[0].data, "]]>");
|
||||
}
|
||||
function renderComment(elem) {
|
||||
return "<!--".concat(elem.data, "-->");
|
||||
}
|
||||
69
test/imaps/node_modules/dom-serializer/package.json
generated
vendored
69
test/imaps/node_modules/dom-serializer/package.json
generated
vendored
@@ -1,69 +0,0 @@
|
||||
{
|
||||
"name": "dom-serializer",
|
||||
"version": "2.0.0",
|
||||
"description": "render domhandler DOM nodes to a string",
|
||||
"author": "Felix Boehm <me@feedic.com>",
|
||||
"sideEffects": false,
|
||||
"keywords": [
|
||||
"html",
|
||||
"xml",
|
||||
"render"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/cheeriojs/dom-serializer.git"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"module": "lib/esm/index.js",
|
||||
"exports": {
|
||||
"require": "./lib/index.js",
|
||||
"import": "./lib/esm/index.js"
|
||||
},
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.2",
|
||||
"entities": "^4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^17.0.23",
|
||||
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
||||
"@typescript-eslint/parser": "^5.18.0",
|
||||
"cheerio": "^1.0.0-rc.9",
|
||||
"eslint": "^8.12.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"htmlparser2": "^7.2.0",
|
||||
"jest": "^27.5.1",
|
||||
"prettier": "^2.6.2",
|
||||
"ts-jest": "^27.1.4",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run test:jest && npm run lint",
|
||||
"test:jest": "jest",
|
||||
"lint": "npm run lint:es && npm run lint:prettier",
|
||||
"lint:es": "eslint --ignore-path .gitignore .",
|
||||
"lint:prettier": "npm run prettier -- --check",
|
||||
"format": "npm run format:es && npm run format:prettier",
|
||||
"format:es": "npm run lint:es -- --fix",
|
||||
"format:prettier": "npm run prettier -- --write",
|
||||
"prettier": "prettier \"**/*.{ts,md,json,yml}\" --ignore-path .gitignore",
|
||||
"build": "npm run build:cjs && npm run build:esm",
|
||||
"build:cjs": "tsc",
|
||||
"build:esm": "tsc --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
"testEnvironment": "node",
|
||||
"moduleNameMapper": {
|
||||
"^(.*)\\.js$": "$1"
|
||||
}
|
||||
},
|
||||
"funding": "https://github.com/cheeriojs/dom-serializer?sponsor=1",
|
||||
"license": "MIT"
|
||||
}
|
||||
11
test/imaps/node_modules/domelementtype/LICENSE
generated
vendored
11
test/imaps/node_modules/domelementtype/LICENSE
generated
vendored
@@ -1,11 +0,0 @@
|
||||
Copyright (c) Felix Böhm
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
48
test/imaps/node_modules/domelementtype/lib/esm/index.d.ts
generated
vendored
48
test/imaps/node_modules/domelementtype/lib/esm/index.d.ts
generated
vendored
@@ -1,48 +0,0 @@
|
||||
/** Types of elements found in htmlparser2's DOM */
|
||||
export declare enum ElementType {
|
||||
/** Type for the root element of a document */
|
||||
Root = "root",
|
||||
/** Type for Text */
|
||||
Text = "text",
|
||||
/** Type for <? ... ?> */
|
||||
Directive = "directive",
|
||||
/** Type for <!-- ... --> */
|
||||
Comment = "comment",
|
||||
/** Type for <script> tags */
|
||||
Script = "script",
|
||||
/** Type for <style> tags */
|
||||
Style = "style",
|
||||
/** Type for Any tag */
|
||||
Tag = "tag",
|
||||
/** Type for <![CDATA[ ... ]]> */
|
||||
CDATA = "cdata",
|
||||
/** Type for <!doctype ...> */
|
||||
Doctype = "doctype"
|
||||
}
|
||||
/**
|
||||
* Tests whether an element is a tag or not.
|
||||
*
|
||||
* @param elem Element to test
|
||||
*/
|
||||
export declare function isTag(elem: {
|
||||
type: ElementType;
|
||||
}): boolean;
|
||||
/** Type for the root element of a document */
|
||||
export declare const Root = ElementType.Root;
|
||||
/** Type for Text */
|
||||
export declare const Text = ElementType.Text;
|
||||
/** Type for <? ... ?> */
|
||||
export declare const Directive = ElementType.Directive;
|
||||
/** Type for <!-- ... --> */
|
||||
export declare const Comment = ElementType.Comment;
|
||||
/** Type for <script> tags */
|
||||
export declare const Script = ElementType.Script;
|
||||
/** Type for <style> tags */
|
||||
export declare const Style = ElementType.Style;
|
||||
/** Type for Any tag */
|
||||
export declare const Tag = ElementType.Tag;
|
||||
/** Type for <![CDATA[ ... ]]> */
|
||||
export declare const CDATA = ElementType.CDATA;
|
||||
/** Type for <!doctype ...> */
|
||||
export declare const Doctype = ElementType.Doctype;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
test/imaps/node_modules/domelementtype/lib/esm/index.d.ts.map
generated
vendored
1
test/imaps/node_modules/domelementtype/lib/esm/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,oBAAY,WAAW;IACnB,8CAA8C;IAC9C,IAAI,SAAS;IACb,oBAAoB;IACpB,IAAI,SAAS;IACb,yBAAyB;IACzB,SAAS,cAAc;IACvB,4BAA4B;IAC5B,OAAO,YAAY;IACnB,6BAA6B;IAC7B,MAAM,WAAW;IACjB,4BAA4B;IAC5B,KAAK,UAAU;IACf,uBAAuB;IACvB,GAAG,QAAQ;IACX,iCAAiC;IACjC,KAAK,UAAU;IACf,8BAA8B;IAC9B,OAAO,YAAY;CACtB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAM1D;AAGD,8CAA8C;AAC9C,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,oBAAoB;AACpB,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,yBAAyB;AACzB,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C,4BAA4B;AAC5B,eAAO,MAAM,OAAO,sBAAsB,CAAC;AAC3C,6BAA6B;AAC7B,eAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,4BAA4B;AAC5B,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,uBAAuB;AACvB,eAAO,MAAM,GAAG,kBAAkB,CAAC;AACnC,iCAAiC;AACjC,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,8BAA8B;AAC9B,eAAO,MAAM,OAAO,sBAAsB,CAAC"}
|
||||
51
test/imaps/node_modules/domelementtype/lib/esm/index.js
generated
vendored
51
test/imaps/node_modules/domelementtype/lib/esm/index.js
generated
vendored
@@ -1,51 +0,0 @@
|
||||
/** Types of elements found in htmlparser2's DOM */
|
||||
export var ElementType;
|
||||
(function (ElementType) {
|
||||
/** Type for the root element of a document */
|
||||
ElementType["Root"] = "root";
|
||||
/** Type for Text */
|
||||
ElementType["Text"] = "text";
|
||||
/** Type for <? ... ?> */
|
||||
ElementType["Directive"] = "directive";
|
||||
/** Type for <!-- ... --> */
|
||||
ElementType["Comment"] = "comment";
|
||||
/** Type for <script> tags */
|
||||
ElementType["Script"] = "script";
|
||||
/** Type for <style> tags */
|
||||
ElementType["Style"] = "style";
|
||||
/** Type for Any tag */
|
||||
ElementType["Tag"] = "tag";
|
||||
/** Type for <![CDATA[ ... ]]> */
|
||||
ElementType["CDATA"] = "cdata";
|
||||
/** Type for <!doctype ...> */
|
||||
ElementType["Doctype"] = "doctype";
|
||||
})(ElementType || (ElementType = {}));
|
||||
/**
|
||||
* Tests whether an element is a tag or not.
|
||||
*
|
||||
* @param elem Element to test
|
||||
*/
|
||||
export function isTag(elem) {
|
||||
return (elem.type === ElementType.Tag ||
|
||||
elem.type === ElementType.Script ||
|
||||
elem.type === ElementType.Style);
|
||||
}
|
||||
// Exports for backwards compatibility
|
||||
/** Type for the root element of a document */
|
||||
export const Root = ElementType.Root;
|
||||
/** Type for Text */
|
||||
export const Text = ElementType.Text;
|
||||
/** Type for <? ... ?> */
|
||||
export const Directive = ElementType.Directive;
|
||||
/** Type for <!-- ... --> */
|
||||
export const Comment = ElementType.Comment;
|
||||
/** Type for <script> tags */
|
||||
export const Script = ElementType.Script;
|
||||
/** Type for <style> tags */
|
||||
export const Style = ElementType.Style;
|
||||
/** Type for Any tag */
|
||||
export const Tag = ElementType.Tag;
|
||||
/** Type for <![CDATA[ ... ]]> */
|
||||
export const CDATA = ElementType.CDATA;
|
||||
/** Type for <!doctype ...> */
|
||||
export const Doctype = ElementType.Doctype;
|
||||
1
test/imaps/node_modules/domelementtype/lib/esm/package.json
generated
vendored
1
test/imaps/node_modules/domelementtype/lib/esm/package.json
generated
vendored
@@ -1 +0,0 @@
|
||||
{"type":"module"}
|
||||
48
test/imaps/node_modules/domelementtype/lib/index.d.ts
generated
vendored
48
test/imaps/node_modules/domelementtype/lib/index.d.ts
generated
vendored
@@ -1,48 +0,0 @@
|
||||
/** Types of elements found in htmlparser2's DOM */
|
||||
export declare enum ElementType {
|
||||
/** Type for the root element of a document */
|
||||
Root = "root",
|
||||
/** Type for Text */
|
||||
Text = "text",
|
||||
/** Type for <? ... ?> */
|
||||
Directive = "directive",
|
||||
/** Type for <!-- ... --> */
|
||||
Comment = "comment",
|
||||
/** Type for <script> tags */
|
||||
Script = "script",
|
||||
/** Type for <style> tags */
|
||||
Style = "style",
|
||||
/** Type for Any tag */
|
||||
Tag = "tag",
|
||||
/** Type for <![CDATA[ ... ]]> */
|
||||
CDATA = "cdata",
|
||||
/** Type for <!doctype ...> */
|
||||
Doctype = "doctype"
|
||||
}
|
||||
/**
|
||||
* Tests whether an element is a tag or not.
|
||||
*
|
||||
* @param elem Element to test
|
||||
*/
|
||||
export declare function isTag(elem: {
|
||||
type: ElementType;
|
||||
}): boolean;
|
||||
/** Type for the root element of a document */
|
||||
export declare const Root = ElementType.Root;
|
||||
/** Type for Text */
|
||||
export declare const Text = ElementType.Text;
|
||||
/** Type for <? ... ?> */
|
||||
export declare const Directive = ElementType.Directive;
|
||||
/** Type for <!-- ... --> */
|
||||
export declare const Comment = ElementType.Comment;
|
||||
/** Type for <script> tags */
|
||||
export declare const Script = ElementType.Script;
|
||||
/** Type for <style> tags */
|
||||
export declare const Style = ElementType.Style;
|
||||
/** Type for Any tag */
|
||||
export declare const Tag = ElementType.Tag;
|
||||
/** Type for <![CDATA[ ... ]]> */
|
||||
export declare const CDATA = ElementType.CDATA;
|
||||
/** Type for <!doctype ...> */
|
||||
export declare const Doctype = ElementType.Doctype;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
test/imaps/node_modules/domelementtype/lib/index.d.ts.map
generated
vendored
1
test/imaps/node_modules/domelementtype/lib/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,oBAAY,WAAW;IACnB,8CAA8C;IAC9C,IAAI,SAAS;IACb,oBAAoB;IACpB,IAAI,SAAS;IACb,yBAAyB;IACzB,SAAS,cAAc;IACvB,4BAA4B;IAC5B,OAAO,YAAY;IACnB,6BAA6B;IAC7B,MAAM,WAAW;IACjB,4BAA4B;IAC5B,KAAK,UAAU;IACf,uBAAuB;IACvB,GAAG,QAAQ;IACX,iCAAiC;IACjC,KAAK,UAAU;IACf,8BAA8B;IAC9B,OAAO,YAAY;CACtB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAM1D;AAGD,8CAA8C;AAC9C,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,oBAAoB;AACpB,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,yBAAyB;AACzB,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C,4BAA4B;AAC5B,eAAO,MAAM,OAAO,sBAAsB,CAAC;AAC3C,6BAA6B;AAC7B,eAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,4BAA4B;AAC5B,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,uBAAuB;AACvB,eAAO,MAAM,GAAG,kBAAkB,CAAC;AACnC,iCAAiC;AACjC,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,8BAA8B;AAC9B,eAAO,MAAM,OAAO,sBAAsB,CAAC"}
|
||||
55
test/imaps/node_modules/domelementtype/lib/index.js
generated
vendored
55
test/imaps/node_modules/domelementtype/lib/index.js
generated
vendored
@@ -1,55 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0;
|
||||
/** Types of elements found in htmlparser2's DOM */
|
||||
var ElementType;
|
||||
(function (ElementType) {
|
||||
/** Type for the root element of a document */
|
||||
ElementType["Root"] = "root";
|
||||
/** Type for Text */
|
||||
ElementType["Text"] = "text";
|
||||
/** Type for <? ... ?> */
|
||||
ElementType["Directive"] = "directive";
|
||||
/** Type for <!-- ... --> */
|
||||
ElementType["Comment"] = "comment";
|
||||
/** Type for <script> tags */
|
||||
ElementType["Script"] = "script";
|
||||
/** Type for <style> tags */
|
||||
ElementType["Style"] = "style";
|
||||
/** Type for Any tag */
|
||||
ElementType["Tag"] = "tag";
|
||||
/** Type for <![CDATA[ ... ]]> */
|
||||
ElementType["CDATA"] = "cdata";
|
||||
/** Type for <!doctype ...> */
|
||||
ElementType["Doctype"] = "doctype";
|
||||
})(ElementType = exports.ElementType || (exports.ElementType = {}));
|
||||
/**
|
||||
* Tests whether an element is a tag or not.
|
||||
*
|
||||
* @param elem Element to test
|
||||
*/
|
||||
function isTag(elem) {
|
||||
return (elem.type === ElementType.Tag ||
|
||||
elem.type === ElementType.Script ||
|
||||
elem.type === ElementType.Style);
|
||||
}
|
||||
exports.isTag = isTag;
|
||||
// Exports for backwards compatibility
|
||||
/** Type for the root element of a document */
|
||||
exports.Root = ElementType.Root;
|
||||
/** Type for Text */
|
||||
exports.Text = ElementType.Text;
|
||||
/** Type for <? ... ?> */
|
||||
exports.Directive = ElementType.Directive;
|
||||
/** Type for <!-- ... --> */
|
||||
exports.Comment = ElementType.Comment;
|
||||
/** Type for <script> tags */
|
||||
exports.Script = ElementType.Script;
|
||||
/** Type for <style> tags */
|
||||
exports.Style = ElementType.Style;
|
||||
/** Type for Any tag */
|
||||
exports.Tag = ElementType.Tag;
|
||||
/** Type for <![CDATA[ ... ]]> */
|
||||
exports.CDATA = ElementType.CDATA;
|
||||
/** Type for <!doctype ...> */
|
||||
exports.Doctype = ElementType.Doctype;
|
||||
54
test/imaps/node_modules/domelementtype/package.json
generated
vendored
54
test/imaps/node_modules/domelementtype/package.json
generated
vendored
@@ -1,54 +0,0 @@
|
||||
{
|
||||
"name": "domelementtype",
|
||||
"version": "2.3.0",
|
||||
"description": "all the types of nodes in htmlparser2's dom",
|
||||
"author": "Felix Boehm <me@feedic.com>",
|
||||
"license": "BSD-2-Clause",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
],
|
||||
"sideEffects": false,
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"module": "lib/esm/index.js",
|
||||
"exports": {
|
||||
"require": "./lib/index.js",
|
||||
"import": "./lib/esm/index.js"
|
||||
},
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/fb55/domelementtype.git"
|
||||
},
|
||||
"keywords": [
|
||||
"dom",
|
||||
"element",
|
||||
"types",
|
||||
"htmlparser2"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npm run lint && prettier --check **/*.{ts,json,md}",
|
||||
"lint": "eslint src",
|
||||
"format": "prettier --write **/*.{ts,json,md}",
|
||||
"build": "npm run build:cjs && npm run build:esm",
|
||||
"build:cjs": "tsc",
|
||||
"build:esm": "tsc --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 4
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
||||
"@typescript-eslint/parser": "^5.18.0",
|
||||
"eslint": "^8.12.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"prettier": "^2.6.2",
|
||||
"typescript": "^4.6.3"
|
||||
}
|
||||
}
|
||||
1
test/imaps/node_modules/domelementtype/readme.md
generated
vendored
1
test/imaps/node_modules/domelementtype/readme.md
generated
vendored
@@ -1 +0,0 @@
|
||||
All the types of nodes in htmlparser2's DOM.
|
||||
11
test/imaps/node_modules/domhandler/LICENSE
generated
vendored
11
test/imaps/node_modules/domhandler/LICENSE
generated
vendored
@@ -1,11 +0,0 @@
|
||||
Copyright (c) Felix Böhm
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
76
test/imaps/node_modules/domhandler/lib/esm/index.d.ts
generated
vendored
76
test/imaps/node_modules/domhandler/lib/esm/index.d.ts
generated
vendored
@@ -1,76 +0,0 @@
|
||||
import { ChildNode, Element, DataNode, Document, ParentNode } from "./node.js";
|
||||
export * from "./node.js";
|
||||
export interface DomHandlerOptions {
|
||||
/**
|
||||
* Add a `startIndex` property to nodes.
|
||||
* When the parser is used in a non-streaming fashion, `startIndex` is an integer
|
||||
* indicating the position of the start of the node in the document.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
withStartIndices?: boolean;
|
||||
/**
|
||||
* Add an `endIndex` property to nodes.
|
||||
* When the parser is used in a non-streaming fashion, `endIndex` is an integer
|
||||
* indicating the position of the end of the node in the document.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
withEndIndices?: boolean;
|
||||
/**
|
||||
* Treat the markup as XML.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
xmlMode?: boolean;
|
||||
}
|
||||
interface ParserInterface {
|
||||
startIndex: number | null;
|
||||
endIndex: number | null;
|
||||
}
|
||||
declare type Callback = (error: Error | null, dom: ChildNode[]) => void;
|
||||
declare type ElementCallback = (element: Element) => void;
|
||||
export declare class DomHandler {
|
||||
/** The elements of the DOM */
|
||||
dom: ChildNode[];
|
||||
/** The root element for the DOM */
|
||||
root: Document;
|
||||
/** Called once parsing has completed. */
|
||||
private readonly callback;
|
||||
/** Settings for the handler. */
|
||||
private readonly options;
|
||||
/** Callback whenever a tag is closed. */
|
||||
private readonly elementCB;
|
||||
/** Indicated whether parsing has been completed. */
|
||||
private done;
|
||||
/** Stack of open tags. */
|
||||
protected tagStack: ParentNode[];
|
||||
/** A data node that is still being written to. */
|
||||
protected lastNode: DataNode | null;
|
||||
/** Reference to the parser instance. Used for location information. */
|
||||
private parser;
|
||||
/**
|
||||
* @param callback Called once parsing has completed.
|
||||
* @param options Settings for the handler.
|
||||
* @param elementCB Callback whenever a tag is closed.
|
||||
*/
|
||||
constructor(callback?: Callback | null, options?: DomHandlerOptions | null, elementCB?: ElementCallback);
|
||||
onparserinit(parser: ParserInterface): void;
|
||||
onreset(): void;
|
||||
onend(): void;
|
||||
onerror(error: Error): void;
|
||||
onclosetag(): void;
|
||||
onopentag(name: string, attribs: {
|
||||
[key: string]: string;
|
||||
}): void;
|
||||
ontext(data: string): void;
|
||||
oncomment(data: string): void;
|
||||
oncommentend(): void;
|
||||
oncdatastart(): void;
|
||||
oncdataend(): void;
|
||||
onprocessinginstruction(name: string, data: string): void;
|
||||
protected handleCallback(error: Error | null): void;
|
||||
protected addNode(node: ChildNode): void;
|
||||
}
|
||||
export default DomHandler;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
test/imaps/node_modules/domhandler/lib/esm/index.d.ts.map
generated
vendored
1
test/imaps/node_modules/domhandler/lib/esm/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,SAAS,EACT,OAAO,EACP,QAAQ,EAIR,QAAQ,EAER,UAAU,EACb,MAAM,WAAW,CAAC;AAEnB,cAAc,WAAW,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AASD,UAAU,eAAe;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QA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AC,IAAI,EAAE,MAAM,GAAG,IAAI;IAW7B,YAAY,IAAI,IAAI;IAIpB,YAAY,IAAI,IAAI;IAUpB,UAAU,IAAI,IAAI;IAIlB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAKhE,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI;IAQnD,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;CAwB3C;AAED,eAAe,UAAU,CAAC"}
|
||||
146
test/imaps/node_modules/domhandler/lib/esm/index.js
generated
vendored
146
test/imaps/node_modules/domhandler/lib/esm/index.js
generated
vendored
@@ -1,146 +0,0 @@
|
||||
import { ElementType } from "domelementtype";
|
||||
import { Element, Text, Comment, CDATA, Document, ProcessingInstruction, } from "./node.js";
|
||||
export * from "./node.js";
|
||||
// Default options
|
||||
const defaultOpts = {
|
||||
withStartIndices: false,
|
||||
withEndIndices: false,
|
||||
xmlMode: false,
|
||||
};
|
||||
export class DomHandler {
|
||||
/**
|
||||
* @param callback Called once parsing has completed.
|
||||
* @param options Settings for the handler.
|
||||
* @param elementCB Callback whenever a tag is closed.
|
||||
*/
|
||||
constructor(callback, options, elementCB) {
|
||||
/** The elements of the DOM */
|
||||
this.dom = [];
|
||||
/** The root element for the DOM */
|
||||
this.root = new Document(this.dom);
|
||||
/** Indicated whether parsing has been completed. */
|
||||
this.done = false;
|
||||
/** Stack of open tags. */
|
||||
this.tagStack = [this.root];
|
||||
/** A data node that is still being written to. */
|
||||
this.lastNode = null;
|
||||
/** Reference to the parser instance. Used for location information. */
|
||||
this.parser = null;
|
||||
// Make it possible to skip arguments, for backwards-compatibility
|
||||
if (typeof options === "function") {
|
||||
elementCB = options;
|
||||
options = defaultOpts;
|
||||
}
|
||||
if (typeof callback === "object") {
|
||||
options = callback;
|
||||
callback = undefined;
|
||||
}
|
||||
this.callback = callback !== null && callback !== void 0 ? callback : null;
|
||||
this.options = options !== null && options !== void 0 ? options : defaultOpts;
|
||||
this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;
|
||||
}
|
||||
onparserinit(parser) {
|
||||
this.parser = parser;
|
||||
}
|
||||
// Resets the handler back to starting state
|
||||
onreset() {
|
||||
this.dom = [];
|
||||
this.root = new Document(this.dom);
|
||||
this.done = false;
|
||||
this.tagStack = [this.root];
|
||||
this.lastNode = null;
|
||||
this.parser = null;
|
||||
}
|
||||
// Signals the handler that parsing is done
|
||||
onend() {
|
||||
if (this.done)
|
||||
return;
|
||||
this.done = true;
|
||||
this.parser = null;
|
||||
this.handleCallback(null);
|
||||
}
|
||||
onerror(error) {
|
||||
this.handleCallback(error);
|
||||
}
|
||||
onclosetag() {
|
||||
this.lastNode = null;
|
||||
const elem = this.tagStack.pop();
|
||||
if (this.options.withEndIndices) {
|
||||
elem.endIndex = this.parser.endIndex;
|
||||
}
|
||||
if (this.elementCB)
|
||||
this.elementCB(elem);
|
||||
}
|
||||
onopentag(name, attribs) {
|
||||
const type = this.options.xmlMode ? ElementType.Tag : undefined;
|
||||
const element = new Element(name, attribs, undefined, type);
|
||||
this.addNode(element);
|
||||
this.tagStack.push(element);
|
||||
}
|
||||
ontext(data) {
|
||||
const { lastNode } = this;
|
||||
if (lastNode && lastNode.type === ElementType.Text) {
|
||||
lastNode.data += data;
|
||||
if (this.options.withEndIndices) {
|
||||
lastNode.endIndex = this.parser.endIndex;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const node = new Text(data);
|
||||
this.addNode(node);
|
||||
this.lastNode = node;
|
||||
}
|
||||
}
|
||||
oncomment(data) {
|
||||
if (this.lastNode && this.lastNode.type === ElementType.Comment) {
|
||||
this.lastNode.data += data;
|
||||
return;
|
||||
}
|
||||
const node = new Comment(data);
|
||||
this.addNode(node);
|
||||
this.lastNode = node;
|
||||
}
|
||||
oncommentend() {
|
||||
this.lastNode = null;
|
||||
}
|
||||
oncdatastart() {
|
||||
const text = new Text("");
|
||||
const node = new CDATA([text]);
|
||||
this.addNode(node);
|
||||
text.parent = node;
|
||||
this.lastNode = text;
|
||||
}
|
||||
oncdataend() {
|
||||
this.lastNode = null;
|
||||
}
|
||||
onprocessinginstruction(name, data) {
|
||||
const node = new ProcessingInstruction(name, data);
|
||||
this.addNode(node);
|
||||
}
|
||||
handleCallback(error) {
|
||||
if (typeof this.callback === "function") {
|
||||
this.callback(error, this.dom);
|
||||
}
|
||||
else if (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
addNode(node) {
|
||||
const parent = this.tagStack[this.tagStack.length - 1];
|
||||
const previousSibling = parent.children[parent.children.length - 1];
|
||||
if (this.options.withStartIndices) {
|
||||
node.startIndex = this.parser.startIndex;
|
||||
}
|
||||
if (this.options.withEndIndices) {
|
||||
node.endIndex = this.parser.endIndex;
|
||||
}
|
||||
parent.children.push(node);
|
||||
if (previousSibling) {
|
||||
node.prev = previousSibling;
|
||||
previousSibling.next = node;
|
||||
}
|
||||
node.parent = parent;
|
||||
this.lastNode = null;
|
||||
}
|
||||
}
|
||||
export default DomHandler;
|
||||
245
test/imaps/node_modules/domhandler/lib/esm/node.d.ts
generated
vendored
245
test/imaps/node_modules/domhandler/lib/esm/node.d.ts
generated
vendored
@@ -1,245 +0,0 @@
|
||||
import { ElementType } from "domelementtype";
|
||||
interface SourceCodeLocation {
|
||||
/** One-based line index of the first character. */
|
||||
startLine: number;
|
||||
/** One-based column index of the first character. */
|
||||
startCol: number;
|
||||
/** Zero-based first character index. */
|
||||
startOffset: number;
|
||||
/** One-based line index of the last character. */
|
||||
endLine: number;
|
||||
/** One-based column index of the last character. Points directly *after* the last character. */
|
||||
endCol: number;
|
||||
/** Zero-based last character index. Points directly *after* the last character. */
|
||||
endOffset: number;
|
||||
}
|
||||
interface TagSourceCodeLocation extends SourceCodeLocation {
|
||||
startTag?: SourceCodeLocation;
|
||||
endTag?: SourceCodeLocation;
|
||||
}
|
||||
export declare type ParentNode = Document | Element | CDATA;
|
||||
export declare type ChildNode = Text | Comment | ProcessingInstruction | Element | CDATA | Document;
|
||||
export declare type AnyNode = ParentNode | ChildNode;
|
||||
/**
|
||||
* This object will be used as the prototype for Nodes when creating a
|
||||
* DOM-Level-1-compliant structure.
|
||||
*/
|
||||
export declare abstract class Node {
|
||||
/** The type of the node. */
|
||||
abstract readonly type: ElementType;
|
||||
/** Parent of the node */
|
||||
parent: ParentNode | null;
|
||||
/** Previous sibling */
|
||||
prev: ChildNode | null;
|
||||
/** Next sibling */
|
||||
next: ChildNode | null;
|
||||
/** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
|
||||
startIndex: number | null;
|
||||
/** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
|
||||
endIndex: number | null;
|
||||
/**
|
||||
* `parse5` source code location info.
|
||||
*
|
||||
* Available if parsing with parse5 and location info is enabled.
|
||||
*/
|
||||
sourceCodeLocation?: SourceCodeLocation | null;
|
||||
/**
|
||||
* [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodetype)-compatible
|
||||
* node {@link type}.
|
||||
*/
|
||||
abstract readonly nodeType: number;
|
||||
/**
|
||||
* Same as {@link parent}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get parentNode(): ParentNode | null;
|
||||
set parentNode(parent: ParentNode | null);
|
||||
/**
|
||||
* Same as {@link prev}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get previousSibling(): ChildNode | null;
|
||||
set previousSibling(prev: ChildNode | null);
|
||||
/**
|
||||
* Same as {@link next}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get nextSibling(): ChildNode | null;
|
||||
set nextSibling(next: ChildNode | null);
|
||||
/**
|
||||
* Clone this node, and optionally its children.
|
||||
*
|
||||
* @param recursive Clone child nodes as well.
|
||||
* @returns A clone of the node.
|
||||
*/
|
||||
cloneNode<T extends Node>(this: T, recursive?: boolean): T;
|
||||
}
|
||||
/**
|
||||
* A node that contains some data.
|
||||
*/
|
||||
export declare abstract class DataNode extends Node {
|
||||
data: string;
|
||||
/**
|
||||
* @param data The content of the data node
|
||||
*/
|
||||
constructor(data: string);
|
||||
/**
|
||||
* Same as {@link data}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get nodeValue(): string;
|
||||
set nodeValue(data: string);
|
||||
}
|
||||
/**
|
||||
* Text within the document.
|
||||
*/
|
||||
export declare class Text extends DataNode {
|
||||
type: ElementType.Text;
|
||||
get nodeType(): 3;
|
||||
}
|
||||
/**
|
||||
* Comments within the document.
|
||||
*/
|
||||
export declare class Comment extends DataNode {
|
||||
type: ElementType.Comment;
|
||||
get nodeType(): 8;
|
||||
}
|
||||
/**
|
||||
* Processing instructions, including doc types.
|
||||
*/
|
||||
export declare class ProcessingInstruction extends DataNode {
|
||||
name: string;
|
||||
type: ElementType.Directive;
|
||||
constructor(name: string, data: string);
|
||||
get nodeType(): 1;
|
||||
/** If this is a doctype, the document type name (parse5 only). */
|
||||
"x-name"?: string;
|
||||
/** If this is a doctype, the document type public identifier (parse5 only). */
|
||||
"x-publicId"?: string;
|
||||
/** If this is a doctype, the document type system identifier (parse5 only). */
|
||||
"x-systemId"?: string;
|
||||
}
|
||||
/**
|
||||
* A `Node` that can have children.
|
||||
*/
|
||||
export declare abstract class NodeWithChildren extends Node {
|
||||
children: ChildNode[];
|
||||
/**
|
||||
* @param children Children of the node. Only certain node types can have children.
|
||||
*/
|
||||
constructor(children: ChildNode[]);
|
||||
/** First child of the node. */
|
||||
get firstChild(): ChildNode | null;
|
||||
/** Last child of the node. */
|
||||
get lastChild(): ChildNode | null;
|
||||
/**
|
||||
* Same as {@link children}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get childNodes(): ChildNode[];
|
||||
set childNodes(children: ChildNode[]);
|
||||
}
|
||||
export declare class CDATA extends NodeWithChildren {
|
||||
type: ElementType.CDATA;
|
||||
get nodeType(): 4;
|
||||
}
|
||||
/**
|
||||
* The root node of the document.
|
||||
*/
|
||||
export declare class Document extends NodeWithChildren {
|
||||
type: ElementType.Root;
|
||||
get nodeType(): 9;
|
||||
/** [Document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks) (parse5 only). */
|
||||
"x-mode"?: "no-quirks" | "quirks" | "limited-quirks";
|
||||
}
|
||||
/**
|
||||
* The description of an individual attribute.
|
||||
*/
|
||||
interface Attribute {
|
||||
name: string;
|
||||
value: string;
|
||||
namespace?: string;
|
||||
prefix?: string;
|
||||
}
|
||||
/**
|
||||
* An element within the DOM.
|
||||
*/
|
||||
export declare class Element extends NodeWithChildren {
|
||||
name: string;
|
||||
attribs: {
|
||||
[name: string]: string;
|
||||
};
|
||||
type: ElementType.Tag | ElementType.Script | ElementType.Style;
|
||||
/**
|
||||
* @param name Name of the tag, eg. `div`, `span`.
|
||||
* @param attribs Object mapping attribute names to attribute values.
|
||||
* @param children Children of the node.
|
||||
*/
|
||||
constructor(name: string, attribs: {
|
||||
[name: string]: string;
|
||||
}, children?: ChildNode[], type?: ElementType.Tag | ElementType.Script | ElementType.Style);
|
||||
get nodeType(): 1;
|
||||
/**
|
||||
* `parse5` source code location info, with start & end tags.
|
||||
*
|
||||
* Available if parsing with parse5 and location info is enabled.
|
||||
*/
|
||||
sourceCodeLocation?: TagSourceCodeLocation | null;
|
||||
/**
|
||||
* Same as {@link name}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get tagName(): string;
|
||||
set tagName(name: string);
|
||||
get attributes(): Attribute[];
|
||||
/** Element namespace (parse5 only). */
|
||||
namespace?: string;
|
||||
/** Element attribute namespaces (parse5 only). */
|
||||
"x-attribsNamespace"?: Record<string, string>;
|
||||
/** Element attribute namespace-related prefixes (parse5 only). */
|
||||
"x-attribsPrefix"?: Record<string, string>;
|
||||
}
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node is a `Element`, `false` otherwise.
|
||||
*/
|
||||
export declare function isTag(node: Node): node is Element;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `CDATA`, `false` otherwise.
|
||||
*/
|
||||
export declare function isCDATA(node: Node): node is CDATA;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `Text`, `false` otherwise.
|
||||
*/
|
||||
export declare function isText(node: Node): node is Text;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `Comment`, `false` otherwise.
|
||||
*/
|
||||
export declare function isComment(node: Node): node is Comment;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
||||
*/
|
||||
export declare function isDirective(node: Node): node is ProcessingInstruction;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
||||
*/
|
||||
export declare function isDocument(node: Node): node is Document;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has children, `false` otherwise.
|
||||
*/
|
||||
export declare function hasChildren(node: Node): node is ParentNode;
|
||||
/**
|
||||
* Clone a node, and optionally its children.
|
||||
*
|
||||
* @param recursive Clone child nodes as well.
|
||||
* @returns A clone of the node.
|
||||
*/
|
||||
export declare function cloneNode<T extends Node>(node: T, recursive?: boolean): T;
|
||||
export {};
|
||||
//# sourceMappingURL=node.d.ts.map
|
||||
1
test/imaps/node_modules/domhandler/lib/esm/node.d.ts.map
generated
vendored
1
test/imaps/node_modules/domhandler/lib/esm/node.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,gBAAgB,CAAC;AAEhE,UAAU,kBAAkB;IACxB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;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,UAAQ,GAAG,CAAC,CA4DvE"}
|
||||
338
test/imaps/node_modules/domhandler/lib/esm/node.js
generated
vendored
338
test/imaps/node_modules/domhandler/lib/esm/node.js
generated
vendored
@@ -1,338 +0,0 @@
|
||||
import { ElementType, isTag as isTagRaw } from "domelementtype";
|
||||
/**
|
||||
* This object will be used as the prototype for Nodes when creating a
|
||||
* DOM-Level-1-compliant structure.
|
||||
*/
|
||||
export class Node {
|
||||
constructor() {
|
||||
/** Parent of the node */
|
||||
this.parent = null;
|
||||
/** Previous sibling */
|
||||
this.prev = null;
|
||||
/** Next sibling */
|
||||
this.next = null;
|
||||
/** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
|
||||
this.startIndex = null;
|
||||
/** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
|
||||
this.endIndex = null;
|
||||
}
|
||||
// Read-write aliases for properties
|
||||
/**
|
||||
* Same as {@link parent}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get parentNode() {
|
||||
return this.parent;
|
||||
}
|
||||
set parentNode(parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
/**
|
||||
* Same as {@link prev}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get previousSibling() {
|
||||
return this.prev;
|
||||
}
|
||||
set previousSibling(prev) {
|
||||
this.prev = prev;
|
||||
}
|
||||
/**
|
||||
* Same as {@link next}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get nextSibling() {
|
||||
return this.next;
|
||||
}
|
||||
set nextSibling(next) {
|
||||
this.next = next;
|
||||
}
|
||||
/**
|
||||
* Clone this node, and optionally its children.
|
||||
*
|
||||
* @param recursive Clone child nodes as well.
|
||||
* @returns A clone of the node.
|
||||
*/
|
||||
cloneNode(recursive = false) {
|
||||
return cloneNode(this, recursive);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A node that contains some data.
|
||||
*/
|
||||
export class DataNode extends Node {
|
||||
/**
|
||||
* @param data The content of the data node
|
||||
*/
|
||||
constructor(data) {
|
||||
super();
|
||||
this.data = data;
|
||||
}
|
||||
/**
|
||||
* Same as {@link data}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get nodeValue() {
|
||||
return this.data;
|
||||
}
|
||||
set nodeValue(data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Text within the document.
|
||||
*/
|
||||
export class Text extends DataNode {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.type = ElementType.Text;
|
||||
}
|
||||
get nodeType() {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Comments within the document.
|
||||
*/
|
||||
export class Comment extends DataNode {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.type = ElementType.Comment;
|
||||
}
|
||||
get nodeType() {
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Processing instructions, including doc types.
|
||||
*/
|
||||
export class ProcessingInstruction extends DataNode {
|
||||
constructor(name, data) {
|
||||
super(data);
|
||||
this.name = name;
|
||||
this.type = ElementType.Directive;
|
||||
}
|
||||
get nodeType() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A `Node` that can have children.
|
||||
*/
|
||||
export class NodeWithChildren extends Node {
|
||||
/**
|
||||
* @param children Children of the node. Only certain node types can have children.
|
||||
*/
|
||||
constructor(children) {
|
||||
super();
|
||||
this.children = children;
|
||||
}
|
||||
// Aliases
|
||||
/** First child of the node. */
|
||||
get firstChild() {
|
||||
var _a;
|
||||
return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null;
|
||||
}
|
||||
/** Last child of the node. */
|
||||
get lastChild() {
|
||||
return this.children.length > 0
|
||||
? this.children[this.children.length - 1]
|
||||
: null;
|
||||
}
|
||||
/**
|
||||
* Same as {@link children}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get childNodes() {
|
||||
return this.children;
|
||||
}
|
||||
set childNodes(children) {
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
export class CDATA extends NodeWithChildren {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.type = ElementType.CDATA;
|
||||
}
|
||||
get nodeType() {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The root node of the document.
|
||||
*/
|
||||
export class Document extends NodeWithChildren {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.type = ElementType.Root;
|
||||
}
|
||||
get nodeType() {
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* An element within the DOM.
|
||||
*/
|
||||
export class Element extends NodeWithChildren {
|
||||
/**
|
||||
* @param name Name of the tag, eg. `div`, `span`.
|
||||
* @param attribs Object mapping attribute names to attribute values.
|
||||
* @param children Children of the node.
|
||||
*/
|
||||
constructor(name, attribs, children = [], type = name === "script"
|
||||
? ElementType.Script
|
||||
: name === "style"
|
||||
? ElementType.Style
|
||||
: ElementType.Tag) {
|
||||
super(children);
|
||||
this.name = name;
|
||||
this.attribs = attribs;
|
||||
this.type = type;
|
||||
}
|
||||
get nodeType() {
|
||||
return 1;
|
||||
}
|
||||
// DOM Level 1 aliases
|
||||
/**
|
||||
* Same as {@link name}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get tagName() {
|
||||
return this.name;
|
||||
}
|
||||
set tagName(name) {
|
||||
this.name = name;
|
||||
}
|
||||
get attributes() {
|
||||
return Object.keys(this.attribs).map((name) => {
|
||||
var _a, _b;
|
||||
return ({
|
||||
name,
|
||||
value: this.attribs[name],
|
||||
namespace: (_a = this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name],
|
||||
prefix: (_b = this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name],
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node is a `Element`, `false` otherwise.
|
||||
*/
|
||||
export function isTag(node) {
|
||||
return isTagRaw(node);
|
||||
}
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `CDATA`, `false` otherwise.
|
||||
*/
|
||||
export function isCDATA(node) {
|
||||
return node.type === ElementType.CDATA;
|
||||
}
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `Text`, `false` otherwise.
|
||||
*/
|
||||
export function isText(node) {
|
||||
return node.type === ElementType.Text;
|
||||
}
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `Comment`, `false` otherwise.
|
||||
*/
|
||||
export function isComment(node) {
|
||||
return node.type === ElementType.Comment;
|
||||
}
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
||||
*/
|
||||
export function isDirective(node) {
|
||||
return node.type === ElementType.Directive;
|
||||
}
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
||||
*/
|
||||
export function isDocument(node) {
|
||||
return node.type === ElementType.Root;
|
||||
}
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has children, `false` otherwise.
|
||||
*/
|
||||
export function hasChildren(node) {
|
||||
return Object.prototype.hasOwnProperty.call(node, "children");
|
||||
}
|
||||
/**
|
||||
* Clone a node, and optionally its children.
|
||||
*
|
||||
* @param recursive Clone child nodes as well.
|
||||
* @returns A clone of the node.
|
||||
*/
|
||||
export function cloneNode(node, recursive = false) {
|
||||
let result;
|
||||
if (isText(node)) {
|
||||
result = new Text(node.data);
|
||||
}
|
||||
else if (isComment(node)) {
|
||||
result = new Comment(node.data);
|
||||
}
|
||||
else if (isTag(node)) {
|
||||
const children = recursive ? cloneChildren(node.children) : [];
|
||||
const clone = new Element(node.name, { ...node.attribs }, children);
|
||||
children.forEach((child) => (child.parent = clone));
|
||||
if (node.namespace != null) {
|
||||
clone.namespace = node.namespace;
|
||||
}
|
||||
if (node["x-attribsNamespace"]) {
|
||||
clone["x-attribsNamespace"] = { ...node["x-attribsNamespace"] };
|
||||
}
|
||||
if (node["x-attribsPrefix"]) {
|
||||
clone["x-attribsPrefix"] = { ...node["x-attribsPrefix"] };
|
||||
}
|
||||
result = clone;
|
||||
}
|
||||
else if (isCDATA(node)) {
|
||||
const children = recursive ? cloneChildren(node.children) : [];
|
||||
const clone = new CDATA(children);
|
||||
children.forEach((child) => (child.parent = clone));
|
||||
result = clone;
|
||||
}
|
||||
else if (isDocument(node)) {
|
||||
const children = recursive ? cloneChildren(node.children) : [];
|
||||
const clone = new Document(children);
|
||||
children.forEach((child) => (child.parent = clone));
|
||||
if (node["x-mode"]) {
|
||||
clone["x-mode"] = node["x-mode"];
|
||||
}
|
||||
result = clone;
|
||||
}
|
||||
else if (isDirective(node)) {
|
||||
const instruction = new ProcessingInstruction(node.name, node.data);
|
||||
if (node["x-name"] != null) {
|
||||
instruction["x-name"] = node["x-name"];
|
||||
instruction["x-publicId"] = node["x-publicId"];
|
||||
instruction["x-systemId"] = node["x-systemId"];
|
||||
}
|
||||
result = instruction;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Not implemented yet: ${node.type}`);
|
||||
}
|
||||
result.startIndex = node.startIndex;
|
||||
result.endIndex = node.endIndex;
|
||||
if (node.sourceCodeLocation != null) {
|
||||
result.sourceCodeLocation = node.sourceCodeLocation;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function cloneChildren(childs) {
|
||||
const children = childs.map((child) => cloneNode(child, true));
|
||||
for (let i = 1; i < children.length; i++) {
|
||||
children[i].prev = children[i - 1];
|
||||
children[i - 1].next = children[i];
|
||||
}
|
||||
return children;
|
||||
}
|
||||
1
test/imaps/node_modules/domhandler/lib/esm/package.json
generated
vendored
1
test/imaps/node_modules/domhandler/lib/esm/package.json
generated
vendored
@@ -1 +0,0 @@
|
||||
{"type":"module"}
|
||||
76
test/imaps/node_modules/domhandler/lib/index.d.ts
generated
vendored
76
test/imaps/node_modules/domhandler/lib/index.d.ts
generated
vendored
@@ -1,76 +0,0 @@
|
||||
import { ChildNode, Element, DataNode, Document, ParentNode } from "./node.js";
|
||||
export * from "./node.js";
|
||||
export interface DomHandlerOptions {
|
||||
/**
|
||||
* Add a `startIndex` property to nodes.
|
||||
* When the parser is used in a non-streaming fashion, `startIndex` is an integer
|
||||
* indicating the position of the start of the node in the document.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
withStartIndices?: boolean;
|
||||
/**
|
||||
* Add an `endIndex` property to nodes.
|
||||
* When the parser is used in a non-streaming fashion, `endIndex` is an integer
|
||||
* indicating the position of the end of the node in the document.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
withEndIndices?: boolean;
|
||||
/**
|
||||
* Treat the markup as XML.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
xmlMode?: boolean;
|
||||
}
|
||||
interface ParserInterface {
|
||||
startIndex: number | null;
|
||||
endIndex: number | null;
|
||||
}
|
||||
declare type Callback = (error: Error | null, dom: ChildNode[]) => void;
|
||||
declare type ElementCallback = (element: Element) => void;
|
||||
export declare class DomHandler {
|
||||
/** The elements of the DOM */
|
||||
dom: ChildNode[];
|
||||
/** The root element for the DOM */
|
||||
root: Document;
|
||||
/** Called once parsing has completed. */
|
||||
private readonly callback;
|
||||
/** Settings for the handler. */
|
||||
private readonly options;
|
||||
/** Callback whenever a tag is closed. */
|
||||
private readonly elementCB;
|
||||
/** Indicated whether parsing has been completed. */
|
||||
private done;
|
||||
/** Stack of open tags. */
|
||||
protected tagStack: ParentNode[];
|
||||
/** A data node that is still being written to. */
|
||||
protected lastNode: DataNode | null;
|
||||
/** Reference to the parser instance. Used for location information. */
|
||||
private parser;
|
||||
/**
|
||||
* @param callback Called once parsing has completed.
|
||||
* @param options Settings for the handler.
|
||||
* @param elementCB Callback whenever a tag is closed.
|
||||
*/
|
||||
constructor(callback?: Callback | null, options?: DomHandlerOptions | null, elementCB?: ElementCallback);
|
||||
onparserinit(parser: ParserInterface): void;
|
||||
onreset(): void;
|
||||
onend(): void;
|
||||
onerror(error: Error): void;
|
||||
onclosetag(): void;
|
||||
onopentag(name: string, attribs: {
|
||||
[key: string]: string;
|
||||
}): void;
|
||||
ontext(data: string): void;
|
||||
oncomment(data: string): void;
|
||||
oncommentend(): void;
|
||||
oncdatastart(): void;
|
||||
oncdataend(): void;
|
||||
onprocessinginstruction(name: string, data: string): void;
|
||||
protected handleCallback(error: Error | null): void;
|
||||
protected addNode(node: ChildNode): void;
|
||||
}
|
||||
export default DomHandler;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
test/imaps/node_modules/domhandler/lib/index.d.ts.map
generated
vendored
1
test/imaps/node_modules/domhandler/lib/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,SAAS,EACT,OAAO,EACP,QAAQ,EAIR,QAAQ,EAER,UAAU,EACb,MAAM,WAAW,CAAC;AAEnB,cAAc,WAAW,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AASD,UAAU,eAAe;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,aAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;AAChE,aAAK,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAElD,qBAAa,UAAU;IACnB,8BAA8B;IACvB,G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;IAQnD,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;CAwB3C;AAED,eAAe,UAAU,CAAC"}
|
||||
165
test/imaps/node_modules/domhandler/lib/index.js
generated
vendored
165
test/imaps/node_modules/domhandler/lib/index.js
generated
vendored
@@ -1,165 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DomHandler = void 0;
|
||||
var domelementtype_1 = require("domelementtype");
|
||||
var node_js_1 = require("./node.js");
|
||||
__exportStar(require("./node.js"), exports);
|
||||
// Default options
|
||||
var defaultOpts = {
|
||||
withStartIndices: false,
|
||||
withEndIndices: false,
|
||||
xmlMode: false,
|
||||
};
|
||||
var DomHandler = /** @class */ (function () {
|
||||
/**
|
||||
* @param callback Called once parsing has completed.
|
||||
* @param options Settings for the handler.
|
||||
* @param elementCB Callback whenever a tag is closed.
|
||||
*/
|
||||
function DomHandler(callback, options, elementCB) {
|
||||
/** The elements of the DOM */
|
||||
this.dom = [];
|
||||
/** The root element for the DOM */
|
||||
this.root = new node_js_1.Document(this.dom);
|
||||
/** Indicated whether parsing has been completed. */
|
||||
this.done = false;
|
||||
/** Stack of open tags. */
|
||||
this.tagStack = [this.root];
|
||||
/** A data node that is still being written to. */
|
||||
this.lastNode = null;
|
||||
/** Reference to the parser instance. Used for location information. */
|
||||
this.parser = null;
|
||||
// Make it possible to skip arguments, for backwards-compatibility
|
||||
if (typeof options === "function") {
|
||||
elementCB = options;
|
||||
options = defaultOpts;
|
||||
}
|
||||
if (typeof callback === "object") {
|
||||
options = callback;
|
||||
callback = undefined;
|
||||
}
|
||||
this.callback = callback !== null && callback !== void 0 ? callback : null;
|
||||
this.options = options !== null && options !== void 0 ? options : defaultOpts;
|
||||
this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;
|
||||
}
|
||||
DomHandler.prototype.onparserinit = function (parser) {
|
||||
this.parser = parser;
|
||||
};
|
||||
// Resets the handler back to starting state
|
||||
DomHandler.prototype.onreset = function () {
|
||||
this.dom = [];
|
||||
this.root = new node_js_1.Document(this.dom);
|
||||
this.done = false;
|
||||
this.tagStack = [this.root];
|
||||
this.lastNode = null;
|
||||
this.parser = null;
|
||||
};
|
||||
// Signals the handler that parsing is done
|
||||
DomHandler.prototype.onend = function () {
|
||||
if (this.done)
|
||||
return;
|
||||
this.done = true;
|
||||
this.parser = null;
|
||||
this.handleCallback(null);
|
||||
};
|
||||
DomHandler.prototype.onerror = function (error) {
|
||||
this.handleCallback(error);
|
||||
};
|
||||
DomHandler.prototype.onclosetag = function () {
|
||||
this.lastNode = null;
|
||||
var elem = this.tagStack.pop();
|
||||
if (this.options.withEndIndices) {
|
||||
elem.endIndex = this.parser.endIndex;
|
||||
}
|
||||
if (this.elementCB)
|
||||
this.elementCB(elem);
|
||||
};
|
||||
DomHandler.prototype.onopentag = function (name, attribs) {
|
||||
var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : undefined;
|
||||
var element = new node_js_1.Element(name, attribs, undefined, type);
|
||||
this.addNode(element);
|
||||
this.tagStack.push(element);
|
||||
};
|
||||
DomHandler.prototype.ontext = function (data) {
|
||||
var lastNode = this.lastNode;
|
||||
if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) {
|
||||
lastNode.data += data;
|
||||
if (this.options.withEndIndices) {
|
||||
lastNode.endIndex = this.parser.endIndex;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var node = new node_js_1.Text(data);
|
||||
this.addNode(node);
|
||||
this.lastNode = node;
|
||||
}
|
||||
};
|
||||
DomHandler.prototype.oncomment = function (data) {
|
||||
if (this.lastNode && this.lastNode.type === domelementtype_1.ElementType.Comment) {
|
||||
this.lastNode.data += data;
|
||||
return;
|
||||
}
|
||||
var node = new node_js_1.Comment(data);
|
||||
this.addNode(node);
|
||||
this.lastNode = node;
|
||||
};
|
||||
DomHandler.prototype.oncommentend = function () {
|
||||
this.lastNode = null;
|
||||
};
|
||||
DomHandler.prototype.oncdatastart = function () {
|
||||
var text = new node_js_1.Text("");
|
||||
var node = new node_js_1.CDATA([text]);
|
||||
this.addNode(node);
|
||||
text.parent = node;
|
||||
this.lastNode = text;
|
||||
};
|
||||
DomHandler.prototype.oncdataend = function () {
|
||||
this.lastNode = null;
|
||||
};
|
||||
DomHandler.prototype.onprocessinginstruction = function (name, data) {
|
||||
var node = new node_js_1.ProcessingInstruction(name, data);
|
||||
this.addNode(node);
|
||||
};
|
||||
DomHandler.prototype.handleCallback = function (error) {
|
||||
if (typeof this.callback === "function") {
|
||||
this.callback(error, this.dom);
|
||||
}
|
||||
else if (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
DomHandler.prototype.addNode = function (node) {
|
||||
var parent = this.tagStack[this.tagStack.length - 1];
|
||||
var previousSibling = parent.children[parent.children.length - 1];
|
||||
if (this.options.withStartIndices) {
|
||||
node.startIndex = this.parser.startIndex;
|
||||
}
|
||||
if (this.options.withEndIndices) {
|
||||
node.endIndex = this.parser.endIndex;
|
||||
}
|
||||
parent.children.push(node);
|
||||
if (previousSibling) {
|
||||
node.prev = previousSibling;
|
||||
previousSibling.next = node;
|
||||
}
|
||||
node.parent = parent;
|
||||
this.lastNode = null;
|
||||
};
|
||||
return DomHandler;
|
||||
}());
|
||||
exports.DomHandler = DomHandler;
|
||||
exports.default = DomHandler;
|
||||
245
test/imaps/node_modules/domhandler/lib/node.d.ts
generated
vendored
245
test/imaps/node_modules/domhandler/lib/node.d.ts
generated
vendored
@@ -1,245 +0,0 @@
|
||||
import { ElementType } from "domelementtype";
|
||||
interface SourceCodeLocation {
|
||||
/** One-based line index of the first character. */
|
||||
startLine: number;
|
||||
/** One-based column index of the first character. */
|
||||
startCol: number;
|
||||
/** Zero-based first character index. */
|
||||
startOffset: number;
|
||||
/** One-based line index of the last character. */
|
||||
endLine: number;
|
||||
/** One-based column index of the last character. Points directly *after* the last character. */
|
||||
endCol: number;
|
||||
/** Zero-based last character index. Points directly *after* the last character. */
|
||||
endOffset: number;
|
||||
}
|
||||
interface TagSourceCodeLocation extends SourceCodeLocation {
|
||||
startTag?: SourceCodeLocation;
|
||||
endTag?: SourceCodeLocation;
|
||||
}
|
||||
export declare type ParentNode = Document | Element | CDATA;
|
||||
export declare type ChildNode = Text | Comment | ProcessingInstruction | Element | CDATA | Document;
|
||||
export declare type AnyNode = ParentNode | ChildNode;
|
||||
/**
|
||||
* This object will be used as the prototype for Nodes when creating a
|
||||
* DOM-Level-1-compliant structure.
|
||||
*/
|
||||
export declare abstract class Node {
|
||||
/** The type of the node. */
|
||||
abstract readonly type: ElementType;
|
||||
/** Parent of the node */
|
||||
parent: ParentNode | null;
|
||||
/** Previous sibling */
|
||||
prev: ChildNode | null;
|
||||
/** Next sibling */
|
||||
next: ChildNode | null;
|
||||
/** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
|
||||
startIndex: number | null;
|
||||
/** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
|
||||
endIndex: number | null;
|
||||
/**
|
||||
* `parse5` source code location info.
|
||||
*
|
||||
* Available if parsing with parse5 and location info is enabled.
|
||||
*/
|
||||
sourceCodeLocation?: SourceCodeLocation | null;
|
||||
/**
|
||||
* [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodetype)-compatible
|
||||
* node {@link type}.
|
||||
*/
|
||||
abstract readonly nodeType: number;
|
||||
/**
|
||||
* Same as {@link parent}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get parentNode(): ParentNode | null;
|
||||
set parentNode(parent: ParentNode | null);
|
||||
/**
|
||||
* Same as {@link prev}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get previousSibling(): ChildNode | null;
|
||||
set previousSibling(prev: ChildNode | null);
|
||||
/**
|
||||
* Same as {@link next}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get nextSibling(): ChildNode | null;
|
||||
set nextSibling(next: ChildNode | null);
|
||||
/**
|
||||
* Clone this node, and optionally its children.
|
||||
*
|
||||
* @param recursive Clone child nodes as well.
|
||||
* @returns A clone of the node.
|
||||
*/
|
||||
cloneNode<T extends Node>(this: T, recursive?: boolean): T;
|
||||
}
|
||||
/**
|
||||
* A node that contains some data.
|
||||
*/
|
||||
export declare abstract class DataNode extends Node {
|
||||
data: string;
|
||||
/**
|
||||
* @param data The content of the data node
|
||||
*/
|
||||
constructor(data: string);
|
||||
/**
|
||||
* Same as {@link data}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get nodeValue(): string;
|
||||
set nodeValue(data: string);
|
||||
}
|
||||
/**
|
||||
* Text within the document.
|
||||
*/
|
||||
export declare class Text extends DataNode {
|
||||
type: ElementType.Text;
|
||||
get nodeType(): 3;
|
||||
}
|
||||
/**
|
||||
* Comments within the document.
|
||||
*/
|
||||
export declare class Comment extends DataNode {
|
||||
type: ElementType.Comment;
|
||||
get nodeType(): 8;
|
||||
}
|
||||
/**
|
||||
* Processing instructions, including doc types.
|
||||
*/
|
||||
export declare class ProcessingInstruction extends DataNode {
|
||||
name: string;
|
||||
type: ElementType.Directive;
|
||||
constructor(name: string, data: string);
|
||||
get nodeType(): 1;
|
||||
/** If this is a doctype, the document type name (parse5 only). */
|
||||
"x-name"?: string;
|
||||
/** If this is a doctype, the document type public identifier (parse5 only). */
|
||||
"x-publicId"?: string;
|
||||
/** If this is a doctype, the document type system identifier (parse5 only). */
|
||||
"x-systemId"?: string;
|
||||
}
|
||||
/**
|
||||
* A `Node` that can have children.
|
||||
*/
|
||||
export declare abstract class NodeWithChildren extends Node {
|
||||
children: ChildNode[];
|
||||
/**
|
||||
* @param children Children of the node. Only certain node types can have children.
|
||||
*/
|
||||
constructor(children: ChildNode[]);
|
||||
/** First child of the node. */
|
||||
get firstChild(): ChildNode | null;
|
||||
/** Last child of the node. */
|
||||
get lastChild(): ChildNode | null;
|
||||
/**
|
||||
* Same as {@link children}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get childNodes(): ChildNode[];
|
||||
set childNodes(children: ChildNode[]);
|
||||
}
|
||||
export declare class CDATA extends NodeWithChildren {
|
||||
type: ElementType.CDATA;
|
||||
get nodeType(): 4;
|
||||
}
|
||||
/**
|
||||
* The root node of the document.
|
||||
*/
|
||||
export declare class Document extends NodeWithChildren {
|
||||
type: ElementType.Root;
|
||||
get nodeType(): 9;
|
||||
/** [Document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks) (parse5 only). */
|
||||
"x-mode"?: "no-quirks" | "quirks" | "limited-quirks";
|
||||
}
|
||||
/**
|
||||
* The description of an individual attribute.
|
||||
*/
|
||||
interface Attribute {
|
||||
name: string;
|
||||
value: string;
|
||||
namespace?: string;
|
||||
prefix?: string;
|
||||
}
|
||||
/**
|
||||
* An element within the DOM.
|
||||
*/
|
||||
export declare class Element extends NodeWithChildren {
|
||||
name: string;
|
||||
attribs: {
|
||||
[name: string]: string;
|
||||
};
|
||||
type: ElementType.Tag | ElementType.Script | ElementType.Style;
|
||||
/**
|
||||
* @param name Name of the tag, eg. `div`, `span`.
|
||||
* @param attribs Object mapping attribute names to attribute values.
|
||||
* @param children Children of the node.
|
||||
*/
|
||||
constructor(name: string, attribs: {
|
||||
[name: string]: string;
|
||||
}, children?: ChildNode[], type?: ElementType.Tag | ElementType.Script | ElementType.Style);
|
||||
get nodeType(): 1;
|
||||
/**
|
||||
* `parse5` source code location info, with start & end tags.
|
||||
*
|
||||
* Available if parsing with parse5 and location info is enabled.
|
||||
*/
|
||||
sourceCodeLocation?: TagSourceCodeLocation | null;
|
||||
/**
|
||||
* Same as {@link name}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get tagName(): string;
|
||||
set tagName(name: string);
|
||||
get attributes(): Attribute[];
|
||||
/** Element namespace (parse5 only). */
|
||||
namespace?: string;
|
||||
/** Element attribute namespaces (parse5 only). */
|
||||
"x-attribsNamespace"?: Record<string, string>;
|
||||
/** Element attribute namespace-related prefixes (parse5 only). */
|
||||
"x-attribsPrefix"?: Record<string, string>;
|
||||
}
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node is a `Element`, `false` otherwise.
|
||||
*/
|
||||
export declare function isTag(node: Node): node is Element;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `CDATA`, `false` otherwise.
|
||||
*/
|
||||
export declare function isCDATA(node: Node): node is CDATA;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `Text`, `false` otherwise.
|
||||
*/
|
||||
export declare function isText(node: Node): node is Text;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `Comment`, `false` otherwise.
|
||||
*/
|
||||
export declare function isComment(node: Node): node is Comment;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
||||
*/
|
||||
export declare function isDirective(node: Node): node is ProcessingInstruction;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
||||
*/
|
||||
export declare function isDocument(node: Node): node is Document;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has children, `false` otherwise.
|
||||
*/
|
||||
export declare function hasChildren(node: Node): node is ParentNode;
|
||||
/**
|
||||
* Clone a node, and optionally its children.
|
||||
*
|
||||
* @param recursive Clone child nodes as well.
|
||||
* @returns A clone of the node.
|
||||
*/
|
||||
export declare function cloneNode<T extends Node>(node: T, recursive?: boolean): T;
|
||||
export {};
|
||||
//# sourceMappingURL=node.d.ts.map
|
||||
1
test/imaps/node_modules/domhandler/lib/node.d.ts.map
generated
vendored
1
test/imaps/node_modules/domhandler/lib/node.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,gBAAgB,CAAC;AAEhE,UAAU,kBAAkB;IACxB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,qBAAsB,SAAQ,kBAAkB;IACtD,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED,oBAAY,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AACpD,oBAAY,SAAS,GACf,IAAI,GACJ,OAAO,GACP,qBAAqB,GACrB,OAAO,GACP,KAAK,GAEL,QAAQ,CAAC;AACf,oBAAY,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAE7C;;;GAGG;AACH,8BAAsB,IAAI;IACtB,4BAA4B;IAC5B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAEpC,y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E,IAAI,GAAG,IAAI,IAAI,KAAK,CAEjD;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,IAAI,CAE/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,OAAO,CAErD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,qBAAqB,CAErE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,QAAQ,CAEvD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,UAAU,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,UAAQ,GAAG,CAAC,CA4DvE"}
|
||||
474
test/imaps/node_modules/domhandler/lib/node.js
generated
vendored
474
test/imaps/node_modules/domhandler/lib/node.js
generated
vendored
@@ -1,474 +0,0 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.cloneNode = exports.hasChildren = exports.isDocument = exports.isDirective = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = exports.Element = exports.Document = exports.CDATA = exports.NodeWithChildren = exports.ProcessingInstruction = exports.Comment = exports.Text = exports.DataNode = exports.Node = void 0;
|
||||
var domelementtype_1 = require("domelementtype");
|
||||
/**
|
||||
* This object will be used as the prototype for Nodes when creating a
|
||||
* DOM-Level-1-compliant structure.
|
||||
*/
|
||||
var Node = /** @class */ (function () {
|
||||
function Node() {
|
||||
/** Parent of the node */
|
||||
this.parent = null;
|
||||
/** Previous sibling */
|
||||
this.prev = null;
|
||||
/** Next sibling */
|
||||
this.next = null;
|
||||
/** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
|
||||
this.startIndex = null;
|
||||
/** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
|
||||
this.endIndex = null;
|
||||
}
|
||||
Object.defineProperty(Node.prototype, "parentNode", {
|
||||
// Read-write aliases for properties
|
||||
/**
|
||||
* Same as {@link parent}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get: function () {
|
||||
return this.parent;
|
||||
},
|
||||
set: function (parent) {
|
||||
this.parent = parent;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Node.prototype, "previousSibling", {
|
||||
/**
|
||||
* Same as {@link prev}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get: function () {
|
||||
return this.prev;
|
||||
},
|
||||
set: function (prev) {
|
||||
this.prev = prev;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Node.prototype, "nextSibling", {
|
||||
/**
|
||||
* Same as {@link next}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get: function () {
|
||||
return this.next;
|
||||
},
|
||||
set: function (next) {
|
||||
this.next = next;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
/**
|
||||
* Clone this node, and optionally its children.
|
||||
*
|
||||
* @param recursive Clone child nodes as well.
|
||||
* @returns A clone of the node.
|
||||
*/
|
||||
Node.prototype.cloneNode = function (recursive) {
|
||||
if (recursive === void 0) { recursive = false; }
|
||||
return cloneNode(this, recursive);
|
||||
};
|
||||
return Node;
|
||||
}());
|
||||
exports.Node = Node;
|
||||
/**
|
||||
* A node that contains some data.
|
||||
*/
|
||||
var DataNode = /** @class */ (function (_super) {
|
||||
__extends(DataNode, _super);
|
||||
/**
|
||||
* @param data The content of the data node
|
||||
*/
|
||||
function DataNode(data) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.data = data;
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(DataNode.prototype, "nodeValue", {
|
||||
/**
|
||||
* Same as {@link data}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get: function () {
|
||||
return this.data;
|
||||
},
|
||||
set: function (data) {
|
||||
this.data = data;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return DataNode;
|
||||
}(Node));
|
||||
exports.DataNode = DataNode;
|
||||
/**
|
||||
* Text within the document.
|
||||
*/
|
||||
var Text = /** @class */ (function (_super) {
|
||||
__extends(Text, _super);
|
||||
function Text() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = domelementtype_1.ElementType.Text;
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(Text.prototype, "nodeType", {
|
||||
get: function () {
|
||||
return 3;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return Text;
|
||||
}(DataNode));
|
||||
exports.Text = Text;
|
||||
/**
|
||||
* Comments within the document.
|
||||
*/
|
||||
var Comment = /** @class */ (function (_super) {
|
||||
__extends(Comment, _super);
|
||||
function Comment() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = domelementtype_1.ElementType.Comment;
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(Comment.prototype, "nodeType", {
|
||||
get: function () {
|
||||
return 8;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return Comment;
|
||||
}(DataNode));
|
||||
exports.Comment = Comment;
|
||||
/**
|
||||
* Processing instructions, including doc types.
|
||||
*/
|
||||
var ProcessingInstruction = /** @class */ (function (_super) {
|
||||
__extends(ProcessingInstruction, _super);
|
||||
function ProcessingInstruction(name, data) {
|
||||
var _this = _super.call(this, data) || this;
|
||||
_this.name = name;
|
||||
_this.type = domelementtype_1.ElementType.Directive;
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(ProcessingInstruction.prototype, "nodeType", {
|
||||
get: function () {
|
||||
return 1;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return ProcessingInstruction;
|
||||
}(DataNode));
|
||||
exports.ProcessingInstruction = ProcessingInstruction;
|
||||
/**
|
||||
* A `Node` that can have children.
|
||||
*/
|
||||
var NodeWithChildren = /** @class */ (function (_super) {
|
||||
__extends(NodeWithChildren, _super);
|
||||
/**
|
||||
* @param children Children of the node. Only certain node types can have children.
|
||||
*/
|
||||
function NodeWithChildren(children) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.children = children;
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(NodeWithChildren.prototype, "firstChild", {
|
||||
// Aliases
|
||||
/** First child of the node. */
|
||||
get: function () {
|
||||
var _a;
|
||||
return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(NodeWithChildren.prototype, "lastChild", {
|
||||
/** Last child of the node. */
|
||||
get: function () {
|
||||
return this.children.length > 0
|
||||
? this.children[this.children.length - 1]
|
||||
: null;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(NodeWithChildren.prototype, "childNodes", {
|
||||
/**
|
||||
* Same as {@link children}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get: function () {
|
||||
return this.children;
|
||||
},
|
||||
set: function (children) {
|
||||
this.children = children;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return NodeWithChildren;
|
||||
}(Node));
|
||||
exports.NodeWithChildren = NodeWithChildren;
|
||||
var CDATA = /** @class */ (function (_super) {
|
||||
__extends(CDATA, _super);
|
||||
function CDATA() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = domelementtype_1.ElementType.CDATA;
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(CDATA.prototype, "nodeType", {
|
||||
get: function () {
|
||||
return 4;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return CDATA;
|
||||
}(NodeWithChildren));
|
||||
exports.CDATA = CDATA;
|
||||
/**
|
||||
* The root node of the document.
|
||||
*/
|
||||
var Document = /** @class */ (function (_super) {
|
||||
__extends(Document, _super);
|
||||
function Document() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = domelementtype_1.ElementType.Root;
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(Document.prototype, "nodeType", {
|
||||
get: function () {
|
||||
return 9;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return Document;
|
||||
}(NodeWithChildren));
|
||||
exports.Document = Document;
|
||||
/**
|
||||
* An element within the DOM.
|
||||
*/
|
||||
var Element = /** @class */ (function (_super) {
|
||||
__extends(Element, _super);
|
||||
/**
|
||||
* @param name Name of the tag, eg. `div`, `span`.
|
||||
* @param attribs Object mapping attribute names to attribute values.
|
||||
* @param children Children of the node.
|
||||
*/
|
||||
function Element(name, attribs, children, type) {
|
||||
if (children === void 0) { children = []; }
|
||||
if (type === void 0) { type = name === "script"
|
||||
? domelementtype_1.ElementType.Script
|
||||
: name === "style"
|
||||
? domelementtype_1.ElementType.Style
|
||||
: domelementtype_1.ElementType.Tag; }
|
||||
var _this = _super.call(this, children) || this;
|
||||
_this.name = name;
|
||||
_this.attribs = attribs;
|
||||
_this.type = type;
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(Element.prototype, "nodeType", {
|
||||
get: function () {
|
||||
return 1;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Element.prototype, "tagName", {
|
||||
// DOM Level 1 aliases
|
||||
/**
|
||||
* Same as {@link name}.
|
||||
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
||||
*/
|
||||
get: function () {
|
||||
return this.name;
|
||||
},
|
||||
set: function (name) {
|
||||
this.name = name;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Element.prototype, "attributes", {
|
||||
get: function () {
|
||||
var _this = this;
|
||||
return Object.keys(this.attribs).map(function (name) {
|
||||
var _a, _b;
|
||||
return ({
|
||||
name: name,
|
||||
value: _this.attribs[name],
|
||||
namespace: (_a = _this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name],
|
||||
prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name],
|
||||
});
|
||||
});
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return Element;
|
||||
}(NodeWithChildren));
|
||||
exports.Element = Element;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node is a `Element`, `false` otherwise.
|
||||
*/
|
||||
function isTag(node) {
|
||||
return (0, domelementtype_1.isTag)(node);
|
||||
}
|
||||
exports.isTag = isTag;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `CDATA`, `false` otherwise.
|
||||
*/
|
||||
function isCDATA(node) {
|
||||
return node.type === domelementtype_1.ElementType.CDATA;
|
||||
}
|
||||
exports.isCDATA = isCDATA;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `Text`, `false` otherwise.
|
||||
*/
|
||||
function isText(node) {
|
||||
return node.type === domelementtype_1.ElementType.Text;
|
||||
}
|
||||
exports.isText = isText;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `Comment`, `false` otherwise.
|
||||
*/
|
||||
function isComment(node) {
|
||||
return node.type === domelementtype_1.ElementType.Comment;
|
||||
}
|
||||
exports.isComment = isComment;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
||||
*/
|
||||
function isDirective(node) {
|
||||
return node.type === domelementtype_1.ElementType.Directive;
|
||||
}
|
||||
exports.isDirective = isDirective;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
||||
*/
|
||||
function isDocument(node) {
|
||||
return node.type === domelementtype_1.ElementType.Root;
|
||||
}
|
||||
exports.isDocument = isDocument;
|
||||
/**
|
||||
* @param node Node to check.
|
||||
* @returns `true` if the node has children, `false` otherwise.
|
||||
*/
|
||||
function hasChildren(node) {
|
||||
return Object.prototype.hasOwnProperty.call(node, "children");
|
||||
}
|
||||
exports.hasChildren = hasChildren;
|
||||
/**
|
||||
* Clone a node, and optionally its children.
|
||||
*
|
||||
* @param recursive Clone child nodes as well.
|
||||
* @returns A clone of the node.
|
||||
*/
|
||||
function cloneNode(node, recursive) {
|
||||
if (recursive === void 0) { recursive = false; }
|
||||
var result;
|
||||
if (isText(node)) {
|
||||
result = new Text(node.data);
|
||||
}
|
||||
else if (isComment(node)) {
|
||||
result = new Comment(node.data);
|
||||
}
|
||||
else if (isTag(node)) {
|
||||
var children = recursive ? cloneChildren(node.children) : [];
|
||||
var clone_1 = new Element(node.name, __assign({}, node.attribs), children);
|
||||
children.forEach(function (child) { return (child.parent = clone_1); });
|
||||
if (node.namespace != null) {
|
||||
clone_1.namespace = node.namespace;
|
||||
}
|
||||
if (node["x-attribsNamespace"]) {
|
||||
clone_1["x-attribsNamespace"] = __assign({}, node["x-attribsNamespace"]);
|
||||
}
|
||||
if (node["x-attribsPrefix"]) {
|
||||
clone_1["x-attribsPrefix"] = __assign({}, node["x-attribsPrefix"]);
|
||||
}
|
||||
result = clone_1;
|
||||
}
|
||||
else if (isCDATA(node)) {
|
||||
var children = recursive ? cloneChildren(node.children) : [];
|
||||
var clone_2 = new CDATA(children);
|
||||
children.forEach(function (child) { return (child.parent = clone_2); });
|
||||
result = clone_2;
|
||||
}
|
||||
else if (isDocument(node)) {
|
||||
var children = recursive ? cloneChildren(node.children) : [];
|
||||
var clone_3 = new Document(children);
|
||||
children.forEach(function (child) { return (child.parent = clone_3); });
|
||||
if (node["x-mode"]) {
|
||||
clone_3["x-mode"] = node["x-mode"];
|
||||
}
|
||||
result = clone_3;
|
||||
}
|
||||
else if (isDirective(node)) {
|
||||
var instruction = new ProcessingInstruction(node.name, node.data);
|
||||
if (node["x-name"] != null) {
|
||||
instruction["x-name"] = node["x-name"];
|
||||
instruction["x-publicId"] = node["x-publicId"];
|
||||
instruction["x-systemId"] = node["x-systemId"];
|
||||
}
|
||||
result = instruction;
|
||||
}
|
||||
else {
|
||||
throw new Error("Not implemented yet: ".concat(node.type));
|
||||
}
|
||||
result.startIndex = node.startIndex;
|
||||
result.endIndex = node.endIndex;
|
||||
if (node.sourceCodeLocation != null) {
|
||||
result.sourceCodeLocation = node.sourceCodeLocation;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.cloneNode = cloneNode;
|
||||
function cloneChildren(childs) {
|
||||
var children = childs.map(function (child) { return cloneNode(child, true); });
|
||||
for (var i = 1; i < children.length; i++) {
|
||||
children[i].prev = children[i - 1];
|
||||
children[i - 1].next = children[i];
|
||||
}
|
||||
return children;
|
||||
}
|
||||
73
test/imaps/node_modules/domhandler/package.json
generated
vendored
73
test/imaps/node_modules/domhandler/package.json
generated
vendored
@@ -1,73 +0,0 @@
|
||||
{
|
||||
"name": "domhandler",
|
||||
"version": "5.0.3",
|
||||
"description": "Handler for htmlparser2 that turns pages into a dom",
|
||||
"author": "Felix Boehm <me@feedic.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/domhandler?sponsor=1"
|
||||
},
|
||||
"license": "BSD-2-Clause",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"module": "lib/esm/index.js",
|
||||
"exports": {
|
||||
"require": "./lib/index.js",
|
||||
"import": "./lib/esm/index.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npm run test:jest && npm run lint",
|
||||
"test:jest": "jest",
|
||||
"lint": "npm run lint:es && npm run lint:prettier",
|
||||
"lint:es": "eslint --ignore-path .gitignore .",
|
||||
"lint:prettier": "npm run prettier -- --check",
|
||||
"format": "npm run format:es && npm run format:prettier",
|
||||
"format:es": "npm run lint:es -- --fix",
|
||||
"format:prettier": "npm run prettier -- --write",
|
||||
"prettier": "prettier \"**/*.{ts,md,json,yml}\" --ignore-path .gitignore",
|
||||
"build": "npm run build:cjs && npm run build:esm",
|
||||
"build:cjs": "tsc",
|
||||
"build:esm": "tsc --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/fb55/domhandler.git"
|
||||
},
|
||||
"keywords": [
|
||||
"dom",
|
||||
"htmlparser2"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
},
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^17.0.30",
|
||||
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
||||
"@typescript-eslint/parser": "^5.21.0",
|
||||
"eslint": "^8.14.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"htmlparser2": "^8.0.0",
|
||||
"jest": "^27.5.1",
|
||||
"prettier": "^2.6.2",
|
||||
"ts-jest": "^27.1.4",
|
||||
"typescript": "^4.6.4"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
"testEnvironment": "node",
|
||||
"moduleNameMapper": {
|
||||
"^(.*)\\.js$": "$1"
|
||||
}
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 4
|
||||
}
|
||||
}
|
||||
92
test/imaps/node_modules/domhandler/readme.md
generated
vendored
92
test/imaps/node_modules/domhandler/readme.md
generated
vendored
@@ -1,92 +0,0 @@
|
||||
# domhandler [](https://travis-ci.com/fb55/domhandler)
|
||||
|
||||
The DOM handler creates a tree containing all nodes of a page.
|
||||
The tree can be manipulated using the [domutils](https://github.com/fb55/domutils)
|
||||
or [cheerio](https://github.com/cheeriojs/cheerio) libraries and
|
||||
rendered using [dom-serializer](https://github.com/cheeriojs/dom-serializer) .
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
const handler = new DomHandler([ <func> callback(err, dom), ] [ <obj> options ]);
|
||||
// const parser = new Parser(handler[, options]);
|
||||
```
|
||||
|
||||
Available options are described below.
|
||||
|
||||
## Example
|
||||
|
||||
```javascript
|
||||
const { Parser } = require("htmlparser2");
|
||||
const { DomHandler } = require("domhandler");
|
||||
const rawHtml =
|
||||
"Xyz <script language= javascript>var foo = '<<bar>>';</script><!--<!-- Waah! -- -->";
|
||||
const handler = new DomHandler((error, dom) => {
|
||||
if (error) {
|
||||
// Handle error
|
||||
} else {
|
||||
// Parsing completed, do something
|
||||
console.log(dom);
|
||||
}
|
||||
});
|
||||
const parser = new Parser(handler);
|
||||
parser.write(rawHtml);
|
||||
parser.end();
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```javascript
|
||||
[
|
||||
{
|
||||
data: "Xyz ",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
type: "script",
|
||||
name: "script",
|
||||
attribs: {
|
||||
language: "javascript",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: "var foo = '<bar>';<",
|
||||
type: "text",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
data: "<!-- Waah! -- ",
|
||||
type: "comment",
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
## Option: `withStartIndices`
|
||||
|
||||
Add a `startIndex` property to nodes.
|
||||
When the parser is used in a non-streaming fashion, `startIndex` is an integer
|
||||
indicating the position of the start of the node in the document.
|
||||
The default value is `false`.
|
||||
|
||||
## Option: `withEndIndices`
|
||||
|
||||
Add an `endIndex` property to nodes.
|
||||
When the parser is used in a non-streaming fashion, `endIndex` is an integer
|
||||
indicating the position of the end of the node in the document.
|
||||
The default value is `false`.
|
||||
|
||||
---
|
||||
|
||||
License: BSD-2-Clause
|
||||
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
## `domhandler` for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription
|
||||
|
||||
The maintainers of `domhandler` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-domhandler?utm_source=npm-domhandler&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
11
test/imaps/node_modules/domutils/LICENSE
generated
vendored
11
test/imaps/node_modules/domutils/LICENSE
generated
vendored
@@ -1,11 +0,0 @@
|
||||
Copyright (c) Felix Böhm
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
71
test/imaps/node_modules/domutils/lib/esm/feeds.d.ts
generated
vendored
71
test/imaps/node_modules/domutils/lib/esm/feeds.d.ts
generated
vendored
@@ -1,71 +0,0 @@
|
||||
import type { AnyNode } from "domhandler";
|
||||
/**
|
||||
* The medium of a media item.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export type FeedItemMediaMedium = "image" | "audio" | "video" | "document" | "executable";
|
||||
/**
|
||||
* The type of a media item.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export type FeedItemMediaExpression = "sample" | "full" | "nonstop";
|
||||
/**
|
||||
* A media item of a feed entry.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export interface FeedItemMedia {
|
||||
medium: FeedItemMediaMedium | undefined;
|
||||
isDefault: boolean;
|
||||
url?: string;
|
||||
fileSize?: number;
|
||||
type?: string;
|
||||
expression?: FeedItemMediaExpression;
|
||||
bitrate?: number;
|
||||
framerate?: number;
|
||||
samplingrate?: number;
|
||||
channels?: number;
|
||||
duration?: number;
|
||||
height?: number;
|
||||
width?: number;
|
||||
lang?: string;
|
||||
}
|
||||
/**
|
||||
* An entry of a feed.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export interface FeedItem {
|
||||
id?: string;
|
||||
title?: string;
|
||||
link?: string;
|
||||
description?: string;
|
||||
pubDate?: Date;
|
||||
media: FeedItemMedia[];
|
||||
}
|
||||
/**
|
||||
* The root of a feed.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export interface Feed {
|
||||
type: string;
|
||||
id?: string;
|
||||
title?: string;
|
||||
link?: string;
|
||||
description?: string;
|
||||
updated?: Date;
|
||||
author?: string;
|
||||
items: FeedItem[];
|
||||
}
|
||||
/**
|
||||
* Get the feed object from the root of a DOM tree.
|
||||
*
|
||||
* @category Feeds
|
||||
* @param doc - The DOM to to extract the feed from.
|
||||
* @returns The feed.
|
||||
*/
|
||||
export declare function getFeed(doc: AnyNode[]): Feed | null;
|
||||
//# sourceMappingURL=feeds.d.ts.map
|
||||
1
test/imaps/node_modules/domutils/lib/esm/feeds.d.ts.map
generated
vendored
1
test/imaps/node_modules/domutils/lib/esm/feeds.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"feeds.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/96c989e159c98218958f375ea04210f2d1b43c0c/src/","sources":["feeds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,YAAY,CAAC;AAInD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GACzB,OAAO,GACP,OAAO,GACP,OAAO,GACP,UAAU,G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;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAQnD"}
|
||||
183
test/imaps/node_modules/domutils/lib/esm/feeds.js
generated
vendored
183
test/imaps/node_modules/domutils/lib/esm/feeds.js
generated
vendored
@@ -1,183 +0,0 @@
|
||||
import { textContent } from "./stringify.js";
|
||||
import { getElementsByTagName } from "./legacy.js";
|
||||
/**
|
||||
* Get the feed object from the root of a DOM tree.
|
||||
*
|
||||
* @category Feeds
|
||||
* @param doc - The DOM to to extract the feed from.
|
||||
* @returns The feed.
|
||||
*/
|
||||
export function getFeed(doc) {
|
||||
const feedRoot = getOneElement(isValidFeed, doc);
|
||||
return !feedRoot
|
||||
? null
|
||||
: feedRoot.name === "feed"
|
||||
? getAtomFeed(feedRoot)
|
||||
: getRssFeed(feedRoot);
|
||||
}
|
||||
/**
|
||||
* Parse an Atom feed.
|
||||
*
|
||||
* @param feedRoot The root of the feed.
|
||||
* @returns The parsed feed.
|
||||
*/
|
||||
function getAtomFeed(feedRoot) {
|
||||
var _a;
|
||||
const childs = feedRoot.children;
|
||||
const feed = {
|
||||
type: "atom",
|
||||
items: getElementsByTagName("entry", childs).map((item) => {
|
||||
var _a;
|
||||
const { children } = item;
|
||||
const entry = { media: getMediaElements(children) };
|
||||
addConditionally(entry, "id", "id", children);
|
||||
addConditionally(entry, "title", "title", children);
|
||||
const href = (_a = getOneElement("link", children)) === null || _a === void 0 ? void 0 : _a.attribs["href"];
|
||||
if (href) {
|
||||
entry.link = href;
|
||||
}
|
||||
const description = fetch("summary", children) || fetch("content", children);
|
||||
if (description) {
|
||||
entry.description = description;
|
||||
}
|
||||
const pubDate = fetch("updated", children);
|
||||
if (pubDate) {
|
||||
entry.pubDate = new Date(pubDate);
|
||||
}
|
||||
return entry;
|
||||
}),
|
||||
};
|
||||
addConditionally(feed, "id", "id", childs);
|
||||
addConditionally(feed, "title", "title", childs);
|
||||
const href = (_a = getOneElement("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs["href"];
|
||||
if (href) {
|
||||
feed.link = href;
|
||||
}
|
||||
addConditionally(feed, "description", "subtitle", childs);
|
||||
const updated = fetch("updated", childs);
|
||||
if (updated) {
|
||||
feed.updated = new Date(updated);
|
||||
}
|
||||
addConditionally(feed, "author", "email", childs, true);
|
||||
return feed;
|
||||
}
|
||||
/**
|
||||
* Parse a RSS feed.
|
||||
*
|
||||
* @param feedRoot The root of the feed.
|
||||
* @returns The parsed feed.
|
||||
*/
|
||||
function getRssFeed(feedRoot) {
|
||||
var _a, _b;
|
||||
const childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];
|
||||
const feed = {
|
||||
type: feedRoot.name.substr(0, 3),
|
||||
id: "",
|
||||
items: getElementsByTagName("item", feedRoot.children).map((item) => {
|
||||
const { children } = item;
|
||||
const entry = { media: getMediaElements(children) };
|
||||
addConditionally(entry, "id", "guid", children);
|
||||
addConditionally(entry, "title", "title", children);
|
||||
addConditionally(entry, "link", "link", children);
|
||||
addConditionally(entry, "description", "description", children);
|
||||
const pubDate = fetch("pubDate", children) || fetch("dc:date", children);
|
||||
if (pubDate)
|
||||
entry.pubDate = new Date(pubDate);
|
||||
return entry;
|
||||
}),
|
||||
};
|
||||
addConditionally(feed, "title", "title", childs);
|
||||
addConditionally(feed, "link", "link", childs);
|
||||
addConditionally(feed, "description", "description", childs);
|
||||
const updated = fetch("lastBuildDate", childs);
|
||||
if (updated) {
|
||||
feed.updated = new Date(updated);
|
||||
}
|
||||
addConditionally(feed, "author", "managingEditor", childs, true);
|
||||
return feed;
|
||||
}
|
||||
const MEDIA_KEYS_STRING = ["url", "type", "lang"];
|
||||
const MEDIA_KEYS_INT = [
|
||||
"fileSize",
|
||||
"bitrate",
|
||||
"framerate",
|
||||
"samplingrate",
|
||||
"channels",
|
||||
"duration",
|
||||
"height",
|
||||
"width",
|
||||
];
|
||||
/**
|
||||
* Get all media elements of a feed item.
|
||||
*
|
||||
* @param where Nodes to search in.
|
||||
* @returns Media elements.
|
||||
*/
|
||||
function getMediaElements(where) {
|
||||
return getElementsByTagName("media:content", where).map((elem) => {
|
||||
const { attribs } = elem;
|
||||
const media = {
|
||||
medium: attribs["medium"],
|
||||
isDefault: !!attribs["isDefault"],
|
||||
};
|
||||
for (const attrib of MEDIA_KEYS_STRING) {
|
||||
if (attribs[attrib]) {
|
||||
media[attrib] = attribs[attrib];
|
||||
}
|
||||
}
|
||||
for (const attrib of MEDIA_KEYS_INT) {
|
||||
if (attribs[attrib]) {
|
||||
media[attrib] = parseInt(attribs[attrib], 10);
|
||||
}
|
||||
}
|
||||
if (attribs["expression"]) {
|
||||
media.expression = attribs["expression"];
|
||||
}
|
||||
return media;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get one element by tag name.
|
||||
*
|
||||
* @param tagName Tag name to look for
|
||||
* @param node Node to search in
|
||||
* @returns The element or null
|
||||
*/
|
||||
function getOneElement(tagName, node) {
|
||||
return getElementsByTagName(tagName, node, true, 1)[0];
|
||||
}
|
||||
/**
|
||||
* Get the text content of an element with a certain tag name.
|
||||
*
|
||||
* @param tagName Tag name to look for.
|
||||
* @param where Node to search in.
|
||||
* @param recurse Whether to recurse into child nodes.
|
||||
* @returns The text content of the element.
|
||||
*/
|
||||
function fetch(tagName, where, recurse = false) {
|
||||
return textContent(getElementsByTagName(tagName, where, recurse, 1)).trim();
|
||||
}
|
||||
/**
|
||||
* Adds a property to an object if it has a value.
|
||||
*
|
||||
* @param obj Object to be extended
|
||||
* @param prop Property name
|
||||
* @param tagName Tag name that contains the conditionally added property
|
||||
* @param where Element to search for the property
|
||||
* @param recurse Whether to recurse into child nodes.
|
||||
*/
|
||||
function addConditionally(obj, prop, tagName, where, recurse = false) {
|
||||
const val = fetch(tagName, where, recurse);
|
||||
if (val)
|
||||
obj[prop] = val;
|
||||
}
|
||||
/**
|
||||
* Checks if an element is a feed root node.
|
||||
*
|
||||
* @param value The name of the element to check.
|
||||
* @returns Whether an element is a feed root node.
|
||||
*/
|
||||
function isValidFeed(value) {
|
||||
return value === "rss" || value === "feed" || value === "rdf:RDF";
|
||||
}
|
||||
//# sourceMappingURL=feeds.js.map
|
||||
1
test/imaps/node_modules/domutils/lib/esm/feeds.js.map
generated
vendored
1
test/imaps/node_modules/domutils/lib/esm/feeds.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"feeds.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/96c989e159c98218958f375ea04210f2d1b43c0c/src/","sources":["feeds.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAyEnD;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,GAAc;IAClC,MAAM,QAAQ,GAAG,aAAa,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAEjD,OAAO,CAAC,QAAQ;QACZ,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM;YAC1B,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC;YACvB,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,QAAiB;;IAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAEjC,MAAM,IAAI,GAAS;QACf,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;YACtD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;YAC1B,MAAM,KAAK,GAAa,EAAE,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAE9D,gBAAgB,CAAC,KAA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d.ts
generated
vendored
@@ -1,59 +0,0 @@
|
||||
import { AnyNode } from "domhandler";
|
||||
/**
|
||||
* Given an array of nodes, remove any member that is contained by another
|
||||
* member.
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodes Nodes to filter.
|
||||
* @returns Remaining nodes that aren't contained by other nodes.
|
||||
*/
|
||||
export declare function removeSubsets(nodes: AnyNode[]): AnyNode[];
|
||||
/**
|
||||
* @category Helpers
|
||||
* @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition}
|
||||
*/
|
||||
export declare const enum DocumentPosition {
|
||||
DISCONNECTED = 1,
|
||||
PRECEDING = 2,
|
||||
FOLLOWING = 4,
|
||||
CONTAINS = 8,
|
||||
CONTAINED_BY = 16
|
||||
}
|
||||
/**
|
||||
* Compare the position of one node against another node in any other document,
|
||||
* returning a bitmask with the values from {@link DocumentPosition}.
|
||||
*
|
||||
* Document order:
|
||||
* > There is an ordering, document order, defined on all the nodes in the
|
||||
* > document corresponding to the order in which the first character of the
|
||||
* > XML representation of each node occurs in the XML representation of the
|
||||
* > document after expansion of general entities. Thus, the document element
|
||||
* > node will be the first node. Element nodes occur before their children.
|
||||
* > Thus, document order orders element nodes in order of the occurrence of
|
||||
* > their start-tag in the XML (after expansion of entities). The attribute
|
||||
* > nodes of an element occur after the element and before its children. The
|
||||
* > relative order of attribute nodes is implementation-dependent.
|
||||
*
|
||||
* Source:
|
||||
* http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodeA The first node to use in the comparison
|
||||
* @param nodeB The second node to use in the comparison
|
||||
* @returns A bitmask describing the input nodes' relative position.
|
||||
*
|
||||
* See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
|
||||
* a description of these values.
|
||||
*/
|
||||
export declare function compareDocumentPosition(nodeA: AnyNode, nodeB: AnyNode): number;
|
||||
/**
|
||||
* Sort an array of nodes based on their relative position in the document,
|
||||
* removing any duplicate nodes. If the array contains nodes that do not belong
|
||||
* to the same document, sort order is unspecified.
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodes Array of DOM nodes.
|
||||
* @returns Collection of unique nodes, sorted in document order.
|
||||
*/
|
||||
export declare function uniqueSort<T extends AnyNode>(nodes: T[]): T[];
|
||||
//# sourceMappingURL=helpers.d.ts.map
|
||||
1
test/imaps/node_modules/domutils/lib/esm/helpers.d.ts.map
generated
vendored
1
test/imaps/node_modules/domutils/lib/esm/helpers.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"helpers.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/96c989e159c98218958f375ea04210f2d1b43c0c/src/","sources":["helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,OAAO,EAAc,MAAM,YAAY,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CA6BzD;AACD;;;GAGG;AACH,0BAAkB,gBAAgB;IAC9B,YAAY,IAAI;IAChB,SAAS,IAAI;IACb,SAAS,IAAI;IACb,QAAQ,IAAI;IACZ,YAAY,KAAK;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CACnC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,OAAO,GACf,MAAM,CA4CR;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAc7D"}
|
||||
136
test/imaps/node_modules/domutils/lib/esm/helpers.js
generated
vendored
136
test/imaps/node_modules/domutils/lib/esm/helpers.js
generated
vendored
@@ -1,136 +0,0 @@
|
||||
import { hasChildren } from "domhandler";
|
||||
/**
|
||||
* Given an array of nodes, remove any member that is contained by another
|
||||
* member.
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodes Nodes to filter.
|
||||
* @returns Remaining nodes that aren't contained by other nodes.
|
||||
*/
|
||||
export function removeSubsets(nodes) {
|
||||
let idx = nodes.length;
|
||||
/*
|
||||
* Check if each node (or one of its ancestors) is already contained in the
|
||||
* array.
|
||||
*/
|
||||
while (--idx >= 0) {
|
||||
const node = nodes[idx];
|
||||
/*
|
||||
* Remove the node if it is not unique.
|
||||
* We are going through the array from the end, so we only
|
||||
* have to check nodes that preceed the node under consideration in the array.
|
||||
*/
|
||||
if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {
|
||||
nodes.splice(idx, 1);
|
||||
continue;
|
||||
}
|
||||
for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
|
||||
if (nodes.includes(ancestor)) {
|
||||
nodes.splice(idx, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
/**
|
||||
* @category Helpers
|
||||
* @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition}
|
||||
*/
|
||||
export var DocumentPosition;
|
||||
(function (DocumentPosition) {
|
||||
DocumentPosition[DocumentPosition["DISCONNECTED"] = 1] = "DISCONNECTED";
|
||||
DocumentPosition[DocumentPosition["PRECEDING"] = 2] = "PRECEDING";
|
||||
DocumentPosition[DocumentPosition["FOLLOWING"] = 4] = "FOLLOWING";
|
||||
DocumentPosition[DocumentPosition["CONTAINS"] = 8] = "CONTAINS";
|
||||
DocumentPosition[DocumentPosition["CONTAINED_BY"] = 16] = "CONTAINED_BY";
|
||||
})(DocumentPosition || (DocumentPosition = {}));
|
||||
/**
|
||||
* Compare the position of one node against another node in any other document,
|
||||
* returning a bitmask with the values from {@link DocumentPosition}.
|
||||
*
|
||||
* Document order:
|
||||
* > There is an ordering, document order, defined on all the nodes in the
|
||||
* > document corresponding to the order in which the first character of the
|
||||
* > XML representation of each node occurs in the XML representation of the
|
||||
* > document after expansion of general entities. Thus, the document element
|
||||
* > node will be the first node. Element nodes occur before their children.
|
||||
* > Thus, document order orders element nodes in order of the occurrence of
|
||||
* > their start-tag in the XML (after expansion of entities). The attribute
|
||||
* > nodes of an element occur after the element and before its children. The
|
||||
* > relative order of attribute nodes is implementation-dependent.
|
||||
*
|
||||
* Source:
|
||||
* http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodeA The first node to use in the comparison
|
||||
* @param nodeB The second node to use in the comparison
|
||||
* @returns A bitmask describing the input nodes' relative position.
|
||||
*
|
||||
* See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
|
||||
* a description of these values.
|
||||
*/
|
||||
export function compareDocumentPosition(nodeA, nodeB) {
|
||||
const aParents = [];
|
||||
const bParents = [];
|
||||
if (nodeA === nodeB) {
|
||||
return 0;
|
||||
}
|
||||
let current = hasChildren(nodeA) ? nodeA : nodeA.parent;
|
||||
while (current) {
|
||||
aParents.unshift(current);
|
||||
current = current.parent;
|
||||
}
|
||||
current = hasChildren(nodeB) ? nodeB : nodeB.parent;
|
||||
while (current) {
|
||||
bParents.unshift(current);
|
||||
current = current.parent;
|
||||
}
|
||||
const maxIdx = Math.min(aParents.length, bParents.length);
|
||||
let idx = 0;
|
||||
while (idx < maxIdx && aParents[idx] === bParents[idx]) {
|
||||
idx++;
|
||||
}
|
||||
if (idx === 0) {
|
||||
return DocumentPosition.DISCONNECTED;
|
||||
}
|
||||
const sharedParent = aParents[idx - 1];
|
||||
const siblings = sharedParent.children;
|
||||
const aSibling = aParents[idx];
|
||||
const bSibling = bParents[idx];
|
||||
if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
|
||||
if (sharedParent === nodeB) {
|
||||
return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY;
|
||||
}
|
||||
return DocumentPosition.FOLLOWING;
|
||||
}
|
||||
if (sharedParent === nodeA) {
|
||||
return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS;
|
||||
}
|
||||
return DocumentPosition.PRECEDING;
|
||||
}
|
||||
/**
|
||||
* Sort an array of nodes based on their relative position in the document,
|
||||
* removing any duplicate nodes. If the array contains nodes that do not belong
|
||||
* to the same document, sort order is unspecified.
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodes Array of DOM nodes.
|
||||
* @returns Collection of unique nodes, sorted in document order.
|
||||
*/
|
||||
export function uniqueSort(nodes) {
|
||||
nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1));
|
||||
nodes.sort((a, b) => {
|
||||
const relative = compareDocumentPosition(a, b);
|
||||
if (relative & DocumentPosition.PRECEDING) {
|
||||
return -1;
|
||||
}
|
||||
else if (relative & DocumentPosition.FOLLOWING) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
return nodes;
|
||||
}
|
||||
//# sourceMappingURL=helpers.js.map
|
||||
1
test/imaps/node_modules/domutils/lib/esm/helpers.js.map
generated
vendored
1
test/imaps/node_modules/domutils/lib/esm/helpers.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"helpers.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/96c989e159c98218958f375ea04210f2d1b43c0c/src/","sources":["helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuB,MAAM,YAAY,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAgB;IAC1C,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IAEvB;;;OAGG;IACH,OAAO,EAAE,GAAG,IAAI,CAAC,EAAE;QACf,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAExB;;;;WAIG;QACH,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE;YAClD,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACrB,SAAS;SACZ;QAED,KAAK,IAAI,QAAQ,GAAG,IAAI,CAAC,MAA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AG,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,QAAQ,GAAG,gBAAgB,CAAC,SAAS,EAAE;YACvC,OAAO,CAAC,CAAC,CAAC;SACb;aAAM,IAAI,QAAQ,GAAG,gBAAgB,CAAC,SAAS,EAAE;YAC9C,OAAO,CAAC,CAAC;SACZ;QACD,OAAO,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
||||
10
test/imaps/node_modules/domutils/lib/esm/index.d.ts
generated
vendored
10
test/imaps/node_modules/domutils/lib/esm/index.d.ts
generated
vendored
@@ -1,10 +0,0 @@
|
||||
export * from "./stringify.js";
|
||||
export * from "./traversal.js";
|
||||
export * from "./manipulation.js";
|
||||
export * from "./querying.js";
|
||||
export * from "./legacy.js";
|
||||
export * from "./helpers.js";
|
||||
export * from "./feeds.js";
|
||||
/** @deprecated Use these methods from `domhandler` directly. */
|
||||
export { isTag, isCDATA, isText, isComment, isDocument, hasChildren, } from "domhandler";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
test/imaps/node_modules/domutils/lib/esm/index.d.ts.map
generated
vendored
1
test/imaps/node_modules/domutils/lib/esm/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/96c989e159c98218958f375ea04210f2d1b43c0c/src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,gEAAgE;AAChE,OAAO,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,WAAW,GACd,MAAM,YAAY,CAAC"}
|
||||
10
test/imaps/node_modules/domutils/lib/esm/index.js
generated
vendored
10
test/imaps/node_modules/domutils/lib/esm/index.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
export * from "./stringify.js";
|
||||
export * from "./traversal.js";
|
||||
export * from "./manipulation.js";
|
||||
export * from "./querying.js";
|
||||
export * from "./legacy.js";
|
||||
export * from "./helpers.js";
|
||||
export * from "./feeds.js";
|
||||
/** @deprecated Use these methods from `domhandler` directly. */
|
||||
export { isTag, isCDATA, isText, isComment, isDocument, hasChildren, } from "domhandler";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
test/imaps/node_modules/domutils/lib/esm/index.js.map
generated
vendored
1
test/imaps/node_modules/domutils/lib/esm/index.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/96c989e159c98218958f375ea04210f2d1b43c0c/src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,gEAAgE;AAChE,OAAO,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,WAAW,GACd,MAAM,YAAY,CAAC"}
|
||||
68
test/imaps/node_modules/domutils/lib/esm/legacy.d.ts
generated
vendored
68
test/imaps/node_modules/domutils/lib/esm/legacy.d.ts
generated
vendored
@@ -1,68 +0,0 @@
|
||||
import { AnyNode, Element } from "domhandler";
|
||||
import type { ElementType } from "domelementtype";
|
||||
/**
|
||||
* An object with keys to check elements against. If a key is `tag_name`,
|
||||
* `tag_type` or `tag_contains`, it will check the value against that specific
|
||||
* value. Otherwise, it will check an attribute with the key's name.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
*/
|
||||
export interface TestElementOpts {
|
||||
tag_name?: string | ((name: string) => boolean);
|
||||
tag_type?: string | ((name: string) => boolean);
|
||||
tag_contains?: string | ((data?: string) => boolean);
|
||||
[attributeName: string]: undefined | string | ((attributeValue: string) => boolean);
|
||||
}
|
||||
/**
|
||||
* Checks whether a node matches the description in `options`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param options An object describing nodes to look for.
|
||||
* @param node The element to test.
|
||||
* @returns Whether the element matches the description in `options`.
|
||||
*/
|
||||
export declare function testElement(options: TestElementOpts, node: AnyNode): boolean;
|
||||
/**
|
||||
* Returns all nodes that match `options`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param options An object describing nodes to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes that match `options`.
|
||||
*/
|
||||
export declare function getElements(options: TestElementOpts, nodes: AnyNode | AnyNode[], recurse: boolean, limit?: number): AnyNode[];
|
||||
/**
|
||||
* Returns the node with the supplied ID.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param id The unique ID attribute value to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @returns The node with the supplied ID.
|
||||
*/
|
||||
export declare function getElementById(id: string | ((id: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean): Element | null;
|
||||
/**
|
||||
* Returns all nodes with the supplied `tagName`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param tagName Tag name to search for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `tagName`.
|
||||
*/
|
||||
export declare function getElementsByTagName(tagName: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[];
|
||||
/**
|
||||
* Returns all nodes with the supplied `type`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param type Element type to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `type`.
|
||||
*/
|
||||
export declare function getElementsByTagType(type: ElementType | ((type: ElementType) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): AnyNode[];
|
||||
//# sourceMappingURL=legacy.d.ts.map
|
||||
1
test/imaps/node_modules/domutils/lib/esm/legacy.d.ts.map
generated
vendored
1
test/imaps/node_modules/domutils/lib/esm/legacy.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"legacy.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/96c989e159c98218958f375ea04210f2d1b43c0c/src/","sources":["legacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IACrD,CAAC,aAAa,EAAE,MAAM,GAChB,SAAS,GACT,MAAM,GACN,CAAC,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;CAC/C;AAkFD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAG5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACvB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,EAC1B,OAAO,EAAE,OAAO,EAChB,KAAK,SAAW,GACjB,OAAO,EAAE,CAGX;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC1B,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,EACtC,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,EAC1B,OAAO,UAAO,GACf,OAAO,GAAG,IAAI,CAGhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,EAC7C,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,EAC1B,OAAO,UAAO,EACd,KAAK,SAAW,GACjB,OAAO,EAAE,CAOX;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,WAAW,GAAG,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,EACpD,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,EAC1B,OAAO,UAAO,EACd,KAAK,SAAW,GACjB,OAAO,EAAE,CAEX"}
|
||||
139
test/imaps/node_modules/domutils/lib/esm/legacy.js
generated
vendored
139
test/imaps/node_modules/domutils/lib/esm/legacy.js
generated
vendored
@@ -1,139 +0,0 @@
|
||||
import { isTag, isText } from "domhandler";
|
||||
import { filter, findOne } from "./querying.js";
|
||||
/**
|
||||
* A map of functions to check nodes against.
|
||||
*/
|
||||
const Checks = {
|
||||
tag_name(name) {
|
||||
if (typeof name === "function") {
|
||||
return (elem) => isTag(elem) && name(elem.name);
|
||||
}
|
||||
else if (name === "*") {
|
||||
return isTag;
|
||||
}
|
||||
return (elem) => isTag(elem) && elem.name === name;
|
||||
},
|
||||
tag_type(type) {
|
||||
if (typeof type === "function") {
|
||||
return (elem) => type(elem.type);
|
||||
}
|
||||
return (elem) => elem.type === type;
|
||||
},
|
||||
tag_contains(data) {
|
||||
if (typeof data === "function") {
|
||||
return (elem) => isText(elem) && data(elem.data);
|
||||
}
|
||||
return (elem) => isText(elem) && elem.data === data;
|
||||
},
|
||||
};
|
||||
/**
|
||||
* Returns a function to check whether a node has an attribute with a particular
|
||||
* value.
|
||||
*
|
||||
* @param attrib Attribute to check.
|
||||
* @param value Attribute value to look for.
|
||||
* @returns A function to check whether the a node has an attribute with a
|
||||
* particular value.
|
||||
*/
|
||||
function getAttribCheck(attrib, value) {
|
||||
if (typeof value === "function") {
|
||||
return (elem) => isTag(elem) && value(elem.attribs[attrib]);
|
||||
}
|
||||
return (elem) => isTag(elem) && elem.attribs[attrib] === value;
|
||||
}
|
||||
/**
|
||||
* Returns a function that returns `true` if either of the input functions
|
||||
* returns `true` for a node.
|
||||
*
|
||||
* @param a First function to combine.
|
||||
* @param b Second function to combine.
|
||||
* @returns A function taking a node and returning `true` if either of the input
|
||||
* functions returns `true` for the node.
|
||||
*/
|
||||
function combineFuncs(a, b) {
|
||||
return (elem) => a(elem) || b(elem);
|
||||
}
|
||||
/**
|
||||
* Returns a function that executes all checks in `options` and returns `true`
|
||||
* if any of them match a node.
|
||||
*
|
||||
* @param options An object describing nodes to look for.
|
||||
* @returns A function that executes all checks in `options` and returns `true`
|
||||
* if any of them match a node.
|
||||
*/
|
||||
function compileTest(options) {
|
||||
const funcs = Object.keys(options).map((key) => {
|
||||
const value = options[key];
|
||||
return Object.prototype.hasOwnProperty.call(Checks, key)
|
||||
? Checks[key](value)
|
||||
: getAttribCheck(key, value);
|
||||
});
|
||||
return funcs.length === 0 ? null : funcs.reduce(combineFuncs);
|
||||
}
|
||||
/**
|
||||
* Checks whether a node matches the description in `options`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param options An object describing nodes to look for.
|
||||
* @param node The element to test.
|
||||
* @returns Whether the element matches the description in `options`.
|
||||
*/
|
||||
export function testElement(options, node) {
|
||||
const test = compileTest(options);
|
||||
return test ? test(node) : true;
|
||||
}
|
||||
/**
|
||||
* Returns all nodes that match `options`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param options An object describing nodes to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes that match `options`.
|
||||
*/
|
||||
export function getElements(options, nodes, recurse, limit = Infinity) {
|
||||
const test = compileTest(options);
|
||||
return test ? filter(test, nodes, recurse, limit) : [];
|
||||
}
|
||||
/**
|
||||
* Returns the node with the supplied ID.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param id The unique ID attribute value to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @returns The node with the supplied ID.
|
||||
*/
|
||||
export function getElementById(id, nodes, recurse = true) {
|
||||
if (!Array.isArray(nodes))
|
||||
nodes = [nodes];
|
||||
return findOne(getAttribCheck("id", id), nodes, recurse);
|
||||
}
|
||||
/**
|
||||
* Returns all nodes with the supplied `tagName`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param tagName Tag name to search for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `tagName`.
|
||||
*/
|
||||
export function getElementsByTagName(tagName, nodes, recurse = true, limit = Infinity) {
|
||||
return filter(Checks["tag_name"](tagName), nodes, recurse, limit);
|
||||
}
|
||||
/**
|
||||
* Returns all nodes with the supplied `type`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param type Element type to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `type`.
|
||||
*/
|
||||
export function getElementsByTagType(type, nodes, recurse = true, limit = Infinity) {
|
||||
return filter(Checks["tag_type"](type), nodes, recurse, limit);
|
||||
}
|
||||
//# sourceMappingURL=legacy.js.map
|
||||
1
test/imaps/node_modules/domutils/lib/esm/legacy.js.map
generated
vendored
1
test/imaps/node_modules/domutils/lib/esm/legacy.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"legacy.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/96c989e159c98218958f375ea04210f2d1b43c0c/src/","sources":["legacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAoB,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAqBhD;;GAEG;AACH,MAAM,MAAM,GAGR;IACA,QAAQ,CAAC,IAAI;QACT,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC5B,OAAO,CAAC,IAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC5D;aAAM,IAAI,IAAI,KAAK,GAAG,EAAE;YACrB,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,CAAC,IAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;IAChE,CAAC;IACD,QAAQ,CAAC,IAAI;QACT,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC5B,OAAO,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7C;QACD,OAAO,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;IACjD,CAAC;IACD,YAAY,CAAC,IAAI;QACb,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC5B,OAAO,CAAC,IAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7D;QACD,OAAO,CAAC,I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MAAM,CAAC,UAAU,CAAC,CAAC,IAAc,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7E,CAAC"}
|
||||
49
test/imaps/node_modules/domutils/lib/esm/manipulation.d.ts
generated
vendored
49
test/imaps/node_modules/domutils/lib/esm/manipulation.d.ts
generated
vendored
@@ -1,49 +0,0 @@
|
||||
import type { ChildNode, ParentNode } from "domhandler";
|
||||
/**
|
||||
* Remove an element from the dom
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to be removed
|
||||
*/
|
||||
export declare function removeElement(elem: ChildNode): void;
|
||||
/**
|
||||
* Replace an element in the dom
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to be replaced
|
||||
* @param replacement The element to be added
|
||||
*/
|
||||
export declare function replaceElement(elem: ChildNode, replacement: ChildNode): void;
|
||||
/**
|
||||
* Append a child to an element.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param parent The element to append to.
|
||||
* @param child The element to be added as a child.
|
||||
*/
|
||||
export declare function appendChild(parent: ParentNode, child: ChildNode): void;
|
||||
/**
|
||||
* Append an element after another.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to append after.
|
||||
* @param next The element be added.
|
||||
*/
|
||||
export declare function append(elem: ChildNode, next: ChildNode): void;
|
||||
/**
|
||||
* Prepend a child to an element.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param parent The element to prepend before.
|
||||
* @param child The element to be added as a child.
|
||||
*/
|
||||
export declare function prependChild(parent: ParentNode, child: ChildNode): void;
|
||||
/**
|
||||
* Prepend an element before another.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to prepend before.
|
||||
* @param prev The element be added.
|
||||
*/
|
||||
export declare function prepend(elem: ChildNode, prev: ChildNode): void;
|
||||
//# sourceMappingURL=manipulation.d.ts.map
|
||||
1
test/imaps/node_modules/domutils/lib/esm/manipulation.d.ts.map
generated
vendored
1
test/imaps/node_modules/domutils/lib/esm/manipulation.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"manipulation.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/96c989e159c98218958f375ea04210f2d1b43c0c/src/","sources":["manipulation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAcnD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,GAAG,IAAI,CAiB5E;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAatE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAoB7D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAavE;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAiB9D"}
|
||||
134
test/imaps/node_modules/domutils/lib/esm/manipulation.js
generated
vendored
134
test/imaps/node_modules/domutils/lib/esm/manipulation.js
generated
vendored
@@ -1,134 +0,0 @@
|
||||
/**
|
||||
* Remove an element from the dom
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to be removed
|
||||
*/
|
||||
export function removeElement(elem) {
|
||||
if (elem.prev)
|
||||
elem.prev.next = elem.next;
|
||||
if (elem.next)
|
||||
elem.next.prev = elem.prev;
|
||||
if (elem.parent) {
|
||||
const childs = elem.parent.children;
|
||||
const childsIndex = childs.lastIndexOf(elem);
|
||||
if (childsIndex >= 0) {
|
||||
childs.splice(childsIndex, 1);
|
||||
}
|
||||
}
|
||||
elem.next = null;
|
||||
elem.prev = null;
|
||||
elem.parent = null;
|
||||
}
|
||||
/**
|
||||
* Replace an element in the dom
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to be replaced
|
||||
* @param replacement The element to be added
|
||||
*/
|
||||
export function replaceElement(elem, replacement) {
|
||||
const prev = (replacement.prev = elem.prev);
|
||||
if (prev) {
|
||||
prev.next = replacement;
|
||||
}
|
||||
const next = (replacement.next = elem.next);
|
||||
if (next) {
|
||||
next.prev = replacement;
|
||||
}
|
||||
const parent = (replacement.parent = elem.parent);
|
||||
if (parent) {
|
||||
const childs = parent.children;
|
||||
childs[childs.lastIndexOf(elem)] = replacement;
|
||||
elem.parent = null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Append a child to an element.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param parent The element to append to.
|
||||
* @param child The element to be added as a child.
|
||||
*/
|
||||
export function appendChild(parent, child) {
|
||||
removeElement(child);
|
||||
child.next = null;
|
||||
child.parent = parent;
|
||||
if (parent.children.push(child) > 1) {
|
||||
const sibling = parent.children[parent.children.length - 2];
|
||||
sibling.next = child;
|
||||
child.prev = sibling;
|
||||
}
|
||||
else {
|
||||
child.prev = null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Append an element after another.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to append after.
|
||||
* @param next The element be added.
|
||||
*/
|
||||
export function append(elem, next) {
|
||||
removeElement(next);
|
||||
const { parent } = elem;
|
||||
const currNext = elem.next;
|
||||
next.next = currNext;
|
||||
next.prev = elem;
|
||||
elem.next = next;
|
||||
next.parent = parent;
|
||||
if (currNext) {
|
||||
currNext.prev = next;
|
||||
if (parent) {
|
||||
const childs = parent.children;
|
||||
childs.splice(childs.lastIndexOf(currNext), 0, next);
|
||||
}
|
||||
}
|
||||
else if (parent) {
|
||||
parent.children.push(next);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Prepend a child to an element.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param parent The element to prepend before.
|
||||
* @param child The element to be added as a child.
|
||||
*/
|
||||
export function prependChild(parent, child) {
|
||||
removeElement(child);
|
||||
child.parent = parent;
|
||||
child.prev = null;
|
||||
if (parent.children.unshift(child) !== 1) {
|
||||
const sibling = parent.children[1];
|
||||
sibling.prev = child;
|
||||
child.next = sibling;
|
||||
}
|
||||
else {
|
||||
child.next = null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Prepend an element before another.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to prepend before.
|
||||
* @param prev The element be added.
|
||||
*/
|
||||
export function prepend(elem, prev) {
|
||||
removeElement(prev);
|
||||
const { parent } = elem;
|
||||
if (parent) {
|
||||
const childs = parent.children;
|
||||
childs.splice(childs.indexOf(elem), 0, prev);
|
||||
}
|
||||
if (elem.prev) {
|
||||
elem.prev.next = prev;
|
||||
}
|
||||
prev.parent = parent;
|
||||
prev.prev = elem.prev;
|
||||
prev.next = elem;
|
||||
elem.prev = prev;
|
||||
}
|
||||
//# sourceMappingURL=manipulation.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user