Skip to content

Unexpected error when renaming coffeescript files #3

@davenquinn

Description

@davenquinn

This is possibly related to #2, but I am trying to rename coffeescript files for an esm build, and am encountering an error with your plugin. This error appears to occur because this_1 is undefined in line 87 of dist/index.js, when Acorn parses the code to AST.

var ast = this_1.parse(file.code, {
   ecmaVersion: 6,
   sourceType: 'module',
});

The rollup config for this change is at https://github.com/UW-Macrostrat/ui-components/blob/feature/tree-shaking/rollup.config.js,
and the issue can be reproduced by npm run build in the tree-shaking branch of that repository. I've tried reordering plugins, removing CSS compilation, etc.

Thanks for any insight!

Full traceback:

[!] (plugin rename-rollup) SyntaxError: Unexpected token (35:42)
undefined (35:42)
SyntaxError: Unexpected token (35:42)
    at Object.pp$4.raise (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2827:15)
    at Object.pp.unexpected (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:688:10)
    at Object.pp$3.parseIdent (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2778:12)
    at Object.pp$3.parsePropertyName (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2583:107)
    at Object.pp$3.parseProperty (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2510:10)
    at Object.pp$3.parseObj (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2464:23)
    at Object.pp$3.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2247:19)
    at Object.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15340:26)
    at Object.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15357:30)
    at Object.pp$3.parseExprSubscripts (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2090:21)
    at Object.pp$3.parseMaybeUnary (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2067:19)
    at Object.pp$3.parseExprOps (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2011:21)
    at Object.pp$3.parseMaybeConditional (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1994:21)
    at Object.pp$3.parseMaybeAssign (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1969:21)
    at Object.pp$3.parseParenAndDistinguishExpression (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2322:30)
    at Object.pp$3.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2231:43)
    at Object.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15340:26)
    at Object.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15357:30)
    at Object.pp$3.parseExprSubscripts (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2090:21)
    at Object.pp$3.parseMaybeUnary (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2067:19)
    at Object.pp$3.parseExprOps (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2011:21)
    at Object.pp$3.parseMaybeConditional (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1994:21)
    at Object.pp$3.parseMaybeAssign (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1969:21)
    at Object.pp$3.parseExpression (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1934:21)
    at Object.pp$1.parseStatement (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:878:47)
    at Object.parseStatement (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15334:26)
    at Object.parseStatement (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15375:30)
    at Object.pp$1.parseBlock (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1162:23)
    at Object.pp$3.parseFunctionBody (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2672:24)
    at Object.pp$3.parseMethod (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2613:10)
    at Object.pp$1.parseClassMethod (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1388:25)
    at Object.pp$1.parseClassElement (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1377:10)
    at Object.pp$1.parseClass (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1316:26)
    at Object.pp$1.parseStatement (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:834:19)
    at Object.parseStatement (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15334:26)
    at Object.parseStatement (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15375:30)
    at Object.pp$1.parseBlock (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1162:23)
    at Object.pp$3.parseFunctionBody (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2672:24)
    at Object.pp$1.parseFunction (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1284:10)
    at Object.pp$3.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2252:19)
    at Object.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15340:26)
    at Object.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15357:30)
    at Object.pp$3.parseExprSubscripts (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2090:21)
    at Object.pp$3.parseMaybeUnary (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2067:19)
    at Object.pp$3.parseExprOps (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2011:21)
    at Object.pp$3.parseMaybeConditional (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1994:21)
    at Object.pp$3.parseMaybeAssign (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1969:21)
    at Object.pp$3.parseParenAndDistinguishExpression (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2322:30)
    at Object.pp$3.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2231:43)
    at Object.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15340:26)
    at Object.parseExprAtom (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15357:30)
    at Object.pp$3.parseExprSubscripts (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2090:21)
    at Object.pp$3.parseMaybeUnary (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2067:19)
    at Object.pp$3.parseExprOps (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:2011:21)
    at Object.pp$3.parseMaybeConditional (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1994:21)
    at Object.pp$3.parseMaybeAssign (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1969:21)
    at Object.pp$3.parseMaybeAssign (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1979:25)
    at Object.pp$3.parseExpression (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:1934:21)
    at Object.pp$1.parseStatement (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:878:47)
    at Object.parseStatement (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15334:26)
    at Object.parseStatement (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15375:30)
    at Object.pp$1.parseTopLevel (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:745:23)
    at Object.parse (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:552:17)
    at Function.parse (/Users/Daven/Projects/Tools/ui-components/node_modules/acorn/dist/acorn.js:575:37)
    at Object.Graph.contextParse [as parse] (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:16684:70)
    at _loop_1 (/Users/Daven/Projects/Tools/ui-components/node_modules/@betit/rollup-plugin-rename-extensions/dist/index.js:87:38)
    at Object.generateBundle (/Users/Daven/Projects/Tools/ui-components/node_modules/@betit/rollup-plugin-rename-extensions/dist/index.js:118:17)
    at Promise.resolve.then (/Users/Daven/Projects/Tools/ui-components/node_modules/rollup/dist/rollup.js:15806:25)
    at <anonymous>:null:null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions