mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 03:05:12 +00:00
Merge pull request #183 from sveltejs/use-polka
Use polka, remove unused dependencies
This commit is contained in:
11
package.json
11
package.json
@@ -22,17 +22,12 @@
|
||||
"chalk": "^2.3.0",
|
||||
"cheerio": "^1.0.0-rc.2",
|
||||
"chokidar": "^1.7.0",
|
||||
"code-frame": "^5.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"express": "^4.16.2",
|
||||
"glob": "^7.1.2",
|
||||
"locate-character": "^2.0.5",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mri": "^1.1.0",
|
||||
"node-fetch": "^1.7.3",
|
||||
"polka": "^0.3.4",
|
||||
"port-authority": "^1.0.0",
|
||||
"pretty-ms": "^3.1.0",
|
||||
"relative": "^3.0.2",
|
||||
"require-relative": "^0.8.7",
|
||||
"rimraf": "^2.6.2",
|
||||
"sade": "^1.4.0",
|
||||
@@ -50,8 +45,6 @@
|
||||
"@types/mkdirp": "^0.5.2",
|
||||
"@types/rimraf": "^2.0.2",
|
||||
"compression": "^1.7.1",
|
||||
"css-loader": "^0.28.7",
|
||||
"electron": "^1.8.2",
|
||||
"eslint": "^4.13.1",
|
||||
"eslint-plugin-import": "^2.8.0",
|
||||
"get-port": "^3.2.0",
|
||||
@@ -63,7 +56,7 @@
|
||||
"rollup-plugin-json": "^2.3.0",
|
||||
"rollup-plugin-string": "^2.0.2",
|
||||
"rollup-plugin-typescript": "^0.8.1",
|
||||
"style-loader": "^0.19.1",
|
||||
"serve-static": "^1.13.2",
|
||||
"svelte": "^1.49.1",
|
||||
"svelte-loader": "^2.3.2",
|
||||
"ts-node": "^4.1.0",
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
import * as child_process from 'child_process';
|
||||
import * as path from 'path';
|
||||
import * as sander from 'sander';
|
||||
import express from 'express';
|
||||
import polka from 'polka';
|
||||
import cheerio from 'cheerio';
|
||||
import URL from 'url-parse';
|
||||
import fetch from 'node-fetch';
|
||||
import * as ports from 'port-authority';
|
||||
import { dest } from '../config';
|
||||
|
||||
const app = express();
|
||||
|
||||
function read_json(file: string) {
|
||||
return JSON.parse(sander.readFileSync(file, { encoding: 'utf-8' }));
|
||||
}
|
||||
const app = polka();
|
||||
|
||||
export default async function exporter(export_dir: string) {
|
||||
const build_dir = dest();
|
||||
|
||||
@@ -2,7 +2,6 @@ import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as child_process from 'child_process';
|
||||
import sade from 'sade';
|
||||
import mri from 'mri';
|
||||
import chalk from 'chalk';
|
||||
import prettyMs from 'pretty-ms';
|
||||
import help from './help.md';
|
||||
|
||||
@@ -4,7 +4,6 @@ import { ClientRequest, ServerResponse } from 'http';
|
||||
import mkdirp from 'mkdirp';
|
||||
import rimraf from 'rimraf';
|
||||
import serialize from 'serialize-javascript';
|
||||
import escape_html from 'escape-html';
|
||||
import { lookup } from './mime';
|
||||
import { create_routes, templates, create_compilers } from 'sapper/core.js';
|
||||
import { dest, dev } from '../config';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import fs from 'fs';
|
||||
import express from 'express';
|
||||
import polka from 'polka';
|
||||
import compression from 'compression';
|
||||
import serve from 'serve-static';
|
||||
import sapper from '../../../middleware';
|
||||
@@ -28,7 +28,7 @@ process.on('message', message => {
|
||||
}
|
||||
});
|
||||
|
||||
const app = express();
|
||||
const app = polka();
|
||||
|
||||
app.use((req, res, next) => {
|
||||
if (pending) pending.add(req.url);
|
||||
|
||||
5955
test/app/package-lock.json
generated
5955
test/app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "TODO",
|
||||
"description": "TODO",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "node server.js",
|
||||
"build": "sapper build",
|
||||
"start": "cross-env NODE_ENV=production node server.js",
|
||||
"prestart": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"compression": "^1.7.2",
|
||||
"cross-env": "^5.1.3",
|
||||
"css-loader": "^0.28.10",
|
||||
"express": "^4.16.2",
|
||||
"extract-text-webpack-plugin": "^3.0.2",
|
||||
"glob": "^7.1.2",
|
||||
"marked": "^0.3.17",
|
||||
"node-fetch": "^1.7.3",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"serve-static": "^1.13.2",
|
||||
"style-loader": "^0.19.0",
|
||||
"svelte": "^1.56.0",
|
||||
"svelte-loader": "^2.3.3",
|
||||
"uglifyjs-webpack-plugin": "^1.2.2",
|
||||
"webpack": "^4.1.0"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
export function del(req, res) {
|
||||
res.set({
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const contents = JSON.stringify(posts.map(post => {
|
||||
}));
|
||||
|
||||
export function get(req, res) {
|
||||
res.set({
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'application/json',
|
||||
'Cache-Control': `max-age=${30 * 60 * 1e3}` // cache for 30 minutes
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ export function get(req, res, next) {
|
||||
const { slug } = req.params;
|
||||
|
||||
if (slug in lookup) {
|
||||
res.set({
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'application/json',
|
||||
'Cache-Control': `no-cache`
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const config = require('../../../webpack/config.js');
|
||||
const pkg = require('../package.json');
|
||||
const sapper_pkg = require('../../../package.json');
|
||||
|
||||
module.exports = {
|
||||
@@ -9,7 +8,10 @@ module.exports = {
|
||||
resolve: {
|
||||
extensions: ['.js', '.html']
|
||||
},
|
||||
externals: Object.keys(pkg.dependencies).concat(Object.keys(sapper_pkg.dependencies)),
|
||||
externals: [].concat(
|
||||
Object.keys(sapper_pkg.dependencies),
|
||||
Object.keys(sapper_pkg.devDependencies)
|
||||
),
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const path = require('path');
|
||||
const assert = require('assert');
|
||||
const Nightmare = require('nightmare');
|
||||
const express = require('express');
|
||||
const serve = require('serve-static');
|
||||
const walkSync = require('walk-sync');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
Reference in New Issue
Block a user