@@ -56,7 +56,6 @@ fs.copyFile(paths.join(__web, "style.vars.css"), paths.join(__preview_css, "styl
5656fs . copyFile ( paths . join ( __node_modules , "prismjs/themes/prism-tomorrow.css" ) , paths . join ( __preview_css , "style.prism.css" ) )
5757//Scripts
5858fs . writeFile ( paths . join ( __preview_js , "app.js" ) , `${ await fs . readFile ( paths . join ( __web , "app.js" ) ) } ` )
59- fs . writeFile ( paths . join ( __preview_js , "app.placeholder.js" ) , `${ await fs . readFile ( paths . join ( __web , "app.placeholder.js" ) ) } ` )
6059fs . copyFile ( paths . join ( __node_modules , "ejs/ejs.min.js" ) , paths . join ( __preview_js , "ejs.min.js" ) )
6160fs . writeFile ( paths . join ( __preview_js , "faker.min.js" ) , "import {faker} from '/.js/faker/index.mjs';globalThis.faker=faker;globalThis.placeholder.init(globalThis)" )
6261for ( const path of [ [ ] , [ "locale" ] ] ) {
@@ -76,15 +75,31 @@ fs.copyFile(paths.join(__node_modules, "prismjs/components/prism-yaml.min.js"),
7675fs . copyFile ( paths . join ( __node_modules , "prismjs/components/prism-markdown.min.js" ) , paths . join ( __preview_js , "prism.markdown.min.js" ) )
7776fs . copyFile ( paths . join ( __node_modules , "clipboard/dist/clipboard.min.js" ) , paths . join ( __preview_js , "clipboard.min.js" ) )
7877//Meta
78+ fs . writeFile ( paths . join ( __preview , ".modes" ) , JSON . stringify ( [ "embed" , "insights" ] ) )
7979fs . writeFile ( paths . join ( __preview , ".version" ) , JSON . stringify ( `${ conf . package . version } -preview` ) )
8080fs . writeFile ( paths . join ( __preview , ".hosted" ) , JSON . stringify ( { by : "metrics" , link : "https://github.com/lowlighter/metrics" } ) )
81+ //Embed
82+ {
83+ const __web_embed = paths . join ( paths . join ( __web , "embed" ) )
84+ const __web_embed_placeholders = paths . join ( __web_embed , "placeholders" )
85+ const __preview_embed = paths . join ( __preview , "embed" )
86+ const __preview_embed_placeholders = paths . join ( __preview , ".placeholders" )
87+ const __preview_embed_js = paths . join ( __preview_js , "embed" )
88+ await fs . mkdir ( __preview_embed , { recursive : true } )
89+ await fs . mkdir ( __preview_embed_placeholders , { recursive : true } )
90+ await fs . mkdir ( __preview_embed_js , { recursive : true } )
91+ fs . writeFile ( paths . join ( __preview_embed , "index.html" ) , `${ await fs . readFile ( paths . join ( __web_embed , "index.html" ) ) } ` )
92+ fs . writeFile ( paths . join ( __preview_embed_js , "app.js" ) , `${ await fs . readFile ( paths . join ( __web_embed , "app.js" ) ) } ` )
93+ fs . writeFile ( paths . join ( __preview_embed_js , "app.placeholder.js" ) , `${ await fs . readFile ( paths . join ( __web_embed , "app.placeholder.js" ) ) } ` )
94+ for ( const file of await fs . readdir ( __web_embed_placeholders ) )
95+ fs . copyFile ( paths . join ( __web_embed_placeholders , file ) , paths . join ( __preview_embed_placeholders , file ) )
96+ }
8197//Insights
82- for ( const insight of [ "insights" , "about" ] ) {
83- const __web_insights = paths . join ( paths . join ( __web , insight ) )
84- const __preview_insights = paths . join ( __preview , `${ insight } /.statics` )
98+ for ( const insights of [ "insights" , "about" ] ) {
99+ const __web_insights = paths . join ( paths . join ( __web , "insights" ) )
100+ const __preview_insights = paths . join ( __preview , `${ insights } /.statics` )
85101 await fs . mkdir ( __preview_insights , { recursive : true } )
86-
87- fs . copyFile ( paths . join ( __web , insight , "index.html" ) , paths . join ( __preview , insight , "index.html" ) )
102+ fs . copyFile ( paths . join ( __web_insights , "index.html" ) , paths . join ( __preview , insights , "index.html" ) )
88103 for ( const file of await fs . readdir ( __web_insights ) ) {
89104 if ( file !== ".statics" )
90105 fs . copyFile ( paths . join ( __web_insights , file ) , paths . join ( __preview_insights , file ) )
0 commit comments