Hello community, here is the log from the commit of package perl-Mojolicious-Plugin-AssetPack for openSUSE:Factory checked in at 2017-11-15 16:54:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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" Wed Nov 15 16:54:37 2017 rev:36 rq:539969 version:2.01 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack/perl-Mojolicious-Plugin-AssetPack.changes 2017-10-18 16:16:41.612151700 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new/perl-Mojolicious-Plugin-AssetPack.changes 2017-11-15 16:54:39.582937055 +0100 @@ -1,0 +2,16 @@ +Wed Nov 8 16:57:47 UTC 2017 - coolo@suse.com + +- updated to 2.01 + see /usr/share/doc/packages/perl-Mojolicious-Plugin-AssetPack/Changes + + 2.01 2017-11-06T13:02:45+0100 + + - Up version number to try to fix pause indexing issues + + 1.48 2017-10-29T10:20:51+0800 + - Fix RollupJs package name #130 + - load_module() confess on error + - Removed EXPERIMENTAL Reloader pipe + - Removed EXPERIMENTAL clone() method in AssetPack::Asset + +------------------------------------------------------------------- Old: ---- Mojolicious-Plugin-AssetPack-1.47.tar.gz New: ---- Mojolicious-Plugin-AssetPack-2.01.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious-Plugin-AssetPack.spec ++++++ --- /var/tmp/diff_new_pack.Z2UxQi/_old 2017-11-15 16:54:40.346909064 +0100 +++ /var/tmp/diff_new_pack.Z2UxQi/_new 2017-11-15 16:54:40.346909064 +0100 @@ -17,14 +17,14 @@ Name: perl-Mojolicious-Plugin-AssetPack -Version: 1.47 +Version: 2.01 Release: 0 %define cpan_name Mojolicious-Plugin-AssetPack Summary: Compress and convert css, less, sass, javascript and coffeescript files License: Artistic-2.0 Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Mojolicious-Plugin-AssetPack/ -Source0: https://cpan.metacpan.org/authors/id/J/JH/JHTHORSEN/%{cpan_name}-%{version}.tar.gz +Source0: https://cpan.metacpan.org/authors/id/M/MR/MRAMBERG/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ Mojolicious-Plugin-AssetPack-1.47.tar.gz -> Mojolicious-Plugin-AssetPack-2.01.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/Changes new/Mojolicious-Plugin-AssetPack-2.01/Changes --- old/Mojolicious-Plugin-AssetPack-1.47/Changes 2017-10-14 18:58:55.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/Changes 2017-11-06 13:02:45.000000000 +0100 @@ -1,5 +1,15 @@ Revision history for perl distribution Mojolicious-Plugin-AssetPack +2.01 2017-11-06T13:02:45+0100 + + - Up version number to try to fix pause indexing issues + +1.48 2017-10-29T10:20:51+0800 + - Fix RollupJs package name #130 + - load_module() confess on error + - Removed EXPERIMENTAL Reloader pipe + - Removed EXPERIMENTAL clone() method in AssetPack::Asset + 1.47 2017-10-14T18:58:55+0200 - Dropping "original" from assetpack.db diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/MANIFEST new/Mojolicious-Plugin-AssetPack-2.01/MANIFEST --- old/Mojolicious-Plugin-AssetPack-1.47/MANIFEST 2017-10-14 18:58:57.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/MANIFEST 2017-11-06 13:02:45.000000000 +0100 @@ -3,7 +3,6 @@ .travis.yml Changes cpanfile -examples/reloader.pl examples/rollup.pl examples/sprites.pl lib/Mojolicious/Plugin/AssetPack.pm @@ -22,11 +21,10 @@ lib/Mojolicious/Plugin/AssetPack/Pipe/Jpeg.pm lib/Mojolicious/Plugin/AssetPack/Pipe/Less.pm lib/Mojolicious/Plugin/AssetPack/Pipe/Png.pm -lib/Mojolicious/Plugin/AssetPack/Pipe/Reloader.pm lib/Mojolicious/Plugin/AssetPack/Pipe/require.js lib/Mojolicious/Plugin/AssetPack/Pipe/riot.js lib/Mojolicious/Plugin/AssetPack/Pipe/Riotjs.pm -lib/Mojolicious/Plugin/AssetPack/Pipe/Rollupjs.pm +lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm lib/Mojolicious/Plugin/AssetPack/Pipe/typescript.js lib/Mojolicious/Plugin/AssetPack/Pipe/TypeScript.pm @@ -89,8 +87,6 @@ t/range.t t/recreate.t t/register.t -t/reloader-process.t -t/reloader.t t/riotjs-not-loaded.t t/riotjs.t t/rollup.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/META.json new/Mojolicious-Plugin-AssetPack-2.01/META.json --- old/Mojolicious-Plugin-AssetPack-1.47/META.json 2017-10-14 18:58:57.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/META.json 2017-11-06 13:02:45.000000000 +0100 @@ -1,10 +1,10 @@ { "abstract" : "Compress and convert css, less, sass, javascript and coffeescript files", "author" : [ - "Jan Henning Thorsen <jhthorsen@cpan.org>" + "Marcus Ramberg <marcus.ramberg@gmail.com>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005", "license" : [ "artistic_2" ], @@ -45,9 +45,9 @@ }, "homepage" : "https://github.com/jhthorsen/mojolicious-plugin-assetpack", "repository" : { - "url" : "https://github.com/jhthorsen/mojolicious-plugin-assetpack.git" + "url" : "https://github.com/marcus/mojolicious-plugin-assetpack" } }, - "version" : "1.47", - "x_serialization_backend" : "JSON::PP version 2.27400_02" + "version" : "2.01", + "x_serialization_backend" : "JSON::PP version 2.27300" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/META.yml new/Mojolicious-Plugin-AssetPack-2.01/META.yml --- old/Mojolicious-Plugin-AssetPack-1.47/META.yml 2017-10-14 18:58:56.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/META.yml 2017-11-06 13:02:45.000000000 +0100 @@ -1,13 +1,13 @@ --- abstract: 'Compress and convert css, less, sass, javascript and coffeescript files' author: - - 'Jan Henning Thorsen <jhthorsen@cpan.org>' + - 'Marcus Ramberg <marcus.ramberg@gmail.com>' build_requires: Test::More: '0.88' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -24,6 +24,6 @@ resources: 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.47' + repository: https://github.com/marcus/mojolicious-plugin-assetpack +version: '2.01' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/Makefile.PL new/Mojolicious-Plugin-AssetPack-2.01/Makefile.PL --- old/Mojolicious-Plugin-AssetPack-1.47/Makefile.PL 2017-10-14 18:58:55.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/Makefile.PL 2017-11-06 13:02:45.000000000 +0100 @@ -2,16 +2,16 @@ use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Mojolicious::Plugin::AssetPack', - AUTHOR => 'Jan Henning Thorsen <jhthorsen@cpan.org>', + AUTHOR => 'Marcus Ramberg <marcus.ramberg@gmail.com>', LICENSE => 'artistic_2', ABSTRACT_FROM => 'lib/Mojolicious/Plugin/AssetPack.pm', VERSION_FROM => 'lib/Mojolicious/Plugin/AssetPack.pm', - EXE_FILES => [qw()], + EXE_FILES => [qw( )], META_MERGE => { resources => { 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', + repository => 'https://github.com/marcus/mojolicious-plugin-assetpack', }, }, BUILD_REQUIRES => { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/README new/Mojolicious-Plugin-AssetPack-2.01/README --- old/Mojolicious-Plugin-AssetPack-1.47/README 2017-10-14 18:58:55.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/README 2017-11-06 13:02:45.000000000 +0100 @@ -3,7 +3,7 @@ javascript and coffeescript files VERSION - 1.47 + 2.01 SYNOPSIS Application diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/examples/reloader.pl new/Mojolicious-Plugin-AssetPack-2.01/examples/reloader.pl --- old/Mojolicious-Plugin-AssetPack-1.47/examples/reloader.pl 2016-04-08 20:11:40.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/examples/reloader.pl 1970-01-01 01:00:00.000000000 +0100 @@ -1,30 +0,0 @@ -#!/usr/bin/env perl -use lib 'lib'; -use Mojolicious::Lite; - -# 1) Run: perl examples/reloader.pl daemon --listen http://*:3000 -# 2) Open your browser at http://localhost:3000 -# 3) Change the background color in t/assets/example.css and -# see the change in the browser instantly. Note that this -# happens without the help from "morbo". - -plugin AssetPack => {pipes => ['Reloader']}; -app->asset->store->paths(['t/assets']); -app->asset->process('main.css' => 'example.css'); - -get '/' => 'index'; -app->start; - -__DATA__ -@@ index.html.ep -<!DOCTYPE html> -<html> -<head> - %= asset 'main.css' - %= asset 'reloader.js' if app->mode eq 'development' -</head> -<body> -mode=<%= app->mode %>. -<br>time=<%= time %>. -</body> -</html> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Asset.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Asset.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Asset.pm 2017-10-14 18:41:40.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Asset.pm 2017-11-06 12:10:29.000000000 +0100 @@ -63,13 +63,6 @@ return $clone; } -sub clone { - my $self = shift; - my $clone = (ref $self)->new(%{$self}); - delete $clone->{$_} for qw(checksum minified); - return $clone; -} - sub content { my $self = shift; return $self->_asset->slurp unless @_; @@ -163,14 +156,6 @@ This method is EXPERIMENTAL. -=head2 clone - - $clone = $self->clone; - -Makes a shallow clone of the object. - -This method is EXPERIMENTAL. - =head2 content $bytes = $self->content; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Guides/Developing.pod new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Guides/Developing.pod --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Guides/Developing.pod 2017-09-05 18:22:34.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Guides/Developing.pod 2017-11-06 12:10:29.000000000 +0100 @@ -30,45 +30,9 @@ =head2 Faster development cycle -For a faster development cycle, you can use -LMojolicious::Plugin::AssetPack::Pipe::Reloader, and L<MOJO_ASSETPACK_LAZY>. -The combination of the two will result in a webpage that reload itself when -a change is found in either an asset or the perl code. - -Example application: - - use Mojolicious::Lite; - plugin "AssetPack" => {pipes => [qw(Css Reloader)]}; - app->asset->process; - get "/" => "example"; - app->start; - - __DATA__ - @@ assetpack.def - ! myapp.css - < main.css - - @@ main.css - body { background: pink; } - - @@ example.html.ep - <!DOCTYPE html> - <html> - <head> - <title>This page will reload when changes are made</title> - - %# Some asset you have defined: - %= asset "myapp.css" - - %# See Reloader pipe for details - %= asset "reloader.js" if app->mode eq "development" - </head> - <body> - This is a reload test page! - </body> - </html> - -How to run the application: +For a faster development cycle, you can use L<MOJO_ASSETPACK_LAZY>. This +environment variable will make AssetPack only rebuild the asset that is in use +on the current web page. $ MOJO_ASSETPACK_LAZY=1 morbo myapp.pl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod 2017-10-14 18:41:40.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod 2017-11-06 12:10:29.000000000 +0100 @@ -102,10 +102,6 @@ Used to crush "png" image files. -=item * LMojolicious::Plugin::AssetPack::Pipe::Reloader - -EXPERIMENTAL pipe for reloading the page when the assets change. - =item * LMojolicious::Plugin::AssetPack::Pipe::Riotjs Process Lhttp://riotjs.com/ tag files. Should be loaded before @@ -212,7 +208,7 @@ "sass/main.scss". If you want to include a remote file in your output asset, use '<' insteaf of '<<'. -It is also possible to add (EXPERIMENTAL) conditions: +It is also possible to add conditions: ! app.css < development.css [mode==development] [minify==0] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Css.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Css.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Css.pm 2017-10-14 17:15:37.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Css.pm 2017-11-06 12:10:29.000000000 +0100 @@ -16,7 +16,7 @@ $attrs->{minified} = 1; return if $asset->format ne 'css' or $asset->minified; return $asset->content($file)->minified(1) if $file = $store->load($attrs); - load_module 'CSS::Minifier::XS' or die qq(Could not load "CSS::Minifier::XS": $@); + load_module 'CSS::Minifier::XS'; diag 'Minify "%s" with checksum %s.', $asset->url, $asset->checksum if DEBUG; my $css = CSS::Minifier::XS::minify($asset->content); $asset->content($store->save($css, $attrs))->minified(1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Favicon.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Favicon.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Favicon.pm 2017-09-07 20:46:50.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Favicon.pm 2017-11-06 12:10:29.000000000 +0100 @@ -3,7 +3,6 @@ use Mojo::DOM; use Mojo::Util; -use Mojolicious::Plugin::AssetPack::Util qw(diag load_module DEBUG); # this should be considered private our $URL = 'http://realfavicongenerator.net/api/favicon'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/JavaScript.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/JavaScript.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/JavaScript.pm 2017-10-14 17:15:37.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/JavaScript.pm 2017-11-06 12:10:29.000000000 +0100 @@ -17,8 +17,7 @@ return if $asset->format ne 'js' or $asset->minified; return $asset->content($file)->minified(1) if $file = $store->load($attrs); return unless length(my $js = $asset->content); - load_module 'JavaScript::Minifier::XS' - or die qq(Could not load "JavaScript::Minifier::XS": $@); + load_module 'JavaScript::Minifier::XS'; diag 'Minify "%s" with checksum %s.', $asset->url, $asset->checksum if DEBUG; $js = JavaScript::Minifier::XS::minify($js); $asset->content($store->save($js, $attrs))->minified(1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Jpeg.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Jpeg.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Jpeg.pm 2017-10-14 17:15:37.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Jpeg.pm 2017-11-06 12:10:29.000000000 +0100 @@ -1,6 +1,6 @@ package Mojolicious::Plugin::AssetPack::Pipe::Jpeg; use Mojo::Base 'Mojolicious::Plugin::AssetPack::Pipe'; -use Mojolicious::Plugin::AssetPack::Util qw(diag load_module DEBUG); +use Mojolicious::Plugin::AssetPack::Util qw(diag DEBUG); has app => 'jpegoptim'; has app_args => sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Png.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Png.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Png.pm 2017-10-14 17:15:37.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Png.pm 2017-11-06 12:10:29.000000000 +0100 @@ -1,6 +1,6 @@ package Mojolicious::Plugin::AssetPack::Pipe::Png; use Mojo::Base 'Mojolicious::Plugin::AssetPack::Pipe'; -use Mojolicious::Plugin::AssetPack::Util qw(diag load_module DEBUG); +use Mojolicious::Plugin::AssetPack::Util qw(diag DEBUG); has app => 'pngquant'; has app_args => sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Reloader.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Reloader.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Reloader.pm 2017-09-07 20:47:02.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Reloader.pm 1970-01-01 01:00:00.000000000 +0100 @@ -1,169 +0,0 @@ -package Mojolicious::Plugin::AssetPack::Pipe::Reloader; -use Mojo::Base 'Mojolicious::Plugin::AssetPack::Pipe'; -use Mojo::Loader (); - -has enabled => sub { - return $ENV{MOJO_ASSETPACK_LAZY} || shift->app->mode eq 'development'; -}; - -has _files => sub { +{} }; - -sub after_process { - my ($self, $assets) = @_; - $self->_files->{$_} = 1 - for grep {$_} map { ($_->path, @{$_->{dependencies} || []}) } @$assets; -} - -sub before_process { - my ($self, $assets) = @_; - $self->_files->{$_} = 1 - for grep {$_} map { ($_->path, @{$_->{dependencies} || []}) } @$assets; -} - -sub new { - my $self = shift->SUPER::new(@_); - return $self unless $self->enabled; - push @{$self->assetpack->store->classes}, __PACKAGE__; - $self->assetpack->{lazy} = 1; - $self->_add_route; - $self; -} - -sub process { - my $self = shift; - return unless $self->enabled; - return if $self->{processed}++; - - # Cannot call assetpack->process() in new(), since it will initialize and start building - # attributes too soon. - $self->assetpack->process('reloader.js' => 'reloader.js'); - $self->_start_watching; -} - -sub _add_route { - shift->app->routes->websocket('/mojo-assetpack-reloader-ws')->to( - cb => sub { - my $c = shift; - my $cb = sub { $c->finish; }; - $c->inactivity_timeout(3600); - $c->app->plugins->on(assets_changed => $cb); - $c->on(finish => sub { shift->app->plugins->unsubscribe(assets_changed => $cb); }); - } - )->name('mojo-assetpack-reloader-ws'); -} - -sub _start_watching { - my $self = shift; - my $app = $self->app; - my $files = $self->_files; - my $cache = {}; - - Mojo::IOLoop->recurring( - $ENV{MOJO_ASSETPACK_CHECK_INTERVAL} || 0.5, - sub { - my @changed; - for my $file (sort keys %$files) { - my ($size, $mtime) = (stat $file)[7, 9]; - next unless defined $mtime; - my $stats = $cache->{$file} ||= [$^T, $size]; - next if $mtime <= $stats->[0] && $size == $stats->[1]; - @$stats = ($mtime, $size); - push @changed, $file; - } - - $app->plugins->emit(assets_changed => @changed) if @changed; - } - ); -} - -1; - -=encoding utf8 - -=head1 NAME - -Mojolicious::Plugin::AssetPack::Pipe::Reloader - Automatically reload assets in browser - -=head1 SYNOPSIS - -=head2 Application - - $app->plugin(AssetPack => {pipes => ["Reloader"]); - -=head2 Template - - %= asset "reloader.js" if app->mode eq "development" - -=head2 Browser - -The reloader can be disabled by adding the query parameter -"_assetpack_reload=false" to the url, or by setting -C<window.ASSETPACK_RELOAD = false;> in JavaScript. - -=head1 DESCRIPTION - -LMojolicious::Plugin::AssetPack::Pipe::Reloader is a pipe which will create -an asset called "reloader.js". This asset will automatically reload the page in -the browser when one of the assets change on disk. This is done without the -need of L<morbo|Mojo::Server::Morbo>. - -This pipe should be loaded last to enable it to watch all input assets. - -This feature is EXPERIMENTAL, UNSTABLE and only meant to be used while -developing. - -=head1 ATTRIBUTES - -=head2 enabled - - $bool = $self->enabled; - -This pipe is only enabled if either -LMojolicious::Plugin::AssetPack::Guides::Developing/MOJO_ASSETPACK_LAZY is -set or L<Mojolicious/mode> is "development". - -=head1 METHODS - -=head2 after_process - -This method will look for all the input assets and dependencies and add them to -a list of watched files. - -See LMojolicious::Plugin::AssetPack::Pipe/after_process. - -=head2 before_process - -See L</after_process> and LMojolicious::Plugin::AssetPack::Pipe/before_process. - -=head2 new - -Used to add a special "reloader.js" asset and a -"/mojo-assetpack-reloader-ws" WebSocket endpoint. - -=head2 process - -This method does nothing. - -=head1 SEE ALSO - -LMojolicious::Plugin::AssetPack. - -=cut - -__DATA__ -@@ reloader.js -window.addEventListener("load", function(e) { - if (typeof ASSETPACK_RELOAD == "undefined") { - ASSETPACK_RELOAD = location.href.indexOf("_assetpack_reload=false") == -1 ? true : false; - } - var script = document.querySelector('script[src$="/reloader.js"]'); - var reloader = function() { - var socket = new WebSocket(script.src.replace(/^http/, "ws").replace(/\basset.*/, "mojo-assetpack-reloader-ws")); - socket.onopen = function() { console.log("[AssetPack] Reloader is active."); }; - socket.onclose = function() { - if (ASSETPACK_RELOAD) return location = location.href; - console.log("[AssetPack] Reloader was disabled with window.ASSETPACK_RELOAD = true."); - }; - }; - reloader(); -}); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm 2017-11-06 12:10:29.000000000 +0100 @@ -0,0 +1,185 @@ +package Mojolicious::Plugin::AssetPack::Pipe::RollupJs; +use Mojo::Base 'Mojolicious::Plugin::AssetPack::Pipe'; + +use Mojo::File qw(path tempfile); +use Mojo::Loader; +use Mojolicious::Plugin::AssetPack::Util qw(diag $CWD DEBUG); + +has external => sub { [] }; +has globals => sub { [] }; +has modules => sub { [] }; +has plugins => sub { + my $self = shift; + my @plugins = qw(rollup-plugin-node-resolve rollup-plugin-commonjs); + push @plugins, 'rollup-plugin-uglify' if $self->assetpack->minify; + return @plugins; +}; + +has _rollupjs => sub { + my $self = shift; + my $bin = Mojo::Loader::data_section(__PACKAGE__, 'rollup.js'); + my (@import, @plugins); + + for my $plugin (@{$self->plugins}) { + my $func = "plugin_$plugin"; + $func =~ s!\W!_!g; + push @import, "var $func = require('$plugin');\n"; + push @plugins, "$func()"; + } + + $bin =~ s!__PLUGINS__!{join '', @import}!e; + $bin =~ s!__PLUGINS__!{join ',', @plugins}!e; + + if (DEBUG > 2) { + $self->{_rollupjs_src} = path(File::Spec->tmpdir, 'assetpack-rollup.js'); + diag "[RollupJs] Keeping $self->{_rollupjs_src} around."; + } + else { + $self->{_rollupjs_src} = tempfile(SUFFIX => '.js'); + } + + $self->{_rollupjs_src}->spurt($bin); + + return [$self->_find_app([qw(nodejs node)]), $self->{_rollupjs_src}->realpath]; +}; + +sub process { + my ($self, $assets) = @_; + my $minify = $self->assetpack->minify; + my $store = $self->assetpack->store; + my $file; + + $assets->each( + sub { + my ($asset, $index) = @_; + my $attrs = $asset->TO_JSON; + return unless $asset->format eq 'js'; + return unless $asset->path and -r $asset->path; + return unless $asset->content =~ /\bimport\s.*\bfrom\b/s; + + $attrs->{key} = 'rollup'; + $attrs->{minified} = $minify; + return $asset->content($file)->FROM_JSON($attrs) if $file = $store->load($attrs); + + local $CWD = $self->app->home->to_string; + local $ENV{NODE_ENV} = $self->app->mode; + local $ENV{NODE_PATH} = $self->app->home->rel_file('node_modules'); + local $ENV{ROLLUP_EXTERNAL} = join ',', @{$self->external}; + local $ENV{ROLLUP_GLOBALS} = join ',', @{$self->globals}; + local $ENV{ROLLUP_SOURCEMAP} = $self->app->mode eq 'development' ? 1 : 0 + if 0; # TODO + + $self->_install_node_modules('rollup', @{$self->modules}, @{$self->plugins}) + unless $self->{installed}++; + $self->run([@{$self->_rollupjs}, $asset->path, _module_name($asset->name)], + undef, \my $js); + $asset->content($store->save($js, $attrs))->FROM_JSON($attrs); + } + ); +} + +sub _module_name { local $_ = $_[0]; s!\W!_!g; lcfirst(Mojo::Util::camelize($_)) } + +1; + +=encoding utf8 + +=head1 NAME + +Mojolicious::Plugin::AssetPack::Pipe::RollupJs - Use Rollup.js module bundler + +=head1 SYNOPSIS + + use Mojolicious::Lite; + plugin AssetPack => {pipes => [qw(RollupJs)]}; + +=head1 DESCRIPTION + +Rollup is a module bundler for JavaScript which compiles small pieces of code +into something larger and more complex, such as a library or application. + +See Lhttps://rollupjs.org/ for more details. + +=head1 ATTRIBUTES + +=head2 external + + $array_ref = $self->external; + $self = $self->external(["vue"]); + +Comma-separate list of module IDs to exclude. + +=head2 globals + + $array_ref = $self->globals; + $self = $self->globals(["vue"]); + +Comma-separate list of `module ID:Global` pairs. Any module IDs defined here +are added to L</external>. + +=head2 modules + + $array_ref = $self->modules; + $self = $self->modules(["vue"]); + +List of NPM modules that the JavaScript application depends on. + +=head2 plugins + + $array_ref = $self->plugins; + $self = $self->plugins(["rollup-plugin-vue", "rollup-plugin-uglify"]); + +List of NPM modules that should be loaded by Rollup.js. + +=head1 METHODS + +=head2 process + +See LMojolicious::Plugin::AssetPack::Pipe/process. + +=head1 SEE ALSO + +LMojolicious::Plugin::AssetPack. + +=cut + +__DATA__ +@@ rollup.js +#!/usr/bin/env node +'use strict' + +const globals = process.env.ROLLUP_GLOBALS.split(","); +const external = process.env.ROLLUP_EXTERNAL.split(","); +const rollup = require('rollup'); +const stdout = process.stdout; + +__PLUGINS__ + +globals.forEach(function(g) { external.push(g.split(":")[0]) }); + +const inputOptions = { + input: process.argv[2], + external: function(name) { return external.indexOf(name) != -1 }, + plugins: [__PLUGINS__] +}; + +const outputOptions = { + format: "iife", + globals: globals, + name: process.argv[3], + sourcemap: "inline", + // TODO + banner: process.env.ROLLUP_BANNER, + footer: process.env.ROLLUP_FOOTER, + intro: process.env.ROLLUP_INTRO, + outro: process.env.ROLLUP_OUTRO +}; + +async function build() { + const bundle = await rollup.rollup(inputOptions); + const { code, map } = await bundle.generate(outputOptions); + stdout.write(code); + if (process.env.ROLLUP_SOURCEMAP) stdout.write("\n//# sourceMappingURL=" + map + "\n"); +} + +build(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Rollupjs.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Rollupjs.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Rollupjs.pm 2017-10-14 17:14:31.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Rollupjs.pm 1970-01-01 01:00:00.000000000 +0100 @@ -1,185 +0,0 @@ -package Mojolicious::Plugin::AssetPack::Pipe::RollupJs; -use Mojo::Base 'Mojolicious::Plugin::AssetPack::Pipe'; - -use Mojo::File qw(path tempfile); -use Mojo::Loader; -use Mojolicious::Plugin::AssetPack::Util qw(diag $CWD DEBUG); - -has external => sub { [] }; -has globals => sub { [] }; -has modules => sub { [] }; -has plugins => sub { - my $self = shift; - my @plugins = qw(rollup-plugin-node-resolve rollup-plugin-commonjs); - push @plugins, 'rollup-plugin-uglify' if $self->assetpack->minify; - return @plugins; -}; - -has _rollupjs => sub { - my $self = shift; - my $bin = Mojo::Loader::data_section(__PACKAGE__, 'rollup.js'); - my (@import, @plugins); - - for my $plugin (@{$self->plugins}) { - my $func = "plugin_$plugin"; - $func =~ s!\W!_!g; - push @import, "var $func = require('$plugin');\n"; - push @plugins, "$func()"; - } - - $bin =~ s!__PLUGINS__!{join '', @import}!e; - $bin =~ s!__PLUGINS__!{join ',', @plugins}!e; - - if (DEBUG > 2) { - $self->{_rollupjs_src} = path(File::Spec->tmpdir, 'assetpack-rollup.js'); - diag "[RollupJs] Keeping $self->{_rollupjs_src} around."; - } - else { - $self->{_rollupjs_src} = tempfile(SUFFIX => '.js'); - } - - $self->{_rollupjs_src}->spurt($bin); - - return [$self->_find_app([qw(nodejs node)]), $self->{_rollupjs_src}->realpath]; -}; - -sub process { - my ($self, $assets) = @_; - my $minify = $self->assetpack->minify; - my $store = $self->assetpack->store; - my $file; - - $assets->each( - sub { - my ($asset, $index) = @_; - my $attrs = $asset->TO_JSON; - return unless $asset->format eq 'js'; - return unless $asset->path and -r $asset->path; - return unless $asset->content =~ /\bimport\s.*\bfrom\b/s; - - $attrs->{key} = 'rollup'; - $attrs->{minified} = $minify; - return $asset->content($file)->FROM_JSON($attrs) if $file = $store->load($attrs); - - local $CWD = $self->app->home->to_string; - local $ENV{NODE_ENV} = $self->app->mode; - local $ENV{NODE_PATH} = $self->app->home->rel_file('node_modules'); - local $ENV{ROLLUP_EXTERNAL} = join ',', @{$self->external}; - local $ENV{ROLLUP_GLOBALS} = join ',', @{$self->globals}; - local $ENV{ROLLUP_SOURCEMAP} = $self->app->mode eq 'development' ? 1 : 0 - if 0; # TODO - - $self->_install_node_modules('rollup', @{$self->modules}, @{$self->plugins}) - unless $self->{installed}++; - $self->run([@{$self->_rollupjs}, $asset->path, _module_name($asset->name)], - undef, \my $js); - $asset->content($store->save($js, $attrs))->FROM_JSON($attrs); - } - ); -} - -sub _module_name { local $_ = $_[0]; s!\W!_!g; lcfirst(Mojo::Util::camelize($_)) } - -1; - -=encoding utf8 - -=head1 NAME - -Mojolicious::Plugin::AssetPack::Pipe::RollupJs - Use Rollup.js module bundler - -=head1 SYNOPSIS - - use Mojolicious::Lite; - plugin AssetPack => {pipes => [qw(RollupJs)]}; - -=head1 DESCRIPTION - -Rollup is a module bundler for JavaScript which compiles small pieces of code -into something larger and more complex, such as a library or application. - -See Lhttps://rollupjs.org/ for more details. - -=head1 ATTRIBUTES - -=head2 external - - $array_ref = $self->external; - $self = $self->external(["vue"]); - -Comma-separate list of module IDs to exclude. - -=head2 globals - - $array_ref = $self->globals; - $self = $self->globals(["vue"]); - -Comma-separate list of `module ID:Global` pairs. Any module IDs defined here -are added to L</external>. - -=head2 modules - - $array_ref = $self->modules; - $self = $self->modules(["vue"]); - -List of NPM modules that the JavaScript application depends on. - -=head2 plugins - - $array_ref = $self->plugins; - $self = $self->plugins(["rollup-plugin-vue", "rollup-plugin-uglify"]); - -List of NPM modules that should be loaded by Rollup.js. - -=head1 METHODS - -=head2 process - -See LMojolicious::Plugin::AssetPack::Pipe/process. - -=head1 SEE ALSO - -LMojolicious::Plugin::AssetPack. - -=cut - -__DATA__ -@@ rollup.js -#!/usr/bin/env node -'use strict' - -const globals = process.env.ROLLUP_GLOBALS.split(","); -const external = process.env.ROLLUP_EXTERNAL.split(","); -const rollup = require('rollup'); -const stdout = process.stdout; - -__PLUGINS__ - -globals.forEach(function(g) { external.push(g.split(":")[0]) }); - -const inputOptions = { - input: process.argv[2], - external: function(name) { return external.indexOf(name) != -1 }, - plugins: [__PLUGINS__] -}; - -const outputOptions = { - format: "iife", - globals: globals, - name: process.argv[3], - sourcemap: "inline", - // TODO - banner: process.env.ROLLUP_BANNER, - footer: process.env.ROLLUP_FOOTER, - intro: process.env.ROLLUP_INTRO, - outro: process.env.ROLLUP_OUTRO -}; - -async function build() { - const bundle = await rollup.rollup(inputOptions); - const { code, map } = await bundle.generate(outputOptions); - stdout.write(code); - if (process.env.ROLLUP_SOURCEMAP) stdout.write("\n//# sourceMappingURL=" + map + "\n"); -} - -build(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm 2017-10-14 17:15:37.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm 2017-11-06 12:10:29.000000000 +0100 @@ -50,7 +50,7 @@ $opts{include_paths} = [grep {$_} @{$opts{include_paths}}]; diag 'Process "%s" with checksum %s.', $asset->url, $attrs->{checksum} if DEBUG; - if ($self->{has_module} //= load_module 'CSS::Sass') { + if ($self->{has_module} //= eval { load_module 'CSS::Sass'; 1 }) { $opts{output_style} = _output_style($attrs->{minified}); $content = CSS::Sass::sass2scss($content) if $asset->format eq 'sass'; my ($css, $err, $stats) = CSS::Sass::sass_compile($content, %opts); @@ -123,7 +123,6 @@ if ($imported->path) { diag '@import "%s" (%s)', $rel_path, $imported->path if DEBUG >= 2; local $paths->[0] = _include_path($imported); - push @{$asset->{dependencies}}, $imported->path; # hack for Reloader push @c, $self->_checksum($imported->content, $imported, $paths); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Util.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Util.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Util.pm 2017-06-19 21:03:42.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack/Util.pm 2017-11-06 12:10:29.000000000 +0100 @@ -1,5 +1,7 @@ package Mojolicious::Plugin::AssetPack::Util; use Mojo::Base 'Exporter'; + +use Carp 'confess'; use Mojo::Util; use constant DEBUG => $ENV{MOJO_ASSETPACK_DEBUG} || 0; @@ -7,7 +9,7 @@ our @EXPORT = qw(checksum diag dumper has_ro load_module $CWD DEBUG); our $SUM_LEN = 10; -our $TOPIC; +our ($TOPIC, %LOADED); tie our ($CWD), 'Mojolicious::Plugin::AssetPack::Util::_chdir' or die q(Can't tie $CWD); @@ -29,11 +31,11 @@ my ($name, $builder) = @_; my $caller = caller; - $builder ||= sub { Carp::confess(qq("$name" is required in constructor')) }; + $builder ||= sub { confess qq("$name" is required in constructor') }; Mojo::Util::monkey_patch( $caller => $name => sub { - Carp::confess(qq("$name" is read-only")) if @_ > 1; + confess qq("$name" is read-only") if @_ > 1; $_[0]->{$name} //= $_[0]->$builder(); } ); @@ -41,8 +43,9 @@ sub load_module { my $module = shift; - eval "require $module;1"; - return $@ ? '' : $module; + confess qq(Invalid module name "$module") if ($module || '') !~ /^\w(?:[\w:']*\w)?$/; + return $module if $LOADED{$module} ||= eval "require $module; 1"; + confess qq(Could not load "$module": $@); } package Mojolicious::Plugin::AssetPack::Util::_chdir; @@ -107,8 +110,7 @@ $module = load_module $module; -Used to load C<$module>. Echo back C<$module> on success and returns empty -string on failure. C<$@> holds the error message on failure. +Used to load a C<$module>. Will confess on failure. =head1 SEE ALSO diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack.pm new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack.pm --- old/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack.pm 2017-10-14 18:58:55.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-2.01/lib/Mojolicious/Plugin/AssetPack.pm 2017-11-06 13:02:45.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.47'; +our $VERSION = '2.01'; my %TAG_TEMPLATE; $TAG_TEMPLATE{css} = [qw(link rel stylesheet href)]; @@ -135,7 +135,6 @@ map { my $class = load_module /::/ ? $_ : "Mojolicious::Plugin::AssetPack::Pipe::$_"; diag 'Loading pipe "%s".', $class if DEBUG; - die qq(Unable to load "$_": $@) unless $class; my $pipe = $class->new(assetpack => $self); Scalar::Util::weaken($pipe->{assetpack}); $pipe; @@ -163,7 +162,6 @@ local $pipe->{topic} = $topic; diag '%s->%s("%s")', ref $pipe, $method, $topic if DEBUG; $pipe->$method($assets); - push @{$self->{asset_paths}}, $_->path->to_string for grep { $_->path } @$assets; } } @@ -254,7 +252,7 @@ =head1 VERSION -1.47 +2.01 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/t/reloader-process.t new/Mojolicious-Plugin-AssetPack-2.01/t/reloader-process.t --- old/Mojolicious-Plugin-AssetPack-1.47/t/reloader-process.t 2017-01-10 23:20:50.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.01/t/reloader-process.t 1970-01-01 01:00:00.000000000 +0100 @@ -1,34 +0,0 @@ -use lib '.'; -use t::Helper; - -plan skip_all => 'TEST_RELOADER=1' unless $ENV{TEST_RELOADER} or -e '.test-everything'; -plan skip_all => 'cpanm CSS::Sass' unless eval 'use CSS::Sass 3.3.0;1'; - -my $file = Mojo::Asset::File->new(path => 't/assets/t-reloader.scss'); -eval { $file->add_chunk("body{color:#000;}\n") } - or plan skip_all => "t-reloader.scss: $!"; - -my $t = t::Helper->t(pipes => [qw(Sass Combine Reloader)]); -my $asset = $t->app->asset->store->asset('t-reloader.scss'); -$t->app->asset->process('app.css' => $asset); -$t->get_ok('/')->status_is(200); - -$t->websocket_ok('/mojo-assetpack-reloader-ws'); -Mojo::IOLoop->one_tick; -is $t->app->asset->processed('app.css')->first->checksum, 'c42b4ed75e', - 'initial checksum'; - -$file->add_chunk("div{color:#fff;}\n"); -$t->finished_ok(1005); - -$t->get_ok('/')->status_is(200); -is $t->app->asset->processed('app.css')->first->checksum, 'ee9b1ee297', - 'checksum after chunk added'; - -unlink $file->path; - -done_testing; -__DATA__ -@@ index.html.ep -%= asset 'app.css' -%= asset 'reloader.js' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.47/t/reloader.t new/Mojolicious-Plugin-AssetPack-2.01/t/reloader.t --- old/Mojolicious-Plugin-AssetPack-1.47/t/reloader.t 2017-01-10 23:20:50.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.01/t/reloader.t 1970-01-01 01:00:00.000000000 +0100 @@ -1,47 +0,0 @@ -use lib '.'; -use t::Helper; - -plan skip_all => 'TEST_RELOADER=1' unless $ENV{TEST_RELOADER} or -e '.test-everything'; - -my $file = Mojo::Asset::File->new(path => 't/assets/t-reloader.css'); -eval { $file->add_chunk("body{color:#000;}\n") } or plan skip_all => "t-reloader.css: $!"; - -my $t = t::Helper->t(pipes => [qw(Css Combine Reloader)]); -my $asset = $t->app->asset->store->asset('t-reloader.css'); -ok $t->app->asset->pipe('Reloader')->enabled, 'enabled'; - -$t->app->asset->process('app.css' => $asset); -$t->get_ok('/')->status_is(200) - ->element_exists(qq(link[href="/asset/36b3e7b800/t-reloader.css"])); -$t->get_ok($t->tx->res->dom->at('link')->{href})->content_is("body{color:#000;}\n"); - -$t->websocket_ok('/mojo-assetpack-reloader-ws'); -Mojo::IOLoop->one_tick; -$file->add_chunk("div{color:#fff;}\n"); -$t->finished_ok(1005); - -$t->get_ok('/')->status_is(200) - ->element_exists(qq(link[href="/asset/5958b3a722/t-reloader.css"])); -$t->get_ok($t->tx->res->dom->at('link')->{href}) - ->content_is("body{color:#000;}\ndiv{color:#fff;}\n"); - -if (eval 'require CSS::Minifier::XS;1') { - $ENV{MOJO_MODE} = 'whatever'; - $t = t::Helper->t(pipes => [qw(Css Combine Reloader)]); - ok !$t->app->asset->pipe('Reloader')->enabled, 'disabled'; - $t->app->asset->process('app.css' => $asset); - $t->get_ok('/')->status_is(200) - ->element_exists(qq(link[href="/asset/ee9b1ee297/app.css"])); - - $t->get_ok('/mojo-assetpack-reloader-ws')->status_is(404); - $file->add_chunk("div{color:#456;}\n"); - $t->get_ok('/')->status_is(200) - ->element_exists(qq(link[href="/asset/ee9b1ee297/app.css"])); -} - -unlink $file->path; - -done_testing; -__DATA__ -@@ index.html.ep -%= asset 'app.css'