Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

chore: remove moduleId from examples #3362

Merged
merged 6 commits into from
Mar 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
var _exampleBoilerplateFiles = [
'src/styles.css',
'src/systemjs.config.js',
'src/systemjs-angular-loader.js',
'src/tsconfig.json',
'bs-config.json',
'bs-config.e2e.json',
Expand Down
1 change: 1 addition & 0 deletions public/docs/_examples/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# _boilerplate files
!_boilerplate/*
*/*/src/styles.css
*/*/src/systemjs-angular-loader.js
*/*/src/systemjs.config.js
*/*/src/tsconfig.json
*/*/bs-config.e2e.json
Expand Down
43 changes: 43 additions & 0 deletions public/docs/_examples/_boilerplate/src/systemjs-angular-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var templateUrlRegex = /templateUrl\s*:(\s*['"`](.*?)['"`]\s*)/gm;
var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g;
var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;

module.exports.translate = function(load){

var url = new URL(load.address);

var basePathParts = url.pathname.split('/');

if (url.href.indexOf('plnkr') != -1) {
basePathParts.shift();
basePathParts.shift();
}

basePathParts.pop();
var basePath = basePathParts.join('/');
load.source = load.source
.replace(templateUrlRegex, function(match, quote, url){
let resolvedUrl = url;

if (url.startsWith('.')) {
resolvedUrl = basePath + url.substr(1);
}

return `templateUrl: '${resolvedUrl}'`;
})
.replace(stylesRegex, function(match, relativeUrls) {
var urls = [];

while ((match = stringRegex.exec(relativeUrls)) !== null) {
if (match[2].startsWith('.')) {
urls.push(`'${basePath.substr(1)}${match[2].substr(1)}'`);
} else {
urls.push(`'${match[2]}'`);
}
}

return "styleUrls: [" + urls.join(', ') + "]";
});

return load;
};
9 changes: 7 additions & 2 deletions public/docs/_examples/_boilerplate/src/systemjs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
'app': 'app',

// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
Expand All @@ -32,7 +32,12 @@
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
defaultExtension: 'js',
meta: {
'./*.js': {
loader: 'systemjs-angular-loader.js'
}
}
},
rxjs: {
defaultExtension: 'js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
},
// map tells the System loader where to look for things
map: {
'ng-loader': './systemjs-angular-loader.js',
// our app is within the app folder
app: 'app',
'app': 'app',

// angular bundles
'@angular/core': 'ng:core-builds/master/bundles/core.umd.js',
Expand Down Expand Up @@ -71,7 +72,12 @@
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
defaultExtension: 'ts',
meta: {
'./*.ts': {
loader: 'ng-loader'
}
}
},
rxjs: {
defaultExtension: 'js'
Expand Down
10 changes: 8 additions & 2 deletions public/docs/_examples/_boilerplate/src/systemjs.config.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
},
// map tells the System loader where to look for things
map: {
'ng-loader': './systemjs-angular-loader.js',
// our app is within the app folder
app: 'app',
'app': 'app',

// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
Expand All @@ -58,7 +59,12 @@
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
defaultExtension: 'ts',
meta: {
'./*.ts': {
loader: 'ng-loader'
}
}
},
rxjs: {
defaultExtension: 'js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-auto',
// #docregion template
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-basic',
// #enddocregion
/* The click event calls hero.toggleState(), which
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-combined-transitions',
// #docregion template
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-enter-leave-states',
// #docregion template
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-enter-leave',
// #docregion template
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-groups',
template: `
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-inline-styles',
// #docregion template
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-multistep',
// #docregion template
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-timings',
template: `
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import { Heroes } from './hero.service';

@Component({
moduleId: module.id,
selector: 'hero-list-twoway',
// #docregion template
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Component, Input } from '@angular/core';
import { Hero } from './hero';

@Component({
moduleId: module.id,
selector: 'hero-detail',
templateUrl: './hero-detail.component.html'
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { HeroService } from './hero.service';

// #docregion metadata, providers
@Component({
moduleId: module.id,
selector: 'hero-list',
templateUrl: './hero-list.component.html',
providers: [ HeroService ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component } from '@angular/core';

@Component({
moduleId: module.id,
selector: 'my-app',
templateUrl: './app.component.1.html'
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { Component } from '@angular/core';

@Component({
moduleId: module.id,
selector: 'my-app',
templateUrl: './app.component.html'
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { MovieService } from './movie.service';
import { IMovie } from './movie';

@Component({
moduleId: module.id,
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { MovieService } from './movie.service';

// #docregion component
@Component({
moduleId: module.id,
selector: 'movie-list',
templateUrl: './movie-list.component.html',
// #docregion style-url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { Component } from '@angular/core';

@Component({
moduleId: module.id,
selector: 'my-app',
templateUrl: './app.component.html'
})
Expand Down
3 changes: 0 additions & 3 deletions public/docs/_examples/cb-aot-compiler/ts/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<!-- #docregion moduleId -->
<script>window.module = 'aot';</script>
<!-- #enddocregion moduleId -->
</head>
<body>
<my-app>Loading...</my-app>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component } from '@angular/core';

@Component({
moduleId: module.id,
selector: 'my-app',
templateUrl: './app.component.html'
})
Expand Down
42 changes: 0 additions & 42 deletions public/docs/_examples/cb-component-relative-paths/e2e-spec.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading