Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using filter with name-only attributes #2966

Closed
MattMS opened this issue Feb 27, 2018 · 4 comments · Fixed by #2977
Closed

Error using filter with name-only attributes #2966

MattMS opened this issue Feb 27, 2018 · 4 comments · Fixed by #2977

Comments

@MattMS
Copy link

MattMS commented Feb 27, 2018

Pug Version: 1.0.0-alpha6

Node Version: 8.9.4

Detailed version information

  • "jstransformer-stylus": "^1.5.0",
  • "pug-cli": "^1.0.0-alpha6"

Node 8 Docker Image (Debian Jessie)
https://github.com/nodejs/docker-node/blob/8498ff5302c19506c9edc3ce152f2bd4aa6b26b3/8/Dockerfile

Input Pug

Fails:

stylus(compress)

Passes:

stylus(compress=true)

Error

/srv/node_modules/pug-filters/lib/handle-filters.js:100
throw error('FILTER_OPTION_NOT_CONSTANT', ex.message + ' All filters are rendered compile-time so filter options must be constants.', node);

Trace

Step #1: true is not constant. All filters are rendered compile-time so filter options must be constants.
Step #1: at makeError (/srv/node_modules/pug-error/index.js:32:13)
Step #1: at /srv/node_modules/pug-filters/lib/handle-filters.js:100:15
Step #1: at Array.forEach (<anonymous>)
Step #1: at getAttributes (/srv/node_modules/pug-filters/lib/handle-filters.js:95:14)
Step #1: at walk.includeDependencies (/srv/node_modules/pug-filters/lib/handle-filters.js:23:19)
Step #1: at walkAST (/srv/node_modules/pug-walk/index.js:23:18)
Step #1: at /srv/node_modules/pug-walk/index.js:104:20
Step #1: at Array.reduce (<anonymous>)
Step #1: at walkAndMergeNodes (/srv/node_modules/pug-walk/index.js:103:18)
Step #1: at walkAST (/srv/node_modules/pug-walk/index.js:37:19)
Step #1: npm ERR! code ELIFECYCLE
Step #1: npm ERR! errno 1

Additional Comments

This seems to work on my local machine, but fails during Google Cloud Build process.

My local machine: Node 8.9.4 on Windows Subsystem for Linux (bash).
Pug and JS Transformer versions are the same.

@MattMS
Copy link
Author

MattMS commented Feb 27, 2018

Error seems to be thrown by this line:
attrs[attr.name] = constantinople.toConstant(attr.val);

https://github.com/pugjs/pug/blob/master/packages/pug-filters/lib/handle-filters.js#L97

@ForbesLindesay
Copy link
Member

Please try using pug 2.0.0-rc.4 and see if you can still reproduce the error.

@MattMS
Copy link
Author

MattMS commented Mar 7, 2018

This still fails after adding pug 2.0.0-rc.4.

I added "pug": "^2.0.0-rc.4" as a dependency beside the existing "pug-cli": "^1.0.0-alpha6".
It fails with the same error, as above.

@MattMS
Copy link
Author

MattMS commented Mar 7, 2018

Does the pug dependency of pug-cli need to be updated?

It is currently ^2.0.0-alpha7, and I'm not sure how those semver extensions are handled by Node.

ForbesLindesay added a commit that referenced this issue Mar 7, 2018
ForbesLindesay added a commit that referenced this issue Mar 20, 2018
ForbesLindesay added a commit that referenced this issue Mar 20, 2018
* Handle boolean sorthand for filters

[closes #2966]

* Commit the yarn lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants