Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
3,457 additions
and
1,509 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 |
---|---|---|
|
@@ -3,4 +3,5 @@ dist | |
coverage | ||
test/e2e.spec.js | ||
ssr.php | ||
ssr.js | ||
ssr.js | ||
src/types |
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
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
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
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 |
---|---|---|
@@ -1,23 +1,9 @@ | ||
#!/usr/bin/env node | ||
|
||
const { existsSync, readFileSync } = require('fs') | ||
const { resolve, join } = require('path') | ||
require('source-map-support/register') | ||
const { renderBySource } = require('../dist/fixtures/case') | ||
|
||
const caseName = process.argv[2] | ||
const caseRoot = resolve(__dirname, '../test/cases') | ||
const caseDir = resolve(caseRoot, caseName) | ||
const jsSSRPath = join(caseDir, 'ssr.js') | ||
const html = renderBySource(caseName) | ||
|
||
const data = getData(caseDir) | ||
const noDataOutput = /-ndo$/.test(caseDir) | ||
const jsRendered = require(jsSSRPath)(data, noDataOutput) | ||
process.stdout.write(jsRendered) | ||
|
||
function getData (caseDir) { | ||
const dataJSPath = join(caseDir, 'data.js') | ||
if (existsSync(dataJSPath)) { | ||
return require(dataJSPath) | ||
} | ||
const dataPath = join(caseDir, 'data.json') | ||
return JSON.parse(readFileSync(dataPath, 'utf8')) | ||
} | ||
process.stdout.write(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 |
---|---|---|
@@ -1,31 +1,8 @@ | ||
#!/usr/bin/env node | ||
|
||
const { existsSync, readFileSync } = require('fs') | ||
const { resolve, join } = require('path') | ||
|
||
require('source-map-support/register') | ||
const { renderOnthefly } = require('../dist/fixtures/case') | ||
const caseName = process.argv[2] | ||
const caseRoot = resolve(__dirname, '../test/cases') | ||
const caseDir = resolve(caseRoot, caseName) | ||
|
||
const render = getRender() | ||
const data = getData() | ||
const noDataOutput = /-ndo$/.test(caseName) | ||
|
||
const html = render(data, noDataOutput) | ||
const html = renderOnthefly(caseName) | ||
process.stdout.write(html) | ||
|
||
function getData () { | ||
const dataJSPath = join(caseDir, 'data.js') | ||
if (existsSync(dataJSPath)) { | ||
return require(dataJSPath) | ||
} | ||
const dataPath = join(caseDir, 'data.json') | ||
return JSON.parse(readFileSync(dataPath, 'utf8')) | ||
} | ||
|
||
function getRender () { | ||
const ComponentClass = require(join(caseDir, 'component.js')) | ||
return require('../dist/index.js').compileToRenderer(ComponentClass, { | ||
noTemplateOutput: caseDir.indexOf('notpl') > -1 | ||
}) | ||
} |
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
Oops, something went wrong.