Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
refactor: split zone.js into CJS modules, add zone-microtask.js
Browse files Browse the repository at this point in the history
BREAKING CHANGES:

zone.js as well as *-zone.js files are moved from / to dist/
  • Loading branch information
vicb committed May 8, 2015
1 parent 9b6d558 commit 2e52900
Show file tree
Hide file tree
Showing 37 changed files with 4,438 additions and 426 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1,960 changes: 1,960 additions & 0 deletions dist/zone-microtask.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/zone-microtask.min.js

Large diffs are not rendered by default.

933 changes: 531 additions & 402 deletions zone.js → dist/zone.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/zone.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8">
<title>Zone.js Basic Demo</title>
<link rel="stylesheet" href="style.css">
<script src="../zone.js"></script>
<script src="../long-stack-trace-zone.js"></script>
<script src="../dist/zone.js"></script>
<script src="../dist/long-stack-trace-zone.js"></script>
</head>
<body>

Expand Down
4 changes: 2 additions & 2 deletions example/counting.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8">
<title>Counting Pending Tasks</title>
<link rel="stylesheet" href="style.css">
<script src="../zone.js"></script>
<script src="../counting-zone.js"></script>
<script src="../dist/zone.js"></script>
<script src="../dist/counting-zone.js"></script>
</head>
<body>

Expand Down
4 changes: 2 additions & 2 deletions example/except.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8">
<title>Except Zone</title>
<link rel="stylesheet" href="style.css">
<script src="../zone.js"></script>
<script src="../except-zone.js"></script>
<script src="../dist/zone.js"></script>
<script src="../dist/except-zone.js"></script>
</head>
<body>

Expand Down
2 changes: 0 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<meta charset="utf-8">
<title>Zone.js Examples</title>
<link rel="stylesheet" href="style.css">
<script src="../zone.js"></script>
<script src="../long-stack-trace-zone.js"></script>
</head>
<body>

Expand Down
4 changes: 2 additions & 2 deletions example/profiling.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8">
<title>Zones Profiling</title>
<link rel="stylesheet" href="style.css">
<script src="../zone.js"></script>
<script src="../long-stack-trace-zone.js"></script>
<script src="../dist/zone.js"></script>
<script src="../dist/long-stack-trace-zone.js"></script>
</head>
<body>

Expand Down
6 changes: 3 additions & 3 deletions example/throttle.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8">
<title>Zones throttle</title>
<link rel="stylesheet" href="style.css">
<script src="../zone.js"></script>
<script src="../long-stack-trace-zone.js"></script>
<script src="../dist/zone.js"></script>
<script src="../dist/long-stack-trace-zone.js"></script>
</head>
<body>
<h1>Throttle Example</h1>
Expand Down Expand Up @@ -88,4 +88,4 @@ <h1>Throttle Example</h1>
</script>

</body>
</html>
</html>
2 changes: 1 addition & 1 deletion example/web-socket.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>WebSockets with Zones</title>
<link rel="stylesheet" href="style.css">
<script src="../zone.js"></script>
<script src="../dist/zone.js"></script>
</head>
<body>

Expand Down
2 changes: 1 addition & 1 deletion example/xml-http-request.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>HTTP requests with Zones</title>
<link rel="stylesheet" href="style.css">
<script src="../zone.js"></script>
<script src="../dist/zone.js"></script>
</head>
<body>

Expand Down
40 changes: 40 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use strict';

var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var buffer = require('vinyl-buffer');

var distFolder = './dist';

function generateBrowserScript(inFile, outFile) {
var b = browserify({
entries: inFile,
debug: false
});

return b
.bundle()
.pipe(source(outFile))
.pipe(buffer())
.pipe(gulp.dest(distFolder))
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(distFolder));
;
}

gulp.task('build/zone.js', function() {
return generateBrowserScript('./lib/browser/zone.js', 'zone.js');
});

gulp.task('build/zone-microtask.js', function() {
return generateBrowserScript('./lib/browser/zone-microtask.js', 'zone-microtask.js');
});

gulp.task('build', ['build/zone.js', 'build/zone-microtask.js']);



5 changes: 2 additions & 3 deletions karma-browserify.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ module.exports = function (config) {
basePath: '',
files: [
'test/util.js',
{pattern: 'zone.js', watched: true, served: false, included: false},
//'test/lib/brick.js',
{pattern: 'lib/zone.js', watched: true, served: false, included: false},
'test/commonjs.spec.js',
{pattern: 'test/assets/**/*.html', watched: true, served: true, included: false}
],

exclude: [

],

reporters: ['progress'],
Expand Down
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module.exports = function (config) {
basePath: '',
files: [
'test/util.js',
'zone.js',
'*-zone.js',
'dist/zone.js',
'dist/*-zone.js',
//'test/lib/brick.js',
'test/**/*.spec.js',
{pattern: 'test/assets/**/*.html', watched: true, served: true, included: false}
Expand Down
19 changes: 19 additions & 0 deletions lib/browser/zone-microtask.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

var core = require('../core');
var microtask = require('../microtask');
var browserPatch = require('../patch/browser');
var es6Promise = require('../ext/es6-promise.js');

if (global.Zone) {
console.warn('Zone already exported on window the object!');
}

global.Zone = microtask.addMicrotaskSupport(core.Zone);
global.zone = new global.Zone();

// Monkey path ẗhe Promise implementation to add support for microtasks
global.Promise = es6Promise.Promise;

browserPatch.apply();

13 changes: 13 additions & 0 deletions lib/browser/zone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

var core = require('../core');
var browserPatch = require('../patch/browser');

if (global.Zone) {
console.warn('Zone already exported on window the object!');
}

global.Zone = core.Zone;
global.zone = new global.Zone();

browserPatch.apply();
Loading

0 comments on commit 2e52900

Please sign in to comment.