├── 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 |
3 | ${msg}
4 |
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 |
3 |
4 |
{{msg}}
5 |
6 |
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 |
3 |
4 |
{{msg}}
5 |
6 |
7 |
8 |
20 |
21 |
--------------------------------------------------------------------------------
/examples/vue/es6/sfc-class/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
{{msg}}
5 |
6 |
7 |
8 |
17 |
18 |
--------------------------------------------------------------------------------
/examples/vue/ts/hello/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
{{msg}}
5 |
6 |
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 |
3 |
4 |
{{msg}}
5 |
6 |
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 |