Hello community,
here is the log from the commit of package perl-Mojolicious-Plugin-AssetPack for openSUSE:Factory checked in at 2017-10-03 23:17: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"
Tue Oct 3 23:17:37 2017 rev:34 rq:530065 version:1.46
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack/perl-Mojolicious-Plugin-AssetPack.changes 2017-06-29 15:05:11.481233422 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new/perl-Mojolicious-Plugin-AssetPack.changes 2017-10-03 23:17:40.671101518 +0200
@@ -1,0 +2,10 @@
+Thu Sep 28 05:45:27 UTC 2017 - coolo@suse.com
+
+- updated to 1.46
+ see /usr/share/doc/packages/perl-Mojolicious-Plugin-AssetPack/Changes
+
+ 1.46 2017-09-27T21:35:33+0200
+ - Add "asset_class" attribute to AssetPack::Store
+ - Add rollupjs pipe - https://rollupjs.org/
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-Plugin-AssetPack-1.45.tar.gz
New:
----
Mojolicious-Plugin-AssetPack-1.46.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious-Plugin-AssetPack.spec ++++++
--- /var/tmp/diff_new_pack.Nie0eJ/_old 2017-10-03 23:17:41.398999078 +0200
+++ /var/tmp/diff_new_pack.Nie0eJ/_new 2017-10-03 23:17:41.406997953 +0200
@@ -17,7 +17,7 @@
Name: perl-Mojolicious-Plugin-AssetPack
-Version: 1.45
+Version: 1.46
Release: 0
%define cpan_name Mojolicious-Plugin-AssetPack
Summary: Compress and convert css, less, sass, javascript and coffeescript files
++++++ Mojolicious-Plugin-AssetPack-1.45.tar.gz -> Mojolicious-Plugin-AssetPack-1.46.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/Changes new/Mojolicious-Plugin-AssetPack-1.46/Changes
--- old/Mojolicious-Plugin-AssetPack-1.45/Changes 2017-06-19 23:49:30.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/Changes 2017-09-27 21:35:33.000000000 +0200
@@ -1,5 +1,9 @@
Revision history for perl distribution Mojolicious-Plugin-AssetPack
+1.46 2017-09-27T21:35:33+0200
+ - Add "asset_class" attribute to AssetPack::Store
+ - Add rollupjs pipe - https://rollupjs.org/
+
1.45 2017-06-19T23:49:30+0200
- Add Developing guide
- Removed deprecated method end_range() from AssetPack::Asset
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/MANIFEST new/Mojolicious-Plugin-AssetPack-1.46/MANIFEST
--- old/Mojolicious-Plugin-AssetPack-1.45/MANIFEST 2017-06-19 23:49:31.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/MANIFEST 2017-09-27 21:35:34.000000000 +0200
@@ -4,6 +4,7 @@
Changes
cpanfile
examples/reloader.pl
+examples/rollup.pl
examples/sprites.pl
lib/Mojolicious/Plugin/AssetPack.pm
lib/Mojolicious/Plugin/AssetPack/Asset.pm
@@ -22,8 +23,10 @@
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/Sass.pm
lib/Mojolicious/Plugin/AssetPack/Pipe/typescript.js
lib/Mojolicious/Plugin/AssetPack/Pipe/TypeScript.pm
@@ -41,6 +44,9 @@
t/assets/image/master_favicon_thumbnail.png
t/assets/image/photo-1429734160945-4f85244d6a5a.jpg
t/assets/image/sample.png
+t/assets/js/export.js
+t/assets/js/some-lib.js
+t/assets/js/vue-app.js
t/assets/other/dummy.gif
t/assets/other/dummy.ico
t/assets/other/dummy.mp3
@@ -58,6 +64,7 @@
t/assets/sass/sass-2-dup.scss
t/assets/sass/sass-2-dup/_mixins.scss
t/assets/vue/example.vue
+t/assets/vue/Test.vue
t/base-url.t
t/bin/coffee
t/coffee.t
@@ -86,6 +93,7 @@
t/reloader.t
t/riotjs-not-loaded.t
t/riotjs.t
+t/rollup.t
t/route.t
t/sass-bin.t
t/sass-dynamic-include.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/META.json new/Mojolicious-Plugin-AssetPack-1.46/META.json
--- old/Mojolicious-Plugin-AssetPack-1.45/META.json 2017-06-19 23:49:31.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/META.json 2017-09-27 21:35:34.000000000 +0200
@@ -4,7 +4,7 @@
"Jan Henning Thorsen "
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005",
+ "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010",
"license" : [
"artistic_2"
],
@@ -48,6 +48,6 @@
"url" : "https://github.com/jhthorsen/mojolicious-plugin-assetpack.git"
}
},
- "version" : "1.45",
- "x_serialization_backend" : "JSON::PP version 2.27300_01"
+ "version" : "1.46",
+ "x_serialization_backend" : "JSON::PP version 2.27400_02"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/META.yml new/Mojolicious-Plugin-AssetPack-1.46/META.yml
--- old/Mojolicious-Plugin-AssetPack-1.45/META.yml 2017-06-19 23:49:31.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/META.yml 2017-09-27 21:35:34.000000000 +0200
@@ -7,7 +7,7 @@
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005'
+generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -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.45'
+version: '1.46'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/Makefile.PL new/Mojolicious-Plugin-AssetPack-1.46/Makefile.PL
--- old/Mojolicious-Plugin-AssetPack-1.45/Makefile.PL 2017-06-19 23:49:30.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/Makefile.PL 2017-09-27 21:35:33.000000000 +0200
@@ -6,7 +6,7 @@
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',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/README new/Mojolicious-Plugin-AssetPack-1.46/README
--- old/Mojolicious-Plugin-AssetPack-1.45/README 2017-06-19 23:49:30.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/README 2017-09-27 21:35:33.000000000 +0200
@@ -3,7 +3,7 @@
javascript and coffeescript files
VERSION
- 1.45
+ 1.46
SYNOPSIS
Application
@@ -152,7 +152,7 @@
$self = $self->process($definition_file);
Used to process assets. A $definition_file can be used to define $topic
- and @assets in a seperate file. See "Process assets" in
+ and @assets in a separate file. See "Process assets" in
Mojolicious::Plugin::AssetPack::Guides::Tutorial for more details.
$definition_file defaults to "assetpack.def".
@@ -190,7 +190,7 @@
that should bypass the proxy (if any proxy is detected). Default is to
bypass all requests to localhost.
- See "detect" in Mojo::UserAgent::Proxy for more infomation.
+ See "detect" in Mojo::UserAgent::Proxy for more information.
SEE ALSO
"GUIDES", Mojolicious::Plugin::AssetPack::Asset,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/examples/rollup.pl new/Mojolicious-Plugin-AssetPack-1.46/examples/rollup.pl
--- old/Mojolicious-Plugin-AssetPack-1.45/examples/rollup.pl 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/examples/rollup.pl 2017-09-27 17:24:09.000000000 +0200
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+die "Run $0 from ./mojolicious-plugin-assetpack/ root" unless -d 't/assets';
+use lib 'lib';
+use Mojolicious::Lite;
+
+plugin 'AssetPack' => {pipes => ['RollupJs']};
+app->asset->store->paths(['t/assets']);
+
+# Add Vuejs as dependencies
+push @{app->asset->pipe('RollupJs')->modules}, 'vue';
+unshift @{app->asset->pipe('RollupJs')->plugins}, 'rollup-plugin-vue';
+
+# Process js/vue-app.js
+app->asset->process('app.js' => 'js/vue-app.js');
+
+# Set up the mojo lite application and start it
+get '/' => 'index';
+app->start;
+
+__DATA__
+@@ index.html.ep
+<html>
+<head>
+<title>Test!</title>
+</head>
+<body>
+ <div id="app"><my-test x="42"></my-test></div>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.4/vue.min.js"></script>
+ %= asset 'app.js';
+</body>
+</html>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Guides/Cookbook.pod new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Guides/Cookbook.pod
--- old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Guides/Cookbook.pod 2017-06-19 23:18:28.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Guides/Cookbook.pod 2017-09-05 18:22:34.000000000 +0200
@@ -170,7 +170,7 @@
=head2 jQuery
-Lhttp://jquery.com can easily be included by refering to a CDN:
+Lhttp://jquery.com can easily be included by referring to a CDN:
$app->asset->process(
"app.js" => (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod
--- old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod 2017-06-19 23:18:28.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod 2017-09-05 18:22:34.000000000 +0200
@@ -226,7 +226,7 @@
=head2 Using assets
-Any processed asset can be accessed by refering to a topic.
+Any processed asset can be accessed by referring to a topic.
=head3 Template
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Pipe/Css.pm new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe/Css.pm
--- old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Pipe/Css.pm 2017-06-19 21:03:42.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe/Css.pm 2017-09-23 12:42:43.000000000 +0200
@@ -38,7 +38,7 @@
if LMojolicious::Plugin::AssetPack/minify is true and the asset is not
already minified.
-This module require the optional module LCSS::Minifier::XS to minify.
+This module requires the optional module LCSS::Minifier::XS to minify.
=head1 METHODS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Pipe/Riotjs.pm new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe/Riotjs.pm
--- old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Pipe/Riotjs.pm 2017-01-12 20:22:26.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe/Riotjs.pm 2017-09-23 14:31:33.000000000 +0200
@@ -3,14 +3,9 @@
use Mojo::File 'path';
use Mojolicious::Plugin::AssetPack::Util qw(diag $CWD DEBUG);
-use Cwd ();
-has _riotjs => sub {
- my $self = shift;
-
- return [$self->_find_app([qw(nodejs node)]), path(__FILE__)->dirname->child('riot.js'),
- ];
-};
+has _riotjs =>
+ sub { [shift->_find_app([qw(nodejs node)]), path(__FILE__)->dirname->child('riot.js')] };
sub process {
my ($self, $assets) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Pipe/Rollupjs.pm new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe/Rollupjs.pm
--- old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Pipe/Rollupjs.pm 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe/Rollupjs.pm 2017-09-27 21:34:18.000000000 +0200
@@ -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.45/lib/Mojolicious/Plugin/AssetPack/Pipe/require.js new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe/require.js
--- old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Pipe/require.js 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe/require.js 2017-09-27 21:34:18.000000000 +0200
@@ -0,0 +1,13 @@
+var modules = {};
+
+for (var i = 2; i < process.argv.length; i++) {
+ var name = process.argv[i];
+ try {
+ require(name);
+ modules[name] = "";
+ } catch (err) {
+ modules[name] = err.code;
+ }
+}
+
+console.log(JSON.stringify(modules));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Pipe.pm new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe.pm
--- old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Pipe.pm 2017-01-12 20:22:26.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe.pm 2017-09-27 21:34:18.000000000 +0200
@@ -1,11 +1,15 @@
package Mojolicious::Plugin::AssetPack::Pipe;
use Mojo::Base -base;
-use Mojo::File 'path';
-use Mojolicious::Plugin::AssetPack::Asset;
-use Mojolicious::Plugin::AssetPack::Util qw(diag has_ro DEBUG);
+
use File::Temp ();
use IPC::Run3 ();
use List::Util 'first';
+use Mojo::File 'path';
+use Mojo::JSON;
+use Mojolicious::Plugin::AssetPack::Asset;
+use Mojolicious::Plugin::AssetPack::Util qw(diag has_ro DEBUG);
+
+my $REQUIRE_JS = path(__FILE__)->dirname->child(qw(Pipe require.js));
$ENV{PATH} ||= '';
@@ -51,6 +55,19 @@
return '';
}
+sub _install_node_modules {
+ my $self = shift;
+
+ $self->run([$self->_find_app([qw(nodejs node)]), $REQUIRE_JS, @_], \undef, \my $status);
+ $status = Mojo::JSON::decode_json($status);
+
+ for my $plugin ('rollup', @{$self->modules}, @{$self->plugins}) {
+ next unless $status->{$plugin};
+ $self->app->log->warn("Installing $plugin... Please wait. (npm install $plugin)");
+ $self->run([npm => install => $plugin]);
+ }
+}
+
sub _install_gem { shift->_i('https://rubygems.org/pages/download') }
sub _install_node { shift->_i('https://nodejs.org/en/download') }
sub _install_ruby { shift->_i('https://ruby-lang.org/en/documentation/installation') }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Store.pm new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Store.pm
--- old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack/Store.pm 2017-06-19 23:11:19.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Store.pm 2017-09-23 12:42:43.000000000 +0200
@@ -10,6 +10,7 @@
use constant DB_FILE => $ENV{MOJO_ASSETPACK_DB_FILE} || 'assetpack.db';
our %DB_KEYS = map { $_ => 1 } qw(checksum format minified rel);
+has asset_class => 'Mojolicious::Plugin::AssetPack::Asset';
has default_headers => sub { +{"Cache-Control" => "max-age=31536000"} };
has _types => sub {
@@ -64,7 +65,7 @@
local $self->{paths} = [$path];
next unless $asset = $self->file($url);
my $attrs = $self->_db_get({key => 'original', url => $url}) || {url => $url};
- return Mojolicious::Plugin::AssetPack::Asset->new(%$attrs, content => $asset);
+ return $self->asset_class->new(%$attrs, content => $asset);
}
}
}
@@ -120,12 +121,11 @@
mkdir $dir if !-d $dir and -w $dir->dirname;
diag 'Save "%s" = %s', $path, -d $dir ? 1 : 0 if DEBUG;
- return Mojolicious::Plugin::AssetPack::Asset->new(%$attrs, content => $$ref)
- unless -w $dir;
+ return $self->asset_class->new(%$attrs, content => $$ref) unless -w $dir;
$path->spurt($$ref);
$self->_db_set(%$attrs);
- return Mojolicious::Plugin::AssetPack::Asset->new(%$attrs, path => $path);
+ return $self->asset_class->new(%$attrs, path => $path);
}
sub serve_asset {
@@ -215,8 +215,8 @@
$attrs->{format} ||= $tx->req->url->path->[-1] =~ /\.(\w+)$/ ? $1 : undef;
@$attrs{qw(key rel url)} = ('original', $rel, $url);
$self->_db_set(%$attrs);
- return Mojolicious::Plugin::AssetPack::Asset->new(%$attrs, path => $path) if $path;
- return Mojolicious::Plugin::AssetPack::Asset->new(%$attrs)->content($tx->res->body);
+ return $self->asset_class->new(%$attrs, path => $path) if $path;
+ return $self->asset_class->new(%$attrs)->content($tx->res->body);
}
sub _rel {
@@ -275,6 +275,13 @@
LMojolicious::Plugin::AssetPack::Store inherits all attributes from
LMojolicious::Static implements the following new ones.
+=head2 asset_class
+
+ $str = $self->asset_class;
+ $self = $self->asset_class("Mojolicious::Plugin::AssetPack::Asset");
+
+Holds the classname of which new assets will be constructed from.
+
=head2 default_headers
$hash_ref = $self->default_headers;
@@ -304,7 +311,7 @@
$asset = $self->asset($url, $paths);
-Retuns a LMojolicious::Plugin::AssetPack::Asset object or undef unless
+Returns a LMojolicious::Plugin::AssetPack::Asset object or undef unless
C<$url> can be found in C<$paths>. C<$paths> default to
LMojolicious::Static/paths. C<$paths> and C<$url> can be...
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack.pm new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack.pm
--- old/Mojolicious-Plugin-AssetPack-1.45/lib/Mojolicious/Plugin/AssetPack.pm 2017-06-19 23:49:30.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack.pm 2017-09-27 21:35:33.000000000 +0200
@@ -6,7 +6,7 @@
use Mojolicious::Plugin::AssetPack::Store;
use Mojolicious::Plugin::AssetPack::Util qw(diag has_ro load_module DEBUG);
-our $VERSION = '1.45';
+our $VERSION = '1.46';
my %TAG_TEMPLATE;
$TAG_TEMPLATE{css} = [qw(link rel stylesheet href)];
@@ -254,7 +254,7 @@
=head1 VERSION
-1.45
+1.46
=head1 SYNOPSIS
@@ -423,7 +423,7 @@
$self = $self->process($definition_file);
Used to process assets. A C<$definition_file> can be used to define C<$topic>
-and C<@assets> in a seperate file. See
+and C<@assets> in a separate file. See
L for more
details.
@@ -466,7 +466,7 @@
should bypass the proxy (if any proxy is detected). Default is to bypass all
requests to localhost.
-See LMojo::UserAgent::Proxy/detect for more infomation.
+See LMojo::UserAgent::Proxy/detect for more information.
=back
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/t/assets/js/export.js new/Mojolicious-Plugin-AssetPack-1.46/t/assets/js/export.js
--- old/Mojolicious-Plugin-AssetPack-1.45/t/assets/js/export.js 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/t/assets/js/export.js 2017-09-23 14:28:15.000000000 +0200
@@ -0,0 +1 @@
+export default 'hello world!';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/t/assets/js/some-lib.js new/Mojolicious-Plugin-AssetPack-1.46/t/assets/js/some-lib.js
--- old/Mojolicious-Plugin-AssetPack-1.45/t/assets/js/some-lib.js 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/t/assets/js/some-lib.js 2017-09-23 14:28:15.000000000 +0200
@@ -0,0 +1,4 @@
+import foo from './export.js';
+export default function () {
+ console.log(foo);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/t/assets/js/vue-app.js new/Mojolicious-Plugin-AssetPack-1.46/t/assets/js/vue-app.js
--- old/Mojolicious-Plugin-AssetPack-1.45/t/assets/js/vue-app.js 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/t/assets/js/vue-app.js 2017-09-27 21:16:26.000000000 +0200
@@ -0,0 +1,9 @@
+import Vue from 'vue'
+import Test from './../vue/Test.vue'
+
+new Vue({
+ el: '#app',
+ components: {
+ 'my-test': Test
+ }
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/t/assets/vue/Test.vue new/Mojolicious-Plugin-AssetPack-1.46/t/assets/vue/Test.vue
--- old/Mojolicious-Plugin-AssetPack-1.45/t/assets/vue/Test.vue 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/t/assets/vue/Test.vue 2017-09-27 17:24:09.000000000 +0200
@@ -0,0 +1,9 @@
+<template>
+ <div class="test">x={{x}}</div>
+</template>
+
+<script lang="babel">
+export default {
+ props: ["x"]
+}
+</script>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/t/css.t new/Mojolicious-Plugin-AssetPack-1.46/t/css.t
--- old/Mojolicious-Plugin-AssetPack-1.45/t/css.t 2017-06-19 21:42:41.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-1.46/t/css.t 2017-09-23 12:42:43.000000000 +0200
@@ -14,13 +14,24 @@
$t->get_ok($t->tx->res->dom->at('link')->{href})->status_is(200)->content_like(qr{aaa});
$ENV{MOJO_MODE} = 'Test_minify_from_here';
-my @assets = qw(d/css-1-one.css d/css-1-two.css d/css-1-already-min.css);
-my $url_checksum = checksum 'd/css-1-one.css';
+my @assets = qw(d/x.css d/y.css d/already-min.css);
+my $url_checksum = checksum 'd/x.css';
$t = t::Helper->t(pipes => [qw(Css Combine)]);
$t->app->asset->process('app.css' => @assets);
-my $file = $t->app->asset->store->file('cache/css-1-one-52be209045.min.css');
+my $file = $t->app->asset->store->file('cache/x-026c9c3a29.min.css');
isa_ok($file, 'Mojo::Asset::File');
+ok -e $file->path, 'cached file exists';
+
+Mojo::Util::monkey_patch('CSS::Minifier::XS', minify => sub { die 'Not cached!' });
+$t = t::Helper->t(pipes => [qw(Css Combine)]);
+$t->app->asset->process('app.css' => @assets);
+
+$t->app->routes->get('/inline' => 'inline');
+$t->get_ok('/inline')->status_is(200)
+ ->content_like(qr/\.one\{color.*\.two\{color.*.skipped\s\{/s);
+
+$t->app->asset->process('app.css' => @assets);
my $asset_checksum = checksum join ':',
map { checksum(data_section __PACKAGE__, $_) } @assets;
@@ -31,15 +42,6 @@
->header_is('Cache-Control', 'max-age=31536000')->header_is('Content-Type', 'text/css')
->content_like(qr/\.one\{color.*\.two\{color.*.skipped\s\{/s);
-Mojo::Util::monkey_patch('CSS::Minifier::XS', minify => sub { die 'Not cached!' });
-ok -e $file->path, 'cached file exists';
-$t = t::Helper->t(pipes => [qw(Css Combine)]);
-$t->app->asset->process('app.css' => @assets);
-
-$t->app->routes->get('/inline' => 'inline');
-$t->get_ok('/inline')->status_is(200)
- ->content_like(qr/\.one\{color.*\.two\{color.*.skipped\s\{/s);
-
done_testing;
__DATA__
@@ -52,9 +54,9 @@
# some comment
< css-0-one.css #some inline comment
< css-0-two.css # other comment
-@@ d/css-1-one.css
+@@ d/x.css
.one { color: #111; }
-@@ d/css-1-two.css
+@@ d/y.css
.two { color: #222; }
-@@ d/css-1-already-min.css
+@@ d/already-min.css
.skipped { color: #222; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.45/t/rollup.t new/Mojolicious-Plugin-AssetPack-1.46/t/rollup.t
--- old/Mojolicious-Plugin-AssetPack-1.45/t/rollup.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-1.46/t/rollup.t 2017-09-27 21:34:18.000000000 +0200
@@ -0,0 +1,35 @@
+use lib '.';
+use t::Helper;
+plan skip_all => 'TEST_ROLLUP=1' unless $ENV{TEST_ROLLUP} or -e '.test-everything';
+
+# Development mode
+my $t = t::Helper->t(pipes => [qw(RollupJs Combine)]);
+$t->app->asset->process('app.js' => 'js/some-lib.js');
+$t->get_ok('/')->status_is(200)
+ ->element_exists(qq(script[src="/asset/693887ef13/some-lib.js"]));
+$t->get_ok($t->tx->res->dom->at('script')->{src})->status_is(200)
+ ->content_like(qr{someLib\s=\sfunction});
+
+# Production mode
+$ENV{MOJO_MODE} = 'Test_minify_from_here';
+$t = t::Helper->t(pipes => [qw(RollupJs Combine)]);
+$t->app->asset->process('app.js' => 'js/some-lib.js');
+$t->get_ok('/')->status_is(200)
+ ->element_exists(qq(script[src="/asset/96b3f18ab2/app.js"]));
+$t->get_ok($t->tx->res->dom->at('script')->{src})->status_is(200)
+ ->content_like(qr{someLib=function});
+
+# With modules and plugins
+$t = t::Helper->t(pipes => [qw(RollupJs Combine)]);
+push @{$t->app->asset->pipe('RollupJs')->globals}, 'vue:Vue';
+push @{$t->app->asset->pipe('RollupJs')->plugins}, 'rollup-plugin-vue';
+$t->app->asset->process('app.js' => 'js/vue-app.js');
+$t->get_ok('/')->status_is(200);
+$t->get_ok($t->tx->res->dom->at('script')->{src})->status_is(200)
+ ->content_like(qr{\bVue\b});
+
+done_testing;
+
+__DATA__
+@@ index.html.ep
+%= asset 'app.js'