-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: windows paths * fix: more problems, add changeset * fix: typo
- Loading branch information
Showing
16 changed files
with
200 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@marko/vite": patch | ||
--- | ||
|
||
fix: windows paths |
9 changes: 9 additions & 0 deletions
9
...sts__/fixtures/isomorphic-circular-entry-file/__snapshots__/build.expected.loading.0.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<div | ||
id="clickable" | ||
> | ||
Mounted: false Clicks: 0 | ||
</div> | ||
</div> |
9 changes: 9 additions & 0 deletions
9
...sts__/fixtures/isomorphic-circular-entry-file/__snapshots__/build.expected.loading.1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<div | ||
id="clickable" | ||
> | ||
Mounted: true Clicks: 0 | ||
</div> | ||
</div> |
9 changes: 9 additions & 0 deletions
9
...ests__/fixtures/isomorphic-circular-entry-file/__snapshots__/build.expected.step-0.0.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<div | ||
id="clickable" | ||
> | ||
Mounted: true Clicks: 1 | ||
</div> | ||
</div> |
9 changes: 9 additions & 0 deletions
9
...tests__/fixtures/isomorphic-circular-entry-file/__snapshots__/dev.expected.loading.0.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<div | ||
id="clickable" | ||
> | ||
Mounted: false Clicks: 0 | ||
</div> | ||
</div> |
9 changes: 9 additions & 0 deletions
9
...tests__/fixtures/isomorphic-circular-entry-file/__snapshots__/dev.expected.loading.1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<div | ||
id="clickable" | ||
> | ||
Mounted: true Clicks: 0 | ||
</div> | ||
</div> |
9 changes: 9 additions & 0 deletions
9
..._tests__/fixtures/isomorphic-circular-entry-file/__snapshots__/dev.expected.step-0.0.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div | ||
id="implicit" | ||
> | ||
<div | ||
id="clickable" | ||
> | ||
Mounted: true Clicks: 1 | ||
</div> | ||
</div> |
33 changes: 33 additions & 0 deletions
33
src/__tests__/fixtures/isomorphic-circular-entry-file/dev-server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// 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) { | ||
devServer.ssrFixStacktrace(err); | ||
return next(err); | ||
} | ||
}); | ||
})(); |
11 changes: 11 additions & 0 deletions
11
src/__tests__/fixtures/isomorphic-circular-entry-file/server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |
20 changes: 20 additions & 0 deletions
20
src/__tests__/fixtures/isomorphic-circular-entry-file/src/components/class-component.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++; | ||
} | ||
} | ||
|
||
<div#clickable onClick("handleClick")> | ||
Mounted: ${state.mounted} | ||
Clicks: ${state.clickCount} | ||
</div> |
9 changes: 9 additions & 0 deletions
9
...__tests__/fixtures/isomorphic-circular-entry-file/src/components/implicit-component.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
15 changes: 15 additions & 0 deletions
15
src/__tests__/fixtures/isomorphic-circular-entry-file/src/components/layout-component.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
9 changes: 9 additions & 0 deletions
9
src/__tests__/fixtures/isomorphic-circular-entry-file/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import template from "./template.marko"; | ||
|
||
export function handler(req, res) { | ||
if (req.url === "/") { | ||
res.statusCode = 200; | ||
res.setHeader("Content-Type", "text/html; charset=utf-8"); | ||
template.render({}, res); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/__tests__/fixtures/isomorphic-circular-entry-file/src/template.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const x = 1; | ||
|
||
import { x as y } from './template.marko'; | ||
|
||
$ console.log(y); | ||
|
||
style { | ||
div { color: green } | ||
} | ||
|
||
<layout-component> | ||
<div#app> | ||
<implicit-component/> | ||
</div> | ||
</layout-component> |
4 changes: 4 additions & 0 deletions
4
src/__tests__/fixtures/isomorphic-circular-entry-file/test.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const ssr = true; | ||
export async function steps() { | ||
await page.click("#clickable"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters