Comments (10)
I've recently been rewriting my code using typescript. I'll post an ESM package when I'm done. Thanks for you code example.
from velocity.js.
Here is my fork as an example of how to get it to build an ESM compatible build.
https://github.com/Gentomi/velocity.js
The changes needed: master...Gentomi:velocity.js:master
from velocity.js.
@bseib now I published new beta version 2.1.0-beta, Can you help me to check if this version is work ok with esm module?
from velocity.js.
@bseib now I published new beta version 2.1.0-beta, Can you help me to check if this version is work ok with esm module?
Hey awesome @shepherdwind. I should have a chance to look at it this weekend.
from velocity.js.
Hey @shepherdwind , do you have any plans to release your BETA branch to npm? That would make testing a lot simpler -- I would just update my package.json
to point at your new BETA version.
from velocity.js.
Hey @shepherdwind , do you have any plans to release your BETA branch to npm? That would make testing a lot simpler -- I would just update my
package.json
to point at your new BETA version.
https://www.npmjs.com/package/velocityjs/v/2.1.0-beta this beta version is the new one, you can just try this. I had published it a week ago.
from velocity.js.
https://www.npmjs.com/package/velocityjs/v/2.1.0-beta this beta version is the new one, you can just try this. I had published it a week ago.
Ah, thank you, I missed that somehow.
Things look pretty good. I have one snippet of code left to fix, and I haven't dug in yet to see what's going on. My function was parsing a velocity template, then looking through the abstract syntax tree to get all the parameter names that were found. I need to figure out the typescript equivalent for x.id
that worked in javascript.
const parseOutParamNames: ((template: string) => string[]) = (template: string) => {
const astArray = (vjs.parse(template)) as Array<VELOCITY_AST>
return astArray.filter((x) => {
return typeof x === 'object'
}).map((x) => {
return x.id
})
}
I ought to be able to make a new function that is cleaner with respect to types now that the underlying code is also in typescript.
from velocity.js.
@shepherdwind I think VELOCITY_AST
needs to be exported at the top level. That is the type returned when calling parse
, and the caller will need that type to do anything useful. I tried to import it directly, i.e.,
import {VELOCITY_AST} from "velocityjs/dist/types/type"
However that lead to other compilation issues.
I ought to be able to simply do:
import {parse, render, VELOCITY_AST} from 'velocityjs'
from velocity.js.
@shepherdwind The second issue I'm seeing is a runtime error:
The sources are not in the distribution, but it looks like this may be referring to here:
velocity.js/src/compile/blocks.ts
Line 10 in dd6c461
Maybe there is no default constructor up the chain of classes? Not sure what's going on there...
from velocity.js.
@shepherdwind The second issue I'm seeing is a runtime error:
The sources are not in the distribution, but it looks like this may be referring to here:
velocity.js/src/compile/blocks.ts
Line 10 in dd6c461
Maybe there is no default constructor up the chain of classes? Not sure what's going on there...
Can you provide me you code? I just try this in node.
It is better to have a project that can reproduce the whole scene.
from velocity.js.
Related Issues (20)
- Dashes in Identifiers HOT 1
- Support format quiet syntax $!{reference}
- String.replace() is not global HOT 2
- Map.remove() is not implemented HOT 2
- String pipe symbol not implemented HOT 1
- Support the $util.qr directive HOT 1
- IE or older browsers not supported!!! HOT 1
- Bug with #set inside #foreach: setting properties on loop variable from foreach doesn't work HOT 1
- TypeError: Cannot read property 'charCodeAt' of undefined HOT 1
- 如何实现webpack的热更新? HOT 2
- String matches does not work HOT 2
- 变量名称是null时报错 HOT 1
- Bug with rendering #foreach and $util.map.copyAndRemoveAllKeys HOT 13
- How to figure out which references in AST are able to be set in context HOT 2
- Support method with arguments HOT 2
- Parse String to Int HOT 2
- #set with array fails for unknown reason HOT 1
- 无法解析vue中使用element-ui的$message语法 HOT 1
- Date functions not working HOT 2
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 velocity.js.