Comments (10)
From all the features we use, generators are the only thing which require special treatment (e.g., if you use regenerator you'll have to include their runtime in your code, too).
I considered adding a Node version requirement to the package.json, to make sure that you can't install the package with anything less than Node 5 (or Node 4.6 which is probably fine) -- but that would make life hard for everyone who still wants to use it (or at least parts of it).
As you can see, all that is not an answer, but just my rationale. Of course it makes sense include (or offer separately) a transpiled version (preferrably with minimal extra dev dependencies and a npm prepublish script).
from edtf.js.
No, sorry, I haven't tested this on older Node versions. This library makes use of a number of ES6 features and ES5 compatibility was not a target for me.
Having said that, depending on what parts you actually need, transpiling should be relatively easy: probably generators are the only serious problem (and you don't need them for parsing). Glad to help out, but like I said, this is really intended for ES6.
from edtf.js.
Yes, I have been working with ES6 onmy own projects since the start of the year myself and I am transpiling everything. Nevertheless, it took me some hours to figure out why my nodejs tests were throwing an error when everything looked fine in the browser. The help in the readme that tells me to use harmony flags had me work on it for another hour or so, until I figured out that none of the flags work. I thought that I should let you know here and others who run into the same issue will hopefully not spend half a day on this.
from edtf.js.
Ah, sorry about that, the language there could be clearer.
from edtf.js.
Yeah, no worries.
One related thing: I think this is the first project I have come across where the ES2-15 is not transpiled to ES5 when publishing to npm [1]. That means that it behaves slightly different than other packages.
So if I set up testing in a repository that depends on this package, for example with ava [2], I have to ensure cross-compilation of ES2015 at three different levels:
- the test code (ava supports this out of the box)
- my code: there are easy setups that ensure that ava only gets code that has been run through babel.
- the imported edtf.js package: AFAICT, this is not covered by any of the standard setups. It also means that even though I cross-compile my package to ES5, it is still not directly usable by any ES5-only consumer because I depend on your package, unless I bundle a cross compiled version of your package with my package.
As far as I can tell, if one imports from npm packages in ES2015 code, it makes no difference whether that code the code one imports from is ES2015 or cross-compiled into CommonJS/ES5. So unless there is something specific in the ES2015 code that cannot be transpiled into ES5, I wonder what the advantages would be of offering a non-transpiled version like this. But maybe you know more about this?
[1] See for example https://github.com/ProseMirror
[2] See for example https://github.com/fiduswriter/biblatex-csl-converter
from edtf.js.
This seems relevant:
Ideally, you should only be transforming your own source code, rather than running all of your external dependencies through Babel – hence the exclude: 'node_modules/**' in the example above. If you have a dependency that exposes untranspiled ES6 source code that doesn't run in your target environment, then you may need to break this rule, but it often causes problems with unusual .babelrc files or mismatched versions of Babel.
We encourage library authors not to distribute code that uses untranspiled ES6 features (other than modules) for this reason. Consumers of your library should not have to transpile your ES6 code, any more than they should have to transpile your CoffeeScript, ClojureScript or TypeScript.
https://github.com/rollup/rollup-plugin-babel#external-dependencies
from edtf.js.
After some more googling, it seems like there used to exist a hackish solution for it for those importing the package that is now no longer working [1]. But it also seems everyone agrees that all code should be transpiled and not published only as ES6 code to npm.
cloverfield-tools/universal-react-boilerplate#41 (comment)
from edtf.js.
Here is what I have added in the meantime so that I don't create dependency issues for others:
fiduswriter/biblatex-csl-converter@5287973
I would like to revert that.
from edtf.js.
more issues with this: If I transpile edtf.js in my own library, then edtf.js turns into a dev-dependency for my library, as the compiled version is distributed in my package. When importing my lib into another project, however, the dependencies for nearley and randexp are missing.
from edtf.js.
wouldn't a "prepublishonly" step fix all this?
from edtf.js.
Related Issues (20)
- License acquisition HOT 5
- Update to support latest spec HOT 3
- Inconsistent behavior for iterators on unspecified dates HOT 3
- February 29th on unspecified year HOT 2
- Year zero not treated as a leap year HOT 3
- Mismatches for XXXX-X2-<29+>
- -1XXX has incorrect min / max HOT 2
- Lists with continuations not parsing correctly HOT 2
- Usage in closed-source commercial product HOT 3
- Switch to ESM for good
- global is not defined HOT 10
- AssertionError when calling edtf("{1978,1988}") in prod HOT 13
- Day not considered unspecified in month-precision Level 0 date HOT 2
- JSON-schema validator HOT 9
- locale load can't be bundled anymore HOT 5
- allowing uaSymbol on undefined dates HOT 4
- minimal node example not loading HOT 11
- Invalid upper bound with dates before 1970-01-01 HOT 4
- Use unassert to remove assert in release builds HOT 6
- Parse error on trailing zeros HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edtf.js.