Skip to content

Commit

Permalink
fix: conflict export names, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
harttle committed Nov 4, 2019
1 parent 21e1f28 commit 0712a14
Show file tree
Hide file tree
Showing 91 changed files with 12,400 additions and 6,024 deletions.
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,35 @@ san-ssr --target js ./component.ts > ssr.js

## Programmatic Interface

To PHP programmatic inteface ([typedoc: ToPHPCompiler](https://searchfe.github.io/san-ssr/classes/_compilers_to_php_compiler_.tophpcompiler.html)):
The [SanProject class][sanproject] is used to compile component files into ssr code string.

```javascript
const { ToPHPCompiler } = require('san-ssr')
const { writeFileSync } = require('fs')
TypeScript:

const compiler = new ToPHPCompiler()
const targetCode = compiler.compile('./component.ts')
```typescript
import { Target, SanProject } from 'san-project'
import { writeFileSync } from 'fs'

writeFileSync('ssr.php', targetCode)
const project = new SanProject()
const targetCode = project.compile('src/component.ts', Target.js)

writeFileSync('ssr.js', targetCode)
```

To JavaScript programmatic inteface ([typedoc: ToJSCompiler](https://searchfe.github.io/san-ssr/classes/_compilers_to_js_compiler_.tojscompiler.html)):
Or in JavaScript:

```javascript
const { ToJSCompiler } = require('san-ssr')
const { writeFileSync } = require('fs')
```typescript
const { SanProject } = require('san-project')
import { writeFileSync } from 'fs'

const compiler = new ToJSCompiler()
const targetCode = compiler.compile('./component.ts', {emitHeader: true})
const project = new SanProject()
const targetCode = project.compile('src/component.ts', 'js')

writeFileSync('ssr.js', targetCode)
```

The [SanProject#compile(filepath, target, options)][compile] has a third parameter `options`, which is passed
directly to the target code generator's [compile(sanApp, options)][target-compile] as the second parameter.

## Milestones

0. Baseline Establishment
Expand Down Expand Up @@ -152,4 +157,7 @@ Run tests
npm test
```

[san]: https://github.com/baidu/san
[san]: https://github.com/baidu/san
[sanproject]: https://searchfe.github.io/san-ssr/classes/_models_san_project_.sanproject.html
[compile]: https://searchfe.github.io/san-ssr/classes/_models_san_project_.sanproject.html#compile
[target-compile]: https://searchfe.github.io/san-ssr/interfaces/_models_compiler_.compiler.html#compile
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions docs/classes/_loaders_common_js_.commonjs.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/93cf10f/src/loaders/common-js.ts#L22">loaders/common-js.ts:22</a></li>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/21e1f28/src/loaders/common-js.ts#L22">loaders/common-js.ts:22</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -137,7 +137,7 @@ <h3>cache</h3>
<div class="tsd-signature tsd-kind-icon">cache<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> =&nbsp;new Map()</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/93cf10f/src/loaders/common-js.ts#L22">loaders/common-js.ts:22</a></li>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/21e1f28/src/loaders/common-js.ts#L22">loaders/common-js.ts:22</a></li>
</ul>
</aside>
</section>
Expand All @@ -147,7 +147,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> read<wbr>File</h3>
<div class="tsd-signature tsd-kind-icon">read<wbr>File<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/93cf10f/src/loaders/common-js.ts#L21">loaders/common-js.ts:21</a></li>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/21e1f28/src/loaders/common-js.ts#L21">loaders/common-js.ts:21</a></li>
</ul>
</aside>
</section>
Expand All @@ -164,7 +164,7 @@ <h3>require</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/93cf10f/src/loaders/common-js.ts#L32">loaders/common-js.ts:32</a></li>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/21e1f28/src/loaders/common-js.ts#L32">loaders/common-js.ts:32</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -222,6 +222,9 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span
<li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported">
<a href="../modules/_loaders_common_js_.html#defaultfileloader" class="tsd-kind-icon">default<wbr>File<wbr>Loader</a>
</li>
<li class=" tsd-kind-function tsd-parent-kind-external-module">
<a href="../modules/_loaders_common_js_.html#getmodulespecifier" class="tsd-kind-icon">get<wbr>Module<wbr>Specifier</a>
</li>
</ul>
</nav>
</div>
Expand Down
11 changes: 7 additions & 4 deletions docs/classes/_loaders_common_js_.module.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/93cf10f/src/loaders/common-js.ts#L8">loaders/common-js.ts:8</a></li>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/21e1f28/src/loaders/common-js.ts#L8">loaders/common-js.ts:8</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -135,7 +135,7 @@ <h3>content</h3>
<div class="tsd-signature tsd-kind-icon">content<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/93cf10f/src/loaders/common-js.ts#L7">loaders/common-js.ts:7</a></li>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/21e1f28/src/loaders/common-js.ts#L7">loaders/common-js.ts:7</a></li>
</ul>
</aside>
</section>
Expand All @@ -145,7 +145,7 @@ <h3>exports</h3>
<div class="tsd-signature tsd-kind-icon">exports<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/93cf10f/src/loaders/common-js.ts#L8">loaders/common-js.ts:8</a></li>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/21e1f28/src/loaders/common-js.ts#L8">loaders/common-js.ts:8</a></li>
</ul>
</aside>
<div class="tsd-type-declaration">
Expand All @@ -160,7 +160,7 @@ <h3>filepath</h3>
<div class="tsd-signature tsd-kind-icon">filepath<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/93cf10f/src/loaders/common-js.ts#L6">loaders/common-js.ts:6</a></li>
<li>Defined in <a href="https://github.com/searchfe/san-ssr/blob/21e1f28/src/loaders/common-js.ts#L6">loaders/common-js.ts:6</a></li>
</ul>
</aside>
</section>
Expand Down Expand Up @@ -209,6 +209,9 @@ <h3>filepath</h3>
<li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported">
<a href="../modules/_loaders_common_js_.html#defaultfileloader" class="tsd-kind-icon">default<wbr>File<wbr>Loader</a>
</li>
<li class=" tsd-kind-function tsd-parent-kind-external-module">
<a href="../modules/_loaders_common_js_.html#getmodulespecifier" class="tsd-kind-icon">get<wbr>Module<wbr>Specifier</a>
</li>
</ul>
</nav>
</div>
Expand Down
Loading

0 comments on commit 0712a14

Please sign in to comment.