@luna-park/plugin 1.3.1 → 1.4.1

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/dist/plugin.css DELETED
@@ -1,2 +0,0 @@
1
- .story-wrapper[data-v-8d6cff07]{border:1px solid var(--color-soft);border-radius:0 0 var(--length-radius-m)var(--length-radius-m);width:722px;height:320px;overflow:hidden}
2
- /*$vite$:1*/
package/dist/preview.cjs DELETED
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-rCEYsGS8.cjs`);let t=require(`path`),n=require(`fs`),r=require(`@fastify/cors`);r=e.n(r);let i=require(`@fastify/static`);i=e.n(i);let a=require(`fastify`);a=e.n(a);function o(e,t){return e.replace(/\bimport\s+(.*?)\s+from\s+['"]([^.'/][^'"]*)['"];/g,(e,n,r)=>t.includes(r)?e:`import ${n} from 'https://esm.sh/${r}';`).replace(/\bimport\s+['"]([^.'/][^'"]*)['"];/g,(e,n)=>t.includes(n)?e:`import 'https://esm.sh/${n}';`)}async function s(e){let s=(0,a.default)({logger:!1});s.register(r.default,{origin:[`https://luna-park.app`,/localhost:[0-9]+/,/127\.0\.0\.1:[0-9]+/]}),s.addHook(`onRequest`,async(r,i)=>{let a=r.url===`/`?`/index.js`:r.url,s=(0,t.join)(e.dist,a);if(!(0,n.existsSync)(s)&&!(0,t.extname)(r.url)&&(s=(0,t.join)(e.dist,`index.js`)),(0,n.existsSync)(s)&&(0,t.extname)(s)===`.js`){let t=o((0,n.readFileSync)(s,`utf-8`),e.externals).replaceAll(`process.env.NODE_ENV`,JSON.stringify(`development`));return i.type(`application/javascript`).send(t),i}}),s.register(i.default,{prefix:`/`,root:e.dist}),await s.listen({host:`127.0.0.1`,port:e.port}),console.log(`Preview server started at http://127.0.0.1:${e.port}`)}exports.startPreviewServer=s;
package/dist/preview.d.ts DELETED
@@ -1 +0,0 @@
1
- export { }
package/dist/preview.js DELETED
@@ -1,29 +0,0 @@
1
- import { extname, join } from "path";
2
- import { existsSync, readFileSync } from "fs";
3
- import fastifyCors from "@fastify/cors";
4
- import fastifyStatic from "@fastify/static";
5
- import Fastify from "fastify";
6
- function transformImports(e, n) {
7
- return e.replace(/\bimport\s+(.*?)\s+from\s+['"]([^.'/][^'"]*)['"];/g, (e, r, i) => n.includes(i) ? e : `import ${r} from 'https://esm.sh/${i}';`).replace(/\bimport\s+['"]([^.'/][^'"]*)['"];/g, (e, r) => n.includes(r) ? e : `import 'https://esm.sh/${r}';`);
8
- }
9
- async function startPreviewServer(c) {
10
- let l = Fastify({ logger: !1 });
11
- l.register(fastifyCors, { origin: [
12
- "https://luna-park.app",
13
- /localhost:[0-9]+/,
14
- /127\.0\.0\.1:[0-9]+/
15
- ] }), l.addHook("onRequest", async (a, o) => {
16
- let s = a.url === "/" ? "/index.js" : a.url, l = join(c.dist, s);
17
- if (!existsSync(l) && !extname(a.url) && (l = join(c.dist, "index.js")), existsSync(l) && extname(l) === ".js") {
18
- let e = transformImports(readFileSync(l, "utf-8"), c.externals).replaceAll("process.env.NODE_ENV", JSON.stringify("development"));
19
- return o.type("application/javascript").send(e), o;
20
- }
21
- }), l.register(fastifyStatic, {
22
- prefix: "/",
23
- root: c.dist
24
- }), await l.listen({
25
- host: "127.0.0.1",
26
- port: c.port
27
- }), console.log(`Preview server started at http://127.0.0.1:${c.port}`);
28
- }
29
- export { startPreviewServer };