Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rallie/load-html

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rallie/load-html - npm Package Compare versions

Comparing version 0.16.0 to 0.16.1

2

./dist/index.umd.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RallieImportHtml={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(o,l){function i(t){try{s(r.next(t))}catch(t){l(t)}}function c(t){try{s(r.throw(t))}catch(t){l(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,c)}s((r=r.apply(t,e||[])).next())}))}const n=t=>`[@rallie/load-html] ${t}`,r=/^(http:\/\/|https:\/\/|\/\/)([^?#]*)(\?[^?#]+)?(#.+)?/,o=t=>n(`Invalid html path: ${t}`),l=(t,e)=>n(`Can not construct a url by the base '${t}' and the path '${e}'`),i=t=>{const e=Array.from(t.attributes),n=document.createElement(t.tagName);return e.forEach((t=>{n.setAttribute(t.name,t.value)})),n.innerHTML=t.innerHTML,n},c=(t={})=>(n,c)=>e(void 0,void 0,void 0,(function*(){var s;const a=null!==(s=t.fetch)&&void 0!==s?s:window.fetch,u=t.filter;n.loadHtml=c=>e(void 0,void 0,void 0,(function*(){var e;const s=null!==(e=t.regardHtmlPathAsRoot)&&void 0!==e&&e,f=yield a(c),d=yield f.text(),[h,m]=(t=>{const e=r.exec(t);if(e)return[e[0],e[4]||null];throw new Error(o(t))})(c),{root:p,scripts:y,links:v,styles:b}=((t,e,n,r=(()=>!0))=>{const o=document.createElement("html");o.innerHTML=t;const l=Array.from(o.querySelectorAll("script")).filter(r).map((t=>i(t))).map((t=>{const e=t.getAttribute("src");return n&&e&&t.setAttribute("src",n(e)),t})),c=Array.from(o.querySelectorAll("link")).filter(r).map((t=>i(t))).map((t=>{const e=t.getAttribute("href");return n&&e&&t.setAttribute("href",n(e)),t})),s=Array.from(o.querySelectorAll("style")).filter(r).map((t=>i(t)));return{root:e?o.querySelector(e):null,scripts:l,links:c,styles:s}})(d,m,(t=>((t,e,n=!1)=>{if(/^(http:\/\/|https:\/\/|\/\/).+/.test(t))return t;const o=r.exec(e);if(o){const e=o[1],r=o[2];n&&t.startsWith("/")&&(t=t.slice(1));let l="";return l=new URL(t,("//"===e?"http://":e)+r).href,"//"===e&&(l=l.slice(5)),l}return console.error(l(e,t)),""})(t,h,s)),u);for(const t of b)document.head.appendChild(t);for(const t of v)n.loadLink(t);if(p){const t=document.querySelector(m);t?t.innerHTML=p.innerHTML:document.body.appendChild(p)}for(const t of y)yield n.loadScript(t);return!!(y.length+v.length+b.length)||!!p}));const f=(t.entries||{})[n.name];f?yield n.loadHtml(f):yield c()}));t.default=c,t.loadHtml=c,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RallieImportHtml={})}(this,(function(t){"use strict";function e(t,e,r,n){return new(r||(r=Promise))((function(o,l){function i(t){try{s(n.next(t))}catch(t){l(t)}}function c(t){try{s(n.throw(t))}catch(t){l(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,c)}s((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const r=t=>`[@rallie/load-html] ${t}`,n=/^(http:\/\/|https:\/\/|\/\/)([^?#]*)(\?[^?#]+)?(#.+)?/,o=t=>r(`Invalid html path: ${t}`),l=(t,e)=>r(`Can not construct a url by the base '${t}' and the path '${e}'`),i=t=>{const e=Array.from(t.attributes),r=document.createElement(t.tagName);return e.forEach((t=>{r.setAttribute(t.name,t.value)})),r.innerHTML=t.innerHTML,r},c=(t={})=>(r,c)=>e(void 0,void 0,void 0,(function*(){var s;const u=null!==(s=t.fetch)&&void 0!==s?s:window.fetch,a=t.filter;r.loadHtml=c=>e(void 0,void 0,void 0,(function*(){var e;const s=null!==(e=t.regardHtmlPathAsRoot)&&void 0!==e&&e,f=yield u(c),d=yield f.text(),[p,h]=(t=>{const e=n.exec(t);if(e)return[e[0],e[4]||null];throw new Error(o(t))})(c),{root:m,scripts:y,links:v,styles:b}=((t,e,r,n=(()=>!0))=>{const o=document.createElement("html");o.innerHTML=t;const l=Array.from(o.querySelectorAll("script")).filter(n).map((t=>i(t))).map((t=>{const e=t.getAttribute("src");return r&&e&&t.setAttribute("src",r(e)),t})),c=Array.from(o.querySelectorAll("link")).filter(n).map((t=>i(t))).map((t=>{const e=t.getAttribute("href");return r&&e&&t.setAttribute("href",r(e)),t})),s=Array.from(o.querySelectorAll("style")).filter(n).map((t=>i(t)));return{root:e?o.querySelector(e):null,scripts:l,links:c,styles:s}})(d,h,(t=>((t,e,r=!1)=>{if(/^(http:\/\/|https:\/\/|\/\/).+/.test(t))return t;const o=n.exec(e);if(o){const e=o[1],n=o[2];r&&t.startsWith("/")&&(t=t.slice(1));let l="";return l=new URL(t,("//"===e?"http://":e)+n).href,"//"===e&&(l=l.slice(5)),l}return console.error(l(e,t)),""})(t,p,s)),a);for(const t of b)document.head.appendChild(t);for(const t of v)r.loadLink(t);if(m){const t=document.querySelector(h);t?t.innerHTML=m.innerHTML:document.body.appendChild(m)}for(const t of y)yield r.loadScript(t);return!!(y.length+v.length+b.length)||!!m}));const f=(t.entries||{})[r.name];f?yield r.loadHtml(f):yield c()}));t.default=c,t.loadHtml=c,Object.defineProperty(t,"__esModule",{value:!0})}));
import { loadHtml } from './load-html';
export * from './load-html';
export default loadHtml;

@@ -1,1 +0,1 @@

function t(t,e,r,n){return new(r||(r=Promise))((function(o,l){function i(t){try{s(n.next(t))}catch(t){l(t)}}function c(t){try{s(n.throw(t))}catch(t){l(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,c)}s((n=n.apply(t,e||[])).next())}))}const e=t=>`[@rallie/load-html] ${t}`,r=/^(http:\/\/|https:\/\/|\/\/)([^?#]*)(\?[^?#]+)?(#.+)?/,n=t=>e(`Invalid html path: ${t}`),o=(t,r)=>e(`Can not construct a url by the base '${t}' and the path '${r}'`),l=t=>{const e=Array.from(t.attributes),r=document.createElement(t.tagName);return e.forEach((t=>{r.setAttribute(t.name,t.value)})),r.innerHTML=t.innerHTML,r},i=(e={})=>(i,c)=>t(void 0,void 0,void 0,(function*(){var s;const a=null!==(s=e.fetch)&&void 0!==s?s:window.fetch,u=e.filter;i.loadHtml=c=>t(void 0,void 0,void 0,(function*(){var t;const s=null!==(t=e.regardHtmlPathAsRoot)&&void 0!==t&&t,d=yield a(c),f=yield d.text(),[h,m]=(t=>{const e=r.exec(t);if(e)return[e[0],e[4]||null];throw new Error(n(t))})(c),{root:p,scripts:y,links:v,styles:A}=((t,e,r,n=(()=>!0))=>{const o=document.createElement("html");o.innerHTML=t;const i=Array.from(o.querySelectorAll("script")).filter(n).map((t=>l(t))).map((t=>{const e=t.getAttribute("src");return r&&e&&t.setAttribute("src",r(e)),t})),c=Array.from(o.querySelectorAll("link")).filter(n).map((t=>l(t))).map((t=>{const e=t.getAttribute("href");return r&&e&&t.setAttribute("href",r(e)),t})),s=Array.from(o.querySelectorAll("style")).filter(n).map((t=>l(t)));return{root:e?o.querySelector(e):null,scripts:i,links:c,styles:s}})(f,m,(t=>((t,e,n=!1)=>{if(/^(http:\/\/|https:\/\/|\/\/).+/.test(t))return t;const l=r.exec(e);if(l){const e=l[1],r=l[2];n&&t.startsWith("/")&&(t=t.slice(1));let o="";return o=new URL(t,("//"===e?"http://":e)+r).href,"//"===e&&(o=o.slice(5)),o}return console.error(o(e,t)),""})(t,h,s)),u);for(const t of A)document.head.appendChild(t);for(const t of v)i.loadLink(t);if(p){const t=document.querySelector(m);t?t.innerHTML=p.innerHTML:document.body.appendChild(p)}for(const t of y)yield i.loadScript(t);return!!(y.length+v.length+A.length)||!!p}));const d=(e.entries||{})[i.name];d?yield i.loadHtml(d):yield c()}));export{i as default,i as loadHtml};
function t(t,e,r,n){return new(r||(r=Promise))((function(o,l){function i(t){try{s(n.next(t))}catch(t){l(t)}}function c(t){try{s(n.throw(t))}catch(t){l(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,c)}s((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const e=t=>`[@rallie/load-html] ${t}`,r=/^(http:\/\/|https:\/\/|\/\/)([^?#]*)(\?[^?#]+)?(#.+)?/,n=t=>e(`Invalid html path: ${t}`),o=(t,r)=>e(`Can not construct a url by the base '${t}' and the path '${r}'`),l=t=>{const e=Array.from(t.attributes),r=document.createElement(t.tagName);return e.forEach((t=>{r.setAttribute(t.name,t.value)})),r.innerHTML=t.innerHTML,r},i=(e={})=>(i,c)=>t(void 0,void 0,void 0,(function*(){var s;const a=null!==(s=e.fetch)&&void 0!==s?s:window.fetch,u=e.filter;i.loadHtml=c=>t(void 0,void 0,void 0,(function*(){var t;const s=null!==(t=e.regardHtmlPathAsRoot)&&void 0!==t&&t,d=yield a(c),f=yield d.text(),[h,p]=(t=>{const e=r.exec(t);if(e)return[e[0],e[4]||null];throw new Error(n(t))})(c),{root:m,scripts:y,links:v,styles:A}=((t,e,r,n=(()=>!0))=>{const o=document.createElement("html");o.innerHTML=t;const i=Array.from(o.querySelectorAll("script")).filter(n).map((t=>l(t))).map((t=>{const e=t.getAttribute("src");return r&&e&&t.setAttribute("src",r(e)),t})),c=Array.from(o.querySelectorAll("link")).filter(n).map((t=>l(t))).map((t=>{const e=t.getAttribute("href");return r&&e&&t.setAttribute("href",r(e)),t})),s=Array.from(o.querySelectorAll("style")).filter(n).map((t=>l(t)));return{root:e?o.querySelector(e):null,scripts:i,links:c,styles:s}})(f,p,(t=>((t,e,n=!1)=>{if(/^(http:\/\/|https:\/\/|\/\/).+/.test(t))return t;const l=r.exec(e);if(l){const e=l[1],r=l[2];n&&t.startsWith("/")&&(t=t.slice(1));let o="";return o=new URL(t,("//"===e?"http://":e)+r).href,"//"===e&&(o=o.slice(5)),o}return console.error(o(e,t)),""})(t,h,s)),u);for(const t of A)document.head.appendChild(t);for(const t of v)i.loadLink(t);if(m){const t=document.querySelector(p);t?t.innerHTML=m.innerHTML:document.body.appendChild(m)}for(const t of y)yield i.loadScript(t);return!!(y.length+v.length+A.length)||!!m}));const d=(e.entries||{})[i.name];d?yield i.loadHtml(d):yield c()}));export{i as default,i as loadHtml};

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RallieImportHtml={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(o,l){function i(t){try{s(r.next(t))}catch(t){l(t)}}function c(t){try{s(r.throw(t))}catch(t){l(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,c)}s((r=r.apply(t,e||[])).next())}))}const n=t=>`[@rallie/load-html] ${t}`,r=/^(http:\/\/|https:\/\/|\/\/)([^?#]*)(\?[^?#]+)?(#.+)?/,o=t=>n(`Invalid html path: ${t}`),l=(t,e)=>n(`Can not construct a url by the base '${t}' and the path '${e}'`),i=t=>{const e=Array.from(t.attributes),n=document.createElement(t.tagName);return e.forEach((t=>{n.setAttribute(t.name,t.value)})),n.innerHTML=t.innerHTML,n},c=(t={})=>(n,c)=>e(void 0,void 0,void 0,(function*(){var s;const a=null!==(s=t.fetch)&&void 0!==s?s:window.fetch,u=t.filter;n.loadHtml=c=>e(void 0,void 0,void 0,(function*(){var e;const s=null!==(e=t.regardHtmlPathAsRoot)&&void 0!==e&&e,f=yield a(c),d=yield f.text(),[h,m]=(t=>{const e=r.exec(t);if(e)return[e[0],e[4]||null];throw new Error(o(t))})(c),{root:p,scripts:y,links:v,styles:b}=((t,e,n,r=(()=>!0))=>{const o=document.createElement("html");o.innerHTML=t;const l=Array.from(o.querySelectorAll("script")).filter(r).map((t=>i(t))).map((t=>{const e=t.getAttribute("src");return n&&e&&t.setAttribute("src",n(e)),t})),c=Array.from(o.querySelectorAll("link")).filter(r).map((t=>i(t))).map((t=>{const e=t.getAttribute("href");return n&&e&&t.setAttribute("href",n(e)),t})),s=Array.from(o.querySelectorAll("style")).filter(r).map((t=>i(t)));return{root:e?o.querySelector(e):null,scripts:l,links:c,styles:s}})(d,m,(t=>((t,e,n=!1)=>{if(/^(http:\/\/|https:\/\/|\/\/).+/.test(t))return t;const o=r.exec(e);if(o){const e=o[1],r=o[2];n&&t.startsWith("/")&&(t=t.slice(1));let l="";return l=new URL(t,("//"===e?"http://":e)+r).href,"//"===e&&(l=l.slice(5)),l}return console.error(l(e,t)),""})(t,h,s)),u);for(const t of b)document.head.appendChild(t);for(const t of v)n.loadLink(t);if(p){const t=document.querySelector(m);t?t.innerHTML=p.innerHTML:document.body.appendChild(p)}for(const t of y)yield n.loadScript(t);return!!(y.length+v.length+b.length)||!!p}));const f=(t.entries||{})[n.name];f?yield n.loadHtml(f):yield c()}));t.default=c,t.loadHtml=c,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RallieImportHtml={})}(this,(function(t){"use strict";function e(t,e,r,n){return new(r||(r=Promise))((function(o,l){function i(t){try{s(n.next(t))}catch(t){l(t)}}function c(t){try{s(n.throw(t))}catch(t){l(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,c)}s((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const r=t=>`[@rallie/load-html] ${t}`,n=/^(http:\/\/|https:\/\/|\/\/)([^?#]*)(\?[^?#]+)?(#.+)?/,o=t=>r(`Invalid html path: ${t}`),l=(t,e)=>r(`Can not construct a url by the base '${t}' and the path '${e}'`),i=t=>{const e=Array.from(t.attributes),r=document.createElement(t.tagName);return e.forEach((t=>{r.setAttribute(t.name,t.value)})),r.innerHTML=t.innerHTML,r},c=(t={})=>(r,c)=>e(void 0,void 0,void 0,(function*(){var s;const u=null!==(s=t.fetch)&&void 0!==s?s:window.fetch,a=t.filter;r.loadHtml=c=>e(void 0,void 0,void 0,(function*(){var e;const s=null!==(e=t.regardHtmlPathAsRoot)&&void 0!==e&&e,f=yield u(c),d=yield f.text(),[p,h]=(t=>{const e=n.exec(t);if(e)return[e[0],e[4]||null];throw new Error(o(t))})(c),{root:m,scripts:y,links:v,styles:b}=((t,e,r,n=(()=>!0))=>{const o=document.createElement("html");o.innerHTML=t;const l=Array.from(o.querySelectorAll("script")).filter(n).map((t=>i(t))).map((t=>{const e=t.getAttribute("src");return r&&e&&t.setAttribute("src",r(e)),t})),c=Array.from(o.querySelectorAll("link")).filter(n).map((t=>i(t))).map((t=>{const e=t.getAttribute("href");return r&&e&&t.setAttribute("href",r(e)),t})),s=Array.from(o.querySelectorAll("style")).filter(n).map((t=>i(t)));return{root:e?o.querySelector(e):null,scripts:l,links:c,styles:s}})(d,h,(t=>((t,e,r=!1)=>{if(/^(http:\/\/|https:\/\/|\/\/).+/.test(t))return t;const o=n.exec(e);if(o){const e=o[1],n=o[2];r&&t.startsWith("/")&&(t=t.slice(1));let l="";return l=new URL(t,("//"===e?"http://":e)+n).href,"//"===e&&(l=l.slice(5)),l}return console.error(l(e,t)),""})(t,p,s)),a);for(const t of b)document.head.appendChild(t);for(const t of v)r.loadLink(t);if(m){const t=document.querySelector(h);t?t.innerHTML=m.innerHTML:document.body.appendChild(m)}for(const t of y)yield r.loadScript(t);return!!(y.length+v.length+b.length)||!!m}));const f=(t.entries||{})[r.name];f?yield r.loadHtml(f):yield c()}));t.default=c,t.loadHtml=c,Object.defineProperty(t,"__esModule",{value:!0})}));

@@ -0,0 +0,0 @@ import { MiddlewareFnType } from '@rallie/core';

@@ -0,0 +0,0 @@ export declare const errors: {

{
"name": "@rallie/load-html",
"version": "0.16.0",
"version": "0.16.1",
"description": "a middleware to load resources from html",

@@ -25,5 +25,5 @@ "main": "./dist/index.umd.js",

"devDependencies": {
"@rallie/core": "0.16.0"
"@rallie/core": "0.16.1"
},
"gitHead": "a7d26f83e61f737148896b61eae9ad18a25036fb"
"gitHead": "44f6fbfb8164f76dbe553398e54a4ae1717abd93"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc