├── docs ├── CNAME ├── code.gif ├── _config.yml ├── allow-file-access.md ├── assets │ └── css │ │ └── style.scss ├── _layouts │ └── default.html └── index.md ├── examples ├── common │ ├── es6 │ │ └── index │ │ │ ├── main.js │ │ │ ├── folder │ │ │ └── index.js │ │ │ └── hello.html │ └── es5 │ │ └── index │ │ ├── main.js │ │ ├── folder │ │ └── index.js │ │ └── hello.html ├── lodash │ ├── es5 │ │ ├── hello │ │ │ ├── hello.json │ │ │ ├── hello.tpl │ │ │ ├── hello.js │ │ │ └── hello.html │ │ └── x-module │ │ │ └── hello.html │ └── es6 │ │ ├── hello │ │ ├── hello.json │ │ ├── hello.tpl │ │ ├── hello.js │ │ └── hello.html │ │ └── x-module │ │ └── hello.html ├── angular │ ├── es5 │ │ ├── hello │ │ │ ├── app │ │ │ │ ├── app.component.html │ │ │ │ ├── app.component.js │ │ │ │ └── app.module.js │ │ │ ├── main.js │ │ │ └── hello.html │ │ └── x-module │ │ │ └── hello.html │ ├── es6 │ │ ├── hello │ │ │ ├── app │ │ │ │ ├── app.component.html │ │ │ │ ├── app.component.js │ │ │ │ └── app.module.js │ │ │ ├── main.js │ │ │ └── hello.html │ │ └── x-module │ │ │ └── hello.html │ └── ts │ │ ├── hello │ │ ├── app │ │ │ ├── app.component.html │ │ │ ├── app.component.ts │ │ │ └── app.module.ts │ │ ├── main.ts │ │ └── hello.html │ │ ├── x-module │ │ └── hello.html │ │ └── realworld │ │ ├── local.html │ │ └── github.html ├── handlebars │ └── es5 │ │ ├── hello │ │ ├── hello.hbs │ │ ├── hello.json │ │ ├── hello.js │ │ └── hello.html │ │ └── x-module │ │ └── hello.html ├── aurelia │ └── es5 │ │ ├── hello │ │ ├── src │ │ │ ├── app.html │ │ │ ├── app.js │ │ │ └── main.js │ │ └── hello.html │ │ └── x-module │ │ └── hello.html ├── vue │ ├── es6 │ │ ├── hello │ │ │ ├── main.js │ │ │ ├── hello.html │ │ │ └── app.vue │ │ ├── sfc-class │ │ │ ├── main.js │ │ │ ├── hello.html │ │ │ └── app.vue │ │ └── x-module │ │ │ └── hello.html │ ├── ts │ │ ├── hello │ │ │ ├── main.ts │ │ │ ├── hello.html │ │ │ └── app.vue │ │ ├── sfc-class │ │ │ ├── main.ts │ │ │ ├── hello.html │ │ │ └── app.vue │ │ └── x-module │ │ │ └── hello.html │ └── es5 │ │ ├── hello │ │ ├── main.js │ │ ├── hello.html │ │ └── app.vue │ │ └── x-module │ │ └── hello.html ├── jquery │ ├── es6 │ │ └── hello.html │ └── es5 │ │ └── hello.html ├── react │ └── es6 │ │ └── hello.html ├── inferno │ └── es6 │ │ └── hello.html ├── ember │ └── es5 │ │ └── hello.html └── angular-1 │ └── es5 │ └── hello.html ├── .gitignore ├── plugins ├── js.js ├── text.js ├── json.js ├── handlebars.js ├── babel.js ├── index.js ├── cached.js ├── roots.js ├── preload.js ├── package.js ├── files.js ├── typescript.js ├── scan.js ├── x-modules.js ├── vue.js └── cdnjs.js ├── config ├── zone.js ├── angular-1.js ├── vue.js ├── activewidgets.js ├── core.js ├── ember.js ├── lodash.js ├── rxjs.js ├── angular.js └── aurelia.js ├── test ├── e2e │ ├── basics.js │ └── realworld.js └── wdio.local.js ├── src ├── browsersync.js ├── idb.js ├── libs.js ├── config.js ├── min.js └── worker.js ├── LICENSE ├── gulpfile.js ├── package.json └── README.md /docs/CNAME: -------------------------------------------------------------------------------- 1 | getlibs.com -------------------------------------------------------------------------------- /examples/common/es6/index/main.js: -------------------------------------------------------------------------------- 1 | 2 | import './folder'; 3 | -------------------------------------------------------------------------------- /examples/common/es5/index/main.js: -------------------------------------------------------------------------------- 1 | 2 | require('./folder'); 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules 3 | /screenshots 4 | /server.js 5 | -------------------------------------------------------------------------------- /examples/lodash/es5/hello/hello.json: -------------------------------------------------------------------------------- 1 | { 2 | "msg": "Hello World!" 3 | } -------------------------------------------------------------------------------- /examples/lodash/es6/hello/hello.json: -------------------------------------------------------------------------------- 1 | { 2 | "msg": "Hello World!" 3 | } -------------------------------------------------------------------------------- /examples/angular/es5/hello/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |

{{msg}}

3 | -------------------------------------------------------------------------------- /examples/angular/es6/hello/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |

{{msg}}

3 | -------------------------------------------------------------------------------- /examples/angular/ts/hello/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |

{{msg}}

3 | -------------------------------------------------------------------------------- /examples/handlebars/es5/hello/hello.hbs: -------------------------------------------------------------------------------- 1 |

2 | {{msg}} 3 |

4 | -------------------------------------------------------------------------------- /docs/code.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/activewidgets/getlibs/HEAD/docs/code.gif -------------------------------------------------------------------------------- /examples/handlebars/es5/hello/hello.json: -------------------------------------------------------------------------------- 1 | { 2 | "msg": "Hello World!" 3 | } 4 | -------------------------------------------------------------------------------- /examples/lodash/es5/hello/hello.tpl: -------------------------------------------------------------------------------- 1 | 2 |

3 | <%= msg %> 4 |

5 | -------------------------------------------------------------------------------- /examples/lodash/es6/hello/hello.tpl: -------------------------------------------------------------------------------- 1 | 2 |

3 | <%= msg %> 4 |

5 | -------------------------------------------------------------------------------- /plugins/js.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/plugins/js', [], function(){ 3 | return {}; 4 | }); -------------------------------------------------------------------------------- /examples/aurelia/es5/hello/src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /config/zone.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | map: { 5 | 'zone.js/dist/zone': 'zone.js' 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /examples/aurelia/es5/hello/src/app.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = function(){ 3 | this.msg = 'Hello World!'; 4 | }; 5 | -------------------------------------------------------------------------------- /examples/common/es6/index/folder/index.js: -------------------------------------------------------------------------------- 1 | 2 | import $ from 'jquery'; 3 | $('#app').html('

Hello World!

'); 4 | -------------------------------------------------------------------------------- /config/angular-1.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | packages: { 5 | 'angular': {exports: 'angular'} 6 | } 7 | 8 | }); 9 | -------------------------------------------------------------------------------- /examples/common/es5/index/folder/index.js: -------------------------------------------------------------------------------- 1 | 2 | var $ = require('jquery'); 3 | $('#app').html('

Hello World!

'); 4 | -------------------------------------------------------------------------------- /examples/vue/es6/hello/main.js: -------------------------------------------------------------------------------- 1 | 2 | import Vue from 'vue'; 3 | import app from './app.vue'; 4 | 5 | new Vue(app).$mount('#app'); 6 | -------------------------------------------------------------------------------- /examples/vue/ts/hello/main.ts: -------------------------------------------------------------------------------- 1 | 2 | import Vue from 'vue'; 3 | import app from './app.vue'; 4 | 5 | new Vue(app).$mount('#app'); 6 | -------------------------------------------------------------------------------- /examples/vue/ts/sfc-class/main.ts: -------------------------------------------------------------------------------- 1 | 2 | import Vue from 'vue'; 3 | import App from './app.vue'; 4 | 5 | new App().$mount('#app'); 6 | -------------------------------------------------------------------------------- /examples/vue/es5/hello/main.js: -------------------------------------------------------------------------------- 1 | 2 | var Vue = require('vue'), 3 | app = require('./app.vue'); 4 | 5 | new Vue(app).$mount('#app'); 6 | -------------------------------------------------------------------------------- /examples/vue/es6/sfc-class/main.js: -------------------------------------------------------------------------------- 1 | 2 | import Vue from 'vue'; 3 | import App from './app.vue'; 4 | 5 | new App().$mount('#app'); 6 | -------------------------------------------------------------------------------- /config/vue.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | map: { 5 | 'vue-class-component': 'vue-class-component/dist/vue-class-component.min.js' 6 | } 7 | }); 8 | 9 | -------------------------------------------------------------------------------- /plugins/text.js: -------------------------------------------------------------------------------- 1 | 2 | define('text', [], function(){ 3 | return { 4 | instantiate: function(load) { 5 | return load.source; 6 | } 7 | }; 8 | }); 9 | -------------------------------------------------------------------------------- /plugins/json.js: -------------------------------------------------------------------------------- 1 | 2 | define('json', [], function(){ 3 | return { 4 | instantiate: function(load) { 5 | return JSON.parse(load.source); 6 | } 7 | }; 8 | }); 9 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | title: unpkg.com/getlibs 3 | description: Modern javascript. All front-end libraries. No server/build. 4 | google_analytics: UA-35823479-2 5 | -------------------------------------------------------------------------------- /examples/handlebars/es5/hello/hello.js: -------------------------------------------------------------------------------- 1 | 2 | var data = require('./hello.json'), 3 | template = require('./hello.hbs'), 4 | $ = require('jquery'); 5 | 6 | $('#app').html(template(data)); -------------------------------------------------------------------------------- /config/activewidgets.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | packages: { 5 | 'activewidgets': {main: 'dist/ax.js'} 6 | }, 7 | 8 | map: { 9 | 'activewidgets': 'https://cdn.activewidgets.com/' 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /examples/angular/es6/hello/main.js: -------------------------------------------------------------------------------- 1 | 2 | import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; 3 | import {AppModule} from 'app/app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /examples/angular/ts/hello/main.ts: -------------------------------------------------------------------------------- 1 | 2 | import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; 3 | import {AppModule} from 'app/app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /examples/angular/es5/hello/main.js: -------------------------------------------------------------------------------- 1 | 2 | var platformBrowserDynamic = require('@angular/platform-browser-dynamic').platformBrowserDynamic, 3 | AppModule = require('app/app.module').AppModule; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /config/core.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | packages: { 5 | 6 | 'core-js': {main: 'core.min.js', meta: { 7 | 'core.min.js': {loader: 'cdn'}, 8 | 'core.js': {loader: 'cdn'}, 9 | '*': {loader: 'pkg'} 10 | }} 11 | } 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /examples/lodash/es5/hello/hello.js: -------------------------------------------------------------------------------- 1 | 2 | var compile = require('lodash/template'), 3 | template = require('./hello.tpl'), 4 | data = require('./hello.json'), 5 | render = compile(template); 6 | 7 | document.getElementById('app').innerHTML = render(data); 8 | -------------------------------------------------------------------------------- /examples/lodash/es6/hello/hello.js: -------------------------------------------------------------------------------- 1 | 2 | import compile from 'lodash/template'; 3 | import template from './hello.tpl'; 4 | import data from './hello.json'; 5 | 6 | let render = compile(template); 7 | 8 | document.getElementById('app').innerHTML = render(data); 9 | -------------------------------------------------------------------------------- /examples/angular/ts/hello/app/app.component.ts: -------------------------------------------------------------------------------- 1 | 2 | import {Component} from '@angular/core'; 3 | 4 | @Component({ 5 | selector: '#app', 6 | templateUrl: './app.component.html' 7 | }) 8 | 9 | export class AppComponent { 10 | msg = 'Hello World!'; 11 | } 12 | -------------------------------------------------------------------------------- /config/ember.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | packages: { 5 | 'ember-source': {main: 'dist/ember.min.js', meta: {'*.js': {format: 'global', deps: ['jquery', './ember-template-compiler']}}} 6 | }, 7 | 8 | map: { 9 | 'ember': 'ember-source' 10 | } 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /config/lodash.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | packages: { 5 | 6 | 'lodash': {main: 'lodash.min.js', defaultExtension: 'js', meta: { 7 | 'lodash.min.js': {loader: 'cdn'}, 8 | 'lodash.js': {loader: 'cdn'}, 9 | '*': {loader: 'pkg/*'} 10 | }} 11 | } 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /examples/angular/es5/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /examples/angular/es6/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /examples/angular/ts/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /examples/aurelia/es5/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/vue/ts/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/aurelia/es5/hello/src/main.js: -------------------------------------------------------------------------------- 1 | 2 | function configure(aurelia){ 3 | aurelia.use.basicConfiguration(); 4 | aurelia.start().then(function(){ 5 | aurelia.setRoot('src/app', document.getElementById('app')); 6 | }); 7 | }; 8 | 9 | require('aurelia-bootstrapper').bootstrap(configure); 10 | -------------------------------------------------------------------------------- /examples/common/es5/index/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/common/es6/index/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/lodash/es5/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/lodash/es6/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/vue/es5/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/vue/es6/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/vue/es6/sfc-class/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/vue/ts/sfc-class/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/handlebars/es5/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/vue/es5/hello/app.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 20 | -------------------------------------------------------------------------------- /test/e2e/basics.js: -------------------------------------------------------------------------------- 1 | 2 | var glob = require('glob'); 3 | 4 | describe('hello world', function(){ 5 | 6 | glob.sync('**/hello.html').forEach(function(name){ 7 | 8 | it(name, function(){ 9 | browser.url(localhost + name); 10 | browser.waitForExist('#app=Hello World!'); 11 | }); 12 | }); 13 | }); -------------------------------------------------------------------------------- /examples/angular/es6/hello/app/app.component.js: -------------------------------------------------------------------------------- 1 | 2 | import {Component} from '@angular/core'; 3 | 4 | export class AppComponent { 5 | constructor(){ 6 | this.msg = 'Hello World!'; 7 | } 8 | } 9 | 10 | AppComponent.annotations = [new Component({ 11 | selector: '#app', 12 | templateUrl: './app.component.html' 13 | })]; 14 | -------------------------------------------------------------------------------- /examples/angular/es5/hello/app/app.component.js: -------------------------------------------------------------------------------- 1 | 2 | var Component = require('@angular/core').Component; 3 | 4 | function AppComponent(){ 5 | this.msg = 'Hello World!'; 6 | } 7 | 8 | AppComponent.annotations = [new Component({ 9 | selector: '#app', 10 | templateUrl: './app.component.html' 11 | })]; 12 | 13 | exports.AppComponent = AppComponent; -------------------------------------------------------------------------------- /examples/jquery/es6/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/vue/es6/hello/app.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 20 | 21 | -------------------------------------------------------------------------------- /examples/vue/es6/sfc-class/app.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | -------------------------------------------------------------------------------- /examples/vue/ts/hello/app.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 20 | 21 | -------------------------------------------------------------------------------- /examples/jquery/es5/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/angular/ts/hello/app/app.module.ts: -------------------------------------------------------------------------------- 1 | 2 | import {NgModule} from '@angular/core'; 3 | import {BrowserModule} from '@angular/platform-browser'; 4 | import {AppComponent} from './app.component'; 5 | 6 | @NgModule({ 7 | imports: [BrowserModule], 8 | declarations: [AppComponent], 9 | bootstrap: [AppComponent] 10 | }) 11 | 12 | export class AppModule{} 13 | -------------------------------------------------------------------------------- /examples/angular/es6/hello/app/app.module.js: -------------------------------------------------------------------------------- 1 | 2 | import {NgModule} from '@angular/core'; 3 | import {BrowserModule} from '@angular/platform-browser'; 4 | import {AppComponent} from './app.component'; 5 | 6 | 7 | export class AppModule{} 8 | 9 | AppModule.annotations = [new NgModule({ 10 | imports: [BrowserModule], 11 | declarations: [AppComponent], 12 | bootstrap: [AppComponent] 13 | })]; 14 | -------------------------------------------------------------------------------- /docs/allow-file-access.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Allow file access 3 | --- 4 | 5 | ## Running from filesystem 6 | 7 | You will get cross origin errors if you open the examples in chrome directly from the filesystem. To allow file access in chrome lauch it with `--allow-file-access-from-files` flag ([more info](https://stackoverflow.com/questions/18586921/how-to-launch-html-using-chrome-at-allow-file-access-from-files-mode)). 8 | 9 | -------------------------------------------------------------------------------- /plugins/handlebars.js: -------------------------------------------------------------------------------- 1 | 2 | define('hbs', ['handlebars'], function(Handlebars){ 3 | 4 | function translate(load){ 5 | 6 | var precompiled = Handlebars.precompile(load.source), 7 | output = 'var Handlebars = require("handlebars"); \n module.exports = Handlebars.template(' + precompiled +');'; 8 | 9 | load.source = output; 10 | return output; 11 | } 12 | 13 | return { 14 | translate: translate 15 | }; 16 | }); 17 | -------------------------------------------------------------------------------- /examples/vue/ts/sfc-class/app.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 21 | 22 | -------------------------------------------------------------------------------- /examples/angular/es5/hello/app/app.module.js: -------------------------------------------------------------------------------- 1 | 2 | var NgModule = require('@angular/core').NgModule, 3 | BrowserModule = require('@angular/platform-browser').BrowserModule, 4 | AppComponent = require('./app.component').AppComponent; 5 | 6 | 7 | function AppModule(){} 8 | 9 | AppModule.annotations = [new NgModule({ 10 | imports: [BrowserModule], 11 | declarations: [AppComponent], 12 | bootstrap: [AppComponent] 13 | })]; 14 | 15 | exports.AppModule = AppModule; -------------------------------------------------------------------------------- /examples/react/es6/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/e2e/realworld.js: -------------------------------------------------------------------------------- 1 | 2 | var glob = require('glob'); 3 | 4 | glob.sync('./examples/**/realworl*/local.html').forEach(function(name){ 5 | 6 | describe(name, function(){ 7 | 8 | it('has banner', function(){ 9 | browser.url(localhost + name); 10 | browser.waitForExist('h1=conduit'); 11 | }); 12 | 13 | it('shows sign up page', function(){ 14 | browser.click('layout-header a[routerlink="/register"]'); 15 | browser.waitForExist('h1=Sign up'); 16 | }); 17 | }); 18 | }); -------------------------------------------------------------------------------- /examples/vue/es6/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /config/rxjs.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | packages: { 5 | 6 | 'rxjs': {main: 'Rx.min.js', meta: { 7 | 'observable/*': {loader: 'pkg/Observable'}, 8 | 'operator/*': {loader: 'pkg/Observable.prototype'}, 9 | 'Rx.min.js': {loader: 'cdn'}, 10 | 'Rx.js': {loader: 'cdn'}, 11 | '*': {loader: 'pkg'} 12 | }} 13 | }, 14 | 15 | map: { 16 | 'rxjs': '@reactivex/rxjs', 17 | 'rxjs/Rx': '@reactivex/rxjs', 18 | '@reactivex/rxjs': '@reactivex/rxjs' 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /examples/vue/es5/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/lodash/es5/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/vue/ts/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/lodash/es6/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/assets/css/style.scss: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | @import "{{ site.theme }}"; 5 | 6 | .page-header { 7 | color: #fff; 8 | text-align: center; 9 | background-color: #333; 10 | background-image: linear-gradient(120deg, #555, #111); 11 | } 12 | 13 | .main-content h1, 14 | .main-content h2, 15 | .main-content h3, 16 | .main-content h4, 17 | .main-content h5, 18 | .main-content h6 { 19 | margin-top: 2rem; 20 | margin-bottom: 1rem; 21 | font-weight: bold; 22 | color: #666; 23 | } 24 | -------------------------------------------------------------------------------- /examples/inferno/es6/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /examples/ember/es5/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 12 | 13 | 26 | 27 | -------------------------------------------------------------------------------- /examples/angular-1/es5/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Loading.. 9 | 10 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/handlebars/es5/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 12 | 13 | 18 | 19 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /config/angular.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | packages: { 5 | '@angular/core': {main: 'bundles/core.umd.min.js', meta: {'*.js': {deps: ['core-js', 'zone.js', 'rxjs']}}}, 6 | '@angular/common': {main: 'bundles/common.umd.min.js'}, 7 | '@angular/compiler': {main: 'bundles/compiler.umd.min.js'}, 8 | '@angular/platform-browser': {main: 'bundles/platform-browser.umd.min.js'}, 9 | '@angular/platform-browser-dynamic': {main: 'bundles/platform-browser-dynamic.umd.min.js'}, 10 | '@angular/forms': {main: 'bundles/forms.umd.min.js'}, 11 | '@angular/http': {main: 'bundles/http.umd.min.js'}, 12 | '@angular/router': {main: 'bundles/router.umd.min.js'} 13 | } 14 | 15 | }); 16 | -------------------------------------------------------------------------------- /examples/aurelia/es5/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 14 | 15 | 22 | 23 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /plugins/babel.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/plugins/babel', ['../src/worker'], function(WebWorker){ 3 | 4 | function transpiler(){ 5 | 6 | self.translate = function(address, source, options) { 7 | 8 | options.ast = false; 9 | options.filename = address; 10 | options.sourceFileName = address; 11 | 12 | /* global Babel */ 13 | return Babel.transform(source, options); 14 | }; 15 | } 16 | 17 | 18 | var worker = new WebWorker(['babel-standalone', transpiler]), 19 | options = SystemJS.babelOptions; 20 | 21 | 22 | function translate(load){ 23 | return worker.call('translate', load.address, load.source, options).then(function(result){ 24 | load.metadata.sourceMap = result.map; 25 | return result.code; 26 | }); 27 | } 28 | 29 | 30 | return { 31 | translate: translate 32 | }; 33 | }); -------------------------------------------------------------------------------- /plugins/index.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/plugins/index', [], function(){ 3 | 4 | function fetch(load, fallback){ 5 | 6 | function retry(err){ 7 | 8 | if (String(err.message).indexOf('No access to files') == 0){ 9 | throw err; 10 | } 11 | 12 | var address = load.address, 13 | index = address.replace(/\.(ts|js)$/, '/index.$1'), 14 | ext = RegExp.$1, 15 | path = JSON.stringify(index), 16 | source = (ext == 'ts') ? 17 | 'export * from ' + path : 18 | 'module.exports = require(' + path + ')'; 19 | 20 | if (address.match(/\.(ts|js)$/) && !address.match(/index\.(ts|js)$/)){ 21 | return source; 22 | } 23 | 24 | throw err; 25 | } 26 | 27 | 28 | return Promise.resolve(fallback(load)).catch(retry); 29 | } 30 | 31 | 32 | return { 33 | fetch: fetch 34 | }; 35 | }); 36 | 37 | -------------------------------------------------------------------------------- /examples/angular/ts/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /plugins/cached.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/plugins/cached', ['../src/idb'], function(db){ 3 | 4 | function wrap(load, translate){ 5 | 6 | var loader = this, 7 | source = load.source, 8 | address = load.address; 9 | 10 | 11 | function save(result){ 12 | 13 | var item = { 14 | input: source, 15 | result: result, 16 | sourceMap: load.metadata.sourceMap 17 | }; 18 | 19 | return db.set(address, item).then(function(){ 20 | return result; 21 | }); 22 | } 23 | 24 | 25 | function compare(item){ 26 | 27 | if (item && item.input == source){ 28 | load.metadata.sourceMap = item.sourceMap; 29 | return item.result; 30 | } 31 | 32 | return translate.call(loader, load).then(save); 33 | } 34 | 35 | 36 | return db.get(address).then(compare); 37 | } 38 | 39 | return { 40 | wrap: wrap 41 | }; 42 | }); 43 | -------------------------------------------------------------------------------- /examples/angular/ts/realworld/local.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Conduit 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Loading... 15 | 16 | 17 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/browsersync.js: -------------------------------------------------------------------------------- 1 | 2 | (function(){ 3 | 4 | function reload(e){ 5 | 6 | if (e.event != 'change' || e.type != 'inject'){ 7 | return; 8 | } 9 | 10 | var i, address, path = e.path.replace(/\\/g, '/'); 11 | 12 | for (;;) { 13 | 14 | address = location.protocol + '//' + location.host + '/' + path; 15 | 16 | if (System.has(address)){ 17 | return System.reload(address); 18 | } 19 | 20 | i = path.indexOf('/'); 21 | 22 | if (i == -1){ 23 | return; 24 | } 25 | 26 | path = path.substr(i+1); 27 | } 28 | } 29 | 30 | var initialized; 31 | 32 | document.addEventListener('load', function(){ 33 | 34 | if (initialized || !window.___browserSync___){ 35 | return; 36 | } 37 | 38 | System.import('https://unpkg.com/systemjs-hmr').then(function(){ 39 | window.___browserSync___.socket.on('file:reload', reload); 40 | }); 41 | 42 | }, true); 43 | 44 | })(); -------------------------------------------------------------------------------- /examples/angular/es6/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /plugins/roots.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/plugins/roots', [], function(){ 3 | 4 | var roots = ['https://unpkg.com/', 'https://cdnjs.cloudflare.com/']; 5 | 6 | function defineRoots(url){ 7 | 8 | var i, root; 9 | 10 | for(i=0; i 2 | 3 | 4 | 5 | Conduit 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Loading from github source, this may take some time ... 15 | 16 | 17 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/angular/es5/x-module/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Loading..
8 | 9 | 39 | 40 | -------------------------------------------------------------------------------- /test/wdio.local.js: -------------------------------------------------------------------------------- 1 | exports.config = { 2 | 3 | // 4 | // this config requires running chromedriver on port 9515 5 | // 6 | 7 | port: 9515, 8 | path: '/', 9 | specs: ['./test/e2e/**/*.js'], 10 | exclude: [], 11 | maxInstances: 10, 12 | 13 | capabilities: [{ 14 | maxInstances: 1, 15 | browserName: 'chrome' 16 | }], 17 | 18 | sync: true, 19 | logLevel: 'silent', 20 | coloredLogs: true, 21 | bail: 5, 22 | baseUrl: 'http://localhost', 23 | waitforTimeout: 10000, 24 | connectionRetryTimeout: 90000, 25 | connectionRetryCount: 3, 26 | services: ['static-server'], 27 | 28 | staticServerPort: 4567, 29 | staticServerFolders: [ 30 | { mount: '/node_modules', path: './node_modules' }, 31 | { mount: '/examples', path: './examples' }, 32 | { mount: '/src', path: './dist' } 33 | ], 34 | 35 | framework: 'mocha', 36 | reporters: ['spec'], 37 | mochaOpts: {ui: 'bdd', timeout: 20000}, 38 | 39 | before: function (capabilities, specs) { 40 | global.localhost = 'http://localhost:4567/'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /config/aurelia.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | bundles: { 5 | 'aurelia-core': [ 6 | 'aurelia-binding', 7 | 'aurelia-bootstrapper', 8 | 'aurelia-dependency-injection', 9 | 'aurelia-event-aggregator', 10 | 'aurelia-framework', 11 | 'aurelia-loader', 12 | 'aurelia-loader-default', 13 | 'aurelia-logging', 14 | 'aurelia-logging-console', 15 | 'aurelia-metadata', 16 | 'aurelia-pal', 17 | 'aurelia-pal-browser', 18 | 'aurelia-path', 19 | 'aurelia-polyfills', 20 | 'aurelia-task-queue', 21 | 'aurelia-templating', 22 | 'aurelia-templating-binding', 23 | 'aurelia-templating-resources' 24 | ], 25 | 26 | 'aurelia-routing': [ 27 | 'aurelia-history', 28 | 'aurelia-history-browser', 29 | 'aurelia-route-recognizer', 30 | 'aurelia-router', 31 | 'aurelia-templating-router' 32 | ] 33 | }, 34 | 35 | map: { 36 | 'aurelia-core': 'https://rawgit.com/aurelia/aurelia/master/scripts/aurelia-core.min.js', 37 | 'aurelia-routing': 'https://rawgit.com/aurelia/aurelia/master/scripts/aurelia-routing.min.js' 38 | } 39 | }); 40 | 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 ActiveWidgets 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /plugins/preload.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/plugins/preload', [], function(){ 3 | 4 | var map = System.preload.map; 5 | 6 | var defer = function(fn){ 7 | var channel = new MessageChannel(); 8 | channel.port1.onmessage = fn; 9 | channel.port2.postMessage(0); 10 | }; 11 | 12 | if (!window.MessageChannel){ 13 | defer = setTimeout; 14 | } 15 | 16 | function timeout(value){ 17 | return new Promise(function(resolve){ 18 | defer(function(){ 19 | resolve(value); 20 | }, 0); 21 | }); 22 | } 23 | 24 | 25 | function fetch(load, defaultFetch){ 26 | 27 | var prev = map[load.address], 28 | result = defaultFetch(load); 29 | 30 | if (!prev) { 31 | return result; 32 | } 33 | 34 | return System.import(prev).then(timeout).then(function(){ 35 | return result; 36 | }); 37 | } 38 | 39 | 40 | return { 41 | fetch: fetch 42 | }; 43 | }); 44 | 45 | 46 | System.preload = function(items){ 47 | 48 | var i, prev, item, map = System.preload.map; 49 | 50 | for(i=0; i2; --i){ 15 | name = parts.slice(0, i).join('/'); 16 | if (name in packages){ 17 | return name; 18 | } 19 | } 20 | } 21 | 22 | 23 | function property(address, loadAddress){ 24 | 25 | return function(value){ 26 | 27 | var path = address.replace(/^.*\//, ''); 28 | 29 | if (path == '@@'){ 30 | return value; 31 | } 32 | 33 | if (path == '*'){ 34 | path = loadAddress.replace(/^.+\/(\w+)\.js$/, '$1'); 35 | } 36 | 37 | path && path.split('.').forEach(function(name){ 38 | value = value[name]; 39 | }); 40 | 41 | return value; 42 | }; 43 | } 44 | 45 | function instantiate(plugin){ 46 | return { 47 | fetch: fetch, 48 | instantiate: function(load){ 49 | return System.import(package(load.address)).then(property(plugin.address, load.address)); 50 | } 51 | }; 52 | } 53 | 54 | return { 55 | fetch: fetch, 56 | instantiate: instantiate 57 | } 58 | }); 59 | -------------------------------------------------------------------------------- /src/idb.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/src/idb', [], function(){ 3 | 4 | var store = 'cache'; 5 | 6 | var init = new Promise(function(resolve, reject){ 7 | 8 | var request = indexedDB.open('getlibs', 1); 9 | 10 | request.onupgradeneeded = function(){ 11 | request.result.createObjectStore(store); 12 | }; 13 | 14 | request.onsuccess = function(){ 15 | resolve(request.result); 16 | }; 17 | 18 | request.onerror = function(){ 19 | reject(request.error); 20 | }; 21 | }); 22 | 23 | 24 | function wrap(callback){ 25 | return init.then(function(db){ 26 | return new Promise(function(resolve, reject){ 27 | 28 | var request = callback(db); 29 | 30 | request.transaction.oncomplete = function(){ 31 | resolve(request.result); 32 | }; 33 | 34 | request.transaction.onerror = function() { 35 | reject(request.error); 36 | }; 37 | }); 38 | }); 39 | } 40 | 41 | 42 | function getItem(key){ 43 | return wrap(function(db){ 44 | return db.transaction(store).objectStore(store).get(key); 45 | }); 46 | } 47 | 48 | 49 | function setItem(key, value){ 50 | return wrap(function(db){ 51 | return db.transaction(store, 'readwrite').objectStore(store).put(value, key); 52 | }); 53 | } 54 | 55 | return { 56 | 'get': getItem, 57 | 'set': setItem 58 | }; 59 | }); 60 | -------------------------------------------------------------------------------- /plugins/files.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/plugins/files', [], function(){ 3 | 4 | 5 | function fileAccessWarning(){ 6 | /* eslint no-console: "off" */ 7 | console.warn("Allow file access when running directly from files: http://getlibs.com/allow-file-access.html"); 8 | 9 | var e = document.createElement('div'); 10 | e.innerHTML = '
' + 11 | 'getlibs error: file access not allowed (more info)' + 12 | '
'; 13 | document.body.appendChild(e); 14 | } 15 | 16 | 17 | var loadingFromFiles = (location.protocol == 'file:'), 18 | fileAccessAllowed; 19 | 20 | 21 | 22 | function fetch(load, fallback){ 23 | 24 | function ok(source){ 25 | 26 | if (loadingFromFiles && load.address.indexOf('file:') == 0){ 27 | fileAccessAllowed = true; 28 | } 29 | 30 | return source; 31 | } 32 | 33 | function fail(err){ 34 | 35 | if (loadingFromFiles && !fileAccessAllowed){ 36 | setTimeout(fileAccessWarning, 100); 37 | throw new Error('No access to files or wrong path: ' + load.address); 38 | } 39 | 40 | throw err; 41 | } 42 | 43 | 44 | return Promise.resolve(fallback(load)).then(ok, fail); 45 | } 46 | 47 | 48 | return { 49 | fetch: fetch 50 | }; 51 | }); 52 | 53 | -------------------------------------------------------------------------------- /plugins/typescript.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/plugins/typescript', ['../src/worker'], function(WebWorker){ 3 | 4 | function transpiler(){ 5 | 6 | self.translate = function(address, source, options) { 7 | 8 | /* global ts */ 9 | var result = ts.transpileModule(source, { 10 | compilerOptions: options, 11 | reportDiagnostics: true, 12 | moduleName: address, 13 | fileName: address 14 | }); 15 | 16 | result.diagnostics.forEach(function(item){ 17 | item.file = null; 18 | }); 19 | 20 | return result; 21 | }; 22 | } 23 | 24 | 25 | var worker = new WebWorker(['typescript', transpiler]), 26 | options = SystemJS.typescriptOptions; 27 | 28 | 29 | function error(items, address, source){ 30 | 31 | var item = items[0], 32 | parts = source.substr(0, item.start).split('\n'), 33 | line = parts.length, 34 | message = item.messageText + ' (line: ' + line + ')\n\n' + 35 | source.split('\n')[line-1] + '\n' + 36 | parts[line-1].replace(/\S/g, ' ') + '^'; 37 | 38 | return new Error(message); 39 | } 40 | 41 | 42 | function translate(load){ 43 | return worker.call('translate', load.address, load.source, options).then(function(result){ 44 | 45 | if (result.diagnostics.length){ 46 | throw error(result.diagnostics, load.address, load.source); 47 | } 48 | 49 | load.metadata.sourceMap = JSON.parse(result.sourceMapText); 50 | return result.outputText.replace(/^\/\/# sourceMappingURL=.+/m, ''); 51 | }); 52 | } 53 | 54 | 55 | return { 56 | translate: translate 57 | }; 58 | }); -------------------------------------------------------------------------------- /src/libs.js: -------------------------------------------------------------------------------- 1 | 2 | /* eslint no-unused-vars: "off" */ 3 | 4 | function define(){ 5 | return SystemJS.amdDefine.apply(SystemJS, arguments); 6 | } 7 | 8 | function config(){ 9 | return SystemJS.config.apply(SystemJS, arguments); 10 | } 11 | 12 | 13 | define.loader = function(name, plugins){ 14 | 15 | function merge(result, plugin){ 16 | 17 | var _fetch = result.fetch, 18 | _translate = result.translate; 19 | 20 | function fetch(load, fallback){ 21 | 22 | var loader = this; 23 | 24 | function _fallback(){ 25 | return _fetch.call(loader, load, fallback); 26 | } 27 | 28 | return plugin.fetch.call(loader, load, _fallback); 29 | } 30 | 31 | 32 | function translate(load){ 33 | 34 | var loader = this, 35 | result = plugin.translate.call(loader, load); 36 | 37 | return Promise.resolve(result).then(function(source){ 38 | 39 | if (typeof source == 'string'){ 40 | load.source = source; 41 | } 42 | 43 | return _translate.call(loader, load); 44 | }); 45 | } 46 | 47 | 48 | function wrap(load){ 49 | return plugin.wrap.call(this, load, _translate); 50 | } 51 | 52 | 53 | if (plugin.fetch){ 54 | result.fetch = _fetch ? fetch : plugin.fetch; 55 | } 56 | 57 | if (plugin.translate){ 58 | result.translate = _translate ? translate : plugin.translate; 59 | } 60 | 61 | if (plugin.wrap){ 62 | result.translate = wrap; 63 | } 64 | } 65 | 66 | 67 | define(name, plugins, function(){ 68 | 69 | var i = arguments.length, result = {}; 70 | 71 | while(--i >= 0){ 72 | merge(result, arguments[i]); 73 | } 74 | 75 | return result; 76 | }); 77 | }; -------------------------------------------------------------------------------- /plugins/scan.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/plugins/scan', [], function(){ 3 | 4 | var angularPreloaded; 5 | 6 | function angular(load){ 7 | 8 | var reTemplateUrl = /(\btemplateUrl\s*:\s*['"`])(\..*?)([`"'])/g, 9 | reStyleUrls = /(\bstyleUrls\s*:\s*\[)([^\]]*?)(\])/g, 10 | reUrl = /(['"`])(\..*?)([`"'])/g, 11 | source = String(load.source); 12 | 13 | if (!angularPreloaded && source.indexOf('@angular/platform-browser-dynamic') >= 0){ 14 | 15 | angularPreloaded = true; 16 | 17 | System.preload([ 18 | 'core-js', 19 | 'zone.js', 20 | 'rxjs', 21 | '@angular/core', 22 | '@angular/common', 23 | '@angular/platform-browser', 24 | '@angular/compiler', 25 | '@angular/platform-browser-dynamic' 26 | ]); 27 | } 28 | 29 | function absoluteUrl(match, before, url, after){ 30 | return before + System.resolveSync(url, load.address) + after; 31 | } 32 | 33 | function styleUrls(match, before, urls, after){ 34 | return before + urls.replace(reUrl, absoluteUrl) + after; 35 | } 36 | 37 | if (source.indexOf('moduleId') == -1) { 38 | load.source = source.replace(reTemplateUrl, absoluteUrl).replace(reStyleUrls, styleUrls); 39 | } 40 | } 41 | 42 | 43 | function scan(load){ 44 | 45 | var source = String(load.source); 46 | 47 | if (source.indexOf('@angular') >= 0) { 48 | angular(load); 49 | } 50 | } 51 | 52 | 53 | var baseURL = SystemJS.baseURL; 54 | 55 | function translate(load){ 56 | 57 | if (String(load.address).substr(0, baseURL.length) != baseURL){ 58 | scan(load); 59 | } 60 | } 61 | 62 | 63 | return { 64 | translate: translate 65 | }; 66 | }); 67 | 68 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 2 | var fs = require('fs'), 3 | eslint = require('gulp-eslint'), 4 | gulp = require('gulp'), 5 | concat = require('gulp-concat'), 6 | header = require('gulp-header'), 7 | footer = require('gulp-footer'), 8 | sourcemaps = require('gulp-sourcemaps'), 9 | uglify = require('gulp-uglify'), 10 | version = require('./package.json').version; 11 | 12 | var files = []; 13 | 14 | String(fs.readFileSync('src/min.js', {encoding:'utf8'})).split('\n').forEach(function(line){ 15 | if (line.match(/\$import\(.(.+).\);/)){ 16 | files.push(RegExp.$1); 17 | } 18 | }); 19 | 20 | 21 | var cfg = { 22 | includeContent: true, 23 | destPath: './dist', 24 | sourceMappingURLPrefix: 'https://unpkg.com/getlibs@' + version + '/dist' 25 | }; 26 | 27 | 28 | gulp.task('lint', function(){ 29 | return gulp.src(files, {base: './'}) 30 | .pipe(eslint()) 31 | .pipe(eslint.format('unix')) 32 | .pipe(eslint.failAfterError()); 33 | }); 34 | 35 | 36 | gulp.task('source', ['lint'], function() { 37 | 38 | return gulp.src(files, {base: './'}) 39 | .pipe(sourcemaps.init()) 40 | .pipe(concat('src.js')) 41 | .pipe(header('(function(){\n')) 42 | .pipe(footer('\n})()')) 43 | .pipe(sourcemaps.write('', cfg)) 44 | .pipe(gulp.dest('./dist')); 45 | }); 46 | 47 | 48 | gulp.task('minified', ['lint'], function() { 49 | 50 | return gulp.src(files, {base: './'}) 51 | .pipe(sourcemaps.init()) 52 | .pipe(uglify()) 53 | .pipe(concat('min.js')) 54 | .pipe(header('(function(){')) 55 | .pipe(footer('})()')) 56 | .pipe(sourcemaps.write('', cfg)) 57 | .pipe(gulp.dest('./dist')); 58 | }); 59 | 60 | 61 | gulp.task('default', ['source', 'minified']); 62 | 63 | -------------------------------------------------------------------------------- /src/config.js: -------------------------------------------------------------------------------- 1 | 2 | config({ 3 | 4 | baseURL: 'https://unpkg.com/', 5 | 6 | packages: { 7 | 'babel-standalone': {main: 'babel.min.js'}, 8 | 'typescript': {main: 'typescript.min.js', meta: {'*': {exports: 'ts'}}}, 9 | 'cdn': {main: '@@', defaultExtension: '', meta: {'*': {loader: 'getlibs/loader/cdnjs'}}}, 10 | 'pkg': {main: '@@', defaultExtension: '', meta: {'*': {loader: 'getlibs/loader/package'}}} 11 | }, 12 | 13 | map: { 14 | 'src': './src', 15 | 'app': './app', 16 | 17 | 'css': 'systemjs-plugin-css', 18 | 19 | 'babel-standalone': 'https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0', 20 | 'typescript': 'https://cdnjs.cloudflare.com/ajax/libs/typescript/2.6.2', 21 | 22 | 'plugins': 'getlibs/plugins' 23 | }, 24 | 25 | meta: { 26 | '*.js': {loader: 'js'}, 27 | '*.ts': {loader: 'ts'}, 28 | '*.css': {loader: 'css'}, 29 | '*.txt': {loader: 'text'}, 30 | '*.tpl': {loader: 'text'}, 31 | '*.htm': {loader: 'text'}, 32 | '*.html': {loader: 'text'}, 33 | '*.json': {loader: 'json'}, 34 | '*.hbs': {loader: 'hbs'} 35 | }, 36 | 37 | typescriptOptions: { 38 | module: 'system', 39 | sourceMap: true, 40 | emitDecoratorMetadata: true, 41 | experimentalDecorators: true 42 | }, 43 | 44 | babelOptions: { 45 | sourceMap: true, 46 | presets: ['es2015', 'stage-3', 'stage-2', 'react'], 47 | plugins: ['transform-es2015-modules-systemjs'] 48 | }, 49 | 50 | transpiler: '@babel' 51 | }); 52 | 53 | 54 | define.loader('@babel', [ 55 | 'plugins/cached', 56 | 'plugins/babel' 57 | ]); 58 | 59 | 60 | define.loader('js', [ 61 | 'plugins/scan', 62 | 'plugins/roots', 63 | 'plugins/index', 64 | 'plugins/files' 65 | ]); 66 | 67 | 68 | define.loader('ts', [ 69 | 'plugins/scan', 70 | 'plugins/roots', 71 | 'plugins/index', 72 | 'plugins/files', 73 | 'plugins/cached', 74 | 'plugins/typescript' 75 | ]); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "getlibs", 3 | "version": "0.1.1", 4 | "description": "An in-browser module loader configured to get external dependencies directly from CDN. Includes babel/typescript. For quick prototyping, code sharing, teaching/learning - a super simple web dev environment without node/webpack/etc.", 5 | "main": "dist/src.js", 6 | "unpkg": "dist/min.js", 7 | "files": [ 8 | "dist", 9 | "plugins" 10 | ], 11 | "scripts": { 12 | "test": "gulp && wdio test/wdio.local.js", 13 | "build": "gulp" 14 | }, 15 | "devDependencies": { 16 | "ang2-conduit": "git+https://github.com/gothinkster/angular-realworld-example-app.git", 17 | "chai": "^3.5.0", 18 | "es6-promise": "^4.1.0", 19 | "express": "^4.0.0", 20 | "gulp": "^3.9.1", 21 | "gulp-concat": "^2.6.1", 22 | "gulp-eslint": "^3.0.1", 23 | "gulp-footer": "^1.0.5", 24 | "gulp-header": "^1.8.8", 25 | "gulp-sourcemaps": "^2.4.0", 26 | "gulp-uglify": "^2.0.0", 27 | "systemjs": "^0.20.12", 28 | "wdio-dot-reporter": "0.0.8", 29 | "wdio-mocha-framework": "^0.5.10", 30 | "wdio-sauce-service": "^0.4.0", 31 | "wdio-spec-reporter": "^0.1.0", 32 | "wdio-static-server-service": "^1.0.1", 33 | "webdriverio": "^4.8.0" 34 | }, 35 | "repository": { 36 | "type": "git", 37 | "url": "git+https://github.com/activewidgets/getlibs.git" 38 | }, 39 | "keywords": [ 40 | "systemjs", 41 | "unpkg", 42 | "cdnjs", 43 | "babel", 44 | "typescript", 45 | "javascript", 46 | "angular", 47 | "react", 48 | "vue" 49 | ], 50 | "author": "webmaster@activewidgets.com", 51 | "license": "MIT", 52 | "bugs": { 53 | "url": "https://github.com/activewidgets/getlibs/issues" 54 | }, 55 | "eslintConfig": { 56 | "extends": "eslint:recommended", 57 | "globals": { 58 | "Promise": true, 59 | "System": true, 60 | "SystemJS": true, 61 | "define": true, 62 | "config": true 63 | }, 64 | "env": { 65 | "browser": true 66 | } 67 | }, 68 | "homepage": "http://getlibs.com" 69 | } 70 | -------------------------------------------------------------------------------- /src/min.js: -------------------------------------------------------------------------------- 1 | 2 | (function($import){ 3 | 4 | $import('node_modules/es6-promise/dist/es6-promise.auto.js'); 5 | $import('node_modules/systemjs/dist/system.src.js'); 6 | 7 | $import('src/libs.js'); 8 | $import('src/config.js'); 9 | $import('src/idb.js'); 10 | $import('src/worker.js'); 11 | $import('src/browsersync.js'); 12 | 13 | $import('config/activewidgets.js'); 14 | $import('config/angular.js'); 15 | $import('config/angular-1.js'); 16 | $import('config/aurelia.js'); 17 | $import('config/core.js'); 18 | $import('config/ember.js'); 19 | $import('config/lodash.js'); 20 | $import('config/rxjs.js'); 21 | $import('config/vue.js'); 22 | $import('config/zone.js'); 23 | 24 | $import('plugins/text.js'); 25 | $import('plugins/json.js'); 26 | $import('plugins/preload.js'); 27 | $import('plugins/cdnjs.js'); 28 | $import('plugins/cached.js'); 29 | $import('plugins/files.js'); 30 | $import('plugins/roots.js'); 31 | $import('plugins/index.js'); 32 | $import('plugins/scan.js'); 33 | $import('plugins/js.js'); 34 | $import('plugins/babel.js'); 35 | $import('plugins/typescript.js'); 36 | $import('plugins/handlebars.js'); 37 | $import('plugins/package.js'); 38 | $import('plugins/vue.js'); 39 | $import('plugins/x-modules.js'); 40 | 41 | 42 | })((function(){ 43 | 44 | function currentScriptURL(){ 45 | 46 | if (document.currentScript){ 47 | return document.currentScript.src; // modern 48 | } 49 | 50 | document.write(' 46 | {% endif %} 47 | 48 | -------------------------------------------------------------------------------- /plugins/x-modules.js: -------------------------------------------------------------------------------- 1 | 2 | (function(){ 3 | 4 | var defaultLoader = 'getlibs/loader/default'; 5 | 6 | var content = {}, loaders = {'default': defaultLoader}; 7 | 8 | 9 | function tagLoader(arg){ 10 | 11 | var base = arg || {}, 12 | loader = {}; 13 | 14 | Object.keys(base).forEach(function(i){ 15 | loader[i] = base[i]; 16 | }); 17 | 18 | loader.fetch = function(load, fetch){ 19 | 20 | var name = load.address; 21 | 22 | if (content[name]){ 23 | load.source = content[name]; 24 | return content[name]; 25 | } 26 | 27 | if (base.fetch){ 28 | return base.fetch.apply(this, arguments); 29 | } 30 | 31 | return fetch(load); 32 | }; 33 | 34 | return loader; 35 | } 36 | 37 | 38 | define(defaultLoader, [], tagLoader); 39 | 40 | 41 | function registerLoader(name){ 42 | 43 | var xname = 'getlibs/loader/' + name, 44 | basename = SystemJS.normalizeSync(name), 45 | map = {}; 46 | 47 | map[name] = xname; 48 | 49 | define(xname, [basename], tagLoader); 50 | config({map: map}); 51 | 52 | return xname; 53 | } 54 | 55 | 56 | function makeLoader(name){ 57 | 58 | if (!loaders[name]){ 59 | loaders[name] = registerLoader(name); 60 | } 61 | 62 | return loaders[name]; 63 | } 64 | 65 | 66 | Object.keys(SystemJS.meta).forEach(function(key){ 67 | 68 | var meta = SystemJS.meta[key], 69 | name = meta && key.indexOf('*.') == 0 && meta.loader; 70 | 71 | name && makeLoader(name); 72 | }); 73 | 74 | 75 | function isDefault(name){ 76 | return name.match(/\.js$|[^\.\w]\w*$/); 77 | } 78 | 79 | 80 | function registerModules(){ 81 | 82 | var i, meta = {}, start = [], scripts = document.querySelectorAll('script[type="x-module"]'); 83 | 84 | for(i=0; i]*>([\s\S]*)<\/script>/)){ 50 | source = RegExp.$1; 51 | } 52 | 53 | load.source = source; 54 | return source; 55 | } 56 | 57 | return { 58 | fetch: fetch 59 | }; 60 | }); 61 | 62 | 63 | define('vue-html', ['vue-content'], function(content){ 64 | 65 | function fetch(load){ 66 | 67 | var address = load.address.replace(/-html$/, ''), 68 | text = content[address], 69 | source = ''; 70 | 71 | if (String(text).match(/]*>([\s\S]*)<\/template>/)){ 72 | source = 'module.exports = ' + JSON.stringify(RegExp.$1); 73 | } 74 | 75 | return source; 76 | } 77 | 78 | return { 79 | fetch: fetch 80 | }; 81 | }); 82 | 83 | 84 | define('vue-css', ['vue-content'], function(content){ 85 | 86 | function fetch(load){ 87 | 88 | var address = load.address.replace(/-css$/, ''), 89 | text = content[address], 90 | source = ''; 91 | 92 | if (String(text).match(/]*>([\s\S]*)<\/style>/)){ 93 | 94 | var style = RegExp.$1, 95 | el = document.createElement('style'); 96 | 97 | if (el.styleSheet) { 98 | el.styleSheet.cssText = style; 99 | } 100 | else { 101 | el.appendChild(document.createTextNode(style)); 102 | } 103 | 104 | document.head.appendChild(el); 105 | } 106 | 107 | return source; 108 | } 109 | 110 | 111 | return { 112 | fetch: fetch 113 | }; 114 | }); 115 | 116 | 117 | define('vue-content', [], function(){ 118 | return {}; 119 | }); 120 | 121 | 122 | define.loader('vue-ts', [ 123 | 'vue-js', 124 | 'plugins/cached', 125 | 'plugins/typescript' 126 | ]); 127 | 128 | 129 | config({ 130 | meta: { 131 | '*.vue-js': {loader: 'vue-js'}, 132 | '*.vue-ts': {loader: 'vue-ts'}, 133 | '*.vue-html': {loader: 'vue-html'}, 134 | '*.vue-css': {loader: 'vue-css'}, 135 | '*.vue': {loader: 'vue-loader'} 136 | } 137 | }); 138 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![Version](https://img.shields.io/npm/v/getlibs.svg)](http://getlibs.com/) 3 | [![License](https://img.shields.io/npm/l/getlibs.svg)](http://getlibs.com/) 4 | [![Downloads](https://img.shields.io/npm/dm/getlibs.svg)](http://getlibs.com/) 5 | 6 | # https://unpkg.com/getlibs 7 | 8 | An in-browser [module loader](https://github.com/systemjs/systemjs) configured to get external dependencies directly from CDN. Includes babel/typescript. For quick prototyping, code sharing, teaching/learning - a super simple web dev environment without node/webpack/etc. 9 | 10 | ![Code preview](http://getlibs.com/code.gif) 11 | 12 | ## All front-end libraries 13 | 14 | Angular, React, Vue, Bootstrap, Handlebars, jQuery are included. Plus all packages from [cdnjs.com](https://cdnjs.com/) and all of NPM (via [unpkg.com](https://unpkg.com/)). Most front-end libraries should work out of the box - just use `import`/`require()`. If a popular library does not load, tell us and we'll try to solve it with some library-specific config. 15 | 16 | ## Write modern javascript (or typescript) 17 | 18 | Use latest language features or JSX and the code will be transpiled in-browser via babel or typescript (if required). To make it fast the transpiler will start in a worker thread and only process the modified code. Unless you change many files at once or open the project for the first time, the transpiling should be barely noticeable as it runs in parallel with loading and initializing the UI framework. 19 | 20 | ## No server/build required 21 | 22 | No need for a build process or even a web server. Just [use static files](#running-from-filesystem), open in a browser and hit refresh :-). Or run [Browsersync](https://www.browsersync.io/) in watch mode for auto-reload. 23 | 24 | ATTENTION! This is all good for dev environment only. Before going to production, you still need to setup webpack/rollup/eslint/karma/whatever and run a proper build. It is not a good idea to transpile your code in-browser in production (unless it is only required for a small number of older browsers - but we are not there yet :-). 25 | 26 | ## Installation 27 | 28 | There is nothing to install, just include a link to `getlibs` script on CDN - 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ## Usage 35 | 36 | Organize your code as separate modules and call `System.import()` to load the app. 37 | ```html 38 | 41 | ``` 42 | 43 | Or use `` to put everything into `index.html` 44 | 45 | ##### ES5/require() 46 | ```js 47 | var compile = require('lodash/template'), 48 | template = require('./hello.tpl'), 49 | data = require('./hello.json'), 50 | render = compile(template); 51 | 52 | document.getElementById('app').innerHTML = render(data); 53 | ``` 54 | 55 | [Full Source]   56 | [Open in browser]   57 | 58 | 59 | ##### ES6/import 60 | ```js 61 | import React from 'react'; 62 | import ReactDOM from 'react-dom'; 63 | const msg = 'Hello World!'; 64 | 65 | ReactDOM.render(

{msg}

, document.getElementById('app')); 66 | ``` 67 | 68 | [Full Source]   69 | [Open in browser]   70 | 71 | 72 | ##### Typescript 73 | ```ts 74 | import {Component} from '@angular/core'; 75 | 76 | @Component({ 77 | selector: '#app', 78 | templateUrl: './app.component.html' 79 | }) 80 | 81 | export class AppComponent { 82 | msg = 'Hello World!'; 83 | } 84 | ``` 85 | 86 | [Full Source]   87 | [Open in browser]   88 | 89 | ## Running from filesystem 90 | 91 | You will get cross origin errors if you open the examples in chrome directly from the filesystem. To allow file access in chrome lauch it with `--allow-file-access-from-files` flag ([more info](https://stackoverflow.com/questions/18586921/how-to-launch-html-using-chrome-at-allow-file-access-from-files-mode)). 92 | 93 | ## How it works 94 | 95 | `getlibs` is based on [SystemJS](https://github.com/systemjs/systemjs) module loader. Instead of typical setup where it looks for external packages in `node_modules` directory, `getlibs` is configured to load libraries directly from NPM (via [unpkg.com](https://unpkg.com/)) or [cdnjs.com](https://cdnjs.com/), if available. 96 | 97 | ## About 98 | 99 | [SystemJS](https://github.com/systemjs/systemjs) is a module loader developed by [Guy Bedford](https://github.com/guybedford). 100 | 101 | `getlibs` is a bundle of SystemJS with a custom config - maintained by [ActiveWidgets](http://www.activewidgets.com/). 102 | 103 | [![ActiveWidgets](http://www.activewidgets.com/include/logo/aw-logo-40.png?getlibs-readme)](http://www.activewidgets.com/) 104 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Modern javascript. All front-end libraries. No server/build. 3 | description: the simplest way to start a new project. 4 | --- 5 | 6 | [![Version](https://img.shields.io/npm/v/getlibs.svg)](https://www.npmjs.com/package/getlibs) 7 | [![License](https://img.shields.io/npm/l/getlibs.svg)](https://www.npmjs.com/package/getlibs) 8 | [![Downloads](https://img.shields.io/npm/dm/getlibs.svg)](https://www.npmjs.com/package/getlibs) 9 | 10 | An in-browser [module loader](https://github.com/systemjs/systemjs) configured to get external dependencies directly from CDN. Includes babel/typescript. For quick prototyping, code sharing, teaching/learning - a super simple web dev environment without node/webpack/etc. 11 | 12 | ![Code preview](code.gif) 13 | 14 | ## All front-end libraries 15 | 16 | Angular, React, Vue, Bootstrap, Handlebars, jQuery are included. Plus all packages from [cdnjs.com](https://cdnjs.com/) and all of NPM (via [unpkg.com](https://unpkg.com/)). Most front-end libraries should work out of the box - just use `import`/`require()`. If a popular library does not load, tell us and we'll try to solve it with some library-specific config. 17 | 18 | ## Write modern javascript (or typescript) 19 | 20 | Use latest language features or JSX and the code will be transpiled in-browser via babel or typescript (if required). To make it fast the transpiler will start in a worker thread and only process the modified code. Unless you change many files at once or open the project for the first time, the transpiling should be barely noticeable as it runs in parallel with loading and initializing the UI framework. 21 | 22 | ## No server/build required 23 | 24 | No need for a build process or even a web server. Just [use static files](#running-from-filesystem), open in a browser and hit refresh :-). Or run [Browsersync](https://www.browsersync.io/) in watch mode for auto-reload. 25 | 26 | ATTENTION! This is all good for dev environment only. Before going to production, you still need to setup webpack/rollup/eslint/karma/whatever and run a proper build. It is not a good idea to transpile your code in-browser in production (unless it is only required for a small number of older browsers - but we are not there yet :-). 27 | 28 | ## Installation 29 | 30 | There is nothing to install, just include a link to `getlibs` script on CDN - 31 | 32 | ```html 33 | 34 | ``` 35 | 36 | ## Usage 37 | 38 | Organize your code as separate modules and call `System.import()` to load the app. 39 | ```html 40 | 43 | ``` 44 | 45 | Or use `` to put everything into `index.html` 46 | 47 | ##### ES5/require() 48 | ```js 49 | var compile = require('lodash/template'), 50 | template = require('./hello.tpl'), 51 | data = require('./hello.json'), 52 | render = compile(template); 53 | 54 | document.getElementById('app').innerHTML = render(data); 55 | ``` 56 | 57 | [Full Source]   58 | [Open in browser]   59 | 60 | 61 | ##### ES6/import 62 | ```js 63 | import React from 'react'; 64 | import ReactDOM from 'react-dom'; 65 | const msg = 'Hello World!'; 66 | 67 | ReactDOM.render(

{msg}

, document.getElementById('app')); 68 | ``` 69 | 70 | [Full Source]   71 | [Open in browser]   72 | 73 | 74 | ##### Typescript 75 | ```ts 76 | import {Component} from '@angular/core'; 77 | 78 | @Component({ 79 | selector: '#app', 80 | templateUrl: './app.component.html' 81 | }) 82 | 83 | export class AppComponent { 84 | msg = 'Hello World!'; 85 | } 86 | ``` 87 | 88 | [Full Source]   89 | [Open in browser]   90 | 91 | ## Running from filesystem 92 | 93 | You will get cross origin errors if you open the examples in chrome directly from the filesystem. To allow file access in chrome lauch it with `--allow-file-access-from-files` flag ([more info](https://stackoverflow.com/questions/18586921/how-to-launch-html-using-chrome-at-allow-file-access-from-files-mode)). 94 | 95 | ## How it works 96 | 97 | `getlibs` is based on [SystemJS](https://github.com/systemjs/systemjs) module loader. Instead of typical setup where it looks for external packages in `node_modules` directory, `getlibs` is configured to load libraries directly from NPM (via [unpkg.com](https://unpkg.com/)) or [cdnjs.com](https://cdnjs.com/), if available. 98 | 99 | ## About 100 | 101 | [SystemJS](https://github.com/systemjs/systemjs) is a module loader developed by [Guy Bedford](https://github.com/guybedford). 102 | 103 | `getlibs` is a bundle of SystemJS with a custom config - maintained by [ActiveWidgets](http://www.activewidgets.com/). 104 | 105 | [![ActiveWidgets](http://www.activewidgets.com/include/logo/aw-logo-40.png?getlibs-docs)](http://www.activewidgets.com/) 106 | -------------------------------------------------------------------------------- /plugins/cdnjs.js: -------------------------------------------------------------------------------- 1 | 2 | define('getlibs/loader/cdnjs', [], function(){ 3 | 4 | var init = System.import('https://api.cdnjs.com/libraries!json').then(function(response){ 5 | 6 | var libs = {}, map = {"angular.js": "angular", "10up-sanitize.css":"sanitize.css","accounting.js":"accounting","alertify.js":"alertify","AlertifyJS":"alertifyjs","alexandernst-angular-multi-select":"angular-multi-select","angular-autofields":"angular-autoFields-bootstrap","audio5js":"audio5","aui":"@atlassian/aui","babel-core":"babel-browser","backbone-localstorage.js":"backbone.localstorage","backbone.collectionView":"bb-collection-view","backbone.js":"backbone","backbone.validation":"backbone-validation","bacon.js":"baconjs","baffle.js":"baffle","basis.js":"basis-library","bespoke.js":"bespoke","bokeh":"bokehjs","breezejs":"breeze-client","camanjs":"caman","can.js":"can","cannon.js":"cannon","cash":"cash-dom","Chart.js":"chart.js","ClientJS":"clientjs","clipboard.js":"clipboard","Colors.js":"colors.js","cookie.js":"cookie_js","Cookies.js":"cookies-js","css-loader":"pure-css-loader","custom-elements-builder":"ceb","custom-elements":"@webcomponents/custom-elements","dancer.js":"dancer","danialfarid-angular-file-upload":"ng-file-upload","danielgindi-jquery-backstretch":"jquery.backstretch","data.js":"data_js","datepicker":"@fengyuanchen/datepicker","dio":"dio.js","dropbox.js":"dropbox","Dropify":"dropify","dygraph":"dygraphs","elasticsearch":"elasticsearch-browser","eModal":"emodal","Faker":"faker","file-uploader":"fine-uploader","FileSaver.js":"file-saver","forge":"node-forge","graingert-wow":"wow.js","Han":"han-css","handlebars.js":"handlebars","headroom":"headroom.js","hola-video.js":"@hola.org/video.js","ICanHaz.js":"icanhaz","idbwrapper":"idb-wrapper","ifvisible":"ifvisible.js","ion.checkradio":"ion-checkradio","javascript-hooker":"hooker","jquery-browser":"jquery.browser","jquery-easing":"jquery.easing","jquery-jgrowl":"jgrowl","jQuery-linkify":"linkifyjs","jquery-minicolors":"@claviska/jquery-minicolors","jquery-noty":"noty","jquery.imagesloaded":"imagesloaded","jquery.isotope":"isotope-layout","jquery.lazyloadxt":"lazyloadxt","jQuery.Marquee":"jquery.marquee","jQuery.my":"jquerymy","jquery.simpleWeather":"simpleweather","jquery.tabslet.js":"tabslet","jquery.textcomplete":"jquery-textcomplete","jquery.ui-contextmenu":"ui-contextmenu","jquery.wookmark":"wookmark","jqueryui-touch-punch":"jquery-ui-touch-punch","js-xss":"xss","jsdiff":"diff","json-formatter":"jsonformatter","kineticjs":"kinetic","knockout-validation":"knockout.validation","leaflet-locatecontrol":"leaflet.locatecontrol","leaflet.draw":"leaflet-draw","less.js":"less","line-chart":"n3-charts","lunr.js":"lunr","machina.js":"machina","markdown.js":"markdown","mindb":"min","MinPubSub":"minpubsub","mistic100-Bootstrap-Confirmation":"bootstrap-confirmation2","moment.js":"moment","multi-select":"multiselect","MutationObserver.js":"mutationobserver-shim","mycolorway-simple-hotkeys":"simple-hotkeys","ngOfficeUiFabric":"ng-office-ui-fabric","nod":"nod-validate","normalize":"normalize.css","notify.js":"notifyjs","numeral.js":"numeral","oauth-io":"oauthio-web","odometer.js":"odometer","ol3":"openlayers","onsen":"onsenui","p2.js":"p2","p5.js":"p5","parsley.js":"parsleyjs","pdf.js":"pdfjs-dist","pegasus":"@typicode/pegasus","perliedman-leaflet-control-geocoder":"leaflet-control-geocoder","pickadate.js":"pickadate","plastiq":"angular-moment","plottable.js":"plottable","portal":"portal-client","postal.js":"postal","Primer":"primer-css","prism":"prismjs","proj4js":"proj4","pure":"purecss","q.js":"q","qunit":"qunitjs","ramjet.js":"ramjet","remoteStorage":"remotestoragejs","Repaintless.css":"repaintless","retina.js":"retinajs","roll":"rolljs","rxjs":"@reactivex/rxjs","scion":"scxml","script.js":"scriptjs","ScrollMagic":"scrollmagic","should.js":"should","Shuffle":"shufflejs","sigma.js":"sigma","simple-gallery-js":"simpleGallery.js","smoothscroll":"smoothscroll-for-websites","socket.io":"socket.io-client","sprintf":"sprintf-js","stacktrace.js":"stacktrace-js","stomp.js":"stompjs","string.js":"string","Swiper":"swiper","tabletop.js":"tabletop","teleject-hisrc":"hisrc","tinycolor":"tinycolor2","tracking.js":"tracking","Turf.js":"@turf/turf","twitter-bootstrap":"bootstrap","twix.js":"twix","UAParser.js":"ua-parser-js","Uniform.js":"jquery.uniform","Vidage":"vidage","weather":"weather.js","whitestorm.js":"whs","wordcloud2.js":"wordcloud","xls":"xlsjs","yasqe":"yasgui-yasqe","yasr":"yasgui-yasr","Zebra_datepicker":"zebra_datepicker"}; 7 | 8 | response.results.forEach(function(item){ 9 | libs[map[item.name] || item.name] = item; 10 | }); 11 | 12 | return libs; 13 | }); 14 | 15 | 16 | var exceptions = ['@angular/', 'inferno/'], 17 | baseURL = SystemJS.baseURL; 18 | 19 | 20 | function notcdnjs(url){ 21 | return url.indexOf(baseURL) != 0 || exceptions.some(function(item){ 22 | return url.indexOf(baseURL + item) == 0; 23 | }); 24 | } 25 | 26 | 27 | function build(base){ 28 | 29 | var plugin = {}; 30 | 31 | Object.keys(base).forEach(function(i){ 32 | plugin[i] = base[i]; 33 | }); 34 | 35 | plugin.fetch = function(load, fetch){ 36 | 37 | var loader = this; 38 | 39 | if (notcdnjs(load.address)){ 40 | return base.fetch.call(loader, load, fetch); 41 | } 42 | 43 | return init.then(function(libs){ 44 | 45 | var name = load.address.substr(baseURL.length).replace(/^([^@\/]+|@[^\/]+\/[^\/]+)(.*)$/, '$1'), 46 | file = RegExp.$2, 47 | item = libs[name]; 48 | 49 | if (!item){ 50 | return base.fetch.call(loader, load, fetch); 51 | } 52 | 53 | var redirect = item.latest; 54 | 55 | if (file){ 56 | 57 | if (!file.match(/\.\w+$/)){ 58 | file += '.min.js'; 59 | } 60 | 61 | redirect = item.latest.replace(/^(.+\/ajax\/libs\/[^\/]+\/[^\/]+)\/.+$/, '$1') + file; 62 | } 63 | 64 | load.source = 'module.exports = require(' + JSON.stringify(redirect) + ')'; 65 | 66 | 67 | var map = System.preload.map, 68 | prev = map[load.address]; 69 | 70 | if (prev) { 71 | map[redirect] = prev; 72 | } 73 | 74 | return load.source; 75 | }); 76 | } 77 | 78 | return plugin; 79 | } 80 | 81 | 82 | function skip(){ 83 | return '' 84 | } 85 | 86 | 87 | function instantiate(load){ 88 | 89 | var path = load.address.substr(SystemJS.baseURL.length + 4); 90 | path = (path == '@@') ? 'getlibs/plugins/preload' : path; 91 | return System.import(path).then(build); 92 | } 93 | 94 | 95 | return { 96 | fetch: skip, 97 | instantiate: instantiate 98 | }; 99 | }); 100 | 101 | 102 | (function(){ 103 | 104 | config({ 105 | meta: { 106 | 'https://unpkg.com/*': {loader: 'cdn'}, 107 | 'https://cdnjs.cloudflare.com/*.js': {loader: 'cdn'}, 108 | 'getlibs/*': {loader: ''} 109 | } 110 | }); 111 | 112 | var path, meta = {}, current = SystemJS.meta; 113 | 114 | for(path in current){ 115 | if (path.indexOf('*.') == 0 && current[path].loader) { 116 | meta['https://unpkg.com/' + path] = {loader: 'cdn/' + current[path].loader}; 117 | } 118 | } 119 | 120 | meta['https://unpkg.com/*.js'] = {loader: 'cdn'}; 121 | 122 | config({ 123 | meta: meta 124 | }); 125 | 126 | })(); --------------------------------------------------------------------------------