├── .circleci └── config.yml ├── .editorconfig ├── .eslintrc.json ├── .gitignore ├── .npmignore ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── bower.json ├── build ├── args.js ├── babel-options.js ├── paths.js ├── tasks │ ├── build.js │ ├── clean.js │ ├── dev.js │ ├── doc.js │ ├── lint.js │ ├── prepare-release.js │ └── test.js └── typescript-options.js ├── config.js ├── dist ├── amd │ ├── aurelia-loader-default.js │ └── index.js ├── aurelia-loader-default.d.ts ├── aurelia-loader-default.js ├── commonjs │ ├── aurelia-loader-default.js │ └── index.js ├── es2015 │ ├── aurelia-loader-default.js │ └── index.js ├── index.d.ts ├── native-modules │ ├── aurelia-loader-default.js │ └── index.js └── system │ ├── aurelia-loader-default.js │ └── index.js ├── doc ├── CHANGELOG.md └── api.json ├── gulpfile.js ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── index.js └── text-template-loader.js ├── test ├── fixtures │ ├── baseModule.js │ ├── baseTemplate.html │ ├── moduleBase │ │ └── rebasedModule.js │ ├── text.js │ └── viewBase │ │ └── rebasedTemplate.html ├── loader.spec.js └── setup.js ├── tsconfig.json └── typings.json /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | map-1: &filter_only_develop 4 | filters: 5 | branches: 6 | only: develop 7 | 8 | map-2: &filter_only_tag 9 | filters: 10 | branches: 11 | ignore: /.*/ 12 | tags: 13 | only: /^v?[0-9]+(\.[0-9]+)*$/ 14 | 15 | orbs: 16 | v1: aurelia/v1@volatile 17 | 18 | workflows: 19 | main: 20 | jobs: 21 | - v1/build_test 22 | - v1/build_merge: 23 | <<: *filter_only_develop 24 | requires: 25 | - v1/build_test 26 | - v1/npm_publish: 27 | <<: *filter_only_tag 28 | name: npm_publish_dry 29 | args: "--dry-run" 30 | - request_publish_latest: 31 | <<: *filter_only_tag 32 | type: approval 33 | requires: 34 | - npm_publish_dry 35 | - v1/npm_publish: 36 | <<: *filter_only_tag 37 | name: npm_publish 38 | context: Aurelia 39 | requires: 40 | - request_publish_latest 41 | - v1/merge_back: 42 | <<: *filter_only_tag 43 | requires: 44 | - npm_publish 45 | 46 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # 2 space indentation 12 | [**.*] 13 | indent_style = space 14 | indent_size = 2 -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./node_modules/aurelia-tools/.eslintrc.json", 3 | "rules": { 4 | "no-empty": 0 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jspm_packages 3 | bower_components 4 | .idea 5 | .DS_STORE 6 | build/reports 7 | dist 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | jspm_packages 2 | bower_components 3 | .idea 4 | build/reports 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We'd love for you to contribute and to make this project even better than it is today! If this interests you, please begin by reading [our contributing guidelines](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). The contributing document will provide you with all the information you need to get started. Once you have read that, you will need to also [sign our CLA](http://goo.gl/forms/dI8QDDSyKR) before we can accept a Pull Request from you. More information on the process is included in the [contributor's guide](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). 4 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 19 | **I'm submitting a bug report** 20 | **I'm submitting a feature request** 21 | 22 | * **Library Version:** 23 | major.minor.patch-pre 24 | 25 | 26 | **Please tell us about your environment:** 27 | * **Operating System:** 28 | OSX 10.x|Linux (distro)|Windows [7|8|8.1|10] 29 | 30 | * **Node Version:** 31 | 6.2.0 32 | 36 | 37 | * **NPM Version:** 38 | 3.8.9 39 | 43 | 44 | * **JSPM OR Webpack AND Version** 45 | JSPM 0.16.32 | webpack 2.1.0-beta.17 46 | 52 | 53 | * **Browser:** 54 | all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView 55 | 56 | * **Language:** 57 | all | TypeScript X.X | ESNext 58 | 59 | 60 | **Current behavior:** 61 | 62 | 63 | **Expected/desired behavior:** 64 | 71 | 72 | 73 | * **What is the expected behavior?** 74 | 75 | 76 | * **What is the motivation / use case for changing the behavior?** 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2010 - 2018 Blue Spire Inc. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # aurelia-loader-default 2 | 3 | [![npm Version](https://img.shields.io/npm/v/aurelia-loader-default.svg)](https://www.npmjs.com/package/aurelia-loader-default) 4 | [![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io) 5 | [![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 6 | [![CircleCI](https://circleci.com/gh/aurelia/loader-default.svg?style=shield)](https://circleci.com/gh/aurelia/loader-default) 7 | 8 | This library is part of the [Aurelia](http://www.aurelia.io/) platform and contains an implementation of the loader interface which works with system.js and all require-based loader APIs. 9 | 10 | > To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.aurelia.io/) and [our email list](http://eepurl.com/ces50j). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions look around our [Discourse forums](https://discourse.aurelia.io/), chat in our [community on Gitter](https://gitter.im/aurelia/discuss) or use [stack overflow](http://stackoverflow.com/search?q=aurelia). Documentation can be found [in our developer hub](http://aurelia.io/docs). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. 11 | 12 | ## Platform Support 13 | 14 | This library can be used in the **browser** only. 15 | 16 | ## Building The Code 17 | 18 | To build the code, follow these steps. 19 | 20 | 1. Ensure that [NodeJS](http://nodejs.org/) is installed. This provides the platform on which the build tooling runs. 21 | 2. From the project folder, execute the following command: 22 | 23 | ```shell 24 | npm install 25 | ``` 26 | 3. Ensure that [Gulp](http://gulpjs.com/) is installed. If you need to install it, use the following command: 27 | 28 | ```shell 29 | npm install -g gulp 30 | ``` 31 | 4. To build the code, you can now run: 32 | 33 | ```shell 34 | gulp build 35 | ``` 36 | 5. You will find the compiled code in the `dist` folder, available in three module formats: AMD, CommonJS and ES6. 37 | 38 | 6. See `gulpfile.js` for other tasks related to generating the docs and linting. 39 | 40 | ## Running The Tests 41 | 42 | To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps: 43 | 44 | 1. Ensure that the [Karma](http://karma-runner.github.io/) CLI is installed. If you need to install it, use the following command: 45 | 46 | ```shell 47 | npm install -g karma-cli 48 | ``` 49 | 2. Ensure that [jspm](http://jspm.io/) is installed. If you need to install it, use the following commnand: 50 | 51 | ```shell 52 | npm install -g jspm 53 | ``` 54 | 3. Install the client-side dependencies with jspm: 55 | 56 | ```shell 57 | jspm install 58 | ``` 59 | 60 | 4. You can now run the tests with this command: 61 | 62 | ```shell 63 | karma start 64 | ``` 65 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurelia-loader-default", 3 | "version": "1.2.2", 4 | "description": "A default implementation of the loader interface compatible with system.js and require-based loaders.", 5 | "keywords": [ 6 | "aurelia", 7 | "loader", 8 | "modules" 9 | ], 10 | "homepage": "http://aurelia.io", 11 | "main": "dist/commonjs/aurelia-loader-default.js", 12 | "moduleType": "node", 13 | "license": "MIT", 14 | "authors": [ 15 | "Rob Eisenberg (http://robeisenberg.com/)" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "http://github.com/aurelia/loader-default" 20 | }, 21 | "dependencies": { 22 | "aurelia-loader": "^1.0.0", 23 | "aurelia-metadata": "^1.0.0", 24 | "aurelia-pal": "^1.0.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /build/args.js: -------------------------------------------------------------------------------- 1 | var yargs = require('yargs'); 2 | 3 | var argv = yargs.argv, 4 | validBumpTypes = "major|minor|patch|prerelease".split("|"), 5 | bump = (argv.bump || 'patch').toLowerCase(); 6 | 7 | if(validBumpTypes.indexOf(bump) === -1) { 8 | throw new Error('Unrecognized bump "' + bump + '".'); 9 | } 10 | 11 | module.exports = { 12 | bump: bump 13 | }; 14 | -------------------------------------------------------------------------------- /build/babel-options.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var paths = require('./paths'); 3 | 4 | exports.base = function() { 5 | var config = { 6 | filename: '', 7 | filenameRelative: '', 8 | sourceMap: true, 9 | sourceRoot: '', 10 | moduleRoot: path.resolve('src').replace(/\\/g, '/'), 11 | moduleIds: false, 12 | comments: false, 13 | compact: false, 14 | code: true, 15 | presets: [ 'es2015-loose', 'stage-1' ], 16 | plugins: [ 17 | 'syntax-flow', 18 | 'transform-decorators-legacy', 19 | ] 20 | }; 21 | if (!paths.useTypeScriptForDTS) { 22 | config.plugins.push( 23 | ['babel-dts-generator', { 24 | packageName: paths.packageName, 25 | typings: '', 26 | suppressModulePath: true, 27 | suppressComments: false, 28 | memberOutputFilter: /^_.*/, 29 | suppressAmbientDeclaration: true 30 | }] 31 | ); 32 | }; 33 | config.plugins.push('transform-flow-strip-types'); 34 | return config; 35 | } 36 | 37 | exports.commonjs = function() { 38 | var options = exports.base(); 39 | options.plugins.push('transform-es2015-modules-commonjs'); 40 | return options; 41 | }; 42 | 43 | exports.amd = function() { 44 | var options = exports.base(); 45 | options.plugins.push('transform-es2015-modules-amd'); 46 | return options; 47 | }; 48 | 49 | exports.system = function() { 50 | var options = exports.base(); 51 | options.plugins.push('transform-es2015-modules-systemjs'); 52 | return options; 53 | }; 54 | 55 | exports.es2015 = function() { 56 | var options = exports.base(); 57 | options.presets = ['stage-1'] 58 | return options; 59 | }; 60 | 61 | exports['native-modules'] = function() { 62 | var options = exports.base(); 63 | options.presets[0] = 'es2015-loose-native-modules'; 64 | return options; 65 | } 66 | -------------------------------------------------------------------------------- /build/paths.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | 4 | // hide warning // 5 | var emitter = require('events'); 6 | emitter.defaultMaxListeners = 20; 7 | 8 | var appRoot = 'src/'; 9 | var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8')); 10 | 11 | var paths = { 12 | root: appRoot, 13 | source: appRoot + '**/*.js', 14 | html: appRoot + '**/*.html', 15 | style: 'styles/**/*.css', 16 | output: 'dist/', 17 | doc:'./doc', 18 | e2eSpecsSrc: 'test/e2e/src/*.js', 19 | e2eSpecsDist: 'test/e2e/dist/', 20 | packageName: pkg.name, 21 | ignore: [], 22 | useTypeScriptForDTS: false, 23 | importsToAdd: [], 24 | sort: false 25 | }; 26 | 27 | paths.files = [ 28 | 'html-import-template-loader.js', 29 | 'text-template-loader.js', 30 | 'index.js' 31 | ].map(function(file){ 32 | return paths.root + file; 33 | }); 34 | 35 | module.exports = paths; 36 | -------------------------------------------------------------------------------- /build/tasks/build.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var runSequence = require('run-sequence'); 3 | var to5 = require('gulp-babel'); 4 | var paths = require('../paths'); 5 | var compilerOptions = require('../babel-options'); 6 | var compilerTsOptions = require('../typescript-options'); 7 | var assign = Object.assign || require('object.assign'); 8 | var through2 = require('through2'); 9 | var concat = require('gulp-concat'); 10 | var insert = require('gulp-insert'); 11 | var rename = require('gulp-rename'); 12 | var tools = require('aurelia-tools'); 13 | var ts = require('gulp-typescript'); 14 | var gutil = require('gulp-util'); 15 | var gulpIgnore = require('gulp-ignore'); 16 | var merge = require('merge2'); 17 | var jsName = paths.packageName + '.js'; 18 | var compileToModules = ['es2015', 'commonjs', 'amd', 'system', 'native-modules']; 19 | 20 | function cleanGeneratedCode() { 21 | return through2.obj(function(file, enc, callback) { 22 | file.contents = new Buffer(tools.cleanGeneratedCode(file.contents.toString('utf8'))); 23 | this.push(file); 24 | return callback(); 25 | }); 26 | } 27 | 28 | gulp.task('build-index', function() { 29 | var importsToAdd = paths.importsToAdd.slice(); 30 | 31 | var src = gulp.src(paths.files); 32 | 33 | if (paths.sort) { 34 | src = src.pipe(tools.sortFiles()); 35 | } 36 | 37 | if (paths.ignore) { 38 | paths.ignore.forEach(function(filename){ 39 | src = src.pipe(gulpIgnore.exclude(filename)); 40 | }); 41 | } 42 | 43 | return src.pipe(through2.obj(function(file, enc, callback) { 44 | file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd)); 45 | this.push(file); 46 | return callback(); 47 | })) 48 | .pipe(concat(jsName)) 49 | .pipe(insert.transform(function(contents) { 50 | return tools.createImportBlock(importsToAdd) + contents; 51 | })) 52 | .pipe(gulp.dest(paths.output)); 53 | }); 54 | 55 | function gulpFileFromString(filename, string) { 56 | var src = require('stream').Readable({ objectMode: true }); 57 | src._read = function() { 58 | this.push(new gutil.File({ cwd: paths.appRoot, base: paths.output, path: filename, contents: new Buffer(string) })) 59 | this.push(null) 60 | } 61 | return src; 62 | } 63 | 64 | function srcForBabel() { 65 | return merge( 66 | gulp.src(paths.output + jsName), 67 | gulpFileFromString(paths.output + 'index.js', "export * from './" + paths.packageName + "';") 68 | ); 69 | } 70 | 71 | function srcForTypeScript() { 72 | return gulp 73 | .src(paths.output + paths.packageName + '.js') 74 | .pipe(rename(function (path) { 75 | if (path.extname == '.js') { 76 | path.extname = '.ts'; 77 | } 78 | })); 79 | } 80 | 81 | compileToModules.forEach(function(moduleType){ 82 | gulp.task('build-babel-' + moduleType, function () { 83 | return srcForBabel() 84 | .pipe(to5(assign({}, compilerOptions[moduleType]()))) 85 | .pipe(cleanGeneratedCode()) 86 | .pipe(gulp.dest(paths.output + moduleType)); 87 | }); 88 | 89 | if (moduleType === 'native-modules') return; // typescript doesn't support the combination of: es5 + native modules 90 | 91 | gulp.task('build-ts-' + moduleType, function () { 92 | var tsProject = ts.createProject( 93 | compilerTsOptions({ module: moduleType, target: moduleType == 'es2015' ? 'es2015' : 'es5' }), ts.reporter.defaultReporter()); 94 | var tsResult = srcForTypeScript().pipe(ts(tsProject)); 95 | return tsResult.js 96 | .pipe(gulp.dest(paths.output + moduleType)); 97 | }); 98 | }); 99 | 100 | gulp.task('build-dts', function() { 101 | var tsProject = ts.createProject( 102 | compilerTsOptions({ removeComments: false, target: "es2015", module: "es2015" }), ts.reporter.defaultReporter()); 103 | var tsResult = srcForTypeScript().pipe(ts(tsProject)); 104 | return tsResult.dts 105 | .pipe(gulp.dest(paths.output)); 106 | }); 107 | 108 | gulp.task('build', function(callback) { 109 | return runSequence( 110 | 'clean', 111 | 'build-index', 112 | compileToModules 113 | .map(function(moduleType) { return 'build-babel-' + moduleType }) 114 | .concat(paths.useTypeScriptForDTS ? ['build-dts'] : []), 115 | callback 116 | ); 117 | }); 118 | 119 | gulp.task('build-ts', function(callback) { 120 | return runSequence( 121 | 'clean', 122 | 'build-index', 123 | 'build-babel-native-modules', 124 | compileToModules 125 | .filter(function(moduleType) { return moduleType !== 'native-modules' }) 126 | .map(function(moduleType) { return 'build-ts-' + moduleType }) 127 | .concat(paths.useTypeScriptForDTS ? ['build-dts'] : []), 128 | callback 129 | ); 130 | }); 131 | -------------------------------------------------------------------------------- /build/tasks/clean.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var paths = require('../paths'); 3 | var del = require('del'); 4 | var vinylPaths = require('vinyl-paths'); 5 | 6 | gulp.task('clean', function() { 7 | return gulp.src([paths.output]) 8 | .pipe(vinylPaths(del)); 9 | }); 10 | -------------------------------------------------------------------------------- /build/tasks/dev.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var tools = require('aurelia-tools'); 3 | 4 | gulp.task('update-own-deps', function(){ 5 | tools.updateOwnDependenciesFromLocalRepositories(); 6 | }); 7 | 8 | gulp.task('build-dev-env', function () { 9 | tools.buildDevEnv(); 10 | }); 11 | -------------------------------------------------------------------------------- /build/tasks/doc.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var paths = require('../paths'); 3 | var typedoc = require('gulp-typedoc'); 4 | var runSequence = require('run-sequence'); 5 | var through2 = require('through2'); 6 | 7 | gulp.task('doc-generate', function(){ 8 | return gulp.src([paths.output + paths.packageName + '.d.ts']) 9 | .pipe(typedoc({ 10 | target: 'es6', 11 | includeDeclarations: true, 12 | moduleResolution: 'node', 13 | json: paths.doc + '/api.json', 14 | name: paths.packageName + '-docs',  15 | mode: 'modules', 16 | excludeExternals: true, 17 | ignoreCompilerErrors: false, 18 | version: true 19 | })); 20 | }); 21 | 22 | gulp.task('doc-shape', function(){ 23 | return gulp.src([paths.doc + '/api.json']) 24 | .pipe(through2.obj(function(file, enc, callback) { 25 | var json = JSON.parse(file.contents.toString('utf8')).children[0]; 26 | 27 | json = { 28 | name: paths.packageName, 29 | children: json.children, 30 | groups: json.groups 31 | }; 32 | 33 | file.contents = new Buffer(JSON.stringify(json)); 34 | this.push(file); 35 | return callback(); 36 | })) 37 | .pipe(gulp.dest(paths.doc)); 38 | }); 39 | 40 | gulp.task('doc', function(callback){ 41 | return runSequence( 42 | 'doc-generate', 43 | 'doc-shape', 44 | callback 45 | ); 46 | }); 47 | -------------------------------------------------------------------------------- /build/tasks/lint.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var paths = require('../paths'); 3 | var eslint = require('gulp-eslint'); 4 | 5 | gulp.task('lint', function() { 6 | return gulp.src(paths.source) 7 | .pipe(eslint()) 8 | .pipe(eslint.format()) 9 | .pipe(eslint.failOnError()); 10 | }); 11 | -------------------------------------------------------------------------------- /build/tasks/prepare-release.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var runSequence = require('run-sequence'); 3 | var paths = require('../paths'); 4 | var fs = require('fs'); 5 | var bump = require('gulp-bump'); 6 | var args = require('../args'); 7 | var conventionalChangelog = require('gulp-conventional-changelog'); 8 | 9 | gulp.task('changelog', function () { 10 | return gulp.src(paths.doc + '/CHANGELOG.md', { 11 | buffer: false 12 | }).pipe(conventionalChangelog({ 13 | preset: 'angular' 14 | })) 15 | .pipe(gulp.dest(paths.doc)); 16 | }); 17 | 18 | gulp.task('bump-version', function(){ 19 | return gulp.src(['./package.json', './bower.json']) 20 | .pipe(bump({type:args.bump })) //major|minor|patch|prerelease 21 | .pipe(gulp.dest('./')); 22 | }); 23 | 24 | gulp.task('prepare-release', function(callback){ 25 | return runSequence( 26 | 'build', 27 | 'lint', 28 | 'bump-version', 29 | 'doc', 30 | 'changelog', 31 | callback 32 | ); 33 | }); 34 | -------------------------------------------------------------------------------- /build/tasks/test.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var Karma = require('karma').Server; 3 | 4 | /** 5 | * Run test once and exit 6 | */ 7 | gulp.task('test', function (done) { 8 | new Karma({ 9 | configFile: __dirname + '/../../karma.conf.js', 10 | singleRun: true 11 | }, done).start(); 12 | }); 13 | 14 | /** 15 | * Watch for file changes and re-run tests on each change 16 | */ 17 | gulp.task('tdd', function (done) { 18 | new Karma({ 19 | configFile: __dirname + '/../../karma.conf.js' 20 | }, done).start(); 21 | }); 22 | 23 | /** 24 | * Run test once with code coverage and exit 25 | */ 26 | gulp.task('cover', function (done) { 27 | new Karma({ 28 | configFile: __dirname + '/../../karma.conf.js', 29 | singleRun: true, 30 | reporters: ['coverage'], 31 | preprocessors: { 32 | 'test/**/*.js': ['babel'], 33 | 'src/**/*.js': ['babel', 'coverage'] 34 | }, 35 | coverageReporter: { 36 | type: 'html', 37 | dir: 'build/reports/coverage' 38 | } 39 | }, done).start(); 40 | }); 41 | -------------------------------------------------------------------------------- /build/typescript-options.js: -------------------------------------------------------------------------------- 1 | var tsconfig = require('../tsconfig.json'); 2 | var assign = Object.assign || require('object.assign'); 3 | 4 | module.exports = function(override) { 5 | return assign(tsconfig.compilerOptions, { 6 | "target": override && override.target || "es5", 7 | "typescript": require('typescript') 8 | }, override || {}); 9 | } 10 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | System.config({ 2 | defaultJSExtensions: true, 3 | transpiler: "babel", 4 | babelOptions: { 5 | "optional": [ 6 | "runtime", 7 | "optimisation.modules.system" 8 | ] 9 | }, 10 | paths: { 11 | "github:*": "jspm_packages/github/*", 12 | "aurelia-loader-default/*": "dist/*", 13 | "npm:*": "jspm_packages/npm/*" 14 | }, 15 | 16 | map: { 17 | "aurelia-loader": "npm:aurelia-loader@1.0.0", 18 | "aurelia-metadata": "npm:aurelia-metadata@1.0.0", 19 | "aurelia-pal": "npm:aurelia-pal@1.0.0", 20 | "aurelia-pal-browser": "npm:aurelia-pal-browser@1.0.0", 21 | "babel": "npm:babel-core@5.8.38", 22 | "babel-runtime": "npm:babel-runtime@5.8.38", 23 | "core-js": "npm:core-js@2.4.1", 24 | "github:jspm/nodelibs-assert@0.1.0": { 25 | "assert": "npm:assert@1.4.1" 26 | }, 27 | "github:jspm/nodelibs-buffer@0.1.0": { 28 | "buffer": "npm:buffer@3.6.0" 29 | }, 30 | "github:jspm/nodelibs-path@0.1.0": { 31 | "path-browserify": "npm:path-browserify@0.0.0" 32 | }, 33 | "github:jspm/nodelibs-process@0.1.2": { 34 | "process": "npm:process@0.11.6" 35 | }, 36 | "github:jspm/nodelibs-util@0.1.0": { 37 | "util": "npm:util@0.10.3" 38 | }, 39 | "github:jspm/nodelibs-vm@0.1.0": { 40 | "vm-browserify": "npm:vm-browserify@0.0.4" 41 | }, 42 | "npm:assert@1.4.1": { 43 | "assert": "github:jspm/nodelibs-assert@0.1.0", 44 | "buffer": "github:jspm/nodelibs-buffer@0.1.0", 45 | "process": "github:jspm/nodelibs-process@0.1.2", 46 | "util": "npm:util@0.10.3" 47 | }, 48 | "npm:aurelia-loader@1.0.0": { 49 | "aurelia-metadata": "npm:aurelia-metadata@1.0.0", 50 | "aurelia-path": "npm:aurelia-path@1.0.0" 51 | }, 52 | "npm:aurelia-metadata@1.0.0": { 53 | "aurelia-pal": "npm:aurelia-pal@1.0.0" 54 | }, 55 | "npm:aurelia-pal-browser@1.0.0": { 56 | "aurelia-pal": "npm:aurelia-pal@1.0.0" 57 | }, 58 | "npm:babel-runtime@5.8.38": { 59 | "process": "github:jspm/nodelibs-process@0.1.2" 60 | }, 61 | "npm:buffer@3.6.0": { 62 | "base64-js": "npm:base64-js@0.0.8", 63 | "child_process": "github:jspm/nodelibs-child_process@0.1.0", 64 | "fs": "github:jspm/nodelibs-fs@0.1.2", 65 | "ieee754": "npm:ieee754@1.1.6", 66 | "isarray": "npm:isarray@1.0.0", 67 | "process": "github:jspm/nodelibs-process@0.1.2" 68 | }, 69 | "npm:core-js@2.4.1": { 70 | "fs": "github:jspm/nodelibs-fs@0.1.2", 71 | "path": "github:jspm/nodelibs-path@0.1.0", 72 | "process": "github:jspm/nodelibs-process@0.1.2", 73 | "systemjs-json": "github:systemjs/plugin-json@0.1.2" 74 | }, 75 | "npm:inherits@2.0.1": { 76 | "util": "github:jspm/nodelibs-util@0.1.0" 77 | }, 78 | "npm:path-browserify@0.0.0": { 79 | "process": "github:jspm/nodelibs-process@0.1.2" 80 | }, 81 | "npm:process@0.11.6": { 82 | "assert": "github:jspm/nodelibs-assert@0.1.0", 83 | "fs": "github:jspm/nodelibs-fs@0.1.2", 84 | "vm": "github:jspm/nodelibs-vm@0.1.0" 85 | }, 86 | "npm:util@0.10.3": { 87 | "inherits": "npm:inherits@2.0.1", 88 | "process": "github:jspm/nodelibs-process@0.1.2" 89 | }, 90 | "npm:vm-browserify@0.0.4": { 91 | "indexof": "npm:indexof@0.0.1" 92 | } 93 | } 94 | }); 95 | -------------------------------------------------------------------------------- /dist/amd/aurelia-loader-default.js: -------------------------------------------------------------------------------- 1 | define(['exports', 'aurelia-loader', 'aurelia-pal', 'aurelia-metadata'], function (exports, _aureliaLoader, _aureliaPal, _aureliaMetadata) { 2 | 'use strict'; 3 | 4 | Object.defineProperty(exports, "__esModule", { 5 | value: true 6 | }); 7 | exports.DefaultLoader = exports.TextTemplateLoader = undefined; 8 | 9 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { 10 | return typeof obj; 11 | } : function (obj) { 12 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 13 | }; 14 | 15 | function _possibleConstructorReturn(self, call) { 16 | if (!self) { 17 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 18 | } 19 | 20 | return call && (typeof call === "object" || typeof call === "function") ? call : self; 21 | } 22 | 23 | function _inherits(subClass, superClass) { 24 | if (typeof superClass !== "function" && superClass !== null) { 25 | throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); 26 | } 27 | 28 | subClass.prototype = Object.create(superClass && superClass.prototype, { 29 | constructor: { 30 | value: subClass, 31 | enumerable: false, 32 | writable: true, 33 | configurable: true 34 | } 35 | }); 36 | if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; 37 | } 38 | 39 | 40 | 41 | var TextTemplateLoader = exports.TextTemplateLoader = function () { 42 | function TextTemplateLoader() { 43 | 44 | } 45 | 46 | TextTemplateLoader.prototype.loadTemplate = function loadTemplate(loader, entry) { 47 | return loader.loadText(entry.address).then(function (text) { 48 | entry.template = _aureliaPal.DOM.createTemplateFromMarkup(text); 49 | }); 50 | }; 51 | 52 | return TextTemplateLoader; 53 | }(); 54 | 55 | function ensureOriginOnExports(executed, name) { 56 | var target = executed; 57 | var key = void 0; 58 | var exportedValue = void 0; 59 | 60 | if (target.__useDefault) { 61 | target = target['default']; 62 | } 63 | 64 | _aureliaMetadata.Origin.set(target, new _aureliaMetadata.Origin(name, 'default')); 65 | 66 | for (key in target) { 67 | exportedValue = target[key]; 68 | 69 | if (typeof exportedValue === 'function') { 70 | _aureliaMetadata.Origin.set(exportedValue, new _aureliaMetadata.Origin(name, key)); 71 | } 72 | } 73 | 74 | return executed; 75 | } 76 | 77 | var DefaultLoader = exports.DefaultLoader = function (_Loader) { 78 | _inherits(DefaultLoader, _Loader); 79 | 80 | function DefaultLoader() { 81 | 82 | 83 | var _this = _possibleConstructorReturn(this, _Loader.call(this)); 84 | 85 | _this.textPluginName = 'text'; 86 | 87 | 88 | _this.moduleRegistry = Object.create(null); 89 | _this.useTemplateLoader(new TextTemplateLoader()); 90 | 91 | var that = _this; 92 | 93 | _this.addPlugin('template-registry-entry', { 94 | 'fetch': function fetch(address) { 95 | var entry = that.getOrCreateTemplateRegistryEntry(address); 96 | return entry.templateIsLoaded ? entry : that.templateLoader.loadTemplate(that, entry).then(function (x) { 97 | return entry; 98 | }); 99 | } 100 | }); 101 | return _this; 102 | } 103 | 104 | DefaultLoader.prototype.useTemplateLoader = function useTemplateLoader(templateLoader) { 105 | this.templateLoader = templateLoader; 106 | }; 107 | 108 | DefaultLoader.prototype.loadAllModules = function loadAllModules(ids) { 109 | var loads = []; 110 | 111 | for (var i = 0, ii = ids.length; i < ii; ++i) { 112 | loads.push(this.loadModule(ids[i])); 113 | } 114 | 115 | return Promise.all(loads); 116 | }; 117 | 118 | DefaultLoader.prototype.loadTemplate = function loadTemplate(url) { 119 | return this._import(this.applyPluginToUrl(url, 'template-registry-entry')); 120 | }; 121 | 122 | DefaultLoader.prototype.loadText = function loadText(url) { 123 | return this._import(this.applyPluginToUrl(url, this.textPluginName)).then(function (textOrModule) { 124 | if (typeof textOrModule === 'string') { 125 | return textOrModule; 126 | } 127 | 128 | return textOrModule['default']; 129 | }); 130 | }; 131 | 132 | return DefaultLoader; 133 | }(_aureliaLoader.Loader); 134 | 135 | _aureliaPal.PLATFORM.Loader = DefaultLoader; 136 | 137 | if (!_aureliaPal.PLATFORM.global.System || !_aureliaPal.PLATFORM.global.System.import) { 138 | if (_aureliaPal.PLATFORM.global.requirejs) { 139 | var getDefined = void 0; 140 | if (_typeof(_aureliaPal.PLATFORM.global.requirejs.s) === 'object') { 141 | getDefined = function getDefined() { 142 | return _aureliaPal.PLATFORM.global.requirejs.s.contexts._.defined; 143 | }; 144 | } else if (_typeof(_aureliaPal.PLATFORM.global.requirejs.contexts) === 'object') { 145 | getDefined = function getDefined() { 146 | return _aureliaPal.PLATFORM.global.requirejs.contexts._.defined; 147 | }; 148 | } else if (typeof _aureliaPal.PLATFORM.global.requirejs.definedValues === 'function') { 149 | getDefined = function getDefined() { 150 | return _aureliaPal.PLATFORM.global.requirejs.definedValues(); 151 | }; 152 | } else { 153 | getDefined = function getDefined() { 154 | return {}; 155 | }; 156 | } 157 | _aureliaPal.PLATFORM.eachModule = function (callback) { 158 | var defined = getDefined(); 159 | for (var key in defined) { 160 | try { 161 | if (callback(key, defined[key])) return; 162 | } catch (e) {} 163 | } 164 | }; 165 | } else { 166 | _aureliaPal.PLATFORM.eachModule = function (callback) {}; 167 | } 168 | 169 | DefaultLoader.prototype._import = function (moduleId) { 170 | return new Promise(function (resolve, reject) { 171 | _aureliaPal.PLATFORM.global.require([moduleId], resolve, reject); 172 | }); 173 | }; 174 | 175 | DefaultLoader.prototype.loadModule = function (id) { 176 | var _this2 = this; 177 | 178 | var existing = this.moduleRegistry[id]; 179 | if (existing !== undefined) { 180 | return Promise.resolve(existing); 181 | } 182 | 183 | return new Promise(function (resolve, reject) { 184 | _aureliaPal.PLATFORM.global.require([id], function (m) { 185 | _this2.moduleRegistry[id] = m; 186 | resolve(ensureOriginOnExports(m, id)); 187 | }, reject); 188 | }); 189 | }; 190 | 191 | DefaultLoader.prototype.map = function (id, source) {}; 192 | 193 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 194 | return Promise.resolve(moduleId); 195 | }; 196 | 197 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 198 | return moduleId; 199 | }; 200 | 201 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 202 | return pluginName + '!' + url; 203 | }; 204 | 205 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 206 | var nonAnonDefine = define; 207 | nonAnonDefine(pluginName, [], { 208 | 'load': function load(name, req, onload) { 209 | var result = implementation.fetch(name); 210 | Promise.resolve(result).then(onload); 211 | } 212 | }); 213 | }; 214 | } else { 215 | _aureliaPal.PLATFORM.eachModule = function (callback) { 216 | if (System.registry) { 217 | var keys = Array.from(System.registry.keys()); 218 | for (var i = 0; i < keys.length; i++) { 219 | try { 220 | var key = keys[i]; 221 | if (callback(key, System.registry.get(key))) { 222 | return; 223 | } 224 | } catch (e) {} 225 | } 226 | return; 227 | } 228 | 229 | var modules = System._loader.modules; 230 | 231 | for (var _key in modules) { 232 | try { 233 | if (callback(_key, modules[_key].module)) return; 234 | } catch (e) {} 235 | } 236 | }; 237 | 238 | DefaultLoader.prototype._import = function (moduleId) { 239 | return System.import(moduleId); 240 | }; 241 | 242 | DefaultLoader.prototype.loadModule = function (id) { 243 | var _this3 = this; 244 | 245 | return System.normalize(id).then(function (newId) { 246 | var existing = _this3.moduleRegistry[newId]; 247 | if (existing !== undefined) { 248 | return Promise.resolve(existing); 249 | } 250 | 251 | return System.import(newId).then(function (m) { 252 | _this3.moduleRegistry[newId] = m; 253 | return ensureOriginOnExports(m, newId); 254 | }); 255 | }); 256 | }; 257 | 258 | DefaultLoader.prototype.map = function (id, source) { 259 | var _map; 260 | 261 | System.config({ map: (_map = {}, _map[id] = source, _map) }); 262 | }; 263 | 264 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 265 | return System.normalizeSync(moduleId, relativeTo); 266 | }; 267 | 268 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 269 | return System.normalize(moduleId, relativeTo); 270 | }; 271 | 272 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 273 | return url + '!' + pluginName; 274 | }; 275 | 276 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 277 | System.set(pluginName, System.newModule({ 278 | 'fetch': function fetch(load, _fetch) { 279 | var result = implementation.fetch(load.address); 280 | return Promise.resolve(result).then(function (x) { 281 | load.metadata.result = x; 282 | return ''; 283 | }); 284 | }, 285 | 'instantiate': function instantiate(load) { 286 | return load.metadata.result; 287 | } 288 | })); 289 | }; 290 | } 291 | }); -------------------------------------------------------------------------------- /dist/amd/index.js: -------------------------------------------------------------------------------- 1 | define(['exports', './aurelia-loader-default'], function (exports, _aureliaLoaderDefault) { 2 | 'use strict'; 3 | 4 | Object.defineProperty(exports, "__esModule", { 5 | value: true 6 | }); 7 | Object.keys(_aureliaLoaderDefault).forEach(function (key) { 8 | if (key === "default" || key === "__esModule") return; 9 | Object.defineProperty(exports, key, { 10 | enumerable: true, 11 | get: function () { 12 | return _aureliaLoaderDefault[key]; 13 | } 14 | }); 15 | }); 16 | }); -------------------------------------------------------------------------------- /dist/aurelia-loader-default.d.ts: -------------------------------------------------------------------------------- 1 | import { 2 | TemplateRegistryEntry, 3 | Loader 4 | } from 'aurelia-loader'; 5 | import { 6 | DOM, 7 | PLATFORM 8 | } from 'aurelia-pal'; 9 | import { 10 | Origin 11 | } from 'aurelia-metadata'; 12 | 13 | /** 14 | * Represents a template loader. 15 | */ 16 | export declare interface TemplateLoader { 17 | 18 | /** 19 | * Loads a template. 20 | * @param loader The loader that is requesting the template load. 21 | * @param entry The TemplateRegistryEntry to load and populate with a template. 22 | * @return A promise which resolves when the TemplateRegistryEntry is loaded with a template. 23 | */ 24 | loadTemplate(loader: Loader, entry: TemplateRegistryEntry): Promise; 25 | } 26 | 27 | /** 28 | * An implementation of the TemplateLoader interface implemented with text-based loading. 29 | */ 30 | export declare class TextTemplateLoader { 31 | 32 | /** 33 | * Loads a template. 34 | * @param loader The loader that is requesting the template load. 35 | * @param entry The TemplateRegistryEntry to load and populate with a template. 36 | * @return A promise which resolves when the TemplateRegistryEntry is loaded with a template. 37 | */ 38 | loadTemplate(loader: Loader, entry: TemplateRegistryEntry): Promise; 39 | } 40 | 41 | /** 42 | * A default implementation of the Loader abstraction which works with SystemJS, RequireJS and Dojo Loader. 43 | */ 44 | /** 45 | * A default implementation of the Loader abstraction which works with SystemJS, RequireJS and Dojo Loader. 46 | */ 47 | export declare class DefaultLoader extends Loader { 48 | 49 | /** 50 | * The name of the underlying native loader plugin used to load text. 51 | */ 52 | textPluginName: string; 53 | 54 | /** 55 | * Creates an instance of the DefaultLoader. 56 | */ 57 | constructor(); 58 | 59 | /** 60 | * Instructs the loader to use a specific TemplateLoader instance for loading templates 61 | * @param templateLoader The instance of TemplateLoader to use for loading templates. 62 | */ 63 | useTemplateLoader(templateLoader: TemplateLoader): void; 64 | 65 | /** 66 | * Loads a collection of modules. 67 | * @param ids The set of module ids to load. 68 | * @return A Promise for an array of loaded modules. 69 | */ 70 | loadAllModules(ids: string[]): Promise; 71 | 72 | /** 73 | * Loads a template. 74 | * @param url The url of the template to load. 75 | * @return A Promise for a TemplateRegistryEntry containing the template. 76 | */ 77 | loadTemplate(url: string): Promise; 78 | 79 | /** 80 | * Loads a text-based resource. 81 | * @param url The url of the text file to load. 82 | * @return A Promise for text content. 83 | */ 84 | loadText(url: string): Promise; 85 | } -------------------------------------------------------------------------------- /dist/aurelia-loader-default.js: -------------------------------------------------------------------------------- 1 | import {TemplateRegistryEntry,Loader} from 'aurelia-loader'; 2 | import {DOM,PLATFORM} from 'aurelia-pal'; 3 | import {Origin} from 'aurelia-metadata'; 4 | 5 | /** 6 | * An implementation of the TemplateLoader interface implemented with text-based loading. 7 | */ 8 | export class TextTemplateLoader { 9 | /** 10 | * Loads a template. 11 | * @param loader The loader that is requesting the template load. 12 | * @param entry The TemplateRegistryEntry to load and populate with a template. 13 | * @return A promise which resolves when the TemplateRegistryEntry is loaded with a template. 14 | */ 15 | loadTemplate(loader: Loader, entry: TemplateRegistryEntry): Promise { 16 | return loader.loadText(entry.address).then(text => { 17 | entry.template = DOM.createTemplateFromMarkup(text); 18 | }); 19 | } 20 | } 21 | 22 | /*eslint dot-notation:0*/ 23 | function ensureOriginOnExports(executed, name) { 24 | let target = executed; 25 | let key; 26 | let exportedValue; 27 | 28 | if (target.__useDefault) { 29 | target = target['default']; 30 | } 31 | 32 | Origin.set(target, new Origin(name, 'default')); 33 | 34 | for (key in target) { 35 | exportedValue = target[key]; 36 | 37 | if (typeof exportedValue === 'function') { 38 | Origin.set(exportedValue, new Origin(name, key)); 39 | } 40 | } 41 | 42 | return executed; 43 | } 44 | 45 | /** 46 | * Represents a template loader. 47 | */ 48 | interface TemplateLoader { 49 | /** 50 | * Loads a template. 51 | * @param loader The loader that is requesting the template load. 52 | * @param entry The TemplateRegistryEntry to load and populate with a template. 53 | * @return A promise which resolves when the TemplateRegistryEntry is loaded with a template. 54 | */ 55 | loadTemplate(loader: Loader, entry: TemplateRegistryEntry): Promise; 56 | } 57 | 58 | /** 59 | * A default implementation of the Loader abstraction which works with SystemJS, RequireJS and Dojo Loader. 60 | */ 61 | export class DefaultLoader extends Loader { 62 | /** 63 | * The name of the underlying native loader plugin used to load text. 64 | */ 65 | textPluginName: string = 'text'; 66 | 67 | /** 68 | * Creates an instance of the DefaultLoader. 69 | */ 70 | constructor() { 71 | super(); 72 | 73 | this.moduleRegistry = Object.create(null); 74 | this.useTemplateLoader(new TextTemplateLoader()); 75 | 76 | let that = this; 77 | 78 | this.addPlugin('template-registry-entry', { 79 | 'fetch': function(address) { 80 | let entry = that.getOrCreateTemplateRegistryEntry(address); 81 | return entry.templateIsLoaded ? entry : that.templateLoader.loadTemplate(that, entry).then(x => entry); 82 | } 83 | }); 84 | } 85 | 86 | /** 87 | * Instructs the loader to use a specific TemplateLoader instance for loading templates 88 | * @param templateLoader The instance of TemplateLoader to use for loading templates. 89 | */ 90 | useTemplateLoader(templateLoader: TemplateLoader): void { 91 | this.templateLoader = templateLoader; 92 | } 93 | 94 | /** 95 | * Loads a collection of modules. 96 | * @param ids The set of module ids to load. 97 | * @return A Promise for an array of loaded modules. 98 | */ 99 | loadAllModules(ids: string[]): Promise { 100 | let loads = []; 101 | 102 | for (let i = 0, ii = ids.length; i < ii; ++i) { 103 | loads.push(this.loadModule(ids[i])); 104 | } 105 | 106 | return Promise.all(loads); 107 | } 108 | 109 | /** 110 | * Loads a template. 111 | * @param url The url of the template to load. 112 | * @return A Promise for a TemplateRegistryEntry containing the template. 113 | */ 114 | loadTemplate(url: string): Promise { 115 | return this._import(this.applyPluginToUrl(url, 'template-registry-entry')); 116 | } 117 | 118 | /** 119 | * Loads a text-based resource. 120 | * @param url The url of the text file to load. 121 | * @return A Promise for text content. 122 | */ 123 | loadText(url: string): Promise { 124 | return this._import(this.applyPluginToUrl(url, this.textPluginName)).then(textOrModule => { 125 | if (typeof textOrModule === 'string') { 126 | return textOrModule; 127 | } 128 | 129 | return textOrModule['default']; 130 | }); 131 | } 132 | } 133 | 134 | PLATFORM.Loader = DefaultLoader; 135 | 136 | if (!PLATFORM.global.System || !PLATFORM.global.System.import) { 137 | if (PLATFORM.global.requirejs) { 138 | let getDefined; 139 | if (typeof PLATFORM.global.requirejs.s === 'object') { 140 | // Support for requirejs/requirejs 141 | getDefined = () => PLATFORM.global.requirejs.s.contexts._.defined; 142 | } else if (typeof PLATFORM.global.requirejs.contexts === 'object') { 143 | // Support for requirejs/alameda 144 | getDefined = () => PLATFORM.global.requirejs.contexts._.defined; 145 | } else if (typeof PLATFORM.global.requirejs.definedValues === 'function') { 146 | // Support for dumberjs/dumber-module-loader 147 | getDefined = () => PLATFORM.global.requirejs.definedValues(); 148 | } else { 149 | // skip any unknown AMD loader 150 | getDefined = () => ({}); 151 | } 152 | PLATFORM.eachModule = function(callback) { 153 | const defined = getDefined(); 154 | for (let key in defined) { 155 | try { 156 | if (callback(key, defined[key])) return; 157 | } catch (e) {} 158 | } 159 | }; 160 | } else { 161 | PLATFORM.eachModule = function(callback) {}; 162 | } 163 | 164 | DefaultLoader.prototype._import = function(moduleId) { 165 | return new Promise((resolve, reject) => { 166 | PLATFORM.global.require([moduleId], resolve, reject); 167 | }); 168 | }; 169 | 170 | DefaultLoader.prototype.loadModule = function(id) { 171 | let existing = this.moduleRegistry[id]; 172 | if (existing !== undefined) { 173 | return Promise.resolve(existing); 174 | } 175 | 176 | return new Promise((resolve, reject) => { 177 | PLATFORM.global.require([id], m => { 178 | this.moduleRegistry[id] = m; 179 | resolve(ensureOriginOnExports(m, id)); 180 | }, reject); 181 | }); 182 | }; 183 | 184 | DefaultLoader.prototype.map = function(id, source) {}; 185 | 186 | DefaultLoader.prototype.normalize = function(moduleId, relativeTo) { 187 | return Promise.resolve(moduleId); 188 | }; 189 | 190 | DefaultLoader.prototype.normalizeSync = function(moduleId, relativeTo) { 191 | return moduleId; 192 | }; 193 | 194 | DefaultLoader.prototype.applyPluginToUrl = function(url, pluginName) { 195 | return `${pluginName}!${url}`; 196 | }; 197 | 198 | DefaultLoader.prototype.addPlugin = function(pluginName, implementation) { 199 | let nonAnonDefine = define; 200 | nonAnonDefine(pluginName, [], { 201 | 'load': function(name, req, onload) { 202 | let result = implementation.fetch(name); 203 | Promise.resolve(result).then(onload); 204 | } 205 | }); 206 | }; 207 | } else { 208 | PLATFORM.eachModule = function(callback) { 209 | if (System.registry) { // SystemJS >= 0.20.x 210 | const keys = Array.from(System.registry.keys()); 211 | for (let i = 0; i < keys.length; i++) { 212 | try { 213 | let key = keys[i]; 214 | if (callback(key, System.registry.get(key))) { return; } 215 | } catch (e) {} 216 | } 217 | return; 218 | } 219 | 220 | // SystemJS < 0.20.x 221 | let modules = System._loader.modules; 222 | 223 | for (let key in modules) { 224 | try { 225 | if (callback(key, modules[key].module)) return; 226 | } catch (e) {} 227 | } 228 | }; 229 | 230 | DefaultLoader.prototype._import = function(moduleId) { 231 | return System.import(moduleId); 232 | }; 233 | 234 | DefaultLoader.prototype.loadModule = function(id) { 235 | return System.normalize(id).then(newId => { 236 | let existing = this.moduleRegistry[newId]; 237 | if (existing !== undefined) { 238 | return Promise.resolve(existing); 239 | } 240 | 241 | return System.import(newId).then(m => { 242 | this.moduleRegistry[newId] = m; 243 | return ensureOriginOnExports(m, newId); 244 | }); 245 | }); 246 | }; 247 | 248 | DefaultLoader.prototype.map = function(id, source) { 249 | System.config({ map: { [id]: source } }); 250 | }; 251 | 252 | DefaultLoader.prototype.normalizeSync = function(moduleId, relativeTo) { 253 | return System.normalizeSync(moduleId, relativeTo); 254 | }; 255 | 256 | DefaultLoader.prototype.normalize = function(moduleId, relativeTo) { 257 | return System.normalize(moduleId, relativeTo); 258 | }; 259 | 260 | DefaultLoader.prototype.applyPluginToUrl = function(url, pluginName) { 261 | return `${url}!${pluginName}`; 262 | }; 263 | 264 | DefaultLoader.prototype.addPlugin = function(pluginName, implementation) { 265 | System.set(pluginName, System.newModule({ 266 | 'fetch': function(load, _fetch) { 267 | let result = implementation.fetch(load.address); 268 | return Promise.resolve(result).then(x => { 269 | load.metadata.result = x; 270 | return ''; 271 | }); 272 | }, 273 | 'instantiate': function(load) { 274 | return load.metadata.result; 275 | } 276 | })); 277 | }; 278 | } 279 | -------------------------------------------------------------------------------- /dist/commonjs/aurelia-loader-default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.DefaultLoader = exports.TextTemplateLoader = undefined; 7 | 8 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 9 | 10 | var _aureliaLoader = require('aurelia-loader'); 11 | 12 | var _aureliaPal = require('aurelia-pal'); 13 | 14 | var _aureliaMetadata = require('aurelia-metadata'); 15 | 16 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 17 | 18 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 19 | 20 | 21 | 22 | var TextTemplateLoader = exports.TextTemplateLoader = function () { 23 | function TextTemplateLoader() { 24 | 25 | } 26 | 27 | TextTemplateLoader.prototype.loadTemplate = function loadTemplate(loader, entry) { 28 | return loader.loadText(entry.address).then(function (text) { 29 | entry.template = _aureliaPal.DOM.createTemplateFromMarkup(text); 30 | }); 31 | }; 32 | 33 | return TextTemplateLoader; 34 | }(); 35 | 36 | function ensureOriginOnExports(executed, name) { 37 | var target = executed; 38 | var key = void 0; 39 | var exportedValue = void 0; 40 | 41 | if (target.__useDefault) { 42 | target = target['default']; 43 | } 44 | 45 | _aureliaMetadata.Origin.set(target, new _aureliaMetadata.Origin(name, 'default')); 46 | 47 | for (key in target) { 48 | exportedValue = target[key]; 49 | 50 | if (typeof exportedValue === 'function') { 51 | _aureliaMetadata.Origin.set(exportedValue, new _aureliaMetadata.Origin(name, key)); 52 | } 53 | } 54 | 55 | return executed; 56 | } 57 | 58 | var DefaultLoader = exports.DefaultLoader = function (_Loader) { 59 | _inherits(DefaultLoader, _Loader); 60 | 61 | function DefaultLoader() { 62 | 63 | 64 | var _this = _possibleConstructorReturn(this, _Loader.call(this)); 65 | 66 | _this.textPluginName = 'text'; 67 | 68 | 69 | _this.moduleRegistry = Object.create(null); 70 | _this.useTemplateLoader(new TextTemplateLoader()); 71 | 72 | var that = _this; 73 | 74 | _this.addPlugin('template-registry-entry', { 75 | 'fetch': function fetch(address) { 76 | var entry = that.getOrCreateTemplateRegistryEntry(address); 77 | return entry.templateIsLoaded ? entry : that.templateLoader.loadTemplate(that, entry).then(function (x) { 78 | return entry; 79 | }); 80 | } 81 | }); 82 | return _this; 83 | } 84 | 85 | DefaultLoader.prototype.useTemplateLoader = function useTemplateLoader(templateLoader) { 86 | this.templateLoader = templateLoader; 87 | }; 88 | 89 | DefaultLoader.prototype.loadAllModules = function loadAllModules(ids) { 90 | var loads = []; 91 | 92 | for (var i = 0, ii = ids.length; i < ii; ++i) { 93 | loads.push(this.loadModule(ids[i])); 94 | } 95 | 96 | return Promise.all(loads); 97 | }; 98 | 99 | DefaultLoader.prototype.loadTemplate = function loadTemplate(url) { 100 | return this._import(this.applyPluginToUrl(url, 'template-registry-entry')); 101 | }; 102 | 103 | DefaultLoader.prototype.loadText = function loadText(url) { 104 | return this._import(this.applyPluginToUrl(url, this.textPluginName)).then(function (textOrModule) { 105 | if (typeof textOrModule === 'string') { 106 | return textOrModule; 107 | } 108 | 109 | return textOrModule['default']; 110 | }); 111 | }; 112 | 113 | return DefaultLoader; 114 | }(_aureliaLoader.Loader); 115 | 116 | _aureliaPal.PLATFORM.Loader = DefaultLoader; 117 | 118 | if (!_aureliaPal.PLATFORM.global.System || !_aureliaPal.PLATFORM.global.System.import) { 119 | if (_aureliaPal.PLATFORM.global.requirejs) { 120 | var getDefined = void 0; 121 | if (_typeof(_aureliaPal.PLATFORM.global.requirejs.s) === 'object') { 122 | getDefined = function getDefined() { 123 | return _aureliaPal.PLATFORM.global.requirejs.s.contexts._.defined; 124 | }; 125 | } else if (_typeof(_aureliaPal.PLATFORM.global.requirejs.contexts) === 'object') { 126 | getDefined = function getDefined() { 127 | return _aureliaPal.PLATFORM.global.requirejs.contexts._.defined; 128 | }; 129 | } else if (typeof _aureliaPal.PLATFORM.global.requirejs.definedValues === 'function') { 130 | getDefined = function getDefined() { 131 | return _aureliaPal.PLATFORM.global.requirejs.definedValues(); 132 | }; 133 | } else { 134 | getDefined = function getDefined() { 135 | return {}; 136 | }; 137 | } 138 | _aureliaPal.PLATFORM.eachModule = function (callback) { 139 | var defined = getDefined(); 140 | for (var key in defined) { 141 | try { 142 | if (callback(key, defined[key])) return; 143 | } catch (e) {} 144 | } 145 | }; 146 | } else { 147 | _aureliaPal.PLATFORM.eachModule = function (callback) {}; 148 | } 149 | 150 | DefaultLoader.prototype._import = function (moduleId) { 151 | return new Promise(function (resolve, reject) { 152 | _aureliaPal.PLATFORM.global.require([moduleId], resolve, reject); 153 | }); 154 | }; 155 | 156 | DefaultLoader.prototype.loadModule = function (id) { 157 | var _this2 = this; 158 | 159 | var existing = this.moduleRegistry[id]; 160 | if (existing !== undefined) { 161 | return Promise.resolve(existing); 162 | } 163 | 164 | return new Promise(function (resolve, reject) { 165 | _aureliaPal.PLATFORM.global.require([id], function (m) { 166 | _this2.moduleRegistry[id] = m; 167 | resolve(ensureOriginOnExports(m, id)); 168 | }, reject); 169 | }); 170 | }; 171 | 172 | DefaultLoader.prototype.map = function (id, source) {}; 173 | 174 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 175 | return Promise.resolve(moduleId); 176 | }; 177 | 178 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 179 | return moduleId; 180 | }; 181 | 182 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 183 | return pluginName + '!' + url; 184 | }; 185 | 186 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 187 | var nonAnonDefine = define; 188 | nonAnonDefine(pluginName, [], { 189 | 'load': function load(name, req, onload) { 190 | var result = implementation.fetch(name); 191 | Promise.resolve(result).then(onload); 192 | } 193 | }); 194 | }; 195 | } else { 196 | _aureliaPal.PLATFORM.eachModule = function (callback) { 197 | if (System.registry) { 198 | var keys = Array.from(System.registry.keys()); 199 | for (var i = 0; i < keys.length; i++) { 200 | try { 201 | var key = keys[i]; 202 | if (callback(key, System.registry.get(key))) { 203 | return; 204 | } 205 | } catch (e) {} 206 | } 207 | return; 208 | } 209 | 210 | var modules = System._loader.modules; 211 | 212 | for (var _key in modules) { 213 | try { 214 | if (callback(_key, modules[_key].module)) return; 215 | } catch (e) {} 216 | } 217 | }; 218 | 219 | DefaultLoader.prototype._import = function (moduleId) { 220 | return System.import(moduleId); 221 | }; 222 | 223 | DefaultLoader.prototype.loadModule = function (id) { 224 | var _this3 = this; 225 | 226 | return System.normalize(id).then(function (newId) { 227 | var existing = _this3.moduleRegistry[newId]; 228 | if (existing !== undefined) { 229 | return Promise.resolve(existing); 230 | } 231 | 232 | return System.import(newId).then(function (m) { 233 | _this3.moduleRegistry[newId] = m; 234 | return ensureOriginOnExports(m, newId); 235 | }); 236 | }); 237 | }; 238 | 239 | DefaultLoader.prototype.map = function (id, source) { 240 | var _map; 241 | 242 | System.config({ map: (_map = {}, _map[id] = source, _map) }); 243 | }; 244 | 245 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 246 | return System.normalizeSync(moduleId, relativeTo); 247 | }; 248 | 249 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 250 | return System.normalize(moduleId, relativeTo); 251 | }; 252 | 253 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 254 | return url + '!' + pluginName; 255 | }; 256 | 257 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 258 | System.set(pluginName, System.newModule({ 259 | 'fetch': function fetch(load, _fetch) { 260 | var result = implementation.fetch(load.address); 261 | return Promise.resolve(result).then(function (x) { 262 | load.metadata.result = x; 263 | return ''; 264 | }); 265 | }, 266 | 'instantiate': function instantiate(load) { 267 | return load.metadata.result; 268 | } 269 | })); 270 | }; 271 | } -------------------------------------------------------------------------------- /dist/commonjs/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _aureliaLoaderDefault = require('./aurelia-loader-default'); 8 | 9 | Object.keys(_aureliaLoaderDefault).forEach(function (key) { 10 | if (key === "default" || key === "__esModule") return; 11 | Object.defineProperty(exports, key, { 12 | enumerable: true, 13 | get: function get() { 14 | return _aureliaLoaderDefault[key]; 15 | } 16 | }); 17 | }); -------------------------------------------------------------------------------- /dist/es2015/aurelia-loader-default.js: -------------------------------------------------------------------------------- 1 | import { TemplateRegistryEntry, Loader } from 'aurelia-loader'; 2 | import { DOM, PLATFORM } from 'aurelia-pal'; 3 | import { Origin } from 'aurelia-metadata'; 4 | 5 | export let TextTemplateLoader = class TextTemplateLoader { 6 | loadTemplate(loader, entry) { 7 | return loader.loadText(entry.address).then(text => { 8 | entry.template = DOM.createTemplateFromMarkup(text); 9 | }); 10 | } 11 | }; 12 | 13 | function ensureOriginOnExports(executed, name) { 14 | let target = executed; 15 | let key; 16 | let exportedValue; 17 | 18 | if (target.__useDefault) { 19 | target = target['default']; 20 | } 21 | 22 | Origin.set(target, new Origin(name, 'default')); 23 | 24 | for (key in target) { 25 | exportedValue = target[key]; 26 | 27 | if (typeof exportedValue === 'function') { 28 | Origin.set(exportedValue, new Origin(name, key)); 29 | } 30 | } 31 | 32 | return executed; 33 | } 34 | 35 | export let DefaultLoader = class DefaultLoader extends Loader { 36 | constructor() { 37 | super(); 38 | 39 | this.textPluginName = 'text'; 40 | this.moduleRegistry = Object.create(null); 41 | this.useTemplateLoader(new TextTemplateLoader()); 42 | 43 | let that = this; 44 | 45 | this.addPlugin('template-registry-entry', { 46 | 'fetch': function (address) { 47 | let entry = that.getOrCreateTemplateRegistryEntry(address); 48 | return entry.templateIsLoaded ? entry : that.templateLoader.loadTemplate(that, entry).then(x => entry); 49 | } 50 | }); 51 | } 52 | 53 | useTemplateLoader(templateLoader) { 54 | this.templateLoader = templateLoader; 55 | } 56 | 57 | loadAllModules(ids) { 58 | let loads = []; 59 | 60 | for (let i = 0, ii = ids.length; i < ii; ++i) { 61 | loads.push(this.loadModule(ids[i])); 62 | } 63 | 64 | return Promise.all(loads); 65 | } 66 | 67 | loadTemplate(url) { 68 | return this._import(this.applyPluginToUrl(url, 'template-registry-entry')); 69 | } 70 | 71 | loadText(url) { 72 | return this._import(this.applyPluginToUrl(url, this.textPluginName)).then(textOrModule => { 73 | if (typeof textOrModule === 'string') { 74 | return textOrModule; 75 | } 76 | 77 | return textOrModule['default']; 78 | }); 79 | } 80 | }; 81 | 82 | PLATFORM.Loader = DefaultLoader; 83 | 84 | if (!PLATFORM.global.System || !PLATFORM.global.System.import) { 85 | if (PLATFORM.global.requirejs) { 86 | let getDefined; 87 | if (typeof PLATFORM.global.requirejs.s === 'object') { 88 | getDefined = () => PLATFORM.global.requirejs.s.contexts._.defined; 89 | } else if (typeof PLATFORM.global.requirejs.contexts === 'object') { 90 | getDefined = () => PLATFORM.global.requirejs.contexts._.defined; 91 | } else if (typeof PLATFORM.global.requirejs.definedValues === 'function') { 92 | getDefined = () => PLATFORM.global.requirejs.definedValues(); 93 | } else { 94 | getDefined = () => ({}); 95 | } 96 | PLATFORM.eachModule = function (callback) { 97 | const defined = getDefined(); 98 | for (let key in defined) { 99 | try { 100 | if (callback(key, defined[key])) return; 101 | } catch (e) {} 102 | } 103 | }; 104 | } else { 105 | PLATFORM.eachModule = function (callback) {}; 106 | } 107 | 108 | DefaultLoader.prototype._import = function (moduleId) { 109 | return new Promise((resolve, reject) => { 110 | PLATFORM.global.require([moduleId], resolve, reject); 111 | }); 112 | }; 113 | 114 | DefaultLoader.prototype.loadModule = function (id) { 115 | let existing = this.moduleRegistry[id]; 116 | if (existing !== undefined) { 117 | return Promise.resolve(existing); 118 | } 119 | 120 | return new Promise((resolve, reject) => { 121 | PLATFORM.global.require([id], m => { 122 | this.moduleRegistry[id] = m; 123 | resolve(ensureOriginOnExports(m, id)); 124 | }, reject); 125 | }); 126 | }; 127 | 128 | DefaultLoader.prototype.map = function (id, source) {}; 129 | 130 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 131 | return Promise.resolve(moduleId); 132 | }; 133 | 134 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 135 | return moduleId; 136 | }; 137 | 138 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 139 | return `${pluginName}!${url}`; 140 | }; 141 | 142 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 143 | let nonAnonDefine = define; 144 | nonAnonDefine(pluginName, [], { 145 | 'load': function (name, req, onload) { 146 | let result = implementation.fetch(name); 147 | Promise.resolve(result).then(onload); 148 | } 149 | }); 150 | }; 151 | } else { 152 | PLATFORM.eachModule = function (callback) { 153 | if (System.registry) { 154 | const keys = Array.from(System.registry.keys()); 155 | for (let i = 0; i < keys.length; i++) { 156 | try { 157 | let key = keys[i]; 158 | if (callback(key, System.registry.get(key))) { 159 | return; 160 | } 161 | } catch (e) {} 162 | } 163 | return; 164 | } 165 | 166 | let modules = System._loader.modules; 167 | 168 | for (let key in modules) { 169 | try { 170 | if (callback(key, modules[key].module)) return; 171 | } catch (e) {} 172 | } 173 | }; 174 | 175 | DefaultLoader.prototype._import = function (moduleId) { 176 | return System.import(moduleId); 177 | }; 178 | 179 | DefaultLoader.prototype.loadModule = function (id) { 180 | return System.normalize(id).then(newId => { 181 | let existing = this.moduleRegistry[newId]; 182 | if (existing !== undefined) { 183 | return Promise.resolve(existing); 184 | } 185 | 186 | return System.import(newId).then(m => { 187 | this.moduleRegistry[newId] = m; 188 | return ensureOriginOnExports(m, newId); 189 | }); 190 | }); 191 | }; 192 | 193 | DefaultLoader.prototype.map = function (id, source) { 194 | System.config({ map: { [id]: source } }); 195 | }; 196 | 197 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 198 | return System.normalizeSync(moduleId, relativeTo); 199 | }; 200 | 201 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 202 | return System.normalize(moduleId, relativeTo); 203 | }; 204 | 205 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 206 | return `${url}!${pluginName}`; 207 | }; 208 | 209 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 210 | System.set(pluginName, System.newModule({ 211 | 'fetch': function (load, _fetch) { 212 | let result = implementation.fetch(load.address); 213 | return Promise.resolve(result).then(x => { 214 | load.metadata.result = x; 215 | return ''; 216 | }); 217 | }, 218 | 'instantiate': function (load) { 219 | return load.metadata.result; 220 | } 221 | })); 222 | }; 223 | } -------------------------------------------------------------------------------- /dist/es2015/index.js: -------------------------------------------------------------------------------- 1 | export * from './aurelia-loader-default'; -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from 'aurelia-loader-default/aurelia-loader-default'; -------------------------------------------------------------------------------- /dist/native-modules/aurelia-loader-default.js: -------------------------------------------------------------------------------- 1 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 2 | 3 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 4 | 5 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 6 | 7 | 8 | 9 | import { TemplateRegistryEntry, Loader } from 'aurelia-loader'; 10 | import { DOM, PLATFORM } from 'aurelia-pal'; 11 | import { Origin } from 'aurelia-metadata'; 12 | 13 | export var TextTemplateLoader = function () { 14 | function TextTemplateLoader() { 15 | 16 | } 17 | 18 | TextTemplateLoader.prototype.loadTemplate = function loadTemplate(loader, entry) { 19 | return loader.loadText(entry.address).then(function (text) { 20 | entry.template = DOM.createTemplateFromMarkup(text); 21 | }); 22 | }; 23 | 24 | return TextTemplateLoader; 25 | }(); 26 | 27 | function ensureOriginOnExports(executed, name) { 28 | var target = executed; 29 | var key = void 0; 30 | var exportedValue = void 0; 31 | 32 | if (target.__useDefault) { 33 | target = target['default']; 34 | } 35 | 36 | Origin.set(target, new Origin(name, 'default')); 37 | 38 | for (key in target) { 39 | exportedValue = target[key]; 40 | 41 | if (typeof exportedValue === 'function') { 42 | Origin.set(exportedValue, new Origin(name, key)); 43 | } 44 | } 45 | 46 | return executed; 47 | } 48 | 49 | export var DefaultLoader = function (_Loader) { 50 | _inherits(DefaultLoader, _Loader); 51 | 52 | function DefaultLoader() { 53 | 54 | 55 | var _this = _possibleConstructorReturn(this, _Loader.call(this)); 56 | 57 | _this.textPluginName = 'text'; 58 | 59 | 60 | _this.moduleRegistry = Object.create(null); 61 | _this.useTemplateLoader(new TextTemplateLoader()); 62 | 63 | var that = _this; 64 | 65 | _this.addPlugin('template-registry-entry', { 66 | 'fetch': function fetch(address) { 67 | var entry = that.getOrCreateTemplateRegistryEntry(address); 68 | return entry.templateIsLoaded ? entry : that.templateLoader.loadTemplate(that, entry).then(function (x) { 69 | return entry; 70 | }); 71 | } 72 | }); 73 | return _this; 74 | } 75 | 76 | DefaultLoader.prototype.useTemplateLoader = function useTemplateLoader(templateLoader) { 77 | this.templateLoader = templateLoader; 78 | }; 79 | 80 | DefaultLoader.prototype.loadAllModules = function loadAllModules(ids) { 81 | var loads = []; 82 | 83 | for (var i = 0, ii = ids.length; i < ii; ++i) { 84 | loads.push(this.loadModule(ids[i])); 85 | } 86 | 87 | return Promise.all(loads); 88 | }; 89 | 90 | DefaultLoader.prototype.loadTemplate = function loadTemplate(url) { 91 | return this._import(this.applyPluginToUrl(url, 'template-registry-entry')); 92 | }; 93 | 94 | DefaultLoader.prototype.loadText = function loadText(url) { 95 | return this._import(this.applyPluginToUrl(url, this.textPluginName)).then(function (textOrModule) { 96 | if (typeof textOrModule === 'string') { 97 | return textOrModule; 98 | } 99 | 100 | return textOrModule['default']; 101 | }); 102 | }; 103 | 104 | return DefaultLoader; 105 | }(Loader); 106 | 107 | PLATFORM.Loader = DefaultLoader; 108 | 109 | if (!PLATFORM.global.System || !PLATFORM.global.System.import) { 110 | if (PLATFORM.global.requirejs) { 111 | var getDefined = void 0; 112 | if (_typeof(PLATFORM.global.requirejs.s) === 'object') { 113 | getDefined = function getDefined() { 114 | return PLATFORM.global.requirejs.s.contexts._.defined; 115 | }; 116 | } else if (_typeof(PLATFORM.global.requirejs.contexts) === 'object') { 117 | getDefined = function getDefined() { 118 | return PLATFORM.global.requirejs.contexts._.defined; 119 | }; 120 | } else if (typeof PLATFORM.global.requirejs.definedValues === 'function') { 121 | getDefined = function getDefined() { 122 | return PLATFORM.global.requirejs.definedValues(); 123 | }; 124 | } else { 125 | getDefined = function getDefined() { 126 | return {}; 127 | }; 128 | } 129 | PLATFORM.eachModule = function (callback) { 130 | var defined = getDefined(); 131 | for (var key in defined) { 132 | try { 133 | if (callback(key, defined[key])) return; 134 | } catch (e) {} 135 | } 136 | }; 137 | } else { 138 | PLATFORM.eachModule = function (callback) {}; 139 | } 140 | 141 | DefaultLoader.prototype._import = function (moduleId) { 142 | return new Promise(function (resolve, reject) { 143 | PLATFORM.global.require([moduleId], resolve, reject); 144 | }); 145 | }; 146 | 147 | DefaultLoader.prototype.loadModule = function (id) { 148 | var _this2 = this; 149 | 150 | var existing = this.moduleRegistry[id]; 151 | if (existing !== undefined) { 152 | return Promise.resolve(existing); 153 | } 154 | 155 | return new Promise(function (resolve, reject) { 156 | PLATFORM.global.require([id], function (m) { 157 | _this2.moduleRegistry[id] = m; 158 | resolve(ensureOriginOnExports(m, id)); 159 | }, reject); 160 | }); 161 | }; 162 | 163 | DefaultLoader.prototype.map = function (id, source) {}; 164 | 165 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 166 | return Promise.resolve(moduleId); 167 | }; 168 | 169 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 170 | return moduleId; 171 | }; 172 | 173 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 174 | return pluginName + '!' + url; 175 | }; 176 | 177 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 178 | var nonAnonDefine = define; 179 | nonAnonDefine(pluginName, [], { 180 | 'load': function load(name, req, onload) { 181 | var result = implementation.fetch(name); 182 | Promise.resolve(result).then(onload); 183 | } 184 | }); 185 | }; 186 | } else { 187 | PLATFORM.eachModule = function (callback) { 188 | if (System.registry) { 189 | var keys = Array.from(System.registry.keys()); 190 | for (var i = 0; i < keys.length; i++) { 191 | try { 192 | var key = keys[i]; 193 | if (callback(key, System.registry.get(key))) { 194 | return; 195 | } 196 | } catch (e) {} 197 | } 198 | return; 199 | } 200 | 201 | var modules = System._loader.modules; 202 | 203 | for (var _key in modules) { 204 | try { 205 | if (callback(_key, modules[_key].module)) return; 206 | } catch (e) {} 207 | } 208 | }; 209 | 210 | DefaultLoader.prototype._import = function (moduleId) { 211 | return System.import(moduleId); 212 | }; 213 | 214 | DefaultLoader.prototype.loadModule = function (id) { 215 | var _this3 = this; 216 | 217 | return System.normalize(id).then(function (newId) { 218 | var existing = _this3.moduleRegistry[newId]; 219 | if (existing !== undefined) { 220 | return Promise.resolve(existing); 221 | } 222 | 223 | return System.import(newId).then(function (m) { 224 | _this3.moduleRegistry[newId] = m; 225 | return ensureOriginOnExports(m, newId); 226 | }); 227 | }); 228 | }; 229 | 230 | DefaultLoader.prototype.map = function (id, source) { 231 | var _map; 232 | 233 | System.config({ map: (_map = {}, _map[id] = source, _map) }); 234 | }; 235 | 236 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 237 | return System.normalizeSync(moduleId, relativeTo); 238 | }; 239 | 240 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 241 | return System.normalize(moduleId, relativeTo); 242 | }; 243 | 244 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 245 | return url + '!' + pluginName; 246 | }; 247 | 248 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 249 | System.set(pluginName, System.newModule({ 250 | 'fetch': function fetch(load, _fetch) { 251 | var result = implementation.fetch(load.address); 252 | return Promise.resolve(result).then(function (x) { 253 | load.metadata.result = x; 254 | return ''; 255 | }); 256 | }, 257 | 'instantiate': function instantiate(load) { 258 | return load.metadata.result; 259 | } 260 | })); 261 | }; 262 | } -------------------------------------------------------------------------------- /dist/native-modules/index.js: -------------------------------------------------------------------------------- 1 | export * from './aurelia-loader-default'; -------------------------------------------------------------------------------- /dist/system/aurelia-loader-default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register(['aurelia-loader', 'aurelia-pal', 'aurelia-metadata'], function (_export, _context) { 4 | "use strict"; 5 | 6 | var TemplateRegistryEntry, Loader, DOM, PLATFORM, Origin, _typeof, TextTemplateLoader, DefaultLoader, getDefined; 7 | 8 | function _possibleConstructorReturn(self, call) { 9 | if (!self) { 10 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 11 | } 12 | 13 | return call && (typeof call === "object" || typeof call === "function") ? call : self; 14 | } 15 | 16 | function _inherits(subClass, superClass) { 17 | if (typeof superClass !== "function" && superClass !== null) { 18 | throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); 19 | } 20 | 21 | subClass.prototype = Object.create(superClass && superClass.prototype, { 22 | constructor: { 23 | value: subClass, 24 | enumerable: false, 25 | writable: true, 26 | configurable: true 27 | } 28 | }); 29 | if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; 30 | } 31 | 32 | 33 | 34 | function ensureOriginOnExports(executed, name) { 35 | var target = executed; 36 | var key = void 0; 37 | var exportedValue = void 0; 38 | 39 | if (target.__useDefault) { 40 | target = target['default']; 41 | } 42 | 43 | Origin.set(target, new Origin(name, 'default')); 44 | 45 | for (key in target) { 46 | exportedValue = target[key]; 47 | 48 | if (typeof exportedValue === 'function') { 49 | Origin.set(exportedValue, new Origin(name, key)); 50 | } 51 | } 52 | 53 | return executed; 54 | } 55 | 56 | return { 57 | setters: [function (_aureliaLoader) { 58 | TemplateRegistryEntry = _aureliaLoader.TemplateRegistryEntry; 59 | Loader = _aureliaLoader.Loader; 60 | }, function (_aureliaPal) { 61 | DOM = _aureliaPal.DOM; 62 | PLATFORM = _aureliaPal.PLATFORM; 63 | }, function (_aureliaMetadata) { 64 | Origin = _aureliaMetadata.Origin; 65 | }], 66 | execute: function () { 67 | _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { 68 | return typeof obj; 69 | } : function (obj) { 70 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 71 | }; 72 | 73 | _export('TextTemplateLoader', TextTemplateLoader = function () { 74 | function TextTemplateLoader() { 75 | 76 | } 77 | 78 | TextTemplateLoader.prototype.loadTemplate = function loadTemplate(loader, entry) { 79 | return loader.loadText(entry.address).then(function (text) { 80 | entry.template = DOM.createTemplateFromMarkup(text); 81 | }); 82 | }; 83 | 84 | return TextTemplateLoader; 85 | }()); 86 | 87 | _export('TextTemplateLoader', TextTemplateLoader); 88 | 89 | _export('DefaultLoader', DefaultLoader = function (_Loader) { 90 | _inherits(DefaultLoader, _Loader); 91 | 92 | function DefaultLoader() { 93 | 94 | 95 | var _this = _possibleConstructorReturn(this, _Loader.call(this)); 96 | 97 | _this.textPluginName = 'text'; 98 | 99 | 100 | _this.moduleRegistry = Object.create(null); 101 | _this.useTemplateLoader(new TextTemplateLoader()); 102 | 103 | var that = _this; 104 | 105 | _this.addPlugin('template-registry-entry', { 106 | 'fetch': function fetch(address) { 107 | var entry = that.getOrCreateTemplateRegistryEntry(address); 108 | return entry.templateIsLoaded ? entry : that.templateLoader.loadTemplate(that, entry).then(function (x) { 109 | return entry; 110 | }); 111 | } 112 | }); 113 | return _this; 114 | } 115 | 116 | DefaultLoader.prototype.useTemplateLoader = function useTemplateLoader(templateLoader) { 117 | this.templateLoader = templateLoader; 118 | }; 119 | 120 | DefaultLoader.prototype.loadAllModules = function loadAllModules(ids) { 121 | var loads = []; 122 | 123 | for (var i = 0, ii = ids.length; i < ii; ++i) { 124 | loads.push(this.loadModule(ids[i])); 125 | } 126 | 127 | return Promise.all(loads); 128 | }; 129 | 130 | DefaultLoader.prototype.loadTemplate = function loadTemplate(url) { 131 | return this._import(this.applyPluginToUrl(url, 'template-registry-entry')); 132 | }; 133 | 134 | DefaultLoader.prototype.loadText = function loadText(url) { 135 | return this._import(this.applyPluginToUrl(url, this.textPluginName)).then(function (textOrModule) { 136 | if (typeof textOrModule === 'string') { 137 | return textOrModule; 138 | } 139 | 140 | return textOrModule['default']; 141 | }); 142 | }; 143 | 144 | return DefaultLoader; 145 | }(Loader)); 146 | 147 | _export('DefaultLoader', DefaultLoader); 148 | 149 | PLATFORM.Loader = DefaultLoader; 150 | 151 | if (!PLATFORM.global.System || !PLATFORM.global.System.import) { 152 | if (PLATFORM.global.requirejs) { 153 | getDefined = void 0; 154 | 155 | if (_typeof(PLATFORM.global.requirejs.s) === 'object') { 156 | getDefined = function getDefined() { 157 | return PLATFORM.global.requirejs.s.contexts._.defined; 158 | }; 159 | } else if (_typeof(PLATFORM.global.requirejs.contexts) === 'object') { 160 | getDefined = function getDefined() { 161 | return PLATFORM.global.requirejs.contexts._.defined; 162 | }; 163 | } else if (typeof PLATFORM.global.requirejs.definedValues === 'function') { 164 | getDefined = function getDefined() { 165 | return PLATFORM.global.requirejs.definedValues(); 166 | }; 167 | } else { 168 | getDefined = function getDefined() { 169 | return {}; 170 | }; 171 | } 172 | PLATFORM.eachModule = function (callback) { 173 | var defined = getDefined(); 174 | for (var key in defined) { 175 | try { 176 | if (callback(key, defined[key])) return; 177 | } catch (e) {} 178 | } 179 | }; 180 | } else { 181 | PLATFORM.eachModule = function (callback) {}; 182 | } 183 | 184 | DefaultLoader.prototype._import = function (moduleId) { 185 | return new Promise(function (resolve, reject) { 186 | PLATFORM.global.require([moduleId], resolve, reject); 187 | }); 188 | }; 189 | 190 | DefaultLoader.prototype.loadModule = function (id) { 191 | var _this2 = this; 192 | 193 | var existing = this.moduleRegistry[id]; 194 | if (existing !== undefined) { 195 | return Promise.resolve(existing); 196 | } 197 | 198 | return new Promise(function (resolve, reject) { 199 | PLATFORM.global.require([id], function (m) { 200 | _this2.moduleRegistry[id] = m; 201 | resolve(ensureOriginOnExports(m, id)); 202 | }, reject); 203 | }); 204 | }; 205 | 206 | DefaultLoader.prototype.map = function (id, source) {}; 207 | 208 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 209 | return Promise.resolve(moduleId); 210 | }; 211 | 212 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 213 | return moduleId; 214 | }; 215 | 216 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 217 | return pluginName + '!' + url; 218 | }; 219 | 220 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 221 | var nonAnonDefine = define; 222 | nonAnonDefine(pluginName, [], { 223 | 'load': function load(name, req, onload) { 224 | var result = implementation.fetch(name); 225 | Promise.resolve(result).then(onload); 226 | } 227 | }); 228 | }; 229 | } else { 230 | PLATFORM.eachModule = function (callback) { 231 | if (System.registry) { 232 | var keys = Array.from(System.registry.keys()); 233 | for (var i = 0; i < keys.length; i++) { 234 | try { 235 | var key = keys[i]; 236 | if (callback(key, System.registry.get(key))) { 237 | return; 238 | } 239 | } catch (e) {} 240 | } 241 | return; 242 | } 243 | 244 | var modules = System._loader.modules; 245 | 246 | for (var _key in modules) { 247 | try { 248 | if (callback(_key, modules[_key].module)) return; 249 | } catch (e) {} 250 | } 251 | }; 252 | 253 | DefaultLoader.prototype._import = function (moduleId) { 254 | return System.import(moduleId); 255 | }; 256 | 257 | DefaultLoader.prototype.loadModule = function (id) { 258 | var _this3 = this; 259 | 260 | return System.normalize(id).then(function (newId) { 261 | var existing = _this3.moduleRegistry[newId]; 262 | if (existing !== undefined) { 263 | return Promise.resolve(existing); 264 | } 265 | 266 | return System.import(newId).then(function (m) { 267 | _this3.moduleRegistry[newId] = m; 268 | return ensureOriginOnExports(m, newId); 269 | }); 270 | }); 271 | }; 272 | 273 | DefaultLoader.prototype.map = function (id, source) { 274 | var _map; 275 | 276 | System.config({ map: (_map = {}, _map[id] = source, _map) }); 277 | }; 278 | 279 | DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) { 280 | return System.normalizeSync(moduleId, relativeTo); 281 | }; 282 | 283 | DefaultLoader.prototype.normalize = function (moduleId, relativeTo) { 284 | return System.normalize(moduleId, relativeTo); 285 | }; 286 | 287 | DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) { 288 | return url + '!' + pluginName; 289 | }; 290 | 291 | DefaultLoader.prototype.addPlugin = function (pluginName, implementation) { 292 | System.set(pluginName, System.newModule({ 293 | 'fetch': function fetch(load, _fetch) { 294 | var result = implementation.fetch(load.address); 295 | return Promise.resolve(result).then(function (x) { 296 | load.metadata.result = x; 297 | return ''; 298 | }); 299 | }, 300 | 'instantiate': function instantiate(load) { 301 | return load.metadata.result; 302 | } 303 | })); 304 | }; 305 | } 306 | } 307 | }; 308 | }); -------------------------------------------------------------------------------- /dist/system/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register(['./aurelia-loader-default'], function (_export, _context) { 4 | "use strict"; 5 | 6 | return { 7 | setters: [function (_aureliaLoaderDefault) { 8 | var _exportObj = {}; 9 | 10 | for (var _key in _aureliaLoaderDefault) { 11 | if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _aureliaLoaderDefault[_key]; 12 | } 13 | 14 | _export(_exportObj); 15 | }], 16 | execute: function () {} 17 | }; 18 | }); -------------------------------------------------------------------------------- /doc/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | ## [1.2.2](https://github.com/aurelia/loader-default/compare/1.2.0...1.2.2) (2019-03-27) 3 | 4 | 5 | 6 | 7 | ## [1.2.1](https://github.com/aurelia/loader-default/compare/1.2.0...1.2.1) (2019-02-04) 8 | 9 | 10 | 11 | 12 | # [1.2.0](https://github.com/aurelia/loader-default/compare/1.1.0...1.2.0) (2019-01-18) 13 | 14 | 15 | ### Bug Fixes 16 | 17 | * do not reject unsupported AMD loader ([846befe](https://github.com/aurelia/loader-default/commit/846befe)) 18 | 19 | 20 | ### Features 21 | 22 | * add support of dumber-module-loader ([1d9433f](https://github.com/aurelia/loader-default/commit/1d9433f)) 23 | 24 | 25 | 26 | 27 | # [1.1.0](https://github.com/aurelia/loader-default/compare/1.0.4...1.1.0) (2018-12-01) 28 | 29 | 30 | ### Bug Fixes 31 | 32 | * remove unnecessary inline SystemJS text plugin ([8c9a183](https://github.com/aurelia/loader-default/commit/8c9a183)), closes [aurelia/i18n#289](https://github.com/aurelia/i18n/issues/289) 33 | 34 | 35 | ### Features 36 | 37 | * **loader:** Added support for alameda amd loader ([9b4bb40](https://github.com/aurelia/loader-default/commit/9b4bb40)) 38 | 39 | 40 | 41 | 42 | ## [1.0.4](https://github.com/aurelia/loader-default/compare/1.0.3...1.0.4) (2018-03-29) 43 | 44 | 45 | ### Bug Fixes 46 | 47 | * fix commonjs build error in requirejs env ([04f6d60](https://github.com/aurelia/loader-default/commit/04f6d60)), closes [#47](https://github.com/aurelia/loader-default/issues/47) 48 | * improve compatibility with other AMD implementations. ([0f8b5e8](https://github.com/aurelia/loader-default/commit/0f8b5e8)), closes [#48](https://github.com/aurelia/loader-default/issues/48) 49 | 50 | 51 | 52 | 53 | ## [1.0.3](https://github.com/aurelia/loader-default/compare/1.0.2...v1.0.3) (2017-10-01) 54 | 55 | 56 | ### Bug Fixes 57 | 58 | * **index:** use .keys instead of .entries close [#43](https://github.com/aurelia/loader-default/issues/43) ([49948a1](https://github.com/aurelia/loader-default/commit/49948a1)), closes [#43](https://github.com/aurelia/loader-default/issues/43) 59 | 60 | 61 | ### Performance Improvements 62 | 63 | * **index:** single array index for system key ([f5e36b1](https://github.com/aurelia/loader-default/commit/f5e36b1)) 64 | 65 | 66 | 67 | 68 | ## [1.0.2](https://github.com/aurelia/loader-default/compare/1.0.1...v1.0.2) (2017-03-23) 69 | 70 | 71 | ### Bug Fixes 72 | 73 | * **index:** fix PLATFORM.eachModule for SystemJS[@0](https://github.com/0).20.x ([7c2c925](https://github.com/aurelia/loader-default/commit/7c2c925)) 74 | 75 | 76 | 77 | 78 | ## [1.0.1](https://github.com/aurelia/loader-default/compare/1.0.0...v1.0.1) (2017-02-21) 79 | 80 | 81 | ### Bug Fixes 82 | 83 | * **DefaultLoader:** use config API for map ([a4607b9](https://github.com/aurelia/loader-default/commit/a4607b9)) 84 | 85 | 86 | 87 | 88 | # [1.0.0](https://github.com/aurelia/loader-default/compare/1.0.0-rc.1.0.0...v1.0.0) (2016-07-27) 89 | 90 | 91 | 92 | 93 | # [1.0.0-rc.1.0.0](https://github.com/aurelia/loader-default/compare/1.0.0-beta.2.0.2...v1.0.0-rc.1.0.0) (2016-06-22) 94 | 95 | 96 | 97 | ### 1.0.0-beta.1.2.2 (2016-05-10) 98 | 99 | 100 | ### 1.0.0-beta.1.2.1 (2016-04-13) 101 | 102 | 103 | #### Bug Fixes 104 | 105 | * **index:** ensure correct cache lookup ([b32ff61a](http://github.com/aurelia/loader-default/commit/b32ff61a5fc00eb995bb008d7c1f83fdffa71d7d)) 106 | 107 | 108 | ### 1.0.0-beta.1.2.0(2016-03-22) 109 | 110 | #### Bug Fixes 111 | 112 | * **DefaultLoader:** do not map name to address in requirejs mode ([30016b6e](http://github.com/aurelia/loader-default/commit/30016b6ef904228a582863e83b49e8f3c0556e63)) 113 | 114 | ### 1.0.0-beta.1.1.3 (2016-02-25) 115 | 116 | 117 | #### Bug Fixes 118 | 119 | * **loader:** alias the loader ([70b7cb83](http://github.com/aurelia/loader-default/commit/70b7cb83a5f78131cdb66bc29398c24fd243b2b1)) 120 | 121 | 122 | ### 1.0.0-beta.1.1.2 (2016-02-08) 123 | 124 | 125 | #### Bug Fixes 126 | 127 | * **index:** properly normalize for systemjs ([aa3c4813](http://github.com/aurelia/loader-default/commit/aa3c48136a829ff1137d8ecb5f367d7b5e05cf0d)) 128 | 129 | 130 | ### 1.0.0-beta.1.1.0 (2016-01-29) 131 | 132 | 133 | #### Features 134 | 135 | * **all:** update jspm meta; core-js; aurelia deps ([7777dfcc](http://github.com/aurelia/loader-default/commit/7777dfcca39fb610b7dd66bad868133b2d0c9962)) 136 | 137 | 138 | ### 1.0.0-beta.1.0.2 (2016-01-08) 139 | 140 | 141 | #### Features 142 | 143 | * **all:** remove internal normalizeSync use and add normalize impl ([3c323466](http://github.com/aurelia/loader-default/commit/3c323466f461a9831675aa9421968b2727c50164)) 144 | 145 | 146 | ## 1.0.0-beta.1.0.1 (2015-11-17) 147 | 148 | 149 | #### Bug Fixes 150 | 151 | * **index:** firefox can die on some module getter accessors ([97dee32c](http://github.com/aurelia/loader-default/commit/97dee32c0df0359ec722ea852ab5529e98ae34be)) 152 | 153 | 154 | ### 1.0.0-beta.1 (2015-11-16) 155 | 156 | 157 | ## 0.12.0 (2015-11-10) 158 | 159 | 160 | #### Bug Fixes 161 | 162 | * **text-template-loader:** update to latest template entry api ([9fd102dc](http://github.com/aurelia/loader-default/commit/9fd102dc55af408b0393844442171a7a9b31ca93)) 163 | 164 | 165 | ### 0.11.2 (2015-10-13) 166 | 167 | 168 | #### Bug Fixes 169 | 170 | * **all:** 171 | * remove web components and html imports ([5e40af0f](http://github.com/aurelia/loader-default/commit/5e40af0f22ccf90b7f959fb770cbf2cd5a9f7c8e)) 172 | * improve the template loader interface and html imports lookup ([dec84529](http://github.com/aurelia/loader-default/commit/dec84529b0dc6174c5daa9609ecaf2304515886f)) 173 | * differentiate between real, polyfill and fake system ([09767418](http://github.com/aurelia/loader-default/commit/09767418d730aac3e772c0de954b18159673ee68)) 174 | * update compiler ([11498313](http://github.com/aurelia/loader-default/commit/11498313b369c5752f69190ddecfccaaae7ea32b)) 175 | * **build:** 176 | * update linting, testing and tools ([9b8935a2](http://github.com/aurelia/loader-default/commit/9b8935a297c2b7807acf7be429fe6a528c9ceef8)) 177 | * add missing bower bump ([a3e96402](http://github.com/aurelia/loader-default/commit/a3e96402dbdd48da9904fe228c4ddc5b9d32ef97)) 178 | * **index:** 179 | * sometimes undefined modules list in eachModule iterator ([fe4adddc](http://github.com/aurelia/loader-default/commit/fe4adddce7517c282011f6728b448fbf4d598ef9)) 180 | * incorrect variable name in require-based default loader code ([4cdf9df5](http://github.com/aurelia/loader-default/commit/4cdf9df55d4eecedd5d43fddc9b41871b858818e), closes [#27](http://github.com/aurelia/loader-default/issues/27)) 181 | * add missing import ([8adcd049](http://github.com/aurelia/loader-default/commit/8adcd049f6d25ffa2823a000a82d380a51e1287a)) 182 | * remove unnecessary URL polyfill code ([55d70449](http://github.com/aurelia/loader-default/commit/55d704498ca44afd708859500b12049f1c6fd56c)) 183 | * fix typos in spelling of Promise ([1d0b43f0](http://github.com/aurelia/loader-default/commit/1d0b43f0b7ca2a1b2cd67ced60bc0cb6422ae45d)) 184 | * various url canonicalization bugs ([b373ef6d](http://github.com/aurelia/loader-default/commit/b373ef6d8e17d2ea4a25b6dbe17f5d0d61ead9ab)) 185 | * prepare loader for jspm beta ([62b18e68](http://github.com/aurelia/loader-default/commit/62b18e68c1ccfb19e4e9b862efda679ed7295ae2)) 186 | * remove for..of to improve perf ([b8cce178](http://github.com/aurelia/loader-default/commit/b8cce178a3d745acb1dd66f43507478e49c0ff90)) 187 | * **loadTemplate:** check url has baseViewUrl ([fb06ca6b](http://github.com/aurelia/loader-default/commit/fb06ca6be36d4fb36707e47e1ed35d546aa89557)) 188 | * **loader:** 189 | * plugin api fetch causes problems with safari ([7788af12](http://github.com/aurelia/loader-default/commit/7788af127ce0dd3f34efcf671b9b43fd0c95a8fb)) 190 | * change plugin name to view ([4c592bec](http://github.com/aurelia/loader-default/commit/4c592becc0977de24175c5d63a668d7835bd9877)) 191 | * correct name of exported DefaultLoader class ([eb179a30](http://github.com/aurelia/loader-default/commit/eb179a3035acee421d5287b021a66c38ebfe2375)) 192 | * update to work with new origin implementation ([a9072680](http://github.com/aurelia/loader-default/commit/a9072680a7ec4e98e9245cf5a8816cba18b96ae9)) 193 | * don't set target on frozen objects ([ebe91ff2](http://github.com/aurelia/loader-default/commit/ebe91ff2024833c79386d59d0c3a42baad4ddedf)) 194 | * loadModule should check for baseUrl ([7ce79f1c](http://github.com/aurelia/loader-default/commit/7ce79f1c2e5a500a487987288c6832547d1a25a1)) 195 | * incorrect paths passes to systemjs loader ([066bb5d7](http://github.com/aurelia/loader-default/commit/066bb5d7193cc71744e11209636a3f52e4f40009)) 196 | * **origin:** short-circuit module registry search on origin location success ([26a2906c](http://github.com/aurelia/loader-default/commit/26a2906c18a5163c877bb129eef448fa98430394)) 197 | * **package:** 198 | * change jspm directories ([176b06ec](http://github.com/aurelia/loader-default/commit/176b06eca87da01ace89bc9725697591c4ce15a8)) 199 | * update dependencies ([496f8c3e](http://github.com/aurelia/loader-default/commit/496f8c3eafa8e519400f825a8697b56056e31669)) 200 | * update reps and fix bower semver ranges ([5c5b5016](http://github.com/aurelia/loader-default/commit/5c5b501676550e0f38dec195af6348bece39e0d1)) 201 | * update dependencies ([0255ec9a](http://github.com/aurelia/loader-default/commit/0255ec9a0220ea0324b806293f2897843298f71b)) 202 | * update Aurelia dependencies ([21511995](http://github.com/aurelia/loader-default/commit/21511995ac06d523417bee3d9b061816479c0120)) 203 | * update to the latest version of path ([792ca4f5](http://github.com/aurelia/loader-default/commit/792ca4f59104401ec52637648553ceb58746a808)) 204 | * add missing dependency ([0462d8b2](http://github.com/aurelia/loader-default/commit/0462d8b2bbd1509181bf1b394a88b85e929a68a1)) 205 | * update dependencies to latest versions ([9da71e4c](http://github.com/aurelia/loader-default/commit/9da71e4c9864138b3ce93bf6c8aa515086dfcfa8)) 206 | * updating dependencies ([eb8b0aed](http://github.com/aurelia/loader-default/commit/eb8b0aed667db21517eb02c26cfd57199cf03325)) 207 | * **test:** incorrect constructor used with jasmine.any ([9b21817a](http://github.com/aurelia/loader-default/commit/9b21817a91b9a675abd73a8700ccb4e3e3fa2579)) 208 | * **url:** Internet Explorer ([5b1496cb](http://github.com/aurelia/loader-default/commit/5b1496cbe6d7409ff4f9360f65b165456cabd5db)) 209 | 210 | 211 | #### Features 212 | 213 | * **all:** 214 | * implement PAL ([78db72ec](http://github.com/aurelia/loader-default/commit/78db72ec3e335384fc98774d49178f664acc53e5)) 215 | * introduce template loaders; one for html imports and one for text ([babe9484](http://github.com/aurelia/loader-default/commit/babe94840b2292d21f203e68b64ca556d4f27bf5)) 216 | * add more type info ([f12bbca5](http://github.com/aurelia/loader-default/commit/f12bbca550fd78275fe448274f44946aad98f04c)) 217 | * add support for view bundles ([05d333a9](http://github.com/aurelia/loader-default/commit/05d333a94fc6eb9cb6a07da9bdc15a60f961a6d5)) 218 | * implement the new loadText api for the default loader ([e316be6d](http://github.com/aurelia/loader-default/commit/e316be6d1b1eca2d8fe4984280e15a165c2885fe), closes [#4](http://github.com/aurelia/loader-default/issues/4)) 219 | * new loader-plugin-based remplate loader ([ab694b12](http://github.com/aurelia/loader-default/commit/ab694b12f53c06402b0f64d4b60ecacef6490e18)) 220 | * remove system hack; polyfill system for require api; tag through import calls ([7d89aceb](http://github.com/aurelia/loader-default/commit/7d89aceb4775022a6822cb4916d148fda143609a)) 221 | * **build:** update compiler and switch to register module format ([762fbfc9](http://github.com/aurelia/loader-default/commit/762fbfc9c463b612d0b286526735da138be90b78)) 222 | * **docs:** 223 | * generate api.json from .d.ts file ([b33a7888](http://github.com/aurelia/loader-default/commit/b33a78882306817ad01184ccdc69037498f1a58f)) 224 | * generate api.json from .d.ts file ([3602db67](http://github.com/aurelia/loader-default/commit/3602db67493cd8d39318fa3e36a04b3e3a9246e5)) 225 | * **index:** 226 | * ensure that DefaultLoader is set as the platfrom loader ([b8e1fb97](http://github.com/aurelia/loader-default/commit/b8e1fb97b7d66f412dcbd5ead151c80bd3370d8a)) 227 | * add new loader methods and encapsulate loader better ([6ee47165](http://github.com/aurelia/loader-default/commit/6ee47165a0cd650cb83435b50176d94234c2a376)) 228 | * add textPluginName property to the default loader ([99d74421](http://github.com/aurelia/loader-default/commit/99d74421d1a65a12206558739d4b45b1519b498e)) 229 | * **loader:** 230 | * add System.forEachModule registry iteration ([a5f983b4](http://github.com/aurelia/loader-default/commit/a5f983b4da03ba1a1c149c03297ad562f28d3569)) 231 | * add loadModule base url override ([d11cb589](http://github.com/aurelia/loader-default/commit/d11cb58926777ec6b5a41c9dcc0a815b6c09e5f5)) 232 | 233 | 234 | ### 0.11.1 (2015-10-13) 235 | 236 | 237 | #### Bug Fixes 238 | 239 | * **all:** 240 | * remove web components and html imports ([5e40af0f](http://github.com/aurelia/loader-default/commit/5e40af0f22ccf90b7f959fb770cbf2cd5a9f7c8e)) 241 | * improve the template loader interface and html imports lookup ([dec84529](http://github.com/aurelia/loader-default/commit/dec84529b0dc6174c5daa9609ecaf2304515886f)) 242 | * differentiate between real, polyfill and fake system ([09767418](http://github.com/aurelia/loader-default/commit/09767418d730aac3e772c0de954b18159673ee68)) 243 | * update compiler ([11498313](http://github.com/aurelia/loader-default/commit/11498313b369c5752f69190ddecfccaaae7ea32b)) 244 | * **build:** 245 | * update linting, testing and tools ([9b8935a2](http://github.com/aurelia/loader-default/commit/9b8935a297c2b7807acf7be429fe6a528c9ceef8)) 246 | * add missing bower bump ([a3e96402](http://github.com/aurelia/loader-default/commit/a3e96402dbdd48da9904fe228c4ddc5b9d32ef97)) 247 | * **index:** 248 | * incorrect variable name in require-based default loader code ([4cdf9df5](http://github.com/aurelia/loader-default/commit/4cdf9df55d4eecedd5d43fddc9b41871b858818e), closes [#27](http://github.com/aurelia/loader-default/issues/27)) 249 | * add missing import ([8adcd049](http://github.com/aurelia/loader-default/commit/8adcd049f6d25ffa2823a000a82d380a51e1287a)) 250 | * remove unnecessary URL polyfill code ([55d70449](http://github.com/aurelia/loader-default/commit/55d704498ca44afd708859500b12049f1c6fd56c)) 251 | * fix typos in spelling of Promise ([1d0b43f0](http://github.com/aurelia/loader-default/commit/1d0b43f0b7ca2a1b2cd67ced60bc0cb6422ae45d)) 252 | * various url canonicalization bugs ([b373ef6d](http://github.com/aurelia/loader-default/commit/b373ef6d8e17d2ea4a25b6dbe17f5d0d61ead9ab)) 253 | * prepare loader for jspm beta ([62b18e68](http://github.com/aurelia/loader-default/commit/62b18e68c1ccfb19e4e9b862efda679ed7295ae2)) 254 | * remove for..of to improve perf ([b8cce178](http://github.com/aurelia/loader-default/commit/b8cce178a3d745acb1dd66f43507478e49c0ff90)) 255 | * **loadTemplate:** check url has baseViewUrl ([fb06ca6b](http://github.com/aurelia/loader-default/commit/fb06ca6be36d4fb36707e47e1ed35d546aa89557)) 256 | * **loader:** 257 | * plugin api fetch causes problems with safari ([7788af12](http://github.com/aurelia/loader-default/commit/7788af127ce0dd3f34efcf671b9b43fd0c95a8fb)) 258 | * change plugin name to view ([4c592bec](http://github.com/aurelia/loader-default/commit/4c592becc0977de24175c5d63a668d7835bd9877)) 259 | * correct name of exported DefaultLoader class ([eb179a30](http://github.com/aurelia/loader-default/commit/eb179a3035acee421d5287b021a66c38ebfe2375)) 260 | * update to work with new origin implementation ([a9072680](http://github.com/aurelia/loader-default/commit/a9072680a7ec4e98e9245cf5a8816cba18b96ae9)) 261 | * don't set target on frozen objects ([ebe91ff2](http://github.com/aurelia/loader-default/commit/ebe91ff2024833c79386d59d0c3a42baad4ddedf)) 262 | * loadModule should check for baseUrl ([7ce79f1c](http://github.com/aurelia/loader-default/commit/7ce79f1c2e5a500a487987288c6832547d1a25a1)) 263 | * incorrect paths passes to systemjs loader ([066bb5d7](http://github.com/aurelia/loader-default/commit/066bb5d7193cc71744e11209636a3f52e4f40009)) 264 | * **origin:** short-circuit module registry search on origin location success ([26a2906c](http://github.com/aurelia/loader-default/commit/26a2906c18a5163c877bb129eef448fa98430394)) 265 | * **package:** 266 | * change jspm directories ([176b06ec](http://github.com/aurelia/loader-default/commit/176b06eca87da01ace89bc9725697591c4ce15a8)) 267 | * update dependencies ([496f8c3e](http://github.com/aurelia/loader-default/commit/496f8c3eafa8e519400f825a8697b56056e31669)) 268 | * update reps and fix bower semver ranges ([5c5b5016](http://github.com/aurelia/loader-default/commit/5c5b501676550e0f38dec195af6348bece39e0d1)) 269 | * update dependencies ([0255ec9a](http://github.com/aurelia/loader-default/commit/0255ec9a0220ea0324b806293f2897843298f71b)) 270 | * update Aurelia dependencies ([21511995](http://github.com/aurelia/loader-default/commit/21511995ac06d523417bee3d9b061816479c0120)) 271 | * update to the latest version of path ([792ca4f5](http://github.com/aurelia/loader-default/commit/792ca4f59104401ec52637648553ceb58746a808)) 272 | * add missing dependency ([0462d8b2](http://github.com/aurelia/loader-default/commit/0462d8b2bbd1509181bf1b394a88b85e929a68a1)) 273 | * update dependencies to latest versions ([9da71e4c](http://github.com/aurelia/loader-default/commit/9da71e4c9864138b3ce93bf6c8aa515086dfcfa8)) 274 | * updating dependencies ([eb8b0aed](http://github.com/aurelia/loader-default/commit/eb8b0aed667db21517eb02c26cfd57199cf03325)) 275 | * **test:** incorrect constructor used with jasmine.any ([9b21817a](http://github.com/aurelia/loader-default/commit/9b21817a91b9a675abd73a8700ccb4e3e3fa2579)) 276 | * **url:** Internet Explorer ([5b1496cb](http://github.com/aurelia/loader-default/commit/5b1496cbe6d7409ff4f9360f65b165456cabd5db)) 277 | 278 | 279 | #### Features 280 | 281 | * **all:** 282 | * implement PAL ([78db72ec](http://github.com/aurelia/loader-default/commit/78db72ec3e335384fc98774d49178f664acc53e5)) 283 | * introduce template loaders; one for html imports and one for text ([babe9484](http://github.com/aurelia/loader-default/commit/babe94840b2292d21f203e68b64ca556d4f27bf5)) 284 | * add more type info ([f12bbca5](http://github.com/aurelia/loader-default/commit/f12bbca550fd78275fe448274f44946aad98f04c)) 285 | * add support for view bundles ([05d333a9](http://github.com/aurelia/loader-default/commit/05d333a94fc6eb9cb6a07da9bdc15a60f961a6d5)) 286 | * implement the new loadText api for the default loader ([e316be6d](http://github.com/aurelia/loader-default/commit/e316be6d1b1eca2d8fe4984280e15a165c2885fe), closes [#4](http://github.com/aurelia/loader-default/issues/4)) 287 | * new loader-plugin-based remplate loader ([ab694b12](http://github.com/aurelia/loader-default/commit/ab694b12f53c06402b0f64d4b60ecacef6490e18)) 288 | * remove system hack; polyfill system for require api; tag through import calls ([7d89aceb](http://github.com/aurelia/loader-default/commit/7d89aceb4775022a6822cb4916d148fda143609a)) 289 | * **build:** update compiler and switch to register module format ([762fbfc9](http://github.com/aurelia/loader-default/commit/762fbfc9c463b612d0b286526735da138be90b78)) 290 | * **docs:** 291 | * generate api.json from .d.ts file ([b33a7888](http://github.com/aurelia/loader-default/commit/b33a78882306817ad01184ccdc69037498f1a58f)) 292 | * generate api.json from .d.ts file ([3602db67](http://github.com/aurelia/loader-default/commit/3602db67493cd8d39318fa3e36a04b3e3a9246e5)) 293 | * **index:** 294 | * ensure that DefaultLoader is set as the platfrom loader ([b8e1fb97](http://github.com/aurelia/loader-default/commit/b8e1fb97b7d66f412dcbd5ead151c80bd3370d8a)) 295 | * add new loader methods and encapsulate loader better ([6ee47165](http://github.com/aurelia/loader-default/commit/6ee47165a0cd650cb83435b50176d94234c2a376)) 296 | * add textPluginName property to the default loader ([99d74421](http://github.com/aurelia/loader-default/commit/99d74421d1a65a12206558739d4b45b1519b498e)) 297 | * **loader:** 298 | * add System.forEachModule registry iteration ([a5f983b4](http://github.com/aurelia/loader-default/commit/a5f983b4da03ba1a1c149c03297ad562f28d3569)) 299 | * add loadModule base url override ([d11cb589](http://github.com/aurelia/loader-default/commit/d11cb58926777ec6b5a41c9dcc0a815b6c09e5f5)) 300 | 301 | 302 | ## 0.11.0 (2015-10-13) 303 | 304 | 305 | #### Bug Fixes 306 | 307 | * **all:** 308 | * remove web components and html imports ([5e40af0f](http://github.com/aurelia/loader-default/commit/5e40af0f22ccf90b7f959fb770cbf2cd5a9f7c8e)) 309 | * improve the template loader interface and html imports lookup ([dec84529](http://github.com/aurelia/loader-default/commit/dec84529b0dc6174c5daa9609ecaf2304515886f)) 310 | * differentiate between real, polyfill and fake system ([09767418](http://github.com/aurelia/loader-default/commit/09767418d730aac3e772c0de954b18159673ee68)) 311 | * update compiler ([11498313](http://github.com/aurelia/loader-default/commit/11498313b369c5752f69190ddecfccaaae7ea32b)) 312 | * **build:** 313 | * update linting, testing and tools ([9b8935a2](http://github.com/aurelia/loader-default/commit/9b8935a297c2b7807acf7be429fe6a528c9ceef8)) 314 | * add missing bower bump ([a3e96402](http://github.com/aurelia/loader-default/commit/a3e96402dbdd48da9904fe228c4ddc5b9d32ef97)) 315 | * **index:** 316 | * add missing import ([8adcd049](http://github.com/aurelia/loader-default/commit/8adcd049f6d25ffa2823a000a82d380a51e1287a)) 317 | * remove unnecessary URL polyfill code ([55d70449](http://github.com/aurelia/loader-default/commit/55d704498ca44afd708859500b12049f1c6fd56c)) 318 | * fix typos in spelling of Promise ([1d0b43f0](http://github.com/aurelia/loader-default/commit/1d0b43f0b7ca2a1b2cd67ced60bc0cb6422ae45d)) 319 | * various url canonicalization bugs ([b373ef6d](http://github.com/aurelia/loader-default/commit/b373ef6d8e17d2ea4a25b6dbe17f5d0d61ead9ab)) 320 | * prepare loader for jspm beta ([62b18e68](http://github.com/aurelia/loader-default/commit/62b18e68c1ccfb19e4e9b862efda679ed7295ae2)) 321 | * remove for..of to improve perf ([b8cce178](http://github.com/aurelia/loader-default/commit/b8cce178a3d745acb1dd66f43507478e49c0ff90)) 322 | * **loadTemplate:** check url has baseViewUrl ([fb06ca6b](http://github.com/aurelia/loader-default/commit/fb06ca6be36d4fb36707e47e1ed35d546aa89557)) 323 | * **loader:** 324 | * plugin api fetch causes problems with safari ([7788af12](http://github.com/aurelia/loader-default/commit/7788af127ce0dd3f34efcf671b9b43fd0c95a8fb)) 325 | * change plugin name to view ([4c592bec](http://github.com/aurelia/loader-default/commit/4c592becc0977de24175c5d63a668d7835bd9877)) 326 | * correct name of exported DefaultLoader class ([eb179a30](http://github.com/aurelia/loader-default/commit/eb179a3035acee421d5287b021a66c38ebfe2375)) 327 | * update to work with new origin implementation ([a9072680](http://github.com/aurelia/loader-default/commit/a9072680a7ec4e98e9245cf5a8816cba18b96ae9)) 328 | * don't set target on frozen objects ([ebe91ff2](http://github.com/aurelia/loader-default/commit/ebe91ff2024833c79386d59d0c3a42baad4ddedf)) 329 | * loadModule should check for baseUrl ([7ce79f1c](http://github.com/aurelia/loader-default/commit/7ce79f1c2e5a500a487987288c6832547d1a25a1)) 330 | * incorrect paths passes to systemjs loader ([066bb5d7](http://github.com/aurelia/loader-default/commit/066bb5d7193cc71744e11209636a3f52e4f40009)) 331 | * **origin:** short-circuit module registry search on origin location success ([26a2906c](http://github.com/aurelia/loader-default/commit/26a2906c18a5163c877bb129eef448fa98430394)) 332 | * **package:** 333 | * change jspm directories ([176b06ec](http://github.com/aurelia/loader-default/commit/176b06eca87da01ace89bc9725697591c4ce15a8)) 334 | * update dependencies ([496f8c3e](http://github.com/aurelia/loader-default/commit/496f8c3eafa8e519400f825a8697b56056e31669)) 335 | * update reps and fix bower semver ranges ([5c5b5016](http://github.com/aurelia/loader-default/commit/5c5b501676550e0f38dec195af6348bece39e0d1)) 336 | * update dependencies ([0255ec9a](http://github.com/aurelia/loader-default/commit/0255ec9a0220ea0324b806293f2897843298f71b)) 337 | * update Aurelia dependencies ([21511995](http://github.com/aurelia/loader-default/commit/21511995ac06d523417bee3d9b061816479c0120)) 338 | * update to the latest version of path ([792ca4f5](http://github.com/aurelia/loader-default/commit/792ca4f59104401ec52637648553ceb58746a808)) 339 | * add missing dependency ([0462d8b2](http://github.com/aurelia/loader-default/commit/0462d8b2bbd1509181bf1b394a88b85e929a68a1)) 340 | * update dependencies to latest versions ([9da71e4c](http://github.com/aurelia/loader-default/commit/9da71e4c9864138b3ce93bf6c8aa515086dfcfa8)) 341 | * updating dependencies ([eb8b0aed](http://github.com/aurelia/loader-default/commit/eb8b0aed667db21517eb02c26cfd57199cf03325)) 342 | * **test:** incorrect constructor used with jasmine.any ([9b21817a](http://github.com/aurelia/loader-default/commit/9b21817a91b9a675abd73a8700ccb4e3e3fa2579)) 343 | * **url:** Internet Explorer ([5b1496cb](http://github.com/aurelia/loader-default/commit/5b1496cbe6d7409ff4f9360f65b165456cabd5db)) 344 | 345 | 346 | #### Features 347 | 348 | * **all:** 349 | * implement PAL ([78db72ec](http://github.com/aurelia/loader-default/commit/78db72ec3e335384fc98774d49178f664acc53e5)) 350 | * introduce template loaders; one for html imports and one for text ([babe9484](http://github.com/aurelia/loader-default/commit/babe94840b2292d21f203e68b64ca556d4f27bf5)) 351 | * add more type info ([f12bbca5](http://github.com/aurelia/loader-default/commit/f12bbca550fd78275fe448274f44946aad98f04c)) 352 | * add support for view bundles ([05d333a9](http://github.com/aurelia/loader-default/commit/05d333a94fc6eb9cb6a07da9bdc15a60f961a6d5)) 353 | * implement the new loadText api for the default loader ([e316be6d](http://github.com/aurelia/loader-default/commit/e316be6d1b1eca2d8fe4984280e15a165c2885fe), closes [#4](http://github.com/aurelia/loader-default/issues/4)) 354 | * new loader-plugin-based remplate loader ([ab694b12](http://github.com/aurelia/loader-default/commit/ab694b12f53c06402b0f64d4b60ecacef6490e18)) 355 | * remove system hack; polyfill system for require api; tag through import calls ([7d89aceb](http://github.com/aurelia/loader-default/commit/7d89aceb4775022a6822cb4916d148fda143609a)) 356 | * **build:** update compiler and switch to register module format ([762fbfc9](http://github.com/aurelia/loader-default/commit/762fbfc9c463b612d0b286526735da138be90b78)) 357 | * **docs:** 358 | * generate api.json from .d.ts file ([b33a7888](http://github.com/aurelia/loader-default/commit/b33a78882306817ad01184ccdc69037498f1a58f)) 359 | * generate api.json from .d.ts file ([3602db67](http://github.com/aurelia/loader-default/commit/3602db67493cd8d39318fa3e36a04b3e3a9246e5)) 360 | * **index:** 361 | * ensure that DefaultLoader is set as the platfrom loader ([b8e1fb97](http://github.com/aurelia/loader-default/commit/b8e1fb97b7d66f412dcbd5ead151c80bd3370d8a)) 362 | * add new loader methods and encapsulate loader better ([6ee47165](http://github.com/aurelia/loader-default/commit/6ee47165a0cd650cb83435b50176d94234c2a376)) 363 | * add textPluginName property to the default loader ([99d74421](http://github.com/aurelia/loader-default/commit/99d74421d1a65a12206558739d4b45b1519b498e)) 364 | * **loader:** 365 | * add System.forEachModule registry iteration ([a5f983b4](http://github.com/aurelia/loader-default/commit/a5f983b4da03ba1a1c149c03297ad562f28d3569)) 366 | * add loadModule base url override ([d11cb589](http://github.com/aurelia/loader-default/commit/d11cb58926777ec6b5a41c9dcc0a815b6c09e5f5)) 367 | 368 | 369 | ## 0.10.0 (2015-09-04) 370 | 371 | 372 | #### Bug Fixes 373 | 374 | * **all:** 375 | * remove web components and html imports ([5e40af0f](http://github.com/aurelia/loader-default/commit/5e40af0f22ccf90b7f959fb770cbf2cd5a9f7c8e)) 376 | * improve the template loader interface and html imports lookup ([dec84529](http://github.com/aurelia/loader-default/commit/dec84529b0dc6174c5daa9609ecaf2304515886f)) 377 | * **build:** update linting, testing and tools ([9b8935a2](http://github.com/aurelia/loader-default/commit/9b8935a297c2b7807acf7be429fe6a528c9ceef8)) 378 | * **index:** 379 | * add missing import ([8adcd049](http://github.com/aurelia/loader-default/commit/8adcd049f6d25ffa2823a000a82d380a51e1287a)) 380 | * remove unnecessary URL polyfill code ([55d70449](http://github.com/aurelia/loader-default/commit/55d704498ca44afd708859500b12049f1c6fd56c)) 381 | * fix typos in spelling of Promise ([1d0b43f0](http://github.com/aurelia/loader-default/commit/1d0b43f0b7ca2a1b2cd67ced60bc0cb6422ae45d)) 382 | 383 | 384 | #### Features 385 | 386 | * **all:** introduce template loaders; one for html imports and one for text ([babe9484](http://github.com/aurelia/loader-default/commit/babe94840b2292d21f203e68b64ca556d4f27bf5)) 387 | * **docs:** 388 | * generate api.json from .d.ts file ([b33a7888](http://github.com/aurelia/loader-default/commit/b33a78882306817ad01184ccdc69037498f1a58f)) 389 | * generate api.json from .d.ts file ([3602db67](http://github.com/aurelia/loader-default/commit/3602db67493cd8d39318fa3e36a04b3e3a9246e5)) 390 | * **index:** add textPluginName property to the default loader ([99d74421](http://github.com/aurelia/loader-default/commit/99d74421d1a65a12206558739d4b45b1519b498e)) 391 | 392 | 393 | ### 0.9.5 (2015-08-14) 394 | 395 | 396 | #### Features 397 | 398 | * **all:** add more type info ([f12bbca5](http://github.com/aurelia/loader-default/commit/f12bbca550fd78275fe448274f44946aad98f04c)) 399 | 400 | 401 | ### 0.9.4 (2015-08-11) 402 | 403 | 404 | #### Bug Fixes 405 | 406 | * **url:** Internet Explorer ([5b1496cb](http://github.com/aurelia/loader-default/commit/5b1496cbe6d7409ff4f9360f65b165456cabd5db)) 407 | 408 | 409 | ### 0.9.3 (2015-08-05) 410 | 411 | 412 | #### Bug Fixes 413 | 414 | * **index:** various url canonicalization bugs ([b373ef6d](http://github.com/aurelia/loader-default/commit/b373ef6d8e17d2ea4a25b6dbe17f5d0d61ead9ab)) 415 | 416 | 417 | ### 0.9.2 (2015-08-05) 418 | 419 | 420 | #### Bug Fixes 421 | 422 | * **index:** prepare loader for jspm beta ([62b18e68](http://github.com/aurelia/loader-default/commit/62b18e68c1ccfb19e4e9b862efda679ed7295ae2)) 423 | 424 | 425 | ### 0.9.1 (2015-07-29) 426 | 427 | * improve output file name 428 | 429 | ## 0.9.0 (2015-07-02) 430 | 431 | 432 | #### Bug Fixes 433 | 434 | * **all:** differentiate between real, polyfill and fake system ([09767418](http://github.com/aurelia/loader-default/commit/09767418d730aac3e772c0de954b18159673ee68)) 435 | * **origin:** short-circuit module registry search on origin location success ([26a2906c](http://github.com/aurelia/loader-default/commit/26a2906c18a5163c877bb129eef448fa98430394)) 436 | 437 | 438 | ## 0.8.0 (2015-06-08) 439 | 440 | 441 | #### Features 442 | 443 | * **all:** add support for view bundles ([05d333a9](http://github.com/aurelia/loader-default/commit/05d333a94fc6eb9cb6a07da9bdc15a60f961a6d5)) 444 | * **loader:** add System.forEachModule registry iteration ([a5f983b4](http://github.com/aurelia/loader-default/commit/a5f983b4da03ba1a1c149c03297ad562f28d3569)) 445 | 446 | 447 | ## 0.7.0 (2015-04-30) 448 | 449 | 450 | #### Bug Fixes 451 | 452 | * **index:** remove for..of to improve perf ([b8cce178](http://github.com/aurelia/loader-default/commit/b8cce178a3d745acb1dd66f43507478e49c0ff90)) 453 | 454 | 455 | #### Features 456 | 457 | * **all:** implement the new loadText api for the default loader ([e316be6d](http://github.com/aurelia/loader-default/commit/e316be6d1b1eca2d8fe4984280e15a165c2885fe), closes [#4](http://github.com/aurelia/loader-default/issues/4)) 458 | 459 | 460 | ## 0.6.0 (2015-04-09) 461 | 462 | 463 | #### Bug Fixes 464 | 465 | * **all:** update compiler ([11498313](http://github.com/aurelia/loader-default/commit/11498313b369c5752f69190ddecfccaaae7ea32b)) 466 | 467 | 468 | ## 0.5.0 (2015-03-24) 469 | 470 | 471 | #### Bug Fixes 472 | 473 | * **loader:** 474 | * plugin api fetch causes problems with safari ([7788af12](http://github.com/aurelia/loader-default/commit/7788af127ce0dd3f34efcf671b9b43fd0c95a8fb)) 475 | * change plugin name to view ([4c592bec](http://github.com/aurelia/loader-default/commit/4c592becc0977de24175c5d63a668d7835bd9877)) 476 | 477 | 478 | #### Features 479 | 480 | * **all:** new loader-plugin-based remplate loader ([ab694b12](http://github.com/aurelia/loader-default/commit/ab694b12f53c06402b0f64d4b60ecacef6490e18)) 481 | 482 | 483 | ### 0.4.3 (2015-02-28) 484 | 485 | 486 | #### Bug Fixes 487 | 488 | * **package:** change jspm directories ([176b06ec](http://github.com/aurelia/loader-default/commit/176b06eca87da01ace89bc9725697591c4ce15a8)) 489 | 490 | 491 | ### 0.4.2 (2015-02-27) 492 | 493 | 494 | #### Bug Fixes 495 | 496 | * **build:** add missing bower bump ([a3e96402](http://github.com/aurelia/loader-default/commit/a3e96402dbdd48da9904fe228c4ddc5b9d32ef97)) 497 | * **package:** update dependencies ([496f8c3e](http://github.com/aurelia/loader-default/commit/496f8c3eafa8e519400f825a8697b56056e31669)) 498 | 499 | 500 | ### 0.4.1 (2015-01-24) 501 | 502 | 503 | #### Bug Fixes 504 | 505 | * **package:** update reps and fix bower semver ranges ([5c5b5016](http://github.com/aurelia/loader-default/commit/5c5b501676550e0f38dec195af6348bece39e0d1)) 506 | 507 | 508 | ## 0.4.0 (2015-01-22) 509 | 510 | 511 | #### Bug Fixes 512 | 513 | * **loader:** 514 | * correct name of exported DefaultLoader class ([eb179a30](http://github.com/aurelia/loader-default/commit/eb179a3035acee421d5287b021a66c38ebfe2375)) 515 | * update to work with new origin implementation ([a9072680](http://github.com/aurelia/loader-default/commit/a9072680a7ec4e98e9245cf5a8816cba18b96ae9)) 516 | * **package:** update dependencies ([0255ec9a](http://github.com/aurelia/loader-default/commit/0255ec9a0220ea0324b806293f2897843298f71b)) 517 | 518 | 519 | #### Features 520 | 521 | * **all:** remove system hack; polyfill system for require api; tag through import calls ([7d89aceb](http://github.com/aurelia/loader-default/commit/7d89aceb4775022a6822cb4916d148fda143609a)) 522 | 523 | 524 | ### 0.3.2 (2015-01-12) 525 | 526 | 527 | #### Bug Fixes 528 | 529 | * **package:** update Aurelia dependencies ([21511995](http://github.com/aurelia/loader-systemjs/commit/21511995ac06d523417bee3d9b061816479c0120)) 530 | 531 | 532 | ### 0.3.1 (2015-01-06) 533 | 534 | 535 | #### Bug Fixes 536 | 537 | * **loader:** don't set target on frozen objects ([ebe91ff2](http://github.com/aurelia/loader-systemjs/commit/ebe91ff2024833c79386d59d0c3a42baad4ddedf)) 538 | 539 | 540 | ## 0.3.0 (2015-01-06) 541 | 542 | 543 | #### Features 544 | 545 | * **build:** update compiler and switch to register module format ([762fbfc9](http://github.com/aurelia/loader-systemjs/commit/762fbfc9c463b612d0b286526735da138be90b78)) 546 | * **loader:** add loadModule base url override ([d11cb589](http://github.com/aurelia/loader-systemjs/commit/d11cb58926777ec6b5a41c9dcc0a815b6c09e5f5)) 547 | 548 | 549 | ### 0.2.2 (2014-12-18) 550 | 551 | 552 | #### Bug Fixes 553 | 554 | * **package:** update to the latest version of path ([792ca4f5](http://github.com/aurelia/loader-systemjs/commit/792ca4f59104401ec52637648553ceb58746a808)) 555 | 556 | 557 | ### 0.2.1 (2014-12-17) 558 | 559 | 560 | #### Bug Fixes 561 | 562 | * **package:** add missing dependency ([0462d8b2](http://github.com/aurelia/loader-systemjs/commit/0462d8b2bbd1509181bf1b394a88b85e929a68a1)) 563 | 564 | 565 | ## 0.2.0 (2014-12-17) 566 | 567 | 568 | #### Bug Fixes 569 | 570 | * **loadTemplate:** check url has baseViewUrl ([fb06ca6b](http://github.com/aurelia/loader-systemjs/commit/fb06ca6be36d4fb36707e47e1ed35d546aa89557)) 571 | * **package:** update dependencies to latest versions ([9da71e4c](http://github.com/aurelia/loader-systemjs/commit/9da71e4c9864138b3ce93bf6c8aa515086dfcfa8)) 572 | 573 | 574 | ### 0.1.2 (2014-12-11) 575 | 576 | 577 | #### Bug Fixes 578 | 579 | * **package:** updating dependencies ([eb8b0aed](http://github.com/aurelia/loader-systemjs/commit/eb8b0aed667db21517eb02c26cfd57199cf03325)) 580 | 581 | 582 | ### 0.1.1 (2014-12-11) 583 | 584 | 585 | #### Bug Fixes 586 | 587 | * **loader:** loadModule should check for baseUrl ([7ce79f1c](http://github.com/aurelia/loader-systemjs/commit/7ce79f1c2e5a500a487987288c6832547d1a25a1)) 588 | 589 | 590 | ## 0.1.0 (2014-12-11) 591 | 592 | 593 | #### Bug Fixes 594 | 595 | * **loader:** incorrect paths passed to systemjs loader ([066bb5d7](http://github.com/aurelia/loader-systemjs/commit/066bb5d7193cc71744e11209636a3f52e4f40009)) 596 | -------------------------------------------------------------------------------- /doc/api.json: -------------------------------------------------------------------------------- 1 | {"name":"aurelia-loader-default","children":[{"id":12,"name":"DefaultLoader","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"A default implementation of the Loader abstraction which works with SystemJS, RequireJS and Dojo Loader."},"children":[{"id":14,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates an instance of the DefaultLoader."},"signatures":[{"id":15,"name":"new DefaultLoader","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates an instance of the DefaultLoader."},"type":{"type":"reference","name":"DefaultLoader","id":12},"overwrites":{"type":"reference","name":"Loader.__constructor"}}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":52,"character":25}],"overwrites":{"type":"reference","name":"Loader.__constructor"}},{"id":13,"name":"textPluginName","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The name of the underlying native loader plugin used to load text."},"sources":[{"fileName":"aurelia-loader-default.d.ts","line":52,"character":16}],"type":{"type":"instrinct","name":"string"}},{"id":47,"name":"addPlugin","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":48,"name":"addPlugin","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Registers a plugin with the loader."},"parameters":[{"id":49,"name":"pluginName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the plugin."},"type":{"type":"instrinct","name":"string"}},{"id":50,"name":"implementation","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The plugin implementation.\n"},"type":{"type":"reference","name":"LoaderPlugin"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"Loader.addPlugin"}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/aurelia-loader/dist/aurelia-loader.d.ts","line":176,"character":11}],"inheritedFrom":{"type":"reference","name":"Loader.addPlugin"}},{"id":43,"name":"applyPluginToUrl","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":44,"name":"applyPluginToUrl","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Alters a module id so that it includes a plugin loader.","returns":"The plugin-based module id.\n"},"parameters":[{"id":45,"name":"url","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The url of the module to load."},"type":{"type":"instrinct","name":"string"}},{"id":46,"name":"pluginName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The plugin to apply to the module id."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"string"},"inheritedFrom":{"type":"reference","name":"Loader.applyPluginToUrl"}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/aurelia-loader/dist/aurelia-loader.d.ts","line":169,"character":18}],"inheritedFrom":{"type":"reference","name":"Loader.applyPluginToUrl"}},{"id":51,"name":"getOrCreateTemplateRegistryEntry","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":52,"name":"getOrCreateTemplateRegistryEntry","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets or creates a TemplateRegistryEntry for the provided address.","returns":"The located or created TemplateRegistryEntry.\n"},"parameters":[{"id":53,"name":"address","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The address of the template."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"TemplateRegistryEntry"},"inheritedFrom":{"type":"reference","name":"Loader.getOrCreateTemplateRegistryEntry"}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/aurelia-loader/dist/aurelia-loader.d.ts","line":183,"character":34}],"inheritedFrom":{"type":"reference","name":"Loader.getOrCreateTemplateRegistryEntry"}},{"id":19,"name":"loadAllModules","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":20,"name":"loadAllModules","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads a collection of modules.","returns":"A Promise for an array of loaded modules.\n"},"parameters":[{"id":21,"name":"ids","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The set of module ids to load."},"type":{"type":"instrinct","isArray":true,"name":"string"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","isArray":true,"name":"any"}]},"overwrites":{"type":"reference","name":"Loader.loadAllModules"}}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":70,"character":16}],"overwrites":{"type":"reference","name":"Loader.loadAllModules"}},{"id":40,"name":"loadModule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":41,"name":"loadModule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads a module.","returns":"A Promise for the loaded module.\n"},"parameters":[{"id":42,"name":"id","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The module id to normalize."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"any"}]},"inheritedFrom":{"type":"reference","name":"Loader.loadModule"}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/aurelia-loader/dist/aurelia-loader.d.ts","line":140,"character":12}],"inheritedFrom":{"type":"reference","name":"Loader.loadModule"}},{"id":22,"name":"loadTemplate","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":23,"name":"loadTemplate","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads a template.","returns":"A Promise for a TemplateRegistryEntry containing the template.\n"},"parameters":[{"id":24,"name":"url","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The url of the template to load."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"TemplateRegistryEntry"}]},"overwrites":{"type":"reference","name":"Loader.loadTemplate"}}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":77,"character":14}],"overwrites":{"type":"reference","name":"Loader.loadTemplate"}},{"id":25,"name":"loadText","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":26,"name":"loadText","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads a text-based resource.","returns":"A Promise for text content.\n"},"parameters":[{"id":27,"name":"url","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The url of the text file to load."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"string"}]},"overwrites":{"type":"reference","name":"Loader.loadText"}}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":84,"character":10}],"overwrites":{"type":"reference","name":"Loader.loadText"}},{"id":28,"name":"map","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":29,"name":"map","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Maps a module id to a source."},"parameters":[{"id":30,"name":"id","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The module id."},"type":{"type":"instrinct","name":"string"}},{"id":31,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source to map the module to.\n"},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"Loader.map"}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/aurelia-loader/dist/aurelia-loader.d.ts","line":117,"character":5}],"inheritedFrom":{"type":"reference","name":"Loader.map"}},{"id":36,"name":"normalize","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":37,"name":"normalize","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Normalizes a module id.","returns":"A promise for the normalized module id.\n"},"parameters":[{"id":38,"name":"moduleId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The module id to normalize."},"type":{"type":"instrinct","name":"string"}},{"id":39,"name":"relativeTo","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"What the module id should be normalized relative to."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"string"}]},"inheritedFrom":{"type":"reference","name":"Loader.normalize"}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/aurelia-loader/dist/aurelia-loader.d.ts","line":133,"character":11}],"inheritedFrom":{"type":"reference","name":"Loader.normalize"}},{"id":32,"name":"normalizeSync","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":33,"name":"normalizeSync","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Normalizes a module id.","returns":"The normalized module id.\n"},"parameters":[{"id":34,"name":"moduleId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The module id to normalize."},"type":{"type":"instrinct","name":"string"}},{"id":35,"name":"relativeTo","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"What the module id should be normalized relative to."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"string"},"inheritedFrom":{"type":"reference","name":"Loader.normalizeSync"}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/aurelia-loader/dist/aurelia-loader.d.ts","line":125,"character":15}],"inheritedFrom":{"type":"reference","name":"Loader.normalizeSync"}},{"id":16,"name":"useTemplateLoader","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":17,"name":"useTemplateLoader","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Instructs the loader to use a specific TemplateLoader instance for loading templates"},"parameters":[{"id":18,"name":"templateLoader","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The instance of TemplateLoader to use for loading templates.\n"},"type":{"type":"reference","name":"TemplateLoader","id":2}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":63,"character":19}]}],"groups":[{"title":"Constructors","kind":512,"children":[14]},{"title":"Properties","kind":1024,"children":[13]},{"title":"Methods","kind":2048,"children":[47,43,51,19,40,22,25,28,36,32,16]}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":47,"character":34}],"extendedTypes":[{"type":"reference","name":"Loader"}]},{"id":7,"name":"TextTemplateLoader","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"An implementation of the TemplateLoader interface implemented with text-based loading."},"children":[{"id":8,"name":"loadTemplate","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":9,"name":"loadTemplate","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads a template.","returns":"A promise which resolves when the TemplateRegistryEntry is loaded with a template.\n"},"parameters":[{"id":10,"name":"loader","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The loader that is requesting the template load."},"type":{"type":"reference","name":"Loader"}},{"id":11,"name":"entry","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The TemplateRegistryEntry to load and populate with a template."},"type":{"type":"reference","name":"TemplateRegistryEntry"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"any"}]}}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":38,"character":14}]}],"groups":[{"title":"Methods","kind":2048,"children":[8]}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":30,"character":39}]},{"id":2,"name":"TemplateLoader","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Represents a template loader."},"children":[{"id":3,"name":"loadTemplate","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":4,"name":"loadTemplate","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads a template.","returns":"A promise which resolves when the TemplateRegistryEntry is loaded with a template.\n"},"parameters":[{"id":5,"name":"loader","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The loader that is requesting the template load."},"type":{"type":"reference","name":"Loader"}},{"id":6,"name":"entry","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The TemplateRegistryEntry to load and populate with a template."},"type":{"type":"reference","name":"TemplateRegistryEntry"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"any"}]}}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":24,"character":14}]}],"groups":[{"title":"Methods","kind":2048,"children":[3]}],"sources":[{"fileName":"aurelia-loader-default.d.ts","line":16,"character":39}]}],"groups":[{"title":"Classes","kind":128,"children":[12,7]},{"title":"Interfaces","kind":256,"children":[2]}]} -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | require('require-dir')('build/tasks'); 2 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Fri Dec 05 2014 16:49:29 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path that will be used to resolve all patterns (eg. files, exclude) 8 | basePath: '', 9 | 10 | 11 | // frameworks to use 12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 13 | frameworks: ['jspm', 'jasmine'], 14 | 15 | jspm: { 16 | // Edit this to your needs 17 | loadFiles: ['test/**/*.js'], 18 | serveFiles : ['src/**/*.js'] 19 | }, 20 | 21 | 22 | // list of files / patterns to load in the browser 23 | files: [ 24 | {pattern: 'test/fixtures/**/*.html', included: false} 25 | ], 26 | 27 | 28 | // list of files to exclude 29 | exclude: [ 30 | ], 31 | 32 | 33 | // preprocess matching files before serving them to the browser 34 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 35 | preprocessors: { 36 | 'test/**/*.js': ['babel'], 37 | 'src/**/*.js': ['babel'] 38 | }, 39 | 'babelPreprocessor': { 40 | options: { 41 | sourceMap: 'inline', 42 | presets: [ 'es2015-loose', 'stage-1'], 43 | plugins: [ 44 | 'syntax-flow', 45 | 'transform-decorators-legacy', 46 | 'transform-flow-strip-types' 47 | ] 48 | } 49 | }, 50 | 51 | 52 | // test results reporter to use 53 | // possible values: 'dots', 'progress' 54 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter 55 | reporters: ['progress'], 56 | 57 | 58 | // web server port 59 | port: 9876, 60 | 61 | 62 | // enable / disable colors in the output (reporters and logs) 63 | colors: true, 64 | 65 | 66 | // level of logging 67 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 68 | logLevel: config.LOG_INFO, 69 | 70 | 71 | // enable / disable watching file and executing tests whenever any file changes 72 | autoWatch: true, 73 | 74 | 75 | // start these browsers 76 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 77 | browsers: ['Chrome'], 78 | 79 | 80 | // Continuous Integration mode 81 | // if true, Karma captures browsers, runs the tests and exits 82 | singleRun: false 83 | }); 84 | }; 85 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurelia-loader-default", 3 | "version": "1.2.2", 4 | "description": "A default implementation of the loader interface compatible with system.js and require-based loaders.", 5 | "keywords": [ 6 | "aurelia", 7 | "loader", 8 | "modules" 9 | ], 10 | "homepage": "http://aurelia.io", 11 | "bugs": { 12 | "url": "https://github.com/aurelia/loader-default/issues" 13 | }, 14 | "license": "MIT", 15 | "author": "Rob Eisenberg (http://robeisenberg.com/)", 16 | "main": "dist/commonjs/aurelia-loader-default.js", 17 | "typings": "dist/aurelia-loader-default.d.ts", 18 | "repository": { 19 | "type": "git", 20 | "url": "http://github.com/aurelia/loader-default" 21 | }, 22 | "scripts": { 23 | "test": "karma start --single-run", 24 | "build": "gulp build", 25 | "cut-release": "gulp prepare-release" 26 | }, 27 | "files": [ 28 | "dist", 29 | "doc", 30 | "src", 31 | "typings.json", 32 | "README.md", 33 | "LICENSE" 34 | ], 35 | "jspm": { 36 | "registry": "npm", 37 | "main": "aurelia-loader-default", 38 | "format": "amd", 39 | "directories": { 40 | "dist": "dist/amd" 41 | }, 42 | "dependencies": { 43 | "aurelia-loader": "^1.0.0", 44 | "aurelia-metadata": "^1.0.0", 45 | "aurelia-pal": "^1.0.0" 46 | }, 47 | "devDependencies": { 48 | "aurelia-pal-browser": "^1.0.0-rc.1.0.0", 49 | "babel": "babel-core@^5.1.13", 50 | "babel-runtime": "^5.1.13", 51 | "core-js": "^2.0.3" 52 | } 53 | }, 54 | "dependencies": { 55 | "aurelia-loader": "^1.0.0", 56 | "aurelia-metadata": "^1.0.0", 57 | "aurelia-pal": "^1.0.0" 58 | }, 59 | "devDependencies": { 60 | "aurelia-tools": "^0.2.4", 61 | "babel-dts-generator": "^0.6.1", 62 | "babel-eslint": "^6.1.2", 63 | "babel-plugin-syntax-flow": "^6.8.0", 64 | "babel-plugin-transform-decorators-legacy": "^1.3.4", 65 | "babel-plugin-transform-es2015-modules-amd": "^6.8.0", 66 | "babel-plugin-transform-es2015-modules-commonjs": "^6.11.5", 67 | "babel-plugin-transform-es2015-modules-systemjs": "^6.11.6", 68 | "babel-plugin-transform-flow-strip-types": "^6.8.0", 69 | "babel-preset-es2015": "^6.9.0", 70 | "babel-preset-es2015-loose": "^7.0.0", 71 | "babel-preset-es2015-loose-native-modules": "^1.0.0", 72 | "babel-preset-stage-1": "^6.5.0", 73 | "del": "^2.2.1", 74 | "gulp": "^3.9.1", 75 | "gulp-babel": "^6.1.2", 76 | "gulp-bump": "^2.2.0", 77 | "gulp-concat": "^2.6.0", 78 | "gulp-conventional-changelog": "^1.1.0", 79 | "gulp-eslint": "^3.0.1", 80 | "gulp-ignore": "^2.0.1", 81 | "gulp-insert": "^0.5.0", 82 | "gulp-rename": "^1.2.2", 83 | "gulp-typedoc": "^2.0.0", 84 | "gulp-typedoc-extractor": "^0.0.8", 85 | "gulp-typescript": "^2.13.6", 86 | "gulp-util": "^3.0.7", 87 | "jasmine-core": "^2.4.1", 88 | "jspm": "^0.16.53", 89 | "karma": "^1.1.2", 90 | "karma-babel-preprocessor": "^6.0.1", 91 | "karma-chrome-launcher": "^1.0.1", 92 | "karma-coverage": "^1.1.1", 93 | "karma-jasmine": "^1.0.2", 94 | "karma-jspm": "^2.2.0", 95 | "merge2": "^1.0.2", 96 | "object.assign": "^4.0.4", 97 | "require-dir": "^0.3.0", 98 | "run-sequence": "^1.2.2", 99 | "through2": "^2.0.1", 100 | "typedoc": "^0.4.4", 101 | "typescript": "^1.9.0-dev.20160622-1.0", 102 | "vinyl": "^1.1.1", 103 | "vinyl-paths": "^2.1.0", 104 | "yargs": "^4.8.1" 105 | }, 106 | "aurelia": { 107 | "documentation": { 108 | "articles": [] 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /*eslint dot-notation:0*/ 2 | import {Origin} from 'aurelia-metadata'; 3 | import {TemplateRegistryEntry, Loader} from 'aurelia-loader'; 4 | import {TextTemplateLoader} from './text-template-loader'; 5 | import {PLATFORM} from 'aurelia-pal'; 6 | 7 | function ensureOriginOnExports(executed, name) { 8 | let target = executed; 9 | let key; 10 | let exportedValue; 11 | 12 | if (target.__useDefault) { 13 | target = target['default']; 14 | } 15 | 16 | Origin.set(target, new Origin(name, 'default')); 17 | 18 | for (key in target) { 19 | exportedValue = target[key]; 20 | 21 | if (typeof exportedValue === 'function') { 22 | Origin.set(exportedValue, new Origin(name, key)); 23 | } 24 | } 25 | 26 | return executed; 27 | } 28 | 29 | /** 30 | * Represents a template loader. 31 | */ 32 | interface TemplateLoader { 33 | /** 34 | * Loads a template. 35 | * @param loader The loader that is requesting the template load. 36 | * @param entry The TemplateRegistryEntry to load and populate with a template. 37 | * @return A promise which resolves when the TemplateRegistryEntry is loaded with a template. 38 | */ 39 | loadTemplate(loader: Loader, entry: TemplateRegistryEntry): Promise; 40 | } 41 | 42 | /** 43 | * A default implementation of the Loader abstraction which works with SystemJS, RequireJS and Dojo Loader. 44 | */ 45 | export class DefaultLoader extends Loader { 46 | /** 47 | * The name of the underlying native loader plugin used to load text. 48 | */ 49 | textPluginName: string = 'text'; 50 | 51 | /** 52 | * Creates an instance of the DefaultLoader. 53 | */ 54 | constructor() { 55 | super(); 56 | 57 | this.moduleRegistry = Object.create(null); 58 | this.useTemplateLoader(new TextTemplateLoader()); 59 | 60 | let that = this; 61 | 62 | this.addPlugin('template-registry-entry', { 63 | 'fetch': function(address) { 64 | let entry = that.getOrCreateTemplateRegistryEntry(address); 65 | return entry.templateIsLoaded ? entry : that.templateLoader.loadTemplate(that, entry).then(x => entry); 66 | } 67 | }); 68 | } 69 | 70 | /** 71 | * Instructs the loader to use a specific TemplateLoader instance for loading templates 72 | * @param templateLoader The instance of TemplateLoader to use for loading templates. 73 | */ 74 | useTemplateLoader(templateLoader: TemplateLoader): void { 75 | this.templateLoader = templateLoader; 76 | } 77 | 78 | /** 79 | * Loads a collection of modules. 80 | * @param ids The set of module ids to load. 81 | * @return A Promise for an array of loaded modules. 82 | */ 83 | loadAllModules(ids: string[]): Promise { 84 | let loads = []; 85 | 86 | for (let i = 0, ii = ids.length; i < ii; ++i) { 87 | loads.push(this.loadModule(ids[i])); 88 | } 89 | 90 | return Promise.all(loads); 91 | } 92 | 93 | /** 94 | * Loads a template. 95 | * @param url The url of the template to load. 96 | * @return A Promise for a TemplateRegistryEntry containing the template. 97 | */ 98 | loadTemplate(url: string): Promise { 99 | return this._import(this.applyPluginToUrl(url, 'template-registry-entry')); 100 | } 101 | 102 | /** 103 | * Loads a text-based resource. 104 | * @param url The url of the text file to load. 105 | * @return A Promise for text content. 106 | */ 107 | loadText(url: string): Promise { 108 | return this._import(this.applyPluginToUrl(url, this.textPluginName)).then(textOrModule => { 109 | if (typeof textOrModule === 'string') { 110 | return textOrModule; 111 | } 112 | 113 | return textOrModule['default']; 114 | }); 115 | } 116 | } 117 | 118 | PLATFORM.Loader = DefaultLoader; 119 | 120 | if (!PLATFORM.global.System || !PLATFORM.global.System.import) { 121 | if (PLATFORM.global.requirejs) { 122 | let getDefined; 123 | if (typeof PLATFORM.global.requirejs.s === 'object') { 124 | // Support for requirejs/requirejs 125 | getDefined = () => PLATFORM.global.requirejs.s.contexts._.defined; 126 | } else if (typeof PLATFORM.global.requirejs.contexts === 'object') { 127 | // Support for requirejs/alameda 128 | getDefined = () => PLATFORM.global.requirejs.contexts._.defined; 129 | } else if (typeof PLATFORM.global.requirejs.definedValues === 'function') { 130 | // Support for dumberjs/dumber-module-loader 131 | getDefined = () => PLATFORM.global.requirejs.definedValues(); 132 | } else { 133 | // skip any unknown AMD loader 134 | getDefined = () => ({}); 135 | } 136 | PLATFORM.eachModule = function(callback) { 137 | const defined = getDefined(); 138 | for (let key in defined) { 139 | try { 140 | if (callback(key, defined[key])) return; 141 | } catch (e) {} 142 | } 143 | }; 144 | } else { 145 | PLATFORM.eachModule = function(callback) {}; 146 | } 147 | 148 | DefaultLoader.prototype._import = function(moduleId) { 149 | return new Promise((resolve, reject) => { 150 | PLATFORM.global.require([moduleId], resolve, reject); 151 | }); 152 | }; 153 | 154 | DefaultLoader.prototype.loadModule = function(id) { 155 | let existing = this.moduleRegistry[id]; 156 | if (existing !== undefined) { 157 | return Promise.resolve(existing); 158 | } 159 | 160 | return new Promise((resolve, reject) => { 161 | PLATFORM.global.require([id], m => { 162 | this.moduleRegistry[id] = m; 163 | resolve(ensureOriginOnExports(m, id)); 164 | }, reject); 165 | }); 166 | }; 167 | 168 | DefaultLoader.prototype.map = function(id, source) {}; 169 | 170 | DefaultLoader.prototype.normalize = function(moduleId, relativeTo) { 171 | return Promise.resolve(moduleId); 172 | }; 173 | 174 | DefaultLoader.prototype.normalizeSync = function(moduleId, relativeTo) { 175 | return moduleId; 176 | }; 177 | 178 | DefaultLoader.prototype.applyPluginToUrl = function(url, pluginName) { 179 | return `${pluginName}!${url}`; 180 | }; 181 | 182 | DefaultLoader.prototype.addPlugin = function(pluginName, implementation) { 183 | let nonAnonDefine = define; 184 | nonAnonDefine(pluginName, [], { 185 | 'load': function(name, req, onload) { 186 | let result = implementation.fetch(name); 187 | Promise.resolve(result).then(onload); 188 | } 189 | }); 190 | }; 191 | } else { 192 | PLATFORM.eachModule = function(callback) { 193 | if (System.registry) { // SystemJS >= 0.20.x 194 | const keys = Array.from(System.registry.keys()); 195 | for (let i = 0; i < keys.length; i++) { 196 | try { 197 | let key = keys[i]; 198 | if (callback(key, System.registry.get(key))) { return; } 199 | } catch (e) {} 200 | } 201 | return; 202 | } 203 | 204 | // SystemJS < 0.20.x 205 | let modules = System._loader.modules; 206 | 207 | for (let key in modules) { 208 | try { 209 | if (callback(key, modules[key].module)) return; 210 | } catch (e) {} 211 | } 212 | }; 213 | 214 | DefaultLoader.prototype._import = function(moduleId) { 215 | return System.import(moduleId); 216 | }; 217 | 218 | DefaultLoader.prototype.loadModule = function(id) { 219 | return System.normalize(id).then(newId => { 220 | let existing = this.moduleRegistry[newId]; 221 | if (existing !== undefined) { 222 | return Promise.resolve(existing); 223 | } 224 | 225 | return System.import(newId).then(m => { 226 | this.moduleRegistry[newId] = m; 227 | return ensureOriginOnExports(m, newId); 228 | }); 229 | }); 230 | }; 231 | 232 | DefaultLoader.prototype.map = function(id, source) { 233 | System.config({ map: { [id]: source } }); 234 | }; 235 | 236 | DefaultLoader.prototype.normalizeSync = function(moduleId, relativeTo) { 237 | return System.normalizeSync(moduleId, relativeTo); 238 | }; 239 | 240 | DefaultLoader.prototype.normalize = function(moduleId, relativeTo) { 241 | return System.normalize(moduleId, relativeTo); 242 | }; 243 | 244 | DefaultLoader.prototype.applyPluginToUrl = function(url, pluginName) { 245 | return `${url}!${pluginName}`; 246 | }; 247 | 248 | DefaultLoader.prototype.addPlugin = function(pluginName, implementation) { 249 | System.set(pluginName, System.newModule({ 250 | 'fetch': function(load, _fetch) { 251 | let result = implementation.fetch(load.address); 252 | return Promise.resolve(result).then(x => { 253 | load.metadata.result = x; 254 | return ''; 255 | }); 256 | }, 257 | 'instantiate': function(load) { 258 | return load.metadata.result; 259 | } 260 | })); 261 | }; 262 | } 263 | -------------------------------------------------------------------------------- /src/text-template-loader.js: -------------------------------------------------------------------------------- 1 | import {TemplateRegistryEntry, Loader} from 'aurelia-loader'; 2 | import {DOM} from 'aurelia-pal'; 3 | 4 | /** 5 | * An implementation of the TemplateLoader interface implemented with text-based loading. 6 | */ 7 | export class TextTemplateLoader { 8 | /** 9 | * Loads a template. 10 | * @param loader The loader that is requesting the template load. 11 | * @param entry The TemplateRegistryEntry to load and populate with a template. 12 | * @return A promise which resolves when the TemplateRegistryEntry is loaded with a template. 13 | */ 14 | loadTemplate(loader: Loader, entry: TemplateRegistryEntry): Promise { 15 | return loader.loadText(entry.address).then(text => { 16 | entry.template = DOM.createTemplateFromMarkup(text); 17 | }); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/fixtures/baseModule.js: -------------------------------------------------------------------------------- 1 | export default function sayHi(){ 2 | return "baseModule hello"; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/baseTemplate.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/fixtures/moduleBase/rebasedModule.js: -------------------------------------------------------------------------------- 1 | export default function sayHi(){ 2 | return "rebasedModule hello"; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/text.js: -------------------------------------------------------------------------------- 1 | /* 2 | Text plugin 3 | */ 4 | exports.translate = function(load) { 5 | if (this.builder && this.transpiler) { 6 | load.metadata.format = 'esm'; 7 | return 'exp' + 'ort var __useDefault = ' + JSON.stringify(load.source) + '; exp' + 'ort default __useDefault;'; 8 | } 9 | 10 | load.metadata.format = 'amd'; 11 | return 'def' + 'ine(function() {\nreturn ' + JSON.stringify(load.source) + ';\n});'; 12 | }; 13 | -------------------------------------------------------------------------------- /test/fixtures/viewBase/rebasedTemplate.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/loader.spec.js: -------------------------------------------------------------------------------- 1 | import './setup'; 2 | import {DefaultLoader} from '../src/index'; 3 | 4 | describe('the system.js loader', () => { 5 | describe('instance method', () => { 6 | var loader; 7 | beforeEach(() => { 8 | System.config({ 9 | "paths": { 10 | "*": "test/fixtures/*.js" 11 | } 12 | }); 13 | 14 | loader = new DefaultLoader(); 15 | }); 16 | 17 | describe('loadModule', () => { 18 | it('should load a module', (done) => { 19 | loader.loadModule('baseModule') 20 | .then((result) => { 21 | expect(result).toEqual(jasmine.any(Object)); 22 | expect(result.default).toEqual(jasmine.any(Function)); 23 | expect(result.default()).toEqual("baseModule hello"); 24 | }) 25 | .catch((reason) => expect(false).toBeTruthy(reason)) 26 | .then(done); 27 | }); 28 | 29 | it("should fail if the module doesn't exist", (done) => { 30 | loader.loadModule('notHere') 31 | .then(result => expect(false).toBeTruthy('No module should have been found')) 32 | .catch(reason => expect(reason).toEqual(jasmine.any(Error))) 33 | .then(done); 34 | }); 35 | 36 | it("should cache any repeated module calls", (done) => { 37 | let importSpy = spyOn(System, 'import').and.callThrough(); 38 | 39 | //If both calls are done right after each other then the loader won't cache. 40 | //Perhaps this is a potential optimization 41 | loader.loadModule('baseModule').then(() => { 42 | return loader.loadModule('baseModule').then(() => { 43 | expect(importSpy.calls.count()).toEqual(1); 44 | }); 45 | }) 46 | .catch((reason) => expect(false).toBeTruthy(reason)) 47 | .then(done); 48 | }); 49 | }); 50 | 51 | describe('loadAllModules()', () => { 52 | 53 | it("will return when all modules are loaded", (done) => { 54 | loader.loadAllModules(['baseModule', 'moduleBase/rebasedModule']) 55 | .then((results) => { 56 | expect(results.length).toBe(2); 57 | for (let result of results) { 58 | expect(result).toEqual(jasmine.any(Object)); 59 | expect(result.default).toEqual(jasmine.any(Function)); 60 | expect(result.default()).toEqual(jasmine.any(String)); 61 | } 62 | }) 63 | .catch((reason) => expect(false).toBeTruthy(reason)) 64 | .then(done); 65 | }); 66 | 67 | it("will fail if any modules fail to load", (done) => { 68 | loader.loadAllModules(['baseModule', 'doesntExist']) 69 | .then(() => expect(false).toBeTruthy('No Modules should have loaded')) 70 | .catch((reason) => expect(reason).toEqual(jasmine.any(Error))) 71 | .then(done); 72 | }); 73 | }); 74 | 75 | describe('loadTemplate()', () => { 76 | 77 | it('will load a template', (done) => { 78 | loader.loadTemplate('baseTemplate.html') 79 | .then((result) => { 80 | expect(result.template.innerHTML).toBe("

I am the base template

"); 81 | }) 82 | .catch((reason) => expect(false).toBeTruthy(reason)) 83 | .then(done); 84 | }); 85 | 86 | //At this point I can't test for failing template loads as they never resolve. 87 | //This is an issue with tbe base loader. 88 | }); 89 | 90 | }); 91 | }); 92 | -------------------------------------------------------------------------------- /test/setup.js: -------------------------------------------------------------------------------- 1 | import {initialize} from 'aurelia-pal-browser'; 2 | initialize(); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "es2015", 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": false, 7 | "moduleResolution": "node", 8 | "stripInternal": true, 9 | "preserveConstEnums": true, 10 | "listFiles": true, 11 | "declaration": true, 12 | "removeComments": true, 13 | "lib": ["es2015", "dom"] 14 | }, 15 | "exclude": [ 16 | "node_modules", 17 | "dist", 18 | "build", 19 | "doc", 20 | "test", 21 | "config.js", 22 | "gulpfile.js", 23 | "karma.conf.js" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurelia-loader-default", 3 | "main": "dist/aurelia-loader-default.d.ts" 4 | } 5 | --------------------------------------------------------------------------------