Add pegjs.org/development/try
This commit is contained in:
parent
c65e9dd95f
commit
4964b9af7e
59
server.js
59
server.js
|
@ -60,7 +60,13 @@ app.get( "/", ( req, res ) => {
|
||||||
|
|
||||||
app.get( "/online", ( req, res ) => {
|
app.get( "/online", ( req, res ) => {
|
||||||
|
|
||||||
res.render( "online", { title: "Online version", layout: "layout-online" } );
|
res.render( "online", {
|
||||||
|
|
||||||
|
title: "Online version",
|
||||||
|
layout: "layout-online",
|
||||||
|
pegjs: "/vendor/pegjs/peg.js",
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -84,6 +90,18 @@ app.get( "/development", ( req, res ) => {
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
app.get( "/development/try", ( req, res ) => {
|
||||||
|
|
||||||
|
res.render( "online", {
|
||||||
|
|
||||||
|
title: "Online Development version",
|
||||||
|
layout: "layout-online",
|
||||||
|
pegjs: "/js/peg-bundle.js",
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
app.get( "/download", ( req, res ) => {
|
app.get( "/download", ( req, res ) => {
|
||||||
|
|
||||||
res.redirect( 301, "/#download" );
|
res.redirect( 301, "/#download" );
|
||||||
|
@ -102,36 +120,43 @@ app.get( "/benchmark", ( req, res ) => {
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
/* Test: bundle and optionally watch */
|
/* Bundle local sources (and watch for changes on non-production NODE_ENV) */
|
||||||
|
|
||||||
const babelOptions = require( "./.babelrc" );
|
const babelOptions = require( "./.babelrc" );
|
||||||
babelOptions.babelrc = false;
|
babelOptions.babelrc = false;
|
||||||
babelOptions.exclude = "node_modules/**";
|
babelOptions.exclude = "node_modules/**";
|
||||||
babelOptions.runtimeHelpers = true;
|
babelOptions.runtimeHelpers = true;
|
||||||
|
|
||||||
[ "benchmark", "spec" ].forEach( testType => {
|
[
|
||||||
|
{ name: "benchmark", input: "test/benchmark/**/*.js" },
|
||||||
|
{ name: "spec", input: "test/spec/**/*.js" },
|
||||||
|
{ name: "peg", input: "packages/pegjs/lib/peg.js", format: "umd" },
|
||||||
|
|
||||||
const bundleConfig = {
|
].forEach( bundle => {
|
||||||
|
|
||||||
input: `test/${ testType }/**/*.js`,
|
const plugins = [
|
||||||
output: {
|
resolve(),
|
||||||
name: `PEG_${ testType }`,
|
|
||||||
file: `website/js/${ testType }-bundle.js`,
|
|
||||||
format: "iife",
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
multiEntry(),
|
|
||||||
commonjs(),
|
commonjs(),
|
||||||
json( { namedExports: false } ),
|
json( { namedExports: false } ),
|
||||||
babel( babelOptions ),
|
babel( babelOptions ),
|
||||||
resolve(),
|
];
|
||||||
],
|
|
||||||
|
if ( bundle.input.includes( "*" ) ) plugins.unshift( multiEntry() );
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
|
||||||
|
input: bundle.input,
|
||||||
|
output: {
|
||||||
|
file: `website/js/${ bundle.name }-bundle.js`,
|
||||||
|
format: bundle.format || "iife",
|
||||||
|
name: bundle.name,
|
||||||
|
},
|
||||||
|
plugins,
|
||||||
onwarn( warning, warn ) {
|
onwarn( warning, warn ) {
|
||||||
|
|
||||||
if ( WARNINGS ) warn( warning );
|
if ( WARNINGS ) warn( warning );
|
||||||
|
|
||||||
},
|
},
|
||||||
treeshake: false,
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -162,7 +187,7 @@ babelOptions.runtimeHelpers = true;
|
||||||
if ( NODE_ENV === "production" ) {
|
if ( NODE_ENV === "production" ) {
|
||||||
|
|
||||||
rollup
|
rollup
|
||||||
.rollup( bundleConfig )
|
.rollup( config )
|
||||||
.catch( handleError );
|
.catch( handleError );
|
||||||
|
|
||||||
return void 0;
|
return void 0;
|
||||||
|
@ -171,7 +196,7 @@ babelOptions.runtimeHelpers = true;
|
||||||
|
|
||||||
const watcher = rollup.watch( {
|
const watcher = rollup.watch( {
|
||||||
|
|
||||||
...bundleConfig,
|
...config,
|
||||||
watch: {
|
watch: {
|
||||||
include: [
|
include: [
|
||||||
"packages/**",
|
"packages/**",
|
||||||
|
|
|
@ -118,7 +118,7 @@ _ "whitespace"
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<script src="https://unpkg.com/jquery@1.12.4/dist/jquery.min.js"></script>
|
<script src="https://unpkg.com/jquery@1.12.4/dist/jquery.min.js"></script>
|
||||||
<script src="/vendor/pegjs/peg.js"></script>
|
<script src="<%- pegjs %>"></script>
|
||||||
<script src="/vendor/jsdump/jsDump.js"></script>
|
<script src="/vendor/jsdump/jsDump.js"></script>
|
||||||
<script src="/vendor/codemirror/codemirror.js"></script>
|
<script src="/vendor/codemirror/codemirror.js"></script>
|
||||||
<script src="/js/online.js"></script>
|
<script src="/js/online.js"></script>
|
||||||
|
|
Loading…
Reference in a new issue