sholladay / pogo

Server framework for Deno

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when running example

bdearborn opened this issue · comments

Running the first example on deno results in an error.

import pogo from 'https://deno.land/x/pogo/main.ts';

const server = pogo.server({ port : 3000 });

server.router.get('/', () => {
    return 'Hello, world!';
});

server.start();

deno run --unstable --allow-read=\ --allow-write=\ --allow-net .\server.js
error: 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode at https://cdn.pika.dev/-/csstype@v2.6.10-9lGFwmNeuxj9xXremWKA/dist=es2019,mode=exports/index.d.ts:1:7,Expected Comma, got Some(Word(StandardLonghandProperties)) at https://cdn.pika.dev/-/csstype@v2.6.10-9lGFwmNeuxj9xXremWKA/dist=es2019,mode=exports/index.d.ts:1:17

What version of Deno are you on? I cannot reproduce this.

deno 1.1.1
v8 8.5.104
typescript 3.9.2
Running on Windows 10

Here is some addl info when I reload the modules:

deno run --unstable --reload -A .\server.js
Download https://deno.land/x/pogo/main.ts
Download https://deno.land/x/pogo/lib/router.ts
Download https://deno.land/x/pogo/lib/server.ts
Download https://deno.land/x/pogo/lib/types.ts
Download https://deno.land/x/pogo/dependencies.ts
Download https://deno.land/x/pogo/lib/bang.ts
Download https://deno.land/x/pogo/lib/serialize.ts
Download https://deno.land/x/pogo/lib/request.ts
Download https://deno.land/x/pogo/lib/response.ts
Download https://deno.land/x/pogo/lib/toolkit.ts
Download https://cdn.pika.dev/react@16.12.0
Download https://dev.jspm.io/react-dom@16.12.0/server
Download https://deno.land/std@v0.56.0/http/cookie.ts
Download https://deno.land/std@v0.56.0/http/server.ts
Download https://deno.land/std@v0.56.0/http/http_status.ts
Download https://cdn.pika.dev/mime-types@2.1.27
Download https://deno.land/std@v0.56.0/encoding/utf8.ts
Download https://deno.land/std@v0.56.0/io/bufio.ts
Download https://deno.land/std@v0.56.0/testing/asserts.ts
Download https://deno.land/std@v0.56.0/async/mod.ts
Download https://deno.land/std@v0.56.0/http/_io.ts
Download https://deno.land/std@v0.56.0/datetime/mod.ts
Download https://dev.jspm.io/npm:react-dom@16.12.0/server.browser.dew.js
Download https://dev.jspm.io/react-dom@16.12.0/cjs/react-dom-server.browser.development.dew.js
Download https://dev.jspm.io/npm:object-assign@4?dew
Download https://dev.jspm.io/npm:react@16?dew
Download https://dev.jspm.io/npm:prop-types@15/checkPropTypes?dew
Download https://dev.jspm.io/npm:react-dom@16.12.0/cjs/react-dom-server.browser.development.dew.js
Download https://cdn.pika.dev/-/react@v16.13.1-ByypZEPVPs6cpkpGdpQK/dist=es2019,mode=types/index.d.ts
Download https://cdn.pika.dev/-/react@v16.13.1-ByypZEPVPs6cpkpGdpQK/dist=es2019/react.js
Download https://deno.land/std@v0.56.0/fmt/colors.ts
Download https://deno.land/std@v0.56.0/testing/diff.ts
Download https://deno.land/std@v0.56.0/textproto/mod.ts
Download https://deno.land/std@v0.56.0/async/deferred.ts
Download https://deno.land/std@v0.56.0/async/delay.ts
Download https://deno.land/std@v0.56.0/async/mux_async_iterator.ts
Download https://deno.land/std@v0.56.0/io/util.ts
Download https://dev.jspm.io/npm:prop-types@15.7.2/checkPropTypes.dew.js
Download https://dev.jspm.io/npm:prop-types@15.7.2/lib/ReactPropTypesSecret.dew.js
Download https://dev.jspm.io/npm:react@16.13.1/index.dew.js
Download https://dev.jspm.io/npm:react@16.13.1/cjs/react.development.dew.js
Download https://dev.jspm.io/npm:object-assign@4.1.1/index.dew.js
Download https://cdn.pika.dev/-/mime-types@v2.1.27-EcRNul1gxVHTgSAtG6fe/dist=es2019,mode=types/index.d.ts
Download https://cdn.pika.dev/-/mime-types@v2.1.27-EcRNul1gxVHTgSAtG6fe/dist=es2019/mime-types.js
Download https://deno.land/std@v0.56.0/bytes/mod.ts
Download https://deno.land/std@v0.56.0/path/mod.ts
Download https://cdn.pika.dev/csstype/dist=es2019,mode=types/index.d.ts
Download https://cdn.pika.dev/prop-types/dist=es2019,mode=types/index.d.ts
Download https://cdn.pika.dev/-/react@v16.13.1-ByypZEPVPs6cpkpGdpQK/dist=es2019,mode=types/global.d.ts
Download https://deno.land/std@v0.56.0/path/_constants.ts
Download https://deno.land/std@v0.56.0/path/win32.ts
Download https://deno.land/std@v0.56.0/path/posix.ts
Download https://deno.land/std@v0.56.0/path/common.ts
Download https://deno.land/std@v0.56.0/path/separator.ts
Download https://deno.land/std@v0.56.0/path/_interface.ts
Download https://deno.land/std@v0.56.0/path/glob.ts
Download https://cdn.pika.dev/-/mime-db@v1.44.0-dKNwMIxpxaF4opR7ympR/dist=es2019/mime-db.js
Download https://cdn.pika.dev/-/prop-types@v15.7.2-zP4vfWJ00Q8BlfFeEia7/dist=es2019,mode=exports/index.d.ts
Download https://cdn.pika.dev/-/csstype@v2.6.10-9lGFwmNeuxj9xXremWKA/dist=es2019,mode=exports/index.d.ts
Download https://deno.land/std@v0.56.0/path/_util.ts
error: 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode at https://cdn.pika.dev/-/csstype@v2.6.10-9lGFwmNeuxj9xXremWKA/dist=es2019,mode=exports/index.d.ts:1:7,Expected Comma, got Some(Word(StandardLonghandProperties)) at https://cdn.pika.dev/-/csstype@v2.6.10-9lGFwmNeuxj9xXremWKA/dist=es2019,mode=exports/index.d.ts:1:17

This is definitely an upstream bug. Probably a bug in Deno itself (see denoland/deno#6448), but possibly in the Pika CDN. My recommendation is to try downgrading Deno to an earlier version and see if that works, using a command like deno upgrade --version 1.0.2. I'm not sure what the best version to use is at the moment but our CI tests passed using Deno 1.0.2.

@bdearborn Good news! I was finally able to reproduce your error and I was able to work around it with commit 54f92d7.

I still think the error when using Pika is probably an issue with Deno itself, as Deno seems to be interpreting the .d.ts file delivered by Pika as a TypeScript source code file rather than a type definition file. But for now, using jspm.dev and loading the type definitions manually using @deno-types works.

Could you try the example again and let me know how it goes? You may need to use the --reload flag. I hope it works for you! 🤞

I can confirm that I am able to run the example now. Thank you!