@xylit/ssg
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "@xylit/ssg", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A pure static site generator", | ||
@@ -5,0 +5,0 @@ "homepage": "https://ssg.xylit.dev/", |
@@ -1,4 +0,1 @@ | ||
import { readFile } from "node:fs/promises"; | ||
import { fileURLToPath } from "node:url"; | ||
import { parse } from "acorn"; | ||
@@ -13,3 +10,3 @@ import * as walk from "acorn-walk"; | ||
[ | ||
'import { initialize as __initializeSSG } from "#src/runtime.js";', | ||
'import { initialize as __initializeSSG } from "@xylit/ssg/runtime";', | ||
"const __SSG = __initializeSSG(import.meta);", | ||
@@ -36,4 +33,4 @@ "const { html, style } = __SSG", | ||
const compile = async path => { | ||
const source = new MagicString(await readFile(path, { encoding: "utf-8" })); | ||
const compile = async source => { | ||
source = new MagicString(source); | ||
@@ -53,5 +50,5 @@ const ast = parse(source.toString(), { | ||
const url = new URL(urlStr); | ||
if (!url.pathname.endsWith(".ssg.js")) return next(urlStr, context); | ||
const result = await next(urlStr, context); | ||
const path = fileURLToPath(urlStr); | ||
if (!url.pathname.endsWith(".ssg.js")) return result; | ||
@@ -61,4 +58,4 @@ return { | ||
shortCircuit: true, | ||
source: await compile(path), | ||
source: await compile(result.source.toString()), | ||
}; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47185
1477