Giter Club home page Giter Club logo

Comments (5)

limbic-derek avatar limbic-derek commented on May 27, 2024

I tried removing as const satisfies MyType and I'm still getting this failure. Other files seem fine, but I'm not sure what is unique about this one.

from esm.sh.

limbic-derek avatar limbic-derek commented on May 27, 2024

OK it looks like this package (js_parser) is being invoked here:
https://github.com/esm-dev/esm.sh/blob/main/server/utils.go#L205

It looks like that only validates JavaScript files using this:
https://github.com/ije/esbuild-internal/blob/master/js_parser/js_parser.go

Although, it seems to allow TypeScript files to be "found" and passed in. Writing a small test, I think this is the root cause:

--- FAIL: TestStrictMode (0.00s)
    --- FAIL: TestStrictMode/import{A,B}from"C";export_const_D={}_as_const_satisfies_A;export_default_B(D); (0.00s)
        js_parser_test.go:286: 
            +<stdin>: ERROR: Expected ";" but found "as"
             

The util should probably make use of the ts_parser if one of the ts extensions is selected:
https://github.com/ije/esbuild-internal/blob/master/js_parser/ts_parser.go

This was a confusing error because the message states require either javascript OR typescript, so it made me assume both were valid here. Upon inspection, I believe TS isn't properly supported.

Wishing I could see the actual <stdin> errors that are being produced in situ to confirm further.

from esm.sh.

limbic-derek avatar limbic-derek commented on May 27, 2024

Confirmed locally that enabling TS parsing allows these files to be properly served via esm.sh.

from esm.sh.

ije avatar ije commented on May 27, 2024

i just pushed docker image to v135_2 with your patch, thanks for contributing

from esm.sh.

bennypowers avatar bennypowers commented on May 27, 2024

Please release this fix, as 135 still fails, for example:

https://esm.sh/v135/@rhds/[email protected]/es2022/lib/context/color/context-color.css.js

/* esm.sh - error */
throw new Error("[esm.sh] " + "esmLexer: invalid syntax, require javascript/typescript");
export default null;

and https://esm.sh/v135_2/@rhds/[email protected]/es2022/lib/context/color/context-color.css.js 404s

Thank you for making this helpful service available.

from esm.sh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.