Oops. Now I'm kind of obligated to put something here, aren't I?
dfreeman / broccoli-graphql-filter Goto Github PK
View Code? Open in Web Editor NEWConverts GraphQL files to a JS file exporting an AST
License: MIT License
Converts GraphQL files to a JS file exporting an AST
License: MIT License
Oops. Now I'm kind of obligated to put something here, aren't I?
It would be very nice if this project generated modules that are compatible to importing with the suffix .graphql
.
For these using TS, it is easier to make TS happy if we import it with an extension.
So, let's say we have a file called account.graphql
.
Today, we would import it using:
import accountQuery from './account';
What I would like to have is:
import accountQuery from './account.graphql';
Same goes for importing fragments inside of graphql files.
strange error:
Build Error (broccoli-persistent-filter:GraphQLFilter)
ENOENT: no such file or directory, lstat '/Volumes/RAMDisk/broccoli-66933e1XKQk9MrS7O/out-700-funnel/maestro/styles/modals.scss'
Stack Trace and Error Report: /Volumes/RAMDisk/error.dump.8e0dcf69bc3d32547f1147716edc3a28.log
why would this be concerned with a scss file?
I noticed that a particular fragment can't be imported more than once.
This becomes a bit confusing in cases where a fragment imports a fragment. I think importing the fragment a second time should result in a no-op rather than an error around the fragment being defined more than once.
Is this something you'd be interested in a PR to fix? If so, I would be happy to put one together!
The graphql-import library uses a similar but incompatible syntax.
#import from 'some/runtime/path'
# import FragmentName from 'some/node-resolvable/path'
I'm interested in parity because I would like to use tools like apollo client:extract
on the queries in my Ember app. Currently they fail with a syntax error.
This is obviously not a trivial change. I can foresee two issues:
The path in the broccoli #import
statement doesn't map to a file on disk so graphql-import couldn't use it anyway. (graphql-import uses resolve-from to find files.) We'd need a way to teach graphql-import about Ember's file system layout, wait for ef4's new builder spec to land, or ...?.
The graphql-import syntax matches ES6 module imports, including import specifiers. This is more complicated than broccoli-graphql-filter, which is effectively the same as import * as AllFragments from 'path'
. Dealing with aliases (import { foo as bar }
) is considerably more complicated.
This project could limit itself to supporting only * as AllFragments
for simplicity's sake.
Thoughts? I wish I had a real solution for point number 1!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.