sholladay / pogo

Server framework for Deno
Mozilla Public License 2.0
482 stars 32 forks source link

Error when running example #35

Closed bdearborn closed 4 years ago

bdearborn commented 4 years ago

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

sholladay commented 4 years ago

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

bdearborn commented 4 years ago

deno 1.1.1 v8 8.5.104 typescript 3.9.2 Running on Windows 10

bdearborn commented 4 years ago

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_

sholladay commented 4 years ago

This is definitely an upstream bug. Probably a bug in Deno itself (see https://github.com/denoland/deno/issues/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.

sholladay commented 4 years ago

@bdearborn Good news! I was finally able to reproduce your error and I was able to work around it with commit https://github.com/sholladay/pogo/commit/54f92d71f10e441a67314c866da42e9ff3adc3d4.

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! 🤞

bdearborn commented 4 years ago

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