-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
* fix: cjs imports from marko files in dev * fix: re-export named exports * fix: windows * fix: update snapshot * chore: add changeset
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@marko/vite": patch | ||
--- | ||
|
||
fix: handle cjs dependencies of .marko templates |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<button | ||
class="btn btn--secondary" | ||
data-ebayui="" | ||
id="clickable" | ||
type="button" | ||
> | ||
Mounted: false Clicks: 0 | ||
</button> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<button | ||
class="btn btn--secondary" | ||
data-ebayui="" | ||
id="clickable" | ||
type="button" | ||
> | ||
Mounted: true Clicks: 0 | ||
</button> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<button | ||
class="btn btn--secondary" | ||
data-ebayui="" | ||
id="clickable" | ||
type="button" | ||
> | ||
Mounted: true Clicks: 1 | ||
</button> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<button | ||
class="btn btn--secondary" | ||
data-ebayui="" | ||
id="clickable" | ||
type="button" | ||
> | ||
Mounted: false Clicks: 0 | ||
</button> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<button | ||
class="btn btn--secondary" | ||
data-ebayui="" | ||
id="clickable" | ||
type="button" | ||
> | ||
Mounted: true Clicks: 0 | ||
</button> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<button | ||
class="btn btn--secondary" | ||
data-ebayui="" | ||
id="clickable" | ||
type="button" | ||
> | ||
Mounted: true Clicks: 1 | ||
</button> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// In dev we'll start a Vite dev server in middleware mode, | ||
// and forward requests to our http request handler. | ||
|
||
const { createServer } = require("vite"); | ||
const { join } = require("path"); | ||
const markoPlugin = require("../../..").default; | ||
|
||
module.exports = (async () => { | ||
const devServer = await createServer({ | ||
root: __dirname, | ||
appType: "custom", | ||
logLevel: "silent", | ||
plugins: [markoPlugin()], | ||
optimizeDeps: { force: true }, | ||
server: { | ||
middlewareMode: true, | ||
watch: { | ||
ignored: ["**/node_modules/**", "**/dist/**", "**/__snapshots__/**"], | ||
}, | ||
}, | ||
}); | ||
return devServer.middlewares.use(async (req, res, next) => { | ||
try { | ||
const { handler } = await devServer.ssrLoadModule( | ||
join(__dirname, "./src/index.js") | ||
); | ||
await handler(req, res, next); | ||
} catch (err) { | ||
console.log(err); | ||
devServer.ssrFixStacktrace(err); | ||
return next(err); | ||
} | ||
}); | ||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "isomorphic-commonjs", | ||
"dependencies": { | ||
"test-package": "0.0.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// In production, simply start up the http server. | ||
const path = require("path"); | ||
const { createServer } = require("http"); | ||
const serve = require("serve-handler"); | ||
const { handler } = require("./dist/index.mjs"); | ||
const serveOpts = { public: path.resolve(__dirname, "dist") }; | ||
module.exports = createServer(async (req, res) => { | ||
await handler(req, res); | ||
if (res.headersSent) return; | ||
await serve(req, res, serveOpts); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class { | ||
onCreate() { | ||
this.state = { | ||
clickCount: 0, | ||
mounted: false | ||
}; | ||
} | ||
onMount() { | ||
this.state.mounted = true; | ||
} | ||
handleClick() { | ||
this.state.clickCount++; | ||
} | ||
} | ||
|
||
<test-button#clickable on-click("handleClick")> | ||
Mounted: ${state.mounted} | ||
Clicks: ${state.clickCount} | ||
</test-button> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
static { | ||
if (typeof window === "object") { | ||
document.body.firstElementChild.append("Loaded Implicit Component"); | ||
} | ||
} | ||
|
||
<div#implicit> | ||
<class-component/> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
static { | ||
if (typeof window === "object") { | ||
document.body.firstElementChild.append("Loaded Layout Component"); | ||
} | ||
} | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Hello World</title> | ||
</head> | ||
<body> | ||
<${input.renderBody}/> | ||
</body> | ||
</html> |