Comparing version 0.0.2 to 0.0.3
11
index.js
@@ -5,7 +5,12 @@ document.onreadystatechange = () => { | ||
const babelText = document.querySelector("script[type='text/babel']").textContent; | ||
const importFromPattern = /^\s*import(.+)from\s+['"](.+)['"]/gm; | ||
const importFromPattern = /^\s*import(?:.|\n)*?(?:from)?\s+['"](.+)['"]/gm; | ||
const importMatches = [...babelText.matchAll(importFromPattern)]; | ||
const importFroms = importMatches.map((m) => m[2]); | ||
const imports = Object.fromEntries(importFroms.map((from) => [from, `https://esm.sh/${from}?external=react`])); | ||
const importFroms = importMatches.map((m) => m[1]); | ||
const imports = { | ||
...Object.fromEntries(importFroms.map((from) => [from, `https://esm.sh/${from}?external=react`])), | ||
react: "https://esm.sh/react", | ||
"react-dom/client": "https://esm.sh/react-dom/client", | ||
"react/jsx-runtime": "https://esm.sh/react/jsx-runtime", | ||
}; | ||
@@ -12,0 +17,0 @@ console.log(`[esplay]`, { imports }); |
{ | ||
"name": "esplay", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "index.js", | ||
@@ -25,2 +25,2 @@ "scripts": { | ||
} | ||
} | ||
} |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
3525
3
36
1
58