Data-JPack

 view release on metacpan or  search on metacpan

lib/Data/JPack.pm  view on Meta::CPAN

package Data::JPack;
use strict;
use warnings;
use feature ":all";

use CSS::Minifier::XS;
use JavaScript::Minifier::XS;

our $VERSION="v0.3.0";

use feature qw<say>;
no warnings "experimental";

use MIME::Base64;

lib/Data/JPack.pm  view on Meta::CPAN


# Returns the path of a file, in a next set ( or set provided)
sub next_file_name{
	my $self =shift;
  my $path =shift;

  #Check if the passed file dis defined. If so then we check if its seen or not
  if(defined $path){
    my $p=$self->[html_root_]."/".$self->[prefix_]."/".$path;
    if($seen{$p}){
      #use feature ":all";
      #sleep 1;
      return undef;
    }
    else {
      $seen{$p}=1;
    }
  }
  else {
    # Ass previous versions
  }

lib/Data/JPack/App.pm  view on Meta::CPAN

#                                                                                                            #
#   # put bootstrap into 0/0                                                                                 #
#   push @outputs, "app/jpack/boot/00000000000000000000000000000000/00000000000000000000000000000000.jpack"; #
#                                                                                                            #
#   map {($inputs[$_],$outputs[$_])} 0..$#inputs;                                                            #
# }                                                                                                          #
#                                                                                                            #
##############################################################################################################
# Javascript resources absolute paths. These file are are to be copied into target output
sub js_paths {
  #use feature ":all";
  grep !/pako/, <$share_dir/js/*>;
}


# Encode the source files for JPack App into the bootstrapping segment into a
# tempfile. Return the path to this temp file.
# This file contains the pako.js module as a chunk. Also prefixed with the
# chunkloader and worker pool contents
#
my $dir;

share/app.plt/index.plex.html  view on Meta::CPAN

@{[ init {
  use feature ":all";
  use Data::JPack::App;


  # BOOTSTAPPING OF A JPACK APP
  # 
  my %map=Data::JPack::App->_bootstrap;

  for(keys %map){
    $self->add_resource($_, output=>$map{$_});
    append_slot(head_start=>qq{<script src="@{[res $_]}"></script>});

t/01-container.t.dis  view on Meta::CPAN

use strict;
use warnings;
use feature ":all";
#use Test::More;



use Data::JPack::Container;
my $container=Data::JPack::Container->new();

say $container->build;

t/01-encode.t.dis  view on Meta::CPAN

use strict;
use warnings;
use feature ":all";
#use Test::More;




use Data::JPack;

#say jpack_encode_file "pako/dist/pako.js"; 

my $jpack=Data::JPack->new;

t/01-file-db.t  view on Meta::CPAN

use strict;
use warnings;

use feature ":all";
use Data::JPack;
use Test::More;

use File::Path qw<make_path remove_tree>;
use File::Basename qw<dirname basename>;

# Test file db structures
my $html_container="_data/index.html";
my $html_root=dirname $html_container;

t/01-js.t  view on Meta::CPAN

use Test::More;
use feature ":all";

use Data::JPack;

say STDERR "JS REsources are ", "@{[Data::JPack::js_paths]}";

say STDERR "JS REsources are ", "@{[Data::JPack::resource_map]}";

ok 1;

done_testing;

t/02-process.t.dis  view on Meta::CPAN

#!/usr/bin/perl
use strict;
use warnings;
use feature ":all";
use AnyEvent;
use AnyEvent::AIO;
use Promise::XS;

use Data::Base64;

#open my $outFile,">", "base64.test";
say "#Creating  service";
my $service=Data::Base64::new;
Data::Base64::open $service, "base64.test";

t/02-unpack.t.dis  view on Meta::CPAN

use strict;
use warnings;
use feature ":all";
use Data::JPack qw<jpack_decode_file>;

my $data=jpack_decode_file @ARGV;
while($data){
say unpack "H*", substr $data, 0, 16,"";
}



( run in 0.949 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )