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
Source Maps? #56
Comments
@crisward , I'm working in precompiled expressions and source maps is a low priority TODO. However, any PR is wellcome. |
👍 |
1 similar comment
👍 |
@aMarCruz Any progress on this? May I help you here? Ping me in private so we can discuss about this feature.. I would like to roll out the new version 3.4.0 really soon |
I made a start but don't have a lot of time to work on this at the moment. It would need to link in with the source maps for coffee,ts,babel,jade etc. Jade doesn't appear to create sourcemaps at the moment, but there are browserify jade transforms that do. ie. https://github.com/sidorares/pugify so it's not impossible. |
This feature would be awesome.. at moment I would like to just make a simple version of it avoiding to chain the pre/post compiler sourcemaps |
I've moved this a little further along, but I need to enable with a compile flag, but I'm not sure where this should be enabled See I'm guessing this would be the responsibility of the riot-cli tool, so I'd need to be able to return a method which can create the sourcemap in it's various forms ie, inline base64, and .json file. and handle the case of the concatenated file option. Perhaps a flag like
At the moment it's only translating the line number of the html, it'll also need to handle script and style elements.This still needs a lot of work to be useful. |
@crisward cool can you make a pull request please? |
@crisward any progress on this? |
Sorry, it's more work than I first envisaged. I've never added source map support to any language before so I didn't really know what I was getting myself into. I think I'd need to somehow combine the source maps from the various compile processes to match the final output back to the source and to be honest I'm a bit out of my depth, especially with the very limited time I have to spend on open source. If anyone in the community wants to give any help / take up the baton it would be very much appreciated. |
I can try to add sourcemaps support. Which branch should I use: master or next? |
@dogada yes of course.. I would work in the |
I made initial implementation and it works good so far but I tested only scripts with I didn't tried More difficult target is default To check new compiler I enabled it inside my At the moment I generate inline source maps and browsers understands them well. Node 4 doesn't understand it yet, may be it's need to switch on something. To compile several tags into one js-file with I also plan add support of new compiler format to The current changes is here: https://github.com/dogada/compiler/tree/next |
I also don't want to break backward compatibility with various plugins like https://github.com/jhthorsen/riotify/blob/master/index.js that expects that
Thoughts? |
@dogada wow this a great news and I hope sourcemaps could be generated independently from babel
Thanks for your help |
Source maps for less/sass have sense only when styles extracted from tag-files and then combined into an bigger css file. I didn't see such Riot projects. Can someone who extract css from tag-file point me to an configuration where you did it? Just want to better understand workflow and how to test it. coffeescript, typescript and all other javascript code parsers should work, it's only matter of time to add it. Not sure about source map for jade/pug... How and when it will be consumed? |
I use it with webpack ( const fs = require('fs')
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const npmPackage = require(path.join(__dirname, 'package.json'))
const config = require(path.join(__dirname, 'src/server/config/env'))
const babelrc = JSON.parse(fs.readFileSync(path.join(__dirname, '.babelrc')))
module.exports = {
entry: {
admin: [
'webpack-hot-middleware/client?http://localhost:3100',
path.join(__dirname, 'src/client/apps/admin/webpack-init')
],
auth: [
'webpack-hot-middleware/client?http://localhost:3100',
path.join(__dirname, 'src/client/apps/auth/webpack-init')
]
},
output: {
path: path.join(__dirname, 'public'),
filename: '[name]/bundle.js',
library: 'global',
chunkFilename: '[id].bundle.js',
publicPath: `http://${config.HOST}:${config.PORT}/`
},
resolve: {
root: __dirname,
alias: npmPackage._moduleAliases || {},
extensions: ['', '.js', '.tag', '.riot'],
modulesDirectories: npmPackage._moduleDirectories || []
},
devtool: config.NODE_ENV === 'development' ? 'cheap-module-inline-source-map' : null,
plugins: [
new webpack.DefinePlugin({
IS_CLIENT: true,
IS_SERVER: false,
'process.env': {
NODE_ENV: JSON.stringify(config.NODE_ENV)
},
ENV: JSON.stringify(config.NODE_ENV)
}),
new webpack.ProvidePlugin({
riot: 'riot',
fetch: 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
module: {
preLoaders: [
{
test: /\.tag$/,
exclude: /node_modules/,
loader: 'riotjs',
query: {
type: 'babel',
compact: 'true'
}
},
{
test: /\.riot$/,
exclude: /node_modules/,
loader: 'riot-plain',
query: {
compact: true
}
}
],
loaders: [
{
test: /\.(js|tag|riot)$/,
exclude: /node_modules/,
loader: 'babel',
query: babelrc
},
{
test: /\.css$/,
loaders: [ 'style', 'css?sourceMap' ]
},
{
test: /\.scss$/,
loaders: [ 'style', 'css?sourceMap', 'sass?sourceMap' ]
},
{
test: /\.(jpe|jpg|woff|woff2|eot|ttf|svg)(\?\S*)?$/,
loader: 'file'
},
{
test: /\.json$/,
loader: 'json'
}
],
resolve: {
moduleDirectories: ['node_modules'],
extensions: ['', '.js']
}
},
watch: config.NODE_ENV === 'development',
watchOptions: {
aggregateTimeout: 30
}
}
module.exports.devServer = {
port: 3101,
hot: true,
contentBase: '/'
} |
Thanks, Nick. Can you also mention your Babel and Webpack versions or just On Mon, Jul 25, 2016 at 8:33 PM, Nick Gavrilov notifications@github.com
|
Ok, sure. babel-core@6.9.1 |
Guys any progress on this? @dogada could you make a pull request please? |
Sorry, was really buzy. my branxh works but need to ne polished. Will try
|
jade/pug does not have sourceMaps, but handlebars have this feature in Edit: |
What is the status on this? Really annoying issue to tackle in a pipeline. I have really red eyes now. |
@gnimmelf source maps are already working in chrome since probably riot@2 you can enable them in our official riot-tag-loader. |
@GianlucaGuarini Dah, I went for rollup with this project due to simplicity. Guess I'll try the chamomille soon ;-) |
Ok, so I made a gulp webpack task to compile. Still, sourcemaps are one transform off from the tag-files. Is this the status quo, or can it be made to point to the tag-files themselves? |
Steps to see the riot sourcempas:
You should see something like this: You could try to throw a fake error in one of the components to see the right error position in the source file. |
Ah, then all is ok, your screenshot example is what I have allready; I was under the assumption that the sourcemapping would reveal the the uncompiled tag-files. Thank you for clarifying. |
ok it's months that we don't have any update on this issue. I assigned this task to me and it will be the next thing I will do on riot. Once we will have a parser (using the current codebase) with sourcemaps we can finally focus on riot 4 |
* feature/sourcemaps: added: simple test for sourcemaps updated: skip empty lines added: initial sourcemaps support #56
The new riot-compiler@3.3.0 has experimental sourcemaps support. Sourcemaps can be generated via |
Is anyone working on source maps for riot tags?
These would be really useful for code coverage, I currently do my code coverage on the compiled files but see the original source would be useful. Also debugging when all I have is large bundles.
If no one is, I may have a go. Not that I know anything about source maps...
The text was updated successfully, but these errors were encountered: