1
- 'use strict' ;
1
+ import fs from 'fs' ;
2
+ import { join , basename , dirname , extname , relative } from 'path' ;
2
3
3
- const fs = require ( 'fs' ) ;
4
- const { join, basename, dirname, extname, relative} = require ( 'path' ) ;
5
-
6
- const { compile} = require ( 'yeahjs' ) ;
7
- const fm = require ( 'front-matter' ) ;
8
- const marked = require ( 'marked' ) ;
9
- const yaml = require ( 'js-yaml' ) ;
10
-
11
- module . exports = tinyjam ;
4
+ import { compile } from 'yeahjs' ;
5
+ import fm from 'front-matter' ;
6
+ import marked from 'marked' ;
7
+ import yaml from 'js-yaml' ;
12
8
13
9
const defaultOptions = {
14
10
log : false ,
@@ -17,7 +13,7 @@ const defaultOptions = {
17
13
highlight : null
18
14
} ;
19
15
20
- function tinyjam ( src , dest = src , options = { } ) {
16
+ export default function tinyjam ( src , dest = src , options = { } ) {
21
17
options = Object . assign ( { } , defaultOptions , options ) ;
22
18
23
19
// Markdown renderer options
@@ -116,7 +112,7 @@ function tinyjam(src, dest = src, options = {}) {
116
112
117
113
} else if ( ext === '.yml' || ext === '.yaml' ) {
118
114
log ( `read ${ shortPath } ` ) ;
119
- data [ name ] = createCtx ( rootPath , yaml . safeLoad ( fs . readFileSync ( path , 'utf8' ) ) ) ;
115
+ data [ name ] = createCtx ( rootPath , yaml . load ( fs . readFileSync ( path , 'utf8' ) ) ) ;
120
116
121
117
} else if ( ext === '.ejs' ) {
122
118
if ( name [ 0 ] === '_' ) { // skip includes
0 commit comments