promptslide 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/commands/add.mjs +1 -1
- package/src/commands/publish.mjs +1 -1
- package/src/vite/plugin.mjs +35 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.3](https://github.com/prompticeu/promptslide/compare/promptslide-v0.3.2...promptslide-v0.3.3) (2026-03-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* forward browser ESM import errors to terminal logs ([#61](https://github.com/prompticeu/promptslide/issues/61)) ([4925013](https://github.com/prompticeu/promptslide/commit/49250131469061b4ca102644e8a7cbf6f63ac2c9))
|
|
9
|
+
|
|
10
|
+
## [0.3.2](https://github.com/prompticeu/promptslide/compare/promptslide-v0.3.1...promptslide-v0.3.2) (2026-03-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* correct package.json path resolution in CLI commands ([#59](https://github.com/prompticeu/promptslide/issues/59)) ([a79e81d](https://github.com/prompticeu/promptslide/commit/a79e81dab73606494cf334121bcbff52273d038c))
|
|
16
|
+
|
|
3
17
|
## [0.3.1](https://github.com/prompticeu/promptslide/compare/promptslide-v0.3.0...promptslide-v0.3.1) (2026-03-07)
|
|
4
18
|
|
|
5
19
|
|
package/package.json
CHANGED
package/src/commands/add.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { confirm, closePrompts } from "../utils/prompts.mjs"
|
|
25
25
|
|
|
26
26
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
27
|
-
const CLI_VERSION = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8")).version
|
|
27
|
+
const CLI_VERSION = JSON.parse(readFileSync(join(__dirname, "..", "..", "package.json"), "utf-8")).version
|
|
28
28
|
|
|
29
29
|
/** Extract minor version number from a version string like "0.3.0" or "^0.3.0". */
|
|
30
30
|
function parseMinor(version) {
|
package/src/commands/publish.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { prompt, confirm, select, closePrompts } from "../utils/prompts.mjs"
|
|
|
10
10
|
import { parseDeckConfig } from "../utils/deck-config.mjs"
|
|
11
11
|
|
|
12
12
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
13
|
-
const CLI_VERSION = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8")).version
|
|
13
|
+
const CLI_VERSION = JSON.parse(readFileSync(join(__dirname, "..", "..", "package.json"), "utf-8")).version
|
|
14
14
|
|
|
15
15
|
function readDeckPrefix(cwd) {
|
|
16
16
|
// Prefer stored prefix from lockfile (user's previous choice)
|
package/src/vite/plugin.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { bold, dim } from "../utils/ansi.mjs"
|
|
2
|
+
|
|
1
3
|
const VIRTUAL_ENTRY_ID = "virtual:promptslide-entry"
|
|
2
4
|
const RESOLVED_VIRTUAL_ENTRY_ID = "\0" + VIRTUAL_ENTRY_ID
|
|
3
5
|
const VIRTUAL_EXPORT_ID = "virtual:promptslide-export"
|
|
@@ -5,6 +7,21 @@ const RESOLVED_VIRTUAL_EXPORT_ID = "\0" + VIRTUAL_EXPORT_ID
|
|
|
5
7
|
const VIRTUAL_EMBED_ID = "virtual:promptslide-embed"
|
|
6
8
|
const RESOLVED_VIRTUAL_EMBED_ID = "\0" + VIRTUAL_EMBED_ID
|
|
7
9
|
|
|
10
|
+
// Inline script that catches module load errors (e.g. missing named exports)
|
|
11
|
+
// and forwards them to the Vite dev server so they appear in terminal logs.
|
|
12
|
+
// Must be a regular script (not type="module") to run before module evaluation.
|
|
13
|
+
const ERROR_FORWARD_SCRIPT = `<script>
|
|
14
|
+
window.addEventListener("error", function(e) {
|
|
15
|
+
if (e.message) {
|
|
16
|
+
fetch("/__promptslide_error", {
|
|
17
|
+
method: "POST",
|
|
18
|
+
headers: { "Content-Type": "application/json" },
|
|
19
|
+
body: JSON.stringify({ message: e.message, filename: e.filename || "" })
|
|
20
|
+
}).catch(function() {});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
</script>`
|
|
24
|
+
|
|
8
25
|
function getHtmlTemplate() {
|
|
9
26
|
return `<!doctype html>
|
|
10
27
|
<html lang="en">
|
|
@@ -15,6 +32,7 @@ function getHtmlTemplate() {
|
|
|
15
32
|
</head>
|
|
16
33
|
<body>
|
|
17
34
|
<div id="root"></div>
|
|
35
|
+
${ERROR_FORWARD_SCRIPT}
|
|
18
36
|
<script type="module" src="/@id/${VIRTUAL_ENTRY_ID}"></script>
|
|
19
37
|
</body>
|
|
20
38
|
</html>`
|
|
@@ -155,6 +173,23 @@ export function promptslidePlugin({ root: initialRoot } = {}) {
|
|
|
155
173
|
},
|
|
156
174
|
|
|
157
175
|
configureServer(server) {
|
|
176
|
+
// Pre-middleware: receive browser errors and log them to the terminal
|
|
177
|
+
server.middlewares.use((req, res, next) => {
|
|
178
|
+
if (req.method !== "POST" || req.url !== "/__promptslide_error") return next()
|
|
179
|
+
|
|
180
|
+
let body = ""
|
|
181
|
+
req.on("data", chunk => { body += chunk })
|
|
182
|
+
req.on("end", () => {
|
|
183
|
+
try {
|
|
184
|
+
const { message, filename } = JSON.parse(body)
|
|
185
|
+
const location = filename ? ` ${dim(`(${filename})`)}` : ""
|
|
186
|
+
server.config.logger.error(`${bold("Browser error:")} ${message}${location}`, { timestamp: true })
|
|
187
|
+
} catch {}
|
|
188
|
+
res.statusCode = 204
|
|
189
|
+
res.end()
|
|
190
|
+
})
|
|
191
|
+
})
|
|
192
|
+
|
|
158
193
|
// Pre-middleware: serve /embed route
|
|
159
194
|
server.middlewares.use(async (req, res, next) => {
|
|
160
195
|
const url = new URL(req.url, "http://localhost")
|