Hello community,
here is the log from the commit of package perl-Mojolicious-Plugin-AssetPack
for openSUSE:Factory checked in at 2017-01-18 21:43:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack (Old)
and /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious-Plugin-AssetPack"
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack/perl-Mojolicious-Plugin-AssetPack.changes
2017-01-16 11:14:53.621105841 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new/perl-Mojolicious-Plugin-AssetPack.changes
2017-01-18 21:43:34.913517629 +0100
@@ -1,0 +2,10 @@
+Sat Jan 14 06:06:31 UTC 2017 - [email protected]
+
+- updated to 1.37
+ see /usr/share/doc/packages/perl-Mojolicious-Plugin-AssetPack/Changes
+
+ 1.37 2017-01-12T20:52:18+0100
+ - Add support for sass source maps
+ - No need to delete known media types in AssetPack::Store
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-Plugin-AssetPack-1.36.tar.gz
New:
----
Mojolicious-Plugin-AssetPack-1.37.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious-Plugin-AssetPack.spec ++++++
--- /var/tmp/diff_new_pack.SIT83w/_old 2017-01-18 21:43:35.305462192 +0100
+++ /var/tmp/diff_new_pack.SIT83w/_new 2017-01-18 21:43:35.305462192 +0100
@@ -17,7 +17,7 @@
Name: perl-Mojolicious-Plugin-AssetPack
-Version: 1.36
+Version: 1.37
Release: 0
%define cpan_name Mojolicious-Plugin-AssetPack
Summary: Compress and convert css, less, sass, javascript and
coffeescript files
++++++ Mojolicious-Plugin-AssetPack-1.36.tar.gz ->
Mojolicious-Plugin-AssetPack-1.37.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.36/Changes
new/Mojolicious-Plugin-AssetPack-1.37/Changes
--- old/Mojolicious-Plugin-AssetPack-1.36/Changes 2017-01-11
11:18:45.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.37/Changes 2017-01-12
20:52:18.000000000 +0100
@@ -1,5 +1,9 @@
Revision history for perl distribution Mojolicious-Plugin-AssetPack
+1.37 2017-01-12T20:52:18+0100
+ - Add support for sass source maps
+ - No need to delete known media types in AssetPack::Store
+
1.36 2017-01-11T11:18:45+0100
- Fix bug in Fetch pipe, fixing t/font-awesome.t
- Change Mojolicious::Plugin::AssetPack::Asset::path() to return a Mojo::File
object
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.36/MANIFEST
new/Mojolicious-Plugin-AssetPack-1.37/MANIFEST
--- old/Mojolicious-Plugin-AssetPack-1.36/MANIFEST 2017-01-11
11:18:46.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.37/MANIFEST 2017-01-12
20:52:20.000000000 +0100
@@ -88,6 +88,7 @@
t/sass-bin.t
t/sass-dynamic-include.t
t/sass-functions.t
+t/sass-source-map.t
t/sass-unable-to-download.t
t/sass-utf8.t
t/sass.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.36/META.json
new/Mojolicious-Plugin-AssetPack-1.37/META.json
--- old/Mojolicious-Plugin-AssetPack-1.36/META.json 2017-01-11
11:18:46.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.37/META.json 2017-01-12
20:52:19.000000000 +0100
@@ -48,6 +48,6 @@
"url" :
"https://github.com/jhthorsen/mojolicious-plugin-assetpack.git"
}
},
- "version" : "1.36",
+ "version" : "1.37",
"x_serialization_backend" : "JSON::PP version 2.27300"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.36/META.yml
new/Mojolicious-Plugin-AssetPack-1.37/META.yml
--- old/Mojolicious-Plugin-AssetPack-1.36/META.yml 2017-01-11
11:18:46.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.37/META.yml 2017-01-12
20:52:19.000000000 +0100
@@ -25,5 +25,5 @@
bugtracker: https://github.com/jhthorsen/mojolicious-plugin-assetpack/issues
homepage: https://github.com/jhthorsen/mojolicious-plugin-assetpack
repository: https://github.com/jhthorsen/mojolicious-plugin-assetpack.git
-version: '1.36'
+version: '1.37'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.36/README
new/Mojolicious-Plugin-AssetPack-1.37/README
--- old/Mojolicious-Plugin-AssetPack-1.36/README 2017-01-11
11:18:45.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.37/README 2017-01-12
20:52:19.000000000 +0100
@@ -3,7 +3,7 @@
javascript and coffeescript files
VERSION
- 1.36
+ 1.37
SYNOPSIS
Application
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-Plugin-AssetPack-1.36/lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm
new/Mojolicious-Plugin-AssetPack-1.37/lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm
---
old/Mojolicious-Plugin-AssetPack-1.36/lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm
2017-01-11 11:16:59.000000000 +0100
+++
new/Mojolicious-Plugin-AssetPack-1.37/lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm
2017-01-12 20:45:08.000000000 +0100
@@ -1,12 +1,18 @@
package Mojolicious::Plugin::AssetPack::Pipe::Sass;
use Mojo::Base 'Mojolicious::Plugin::AssetPack::Pipe';
+
use Mojolicious::Plugin::AssetPack::Util qw(checksum diag dumper load_module
DEBUG);
+use Mojo::JSON qw(decode_json encode_json);
use Mojo::Util;
-my $FORMAT_RE = qr{^s[ac]ss$};
-my $IMPORT_RE = qr{( \@import \s+ (["']) (.*?) \2 \s* ; )}x;
+my $FORMAT_RE = qr{^s[ac]ss$};
+my $IMPORT_RE = qr{( \@import \s+ (["']) (.*?) \2 \s* ; )}x;
+my $SOURCE_MAP_PLACEHOLDER = sprintf '__%s__', __PACKAGE__;
+
+$SOURCE_MAP_PLACEHOLDER =~ s!::!_!g;
has functions => sub { +{} };
+has generate_source_map => sub { shift->app->mode eq 'development' ? 1 : 0 };
sub process {
my ($self, $assets) = @_;
@@ -19,6 +25,11 @@
$opts{sass_functions}{$name} = sub { $self->$cb(@_); };
}
+ if ($self->generate_source_map) {
+ $opts{source_map_file} = $SOURCE_MAP_PLACEHOLDER;
+ $opts{source_map_file_urls} = $self->app->mode eq 'development' ? 1 : 0;
+ }
+
return $assets->each(
sub {
my ($asset, $index) = @_;
@@ -47,6 +58,8 @@
$asset->url, dumper(\%opts), $err;
}
$css = Mojo::Util::encode('UTF-8', $css);
+ $self->_add_source_map_asset($asset, \$css, $stats)
+ if $stats->{source_map_string};
$asset->content($store->save(\$css, $attrs))->FROM_JSON($attrs);
}
else {
@@ -59,6 +72,25 @@
);
}
+sub _add_source_map_asset {
+ my ($self, $asset, $css, $stats) = @_;
+ my $data = decode_json $stats->{source_map_string};
+ my $source_map = Mojolicious::Plugin::AssetPack::Asset->new(
+ url => sprintf('%s.css.map', $asset->name));
+
+ # override "stdin" with real file
+ $data->{file} = sprintf 'file://%s', $asset->path if $asset->path;
+ $data->{sources}[0] = $data->{file};
+ $source_map->content(encode_json $data);
+
+ my $relative = join '/', '..', $source_map->checksum, $source_map->url;
+ $$css =~ s!$SOURCE_MAP_PLACEHOLDER!$relative!;
+
+ # TODO
+ $self->assetpack->{by_checksum}{$source_map->checksum} = $source_map;
+ $self->assetpack->{by_topic}{$source_map->url} =
Mojo::Collection->new($source_map);
+}
+
sub _checksum {
my ($self, $ref, $asset, $paths) = @_;
my $ext = $asset->format;
@@ -177,6 +209,22 @@
See L</SYNOPSIS> for example.
+=head2 generate_source_map
+
+ $bool = $self->generate_source_map;
+ $self = $self->generate_source_map(1);
+
+This pipe will generate source maps if true. Default is "1" if
+L<Mojolicious/mode> is "development".
+
+See also L<http://thesassway.com/intermediate/using-source-maps-with-sass> and
+L<https://robots.thoughtbot.com/sass-source-maps-chrome-magic> for more
+information about the usefulness.
+
+See also L<Mojolicious::Plugin::AssetPack/MOJO_ASSETPACK_LAZY> and
+L<Mojolicious::Plugin::AssetPack::Pipe::Reloader> for how to reload the page
+when changes are done inside the browser's dev tools.
+
=head1 METHODS
=head2 process
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-Plugin-AssetPack-1.36/lib/Mojolicious/Plugin/AssetPack/Store.pm
new/Mojolicious-Plugin-AssetPack-1.37/lib/Mojolicious/Plugin/AssetPack/Store.pm
---
old/Mojolicious-Plugin-AssetPack-1.36/lib/Mojolicious/Plugin/AssetPack/Store.pm
2017-01-11 11:16:59.000000000 +0100
+++
new/Mojolicious-Plugin-AssetPack-1.37/lib/Mojolicious/Plugin/AssetPack/Store.pm
2017-01-12 20:34:40.000000000 +0100
@@ -103,21 +103,12 @@
my ($self, $c, $asset) = @_;
my $d = $self->default_headers;
my $h = $c->res->headers;
- my $ct = $self->_types->type($asset->format);
+ my $ct = $self->_types->type($asset->format) || 'application/octet-stream';
- if ($ct) {
- $h->header($_ => $d->{$_}) for keys %$d;
- $h->content_type($ct);
- $self->SUPER::serve_asset($c, $asset->can('asset') ? $asset->asset :
$asset);
- }
- else {
- $h->content_type('text/css');
- $c->render(text =>
- qq(body:before{content:'"@{[$asset->url]}" is not
processed.';font-size:32px;position:absolute;top:0;left:0;background:red;color:white;}\n)
- );
- }
-
- return $self;
+ $h->header($_ => $d->{$_}) for keys %$d;
+ $h->content_type($ct);
+ $self->SUPER::serve_asset($c, $asset->can('asset') ? $asset->asset : $asset);
+ $self;
}
sub _already_downloaded {
@@ -198,7 +189,7 @@
my $tx = $self->ua->get($req_url);
my $h = $tx->res->headers;
- if ($tx->error) {
+ if ($tx->res->is_error or $tx->error) {
$self->ua->server->app->log->warn(
"[AssetPack] Unable to download $req_url: @{[$tx->error->{message}]}");
return undef;
@@ -216,7 +207,7 @@
}
if (my $ct = $h->content_type) {
$ct =~ s!;.*$!!;
- $attrs->{format} = $self->_types->detect($ct)->[0];
+ $attrs->{format} = $self->_types->detect($ct)->[0] unless $ct eq
'text/plain';
}
$attrs->{format} ||= $tx->req->url->path->[-1] =~ /\.(\w+)$/ ? $1 : undef;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-Plugin-AssetPack-1.36/lib/Mojolicious/Plugin/AssetPack.pm
new/Mojolicious-Plugin-AssetPack-1.37/lib/Mojolicious/Plugin/AssetPack.pm
--- old/Mojolicious-Plugin-AssetPack-1.36/lib/Mojolicious/Plugin/AssetPack.pm
2017-01-11 11:18:45.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.37/lib/Mojolicious/Plugin/AssetPack.pm
2017-01-12 20:52:18.000000000 +0100
@@ -6,7 +6,7 @@
use Mojolicious::Plugin::AssetPack::Store;
use Mojolicious::Plugin::AssetPack::Util qw(diag has_ro load_module DEBUG);
-our $VERSION = '1.36';
+our $VERSION = '1.37';
my %TAG_TEMPLATE;
$TAG_TEMPLATE{css} = [qw(link rel stylesheet href)];
@@ -277,7 +277,7 @@
=head1 VERSION
-1.36
+1.37
=head1 SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-Plugin-AssetPack-1.36/t/riotjs-not-loaded.t
new/Mojolicious-Plugin-AssetPack-1.37/t/riotjs-not-loaded.t
--- old/Mojolicious-Plugin-AssetPack-1.36/t/riotjs-not-loaded.t 2016-11-14
19:55:19.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.37/t/riotjs-not-loaded.t 2017-01-12
20:34:40.000000000 +0100
@@ -6,6 +6,8 @@
$t->get_ok('/')->status_is(200)
->element_exists(qq(link[href="/asset/7373328564/r1.tag"]));
+local $TODO = 'removed support for detecting unprocessed in 1.37';
+
$t->get_ok($t->tx->res->dom->at('link')->{href})->status_is(200)
->header_is('Content-Type', 'text/css')
->content_like(qr{content:'"r1.tag" is not processed.';}s);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-Plugin-AssetPack-1.36/t/sass-source-map.t
new/Mojolicious-Plugin-AssetPack-1.37/t/sass-source-map.t
--- old/Mojolicious-Plugin-AssetPack-1.36/t/sass-source-map.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.37/t/sass-source-map.t 2017-01-12
20:45:44.000000000 +0100
@@ -0,0 +1,27 @@
+use lib '.';
+use t::Helper;
+plan skip_all => 'cpanm CSS::Sass' unless eval 'use CSS::Sass 3.3.0;1';
+
+my $t = t::Helper->t(pipes => [qw(Sass)]);
+$t->app->asset->process('app.css' => 'sass/sass-1.scss');
+$t->get_ok('/')->status_is(200)
+ ->element_exists(qq(link[href="/asset/71dcf0669a/sass-1.css"]));
+
+$t->get_ok('/asset/71dcf0669a/sass-1.css')->status_is(200)
+ ->content_like(qr{sourceMappingURL=\.\./8f89310ec6/sass-1\.css\.map});
+$t->get_ok('/asset/8f89310ec6/sass-1.css.map')->json_like('/file',
qr{sass-1\.scss})
+ ->json_has('/mappings')->json_has('/sources')->json_has('/version');
+
+$ENV{MOJO_MODE} = 'development_required';
+$t = t::Helper->t(pipes => [qw(Sass)]);
+$t->app->asset->process('app.css' => 'sass/sass-1.scss');
+$t->get_ok('/')->status_is(200)
+ ->element_exists(qq(link[href="/asset/71dcf0669a/sass-1.css"]));
+$t->get_ok('/asset/71dcf0669a/sass-1.css')->status_is(200)
+ ->content_unlike(qr{sourceMappingURL});
+
+done_testing;
+
+__DATA__
+@@ index.html.ep
+%= asset 'app.css'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-Plugin-AssetPack-1.36/t/sass-unable-to-download.t
new/Mojolicious-Plugin-AssetPack-1.37/t/sass-unable-to-download.t
--- old/Mojolicious-Plugin-AssetPack-1.36/t/sass-unable-to-download.t
2016-12-16 09:50:46.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.37/t/sass-unable-to-download.t
2017-01-12 20:34:40.000000000 +0100
@@ -6,7 +6,7 @@
my @message;
my $url =
'https://raw.githubusercontent.com/select2/select2/master/src/scss/core.scss';
my $t = t::Helper->t(pipes => [qw(Sass Css)]);
-$t->app->log->on(message => sub { shift; push @message, @_ });
+$t->app->log->on(message => sub { shift; push @message, join ' ', @_ });
$t->app->asset->process('app.css' => $url);
$t->get_ok('/')->status_is(200);
$t->get_ok($t->tx->res->dom->at('link[href]')->{href} ||
'/nope')->status_is(200)
@@ -14,7 +14,7 @@
ok + (grep {/Caching/} @message), 'cached assets' or diag join ',', @message;
ok + (grep {/Unable to download.*_layout\.scss/} @message), 'unable to
download'
- or diag join ',', @message;
+ or map { diag $_ } @message;
$ENV{MOJO_ASSETPACK_CLEANUP} = 0;