Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stencil/dev-server

Package Overview
Dependencies
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stencil/dev-server - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

14

dist/index.js

@@ -79,5 +79,5 @@ "use strict";

.concat(lrScriptLocation);
createFileWatcher(wwwRoot, options.watchGlob, emitLiveReloadUpdate);
const requestHandler = createHttpRequestHandler(wwwRoot, options.html5Mode, jsScriptLocations);
http_1.createServer(requestHandler).listen(foundHttpPort);
const fileWatcher = createFileWatcher(wwwRoot, options.watchGlob, emitLiveReloadUpdate);
const requestHandler = createHttpRequestHandler(wwwRoot, jsScriptLocations);
const httpServer = http_1.createServer(requestHandler).listen(foundHttpPort);
console.log(`listening on ${browserUrl}:${foundHttpPort}`);

@@ -87,6 +87,11 @@ console.log(`serving: ${wwwRoot}`);

opn(`http://${browserUrl}:${foundHttpPort}`);
process.once('SIGINT', () => {
httpServer.close();
fileWatcher.close();
process.exit(0);
});
});
}
exports.run = run;
function createHttpRequestHandler(wwwDir, html5Mode, jsScriptsList) {
function createHttpRequestHandler(wwwDir, jsScriptsList) {
const jsScriptsMap = jsScriptsList.reduce((map, fileUrl) => {

@@ -186,2 +191,3 @@ const urlParts = url.parse(fileUrl);

});
return watcher;
}

@@ -188,0 +194,0 @@ function createLiveReload(port, address, wwwDir) {

@@ -23,3 +23,7 @@ "use strict";

</body>`);
res.setHeader('Content-Type', 'text/html');
res.writeHead(200, {
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
'Expires': '0',
'Content-Type': 'text/html'
});
res.end(htmlString);

@@ -67,3 +71,7 @@ });

.replace('{linked-path}', dirUrl.replace(/\//g, ' / '));
res.setHeader('Content-Type', 'text/html');
res.writeHead(200, {
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
'Expires': '0',
'Content-Type': 'text/html'
});
res.end(templateHtml);

@@ -81,2 +89,4 @@ });

res.writeHead(200, {
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
'Expires': '0',
'Content-Type': contentType,

@@ -91,3 +101,7 @@ 'Content-Length': stat.size

function sendError(httpStatus, res, content = {}) {
res.writeHead(httpStatus, { "Content-Type": "text/plain" });
res.writeHead(httpStatus, {
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
'Expires': '0',
'Content-Type': 'text/plain'
});
res.write(JSON.stringify(content, null, 2));

@@ -94,0 +108,0 @@ res.end();

{
"name": "@stencil/dev-server",
"version": "0.0.11",
"version": "0.0.12",
"description": "Tiny LiveReload server that watches a single directory",

@@ -11,3 +11,4 @@ "main": "index.js",

"build": "tsc -p .",
"test": "echo \"Error: no test specified\" && exit 0"
"test": "echo \"Error: no test specified\" && exit 0",
"publish": "np"
},

@@ -37,4 +38,5 @@ "repository": {

"@types/opn": "^3.0.28",
"np": "^2.16.0",
"typescript": "^2.4.1"
}
}

@@ -77,6 +77,6 @@ import * as path from 'path';

createFileWatcher(wwwRoot, options.watchGlob, emitLiveReloadUpdate);
const requestHandler = createHttpRequestHandler(wwwRoot, options.html5Mode, jsScriptLocations);
const fileWatcher = createFileWatcher(wwwRoot, options.watchGlob, emitLiveReloadUpdate);
const requestHandler = createHttpRequestHandler(wwwRoot, jsScriptLocations);
createServer(requestHandler).listen(foundHttpPort);
const httpServer = createServer(requestHandler).listen(foundHttpPort);

@@ -88,5 +88,11 @@ console.log(`listening on ${browserUrl}:${foundHttpPort}`);

opn(`http://${browserUrl}:${foundHttpPort}`);
process.once('SIGINT', () => {
httpServer.close();
fileWatcher.close();
process.exit(0);
});
}
function createHttpRequestHandler(wwwDir: string, html5Mode: boolean, jsScriptsList: string[]) {
function createHttpRequestHandler(wwwDir: string, jsScriptsList: string[]) {
const jsScriptsMap = jsScriptsList.reduce((map, fileUrl: string): { [key: string ]: string } => {

@@ -197,2 +203,4 @@ const urlParts = url.parse(fileUrl);

});
return watcher;
}

@@ -199,0 +207,0 @@

@@ -18,3 +18,7 @@ import * as path from 'path';

res.setHeader('Content-Type', 'text/html');
res.writeHead(200, {
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
'Expires': '0',
'Content-Type': 'text/html'
});
res.end(htmlString);

@@ -72,3 +76,7 @@ };

res.setHeader('Content-Type', 'text/html');
res.writeHead(200, {
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
'Expires': '0',
'Content-Type': 'text/html'
});
res.end(templateHtml);

@@ -85,2 +93,4 @@ }

res.writeHead(200, {
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
'Expires': '0',
'Content-Type': contentType,

@@ -95,5 +105,9 @@ 'Content-Length': stat.size

export function sendError(httpStatus: number, res: ServerResponse, content: { [key: string]: any } = {}) {
res.writeHead(httpStatus, {"Content-Type": "text/plain"});
res.writeHead(httpStatus, {
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
'Expires': '0',
'Content-Type': 'text/plain'
});
res.write(JSON.stringify(content, null, 2));
res.end();
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc