diff options
Diffstat (limited to 'node_modules/ts-loader/examples')
41 files changed, 0 insertions, 1939 deletions
diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/README.md b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/README.md deleted file mode 100644 index e7a0cb064..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# TypeScript, Babel, React, and Karma Sample
-
-## Getting started
-
-You'll need [node / npm](https://nodejs.org/) installed. To get up and running just enter:
-
-```
-npm install
-npm run serve
-```
-
-This will:
-
-1. Download the npm packages you need (including the type definitions from DefinitelyTyped)
-2. Compile the code and serve it up at [http://localhost:8080](http://localhost:8080)
-
diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/clean.js b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/clean.js deleted file mode 100644 index c51b4e416..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/clean.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -var del = require('del'); -var gutil = require('gulp-util'); -var fs = require('fs'); - -function run(done) { - fs.stat('./dist', function(err){ - if (err) { - // Never existed - done(); - } - else { - del(['./dist'], { force: true }) - .then(function(paths) { - gutil.log('Deleted files/folders:\n', paths.join('\n')); - done(); - }) - .catch(function(error) { - gutil.log('Problem deleting:\n', error); - done(); - }); - } - }); -} - -module.exports = { - run: function(done) { return run(done); } -}; diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/inject.js b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/inject.js deleted file mode 100644 index e4133e565..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/inject.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var inject = require('gulp-inject'); -var glob = require('glob'); - -function injectIndex(options) { - function run() { - var target = gulp.src('./src/index.html'); - var sources = gulp.src([ - //'./dist/styles/main*.css', - './dist/scripts/vendor*.js', - './dist/scripts/main*.js' - ], { read: false }); - - return target - .pipe(inject(sources, { ignorePath: '/dist/', addRootSlash: false, removeTags: true })) - .pipe(gulp.dest('./dist')); - } - - var jsCssGlob = 'dist/**/*.{js,css}'; - - function checkForInitialFilesThenRun() { - glob(jsCssGlob, function (er, files) { - var filesWeNeed = ['dist/scripts/main', 'dist/scripts/vendor'/*, 'dist/styles/main'*/]; - - function fileIsPresent(fileWeNeed) { - return files.some(function(file) { - return file.indexOf(fileWeNeed) !== -1; - }); - } - - if (filesWeNeed.every(fileIsPresent)) { - run('initial build'); - } else { - checkForInitialFilesThenRun(); - } - }); - } - - checkForInitialFilesThenRun(); - - if (options.shouldWatch) { - gulp.watch(jsCssGlob, function(evt) { - if (evt.path && evt.type === 'changed') { - run(evt.path); - } - }); - } -} - -module.exports = { - build: function() { return injectIndex({ shouldWatch: false }); }, - watch: function() { return injectIndex({ shouldWatch: true }); } -}; diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/staticFiles.js b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/staticFiles.js deleted file mode 100644 index 20327f272..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/staticFiles.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var cache = require('gulp-cached'); - -var targets = [ - { description: 'INDEX', src: './src/index.html', dest: './dist' } -]; - -function copy(options) { - function run(target) { - gulp.src(target.src) - .pipe(cache(target.description)) - .pipe(gulp.dest(target.dest)); - } - - function watch(target) { - gulp.watch(target.src, function() { run(target); }); - } - - targets.forEach(run); - - if (options.shouldWatch) { - targets.forEach(watch); - } -} - -module.exports = { - build: function() { return copy({ shouldWatch: false }); }, - watch: function() { return copy({ shouldWatch: true }); } -}; diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/tests.js b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/tests.js deleted file mode 100644 index 05af0a551..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/tests.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -var Server = require('karma').Server; -var path = require('path'); -var gutil = require('gulp-util'); - -function runTests(options) { - // Documentation: https://karma-runner.github.io/0.13/dev/public-api.html - var karmaConfig = { - configFile: path.join(__dirname, '../karma.conf.js'), - singleRun: !options.shouldWatch, - - plugins: ['karma-webpack', 'karma-jasmine', 'karma-mocha-reporter', 'karma-sourcemap-loader', 'karma-phantomjs-launcher'], - reporters: ['mocha'] - }; - - if (options.done) { - karmaConfig.plugins.push('karma-junit-reporter'); - karmaConfig.reporters.push('junit'); - } else { - karmaConfig.plugins.push('karma-notify-reporter'); - karmaConfig.reporters.push('notify'); - } - - new Server(karmaConfig, karmaCompleted).start(); - - function karmaCompleted(exitCode) { - if (options.done) { - if (exitCode === 1) { - gutil.log('Karma: tests failed with code ' + exitCode); - } else { - gutil.log('Karma completed!'); - } - options.done(); - } - else { - process.exit(exitCode); - } - } -} - -module.exports = { - run: function(done) { return runTests({ shouldWatch: false, done: done }); }, - watch: function() { return runTests({ shouldWatch: true }); } -}; diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/webpack.js b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/webpack.js deleted file mode 100644 index 7607c122b..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulp/webpack.js +++ /dev/null @@ -1,112 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var gutil = require('gulp-util'); -var webpack = require('webpack'); -var ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); -var ForkTsCheckerNotifierWebpackPlugin = require('fork-ts-checker-notifier-webpack-plugin'); -var webpackFailPlugin = require('webpack-fail-plugin'); - -var webpackConfig = require('../webpack.config.js'); -var packageJson = require('../package.json'); - -function buildProduction(done) { - // modify some webpack config options - var myProdConfig = webpackConfig; - myProdConfig.output.filename = '[name].[hash].js'; - - myProdConfig.plugins = myProdConfig.plugins.concat( - new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': JSON.stringify('production') - } - }), - new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.[hash].js' }), - new webpack.optimize.UglifyJsPlugin({ - compress: { - warnings: true - } - }), - new ForkTsCheckerWebpackPlugin({ - blockEmit: true, - // tslint: true, - watch: ['./src', './test'] // optional but improves performance (less stat calls) - }), - webpackFailPlugin - ); - - // run webpack - webpack(myProdConfig, function (err, stats) { - if (err) { throw new gutil.PluginError('webpack:build', err); } - gutil.log('[webpack:build]', stats.toString({ - colors: true - })); - - if (done) { done(); } - }); -} - -function createDevCompiler() { - // modify some webpack config options - var myDevConfig = webpackConfig; - myDevConfig.devtool = 'inline-source-map'; - - myDevConfig.plugins = myDevConfig.plugins.concat( - new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.js' }), - new ForkTsCheckerNotifierWebpackPlugin ({ title: 'Build', excludeWarnings: false }), - new ForkTsCheckerWebpackPlugin({ - blockEmit: false, - // tslint: true, - watch: ['./src'] // optional but improves performance (less stat calls) - }) - ); - - // create a single instance of the compiler to allow caching - return webpack(myDevConfig); -} - -function build() { - return new Promise(function (resolve, reject) { - buildProduction(function (err) { - if (err) { - reject(err); - } else { - resolve('webpack built'); - } - }); - }); -} - -function watch() { - var firstBuildDone = false; - - return new Promise(function (resolve, reject) { - var devCompiler = createDevCompiler(); - devCompiler.watch({ // watch options: - aggregateTimeout: 300 // wait so long for more changes - }, function (err, stats) { - if (err) { - if (!firstBuildDone) { - firstBuildDone = true; - reject(err); - } - throw new gutil.PluginError('webpack:build-dev', err); - } else { - if (!firstBuildDone) { - firstBuildDone = true; - resolve('webpack built'); - } - } - - gutil.log('[webpack:build-dev]', stats.toString({ - chunks: false, - colors: true - })); - }); - }); -} - -module.exports = { - build: function () { return build(); }, - watch: function () { return watch(); } -}; diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulpFile.js b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulpFile.js deleted file mode 100644 index 02fcbc0d5..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/gulpFile.js +++ /dev/null @@ -1,54 +0,0 @@ -/* eslint-disable no-var, strict, prefer-arrow-callback */ -'use strict'; - -var gulp = require('gulp'); -var gutil = require('gulp-util'); -var webpack = require('./gulp/webpack'); -var staticFiles = require('./gulp/staticFiles'); -var tests = require('./gulp/tests'); -var clean = require('./gulp/clean'); -var inject = require('./gulp/inject'); - -var lintSrcs = ['./gulp/**/*.js']; - -gulp.task('delete-dist', function (done) { - clean.run(done); -}); - -gulp.task('build-js', ['delete-dist'], function(done) { - webpack.build().then(function() { done(); }); -}); - -gulp.task('build-other', ['delete-dist'], function() { - staticFiles.build(); -}); - -gulp.task('build', ['build-js', 'build-other'], function () { - inject.build(); -}); - -gulp.task('watch', ['delete-dist'], function(done) { - process.env.NODE_ENV = 'development'; - Promise.all([ - webpack.watch()//, - //less.watch() - ]).then(function() { - gutil.log('Now that initial assets (js and css) are generated inject will start...'); - inject.watch(); - done(); - }).catch(function(error) { - gutil.log('Problem generating initial assets (js and css)', error); - }); - - staticFiles.watch(); - tests.watch(); -}); - -gulp.task('watch-and-serve', ['watch'], function() { - // local as not required for build - var express = require('express') - var app = express() - - app.use(express.static('dist', {'index': 'index.html'})) - app.listen(8080); -}); diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/karma.conf.js b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/karma.conf.js deleted file mode 100644 index 1c35404d6..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/karma.conf.js +++ /dev/null @@ -1,69 +0,0 @@ -/* eslint-disable no-var, strict */ -'use strict'; - -var webpackConfig = require('./webpack.config.js'); -var ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); -var ForkTsCheckerNotifierWebpackPlugin = require('fork-ts-checker-notifier-webpack-plugin'); - -module.exports = function (config) { - var forkTsCheckerOptions = { - blockEmit: true, - watch: ['./test'] // optional but improves performance (less stat calls) - }; - var plugins = config.singleRun - ? [ - new ForkTsCheckerWebpackPlugin(forkTsCheckerOptions) - ] - : [ - new ForkTsCheckerNotifierWebpackPlugin({ title: 'Tests Build', excludeWarnings: false }), - new ForkTsCheckerWebpackPlugin(Object.assign({}, forkTsCheckerOptions, { blockEmit: false })) - ]; - - // Documentation: https://karma-runner.github.io/0.13/config/configuration-file.html - config.set({ - browsers: ['PhantomJS'], - - files: [ - // This ensures we have the es6 shims in place and then loads all the tests - 'test/main.js' - ], - - port: 9876, - - frameworks: ['jasmine'], - - logLevel: config.LOG_INFO, //config.LOG_DEBUG - - preprocessors: { - 'test/main.js': ['webpack', 'sourcemap'] - }, - - webpack: { - devtool: 'inline-source-map', - module: webpackConfig.module, - resolve: webpackConfig.resolve, - plugins: plugins - }, - - webpackMiddleware: { - quiet: true, - stats: { - colors: true - } - }, - - // reporter options - mochaReporter: { - colors: { - success: 'bgGreen', - info: 'cyan', - warning: 'bgBlue', - error: 'bgRed' - } - }, - - notifyReporter: { - reportSuccess: false // Default: true, Will notify when a suite was successful - } - }); -}; diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/package.json b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/package.json deleted file mode 100644 index a651593b8..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{
- "name": "es6-babel-react-flux-karma",
- "version": "1.0.0",
- "description": "ES6 + TypeScript + Babel + React + Karma: The Secret Recipe",
- "main": "index.js",
- "scripts": {
- "test": "karma start --reporters mocha,junit --single-run --browsers PhantomJS",
- "serve": "gulp watch-and-serve",
- "watch": "gulp watch",
- "build": "gulp build"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/microsoft/typescriptsamples.git"
- },
- "keywords": [
- "React",
- "Flux",
- "ES2016",
- "typescript"
- ],
- "author": "John Reilly",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/microsoft/typescriptsamples/issues"
- },
- "homepage": "https://github.com/Microsoft/TypeScriptSamples/tree/master/es6-babel-react-flux-karma#readme",
- "devDependencies": {
- "@types/fbemitter": "^2.0.32",
- "@types/flux": "0.0.32",
- "@types/jasmine": "^2.5.35",
- "@types/react": "^0.14.41",
- "@types/react-addons-test-utils": "^0.14.15",
- "@types/react-bootstrap": "0.0.33",
- "@types/react-dom": "^0.14.18",
- "@types/react-test-renderer": "^15.5.0",
- "babel": "^6.0.0",
- "babel-core": "^6.0.0",
- "babel-loader": "^7.0.0",
- "babel-preset-es2015": "^6.0.0",
- "babel-preset-es2016": "^6.16.0",
- "babel-preset-react": "^6.0.0",
- "del": "^2.0.2",
- "express": "^4.13.3",
- "fork-ts-checker-notifier-webpack-plugin": "^0.1.3",
- "fork-ts-checker-webpack-plugin": "^0.1.1",
- "glob": "^7.0.0",
- "gulp": "^3.9.0",
- "gulp-autoprefixer": "^3.1.0",
- "gulp-cached": "^1.1.0",
- "gulp-cssmin": "^0.1.7",
- "gulp-eslint": "^2.0.0",
- "gulp-if": "^2.0.0",
- "gulp-inject": "^3.0.0",
- "gulp-notify": "^2.2.0",
- "gulp-sourcemaps": "^1.5.2",
- "gulp-streamify": "1.0.2",
- "gulp-uglify": "^1.2.0",
- "gulp-util": "^3.0.6",
- "jasmine-core": "^2.3.4",
- "karma": "^1.2.0",
- "karma-jasmine": "^1.0.0",
- "karma-junit-reporter": "^1.0.0",
- "karma-mocha-reporter": "^2.0.0",
- "karma-notify-reporter": "^1.0.0",
- "karma-phantomjs-launcher": "^1.0.0",
- "karma-sourcemap-loader": "^0.3.6",
- "karma-webpack": "^2.0.1",
- "phantomjs-prebuilt": "^2.1.4",
- "react-addons-test-utils": "^15.3.1",
- "react-test-renderer": "^15.5.4",
- "ts-loader": "^2.0.0",
- "tslint": "^5.1.0",
- "tslint-react": "^3.0.0",
- "typescript": "^2.1.4",
- "webpack": "^2.2.0",
- "webpack-fail-plugin": "^1.0.4",
- "webpack-notifier": "^1.2.1"
- },
- "dependencies": {
- "babel-polyfill": "^6.0.0",
- "flux": "^2.0.3",
- "fbemitter": "^2.0.2",
- "react": "^15.4.1",
- "react-dom": "^15.4.1"
- }
-}
diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/tsconfig.json b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/tsconfig.json deleted file mode 100644 index c3a732c12..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{
- "compileOnSave": false,
- "compilerOptions": {
- "allowSyntheticDefaultImports": true,
- "lib": [
- "dom",
- "es2015",
- "es2016"
- ],
- "jsx": "preserve",
- "target": "es2016",
- "module": "es2015",
- "moduleResolution": "node",
- "noImplicitAny": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "removeComments": false,
- "preserveConstEnums": true,
- "sourceMap": true,
- "skipLibCheck": true
- }
-}
\ No newline at end of file diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/tslint.json b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/tslint.json deleted file mode 100644 index 40d93780b..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/tslint.json +++ /dev/null @@ -1,91 +0,0 @@ -{
- "extends": [
- "tslint:recommended",
- "tslint-react"
- ],
- "rules": {
- "arrow-parens": false,
- "class-name": true,
- "comment-format": [
- true,
- "check-space"
- ],
- "indent": [
- true,
- "spaces"
- ],
- "interface-name": [
- false
- ],
- "jsx-alignment": false,
- "jsx-no-lambda": true,
- "jsx-wrap-multiline": false,
- "jsx-no-multiline-js": false,
- "jsx-no-string-ref": true,
- "jsx-self-close": true,
- "jsx-curly-spacing": "always",
- "jsx-boolean-value": false,
- "max-classes-per-file": {
- "severity": "warning",
- "options": [true, 1]
- },
- "max-line-length": [
- false
- ],
- "member-access": false,
- "no-duplicate-variable": true,
- "no-empty": false,
- "no-eval": true,
- "no-internal-module": true,
- "no-trailing-whitespace": true,
- "no-var-keyword": true,
- "object-literal-sort-keys": false,
- "one-line": [
- true,
- "check-open-brace",
- "check-whitespace"
- ],
- "ordered-imports": false,
- "radix": false,
- "quotemark": [
- true,
- "single",
- "avoid-escape",
- "jsx-double"
- ],
- "semicolon": [
- true,
- "always"
- ],
- "switch-default": false,
- "trailing-comma": [
- false
- ],
- "triple-equals": [
- true,
- "allow-null-check"
- ],
- "typedef-whitespace": [
- true,
- {
- "call-signature": "nospace",
- "index-signature": "nospace",
- "parameter": "nospace",
- "property-declaration": "nospace",
- "variable-declaration": "nospace"
- }
- ],
- "variable-name": [
- true,
- "ban-keywords"
- ],
- "whitespace": [
- true,
- "check-branch",
- "check-decl",
- "check-operator",
- "check-separator",
- "check-type"
- ]
- }
-}
\ No newline at end of file diff --git a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/webpack.config.js b/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/webpack.config.js deleted file mode 100644 index 4c2922969..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker-react-babel-karma-gulp/webpack.config.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -var path = require('path'); - -var babelOptions = { - "presets": [ - "react", - [ - "es2015", - { - "modules": false - } - ], - "es2016" - ] -}; - -module.exports = { - cache: true, - entry: { - main: './src/main.tsx', - vendor: [ - 'babel-polyfill', - 'fbemitter', - 'flux', - 'react', - 'react-dom' - ] - }, - output: { - path: path.resolve(__dirname, './dist/scripts'), - filename: '[name].js', - chunkFilename: '[chunkhash].js' - }, - module: { - rules: [{ - test: /\.ts(x?)$/, - exclude: /node_modules/, - use: [ - { - loader: 'babel-loader', - options: babelOptions - }, - { - loader: 'ts-loader', - options: { transpileOnly: true } - } - ] - }, { - test: /\.js$/, - exclude: /node_modules/, - use: [ - { - loader: 'babel-loader', - options: babelOptions - } - ] - }] - }, - plugins: [ - ], - resolve: { - extensions: ['.ts', '.tsx', '.js'] - }, -}; diff --git a/node_modules/ts-loader/examples/fork-ts-checker/package.json b/node_modules/ts-loader/examples/fork-ts-checker/package.json deleted file mode 100644 index ee7197974..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{
- "name": "webpack2-fork-ts-checker",
- "main": "index.js",
- "version": "1.0.0",
- "scripts": {
- "start": "./node_modules/.bin/webpack --watch"
- },
- "devDependencies": {
- "fork-ts-checker-webpack-plugin": "^0.1.2",
- "ts-loader": "^2.0.3",
- "typescript": "^2.2.2",
- "webpack": "^2.2.0"
- }
-}
diff --git a/node_modules/ts-loader/examples/fork-ts-checker/tsconfig.json b/node_modules/ts-loader/examples/fork-ts-checker/tsconfig.json deleted file mode 100644 index 655163c00..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{
- "compilerOptions": {
- }
-}
diff --git a/node_modules/ts-loader/examples/fork-ts-checker/webpack.config.js b/node_modules/ts-loader/examples/fork-ts-checker/webpack.config.js deleted file mode 100644 index bac2155e0..000000000 --- a/node_modules/ts-loader/examples/fork-ts-checker/webpack.config.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -var process = require('process'); -var ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); - -module.exports = { - context: __dirname, // to automatically find tsconfig.json - entry: './src/index.ts', - output: { filename: 'index.js' }, - module: { - rules: [ - { - test: /\.tsx?$/, - loader: 'ts-loader', - options: { - transpileOnly: true // IMPORTANT! use transpileOnly mode to speed-up compilation - } - } - ] - }, - resolve: { - extensions: [ '.ts', '.tsx' ] - }, - plugins: [ - new ForkTsCheckerWebpackPlugin({ - tslint: false, // disable tslint support - watch: './src', // optional but improves performance (less stat calls) - workers: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE, // use multi-process mode, leave 2 cpu's free for builder and system - blockEmit: process.env.NODE_ENV === 'production' // for production make it synchronous - }) - ] -}; diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/README.md b/node_modules/ts-loader/examples/react-babel-karma-gulp/README.md deleted file mode 100644 index e7a0cb064..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# TypeScript, Babel, React, and Karma Sample
-
-## Getting started
-
-You'll need [node / npm](https://nodejs.org/) installed. To get up and running just enter:
-
-```
-npm install
-npm run serve
-```
-
-This will:
-
-1. Download the npm packages you need (including the type definitions from DefinitelyTyped)
-2. Compile the code and serve it up at [http://localhost:8080](http://localhost:8080)
-
diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/clean.js b/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/clean.js deleted file mode 100644 index c51b4e416..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/clean.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -var del = require('del'); -var gutil = require('gulp-util'); -var fs = require('fs'); - -function run(done) { - fs.stat('./dist', function(err){ - if (err) { - // Never existed - done(); - } - else { - del(['./dist'], { force: true }) - .then(function(paths) { - gutil.log('Deleted files/folders:\n', paths.join('\n')); - done(); - }) - .catch(function(error) { - gutil.log('Problem deleting:\n', error); - done(); - }); - } - }); -} - -module.exports = { - run: function(done) { return run(done); } -}; diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/inject.js b/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/inject.js deleted file mode 100644 index e4133e565..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/inject.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var inject = require('gulp-inject'); -var glob = require('glob'); - -function injectIndex(options) { - function run() { - var target = gulp.src('./src/index.html'); - var sources = gulp.src([ - //'./dist/styles/main*.css', - './dist/scripts/vendor*.js', - './dist/scripts/main*.js' - ], { read: false }); - - return target - .pipe(inject(sources, { ignorePath: '/dist/', addRootSlash: false, removeTags: true })) - .pipe(gulp.dest('./dist')); - } - - var jsCssGlob = 'dist/**/*.{js,css}'; - - function checkForInitialFilesThenRun() { - glob(jsCssGlob, function (er, files) { - var filesWeNeed = ['dist/scripts/main', 'dist/scripts/vendor'/*, 'dist/styles/main'*/]; - - function fileIsPresent(fileWeNeed) { - return files.some(function(file) { - return file.indexOf(fileWeNeed) !== -1; - }); - } - - if (filesWeNeed.every(fileIsPresent)) { - run('initial build'); - } else { - checkForInitialFilesThenRun(); - } - }); - } - - checkForInitialFilesThenRun(); - - if (options.shouldWatch) { - gulp.watch(jsCssGlob, function(evt) { - if (evt.path && evt.type === 'changed') { - run(evt.path); - } - }); - } -} - -module.exports = { - build: function() { return injectIndex({ shouldWatch: false }); }, - watch: function() { return injectIndex({ shouldWatch: true }); } -}; diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/staticFiles.js b/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/staticFiles.js deleted file mode 100644 index 20327f272..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/staticFiles.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var cache = require('gulp-cached'); - -var targets = [ - { description: 'INDEX', src: './src/index.html', dest: './dist' } -]; - -function copy(options) { - function run(target) { - gulp.src(target.src) - .pipe(cache(target.description)) - .pipe(gulp.dest(target.dest)); - } - - function watch(target) { - gulp.watch(target.src, function() { run(target); }); - } - - targets.forEach(run); - - if (options.shouldWatch) { - targets.forEach(watch); - } -} - -module.exports = { - build: function() { return copy({ shouldWatch: false }); }, - watch: function() { return copy({ shouldWatch: true }); } -}; diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/tests.js b/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/tests.js deleted file mode 100644 index 05af0a551..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/tests.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -var Server = require('karma').Server; -var path = require('path'); -var gutil = require('gulp-util'); - -function runTests(options) { - // Documentation: https://karma-runner.github.io/0.13/dev/public-api.html - var karmaConfig = { - configFile: path.join(__dirname, '../karma.conf.js'), - singleRun: !options.shouldWatch, - - plugins: ['karma-webpack', 'karma-jasmine', 'karma-mocha-reporter', 'karma-sourcemap-loader', 'karma-phantomjs-launcher'], - reporters: ['mocha'] - }; - - if (options.done) { - karmaConfig.plugins.push('karma-junit-reporter'); - karmaConfig.reporters.push('junit'); - } else { - karmaConfig.plugins.push('karma-notify-reporter'); - karmaConfig.reporters.push('notify'); - } - - new Server(karmaConfig, karmaCompleted).start(); - - function karmaCompleted(exitCode) { - if (options.done) { - if (exitCode === 1) { - gutil.log('Karma: tests failed with code ' + exitCode); - } else { - gutil.log('Karma completed!'); - } - options.done(); - } - else { - process.exit(exitCode); - } - } -} - -module.exports = { - run: function(done) { return runTests({ shouldWatch: false, done: done }); }, - watch: function() { return runTests({ shouldWatch: true }); } -}; diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/webpack.js b/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/webpack.js deleted file mode 100644 index 2ecbf42ea..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulp/webpack.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var gutil = require('gulp-util'); -var webpack = require('webpack'); -var WebpackNotifierPlugin = require('webpack-notifier'); -var failPlugin = require('webpack-fail-plugin'); -var webpackConfig = require('../webpack.config.js'); -var packageJson = require('../package.json'); - -function buildProduction(done) { - // modify some webpack config options - var myProdConfig = webpackConfig; - myProdConfig.output.filename = '[name].[hash].js'; - - myProdConfig.plugins = myProdConfig.plugins.concat( - new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': JSON.stringify('production') - } - }), - new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.[hash].js' }), - new webpack.optimize.UglifyJsPlugin({ - compress: { - warnings: true - } - }), - failPlugin - ); - - // run webpack - webpack(myProdConfig, function (err, stats) { - if (err) { throw new gutil.PluginError('webpack:build', err); } - gutil.log('[webpack:build]', stats.toString({ - colors: true - })); - - if (done) { done(); } - }); -} - -function createDevCompiler() { - // modify some webpack config options - var myDevConfig = webpackConfig; - myDevConfig.devtool = 'inline-source-map'; - - myDevConfig.plugins = myDevConfig.plugins.concat( - new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.js' }), - new WebpackNotifierPlugin({ title: 'Webpack build', excludeWarnings: true }) - ); - - // create a single instance of the compiler to allow caching - return webpack(myDevConfig); -} - -function build() { - return new Promise(function (resolve, reject) { - buildProduction(function (err) { - if (err) { - reject(err); - } else { - resolve('webpack built'); - } - }); - }); -} - -function watch() { - var firstBuildDone = false; - - return new Promise(function (resolve, reject) { - var devCompiler = createDevCompiler(); - devCompiler.watch({ // watch options: - aggregateTimeout: 300 // wait so long for more changes - }, function (err, stats) { - if (err) { - if (!firstBuildDone) { - firstBuildDone = true; - reject(err); - } - throw new gutil.PluginError('webpack:build-dev', err); - } else { - if (!firstBuildDone) { - firstBuildDone = true; - resolve('webpack built'); - } - } - - gutil.log('[webpack:build-dev]', stats.toString({ - chunks: false, - colors: true - })); - }); - }); -} - -module.exports = { - build: function () { return build(); }, - watch: function () { return watch(); } -}; diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulpFile.js b/node_modules/ts-loader/examples/react-babel-karma-gulp/gulpFile.js deleted file mode 100644 index 03c6a6b4e..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/gulpFile.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var gutil = require('gulp-util'); -var webpack = require('./gulp/webpack'); -var staticFiles = require('./gulp/staticFiles'); -var tests = require('./gulp/tests'); -var clean = require('./gulp/clean'); -var inject = require('./gulp/inject'); - -gulp.task('delete-dist', function (done) { - clean.run(done); -}); - -gulp.task('build-js', ['delete-dist'], function(done) { - webpack.build().then(function() { done(); }); -}); - -gulp.task('build-other', ['delete-dist'], function() { - staticFiles.build(); -}); - -gulp.task('build', ['build-js', 'build-other'], function () { - inject.build(); -}); - -gulp.task('watch', ['delete-dist'], function(done) { - Promise.all([ - webpack.watch() - ]).then(function() { - gutil.log('Now that initial assets (js and css) are generated inject will start...'); - inject.watch(); - done(); - }).catch(function(error) { - gutil.log('Problem generating initial assets (js and css)', error); - }); - - staticFiles.watch(); - tests.watch(); -}); - -gulp.task('watch-and-serve', ['watch'], function() { - // local as not required for build - var express = require('express') - var app = express() - - app.use(express.static('dist', {'index': 'index.html'})) - app.listen(8080); -}); diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/karma.conf.js b/node_modules/ts-loader/examples/react-babel-karma-gulp/karma.conf.js deleted file mode 100644 index f07fbc179..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/karma.conf.js +++ /dev/null @@ -1,49 +0,0 @@ -/* eslint-disable no-var, strict */ -'use strict'; - -var webpackConfig = require('./webpack.config.js'); - -module.exports = function(config) { - // Documentation: https://karma-runner.github.io/0.13/config/configuration-file.html - config.set({ - browsers: [ 'PhantomJS' ], - - files: [ - // This ensures we have the es6 shims in place and then loads all the tests - 'test/main.js' - ], - - port: 9876, - - frameworks: [ 'jasmine' ], - - logLevel: config.LOG_INFO, //config.LOG_DEBUG - - preprocessors: { - 'test/main.js': [ 'webpack', 'sourcemap' ] - }, - - webpack: { - devtool: 'inline-source-map', - module: webpackConfig.module, - resolve: webpackConfig.resolve - }, - - webpackMiddleware: { - quiet: true, - stats: { - colors: true - } - }, - - // reporter options - mochaReporter: { - colors: { - success: 'bgGreen', - info: 'cyan', - warning: 'bgBlue', - error: 'bgRed' - } - } - }); -}; diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/package.json b/node_modules/ts-loader/examples/react-babel-karma-gulp/package.json deleted file mode 100644 index 52ed4c468..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{
- "name": "es6-babel-react-flux-karma",
- "version": "1.0.0",
- "description": "ES6 + TypeScript + Babel + React + Karma: The Secret Recipe",
- "main": "index.js",
- "scripts": {
- "test": "karma start --reporters mocha,junit --single-run --browsers PhantomJS",
- "serve": "gulp watch-and-serve",
- "watch": "gulp watch",
- "build": "gulp build"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/microsoft/typescriptsamples.git"
- },
- "keywords": [
- "React",
- "Flux",
- "ES2016",
- "typescript"
- ],
- "author": "John Reilly",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/microsoft/typescriptsamples/issues"
- },
- "homepage": "https://github.com/Microsoft/TypeScriptSamples/tree/master/es6-babel-react-flux-karma#readme",
- "devDependencies": {
- "@types/fbemitter": "^2.0.32",
- "@types/flux": "0.0.32",
- "@types/jasmine": "^2.5.35",
- "@types/react": "^0.14.41",
- "@types/react-addons-test-utils": "^0.14.15",
- "@types/react-test-renderer": "^15.5.0",
- "@types/react-bootstrap": "0.0.33",
- "@types/react-dom": "^0.14.18",
- "babel": "^6.0.0",
- "babel-core": "^6.0.0",
- "babel-loader": "^7.0.0",
- "babel-preset-es2015": "^6.0.0",
- "babel-preset-es2016": "^6.16.0",
- "babel-preset-react": "^6.0.0",
- "del": "^2.0.2",
- "eslint": "^2.0.0",
- "express": "^4.13.3",
- "glob": "^7.0.0",
- "gulp": "^3.9.0",
- "gulp-autoprefixer": "^3.1.0",
- "gulp-cached": "^1.1.0",
- "gulp-cssmin": "^0.1.7",
- "gulp-eslint": "^2.0.0",
- "gulp-if": "^2.0.0",
- "gulp-inject": "^3.0.0",
- "gulp-notify": "^2.2.0",
- "gulp-sourcemaps": "^1.5.2",
- "gulp-streamify": "1.0.2",
- "gulp-uglify": "^1.2.0",
- "gulp-util": "^3.0.6",
- "jasmine-core": "^2.3.4",
- "karma": "^1.2.0",
- "karma-jasmine": "^1.0.0",
- "karma-junit-reporter": "^1.0.0",
- "karma-mocha-reporter": "^2.0.0",
- "karma-notify-reporter": "^1.0.0",
- "karma-phantomjs-launcher": "^1.0.0",
- "karma-sourcemap-loader": "^0.3.6",
- "karma-webpack": "^2.0.1",
- "phantomjs-prebuilt": "^2.1.4",
- "react-addons-test-utils": "^15.3.1",
- "react-test-renderer": "^15.5.4",
- "ts-loader": "^2.0.0",
- "typescript": "^2.1.4",
- "webpack": "^2.2.0",
- "webpack-fail-plugin": "^1.0.4",
- "webpack-notifier": "^1.2.1"
- },
- "dependencies": {
- "babel-polyfill": "^6.0.0",
- "flux": "^2.0.3",
- "fbemitter": "^2.0.2",
- "react": "^15.4.1",
- "react-dom": "^15.4.1"
- }
-}
diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/tsconfig.json b/node_modules/ts-loader/examples/react-babel-karma-gulp/tsconfig.json deleted file mode 100644 index c3a732c12..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{
- "compileOnSave": false,
- "compilerOptions": {
- "allowSyntheticDefaultImports": true,
- "lib": [
- "dom",
- "es2015",
- "es2016"
- ],
- "jsx": "preserve",
- "target": "es2016",
- "module": "es2015",
- "moduleResolution": "node",
- "noImplicitAny": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "removeComments": false,
- "preserveConstEnums": true,
- "sourceMap": true,
- "skipLibCheck": true
- }
-}
\ No newline at end of file diff --git a/node_modules/ts-loader/examples/react-babel-karma-gulp/webpack.config.js b/node_modules/ts-loader/examples/react-babel-karma-gulp/webpack.config.js deleted file mode 100644 index 60620a83f..000000000 --- a/node_modules/ts-loader/examples/react-babel-karma-gulp/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -var path = require('path'); - -var babelOptions = { - "presets": [ - "react", - [ - "es2015", - { - "modules": false - } - ], - "es2016" - ] -}; - -module.exports = { - cache: true, - entry: { - main: './src/main.tsx', - vendor: [ - 'babel-polyfill', - 'fbemitter', - 'flux', - 'react', - 'react-dom' - ] - }, - output: { - path: path.resolve(__dirname, './dist/scripts'), - filename: '[name].js', - chunkFilename: '[chunkhash].js' - }, - module: { - rules: [{ - test: /\.ts(x?)$/, - exclude: /node_modules/, - use: [ - { - loader: 'babel-loader', - options: babelOptions - }, - { - loader: 'ts-loader' - } - ] - }, { - test: /\.js$/, - exclude: /node_modules/, - use: [ - { - loader: 'babel-loader', - options: babelOptions - } - ] - }] - }, - plugins: [ - ], - resolve: { - extensions: ['.ts', '.tsx', '.js'] - }, -}; diff --git a/node_modules/ts-loader/examples/react-cdn-simple/index.html b/node_modules/ts-loader/examples/react-cdn-simple/index.html deleted file mode 100644 index 09651107e..000000000 --- a/node_modules/ts-loader/examples/react-cdn-simple/index.html +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE html>
-<html>
- <head>
- <meta charset="UTF-8">
- </head>
- <body>
- <div id="wrapper"></div>
-
- <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.js"></script>
- <script src="index.js"></script>
- </body>
-</html>
diff --git a/node_modules/ts-loader/examples/react-cdn-simple/package.json b/node_modules/ts-loader/examples/react-cdn-simple/package.json deleted file mode 100644 index 33b29639d..000000000 --- a/node_modules/ts-loader/examples/react-cdn-simple/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{
- "name": "webpack2-react-cdn-simple",
- "main": "index.js",
- "version": "1.0.0",
- "scripts": {
- "build": "webpack"
- },
- "devDependencies": {
- "ts-loader": "^2.0.0",
- "webpack": "^2.2.0"
- },
- "dependencies": {
- "@types/react": "^15.0.4",
- "@types/react-dom": "^0.14.21"
- }
-}
diff --git a/node_modules/ts-loader/examples/react-cdn-simple/tsconfig.json b/node_modules/ts-loader/examples/react-cdn-simple/tsconfig.json deleted file mode 100644 index b48ecdfb6..000000000 --- a/node_modules/ts-loader/examples/react-cdn-simple/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{
- "compilerOptions": {
- "jsx": "react"
- }
-}
diff --git a/node_modules/ts-loader/examples/react-cdn-simple/webpack.config.js b/node_modules/ts-loader/examples/react-cdn-simple/webpack.config.js deleted file mode 100644 index 7abb3171d..000000000 --- a/node_modules/ts-loader/examples/react-cdn-simple/webpack.config.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -module.exports = { - entry: './src/index.tsx', - output: { filename: 'index.js' }, - module: { - rules: [ - { - test: /\.tsx?$/, - loader: 'ts-loader', - options: { - transpileOnly: true - } - } - ] - }, - resolve: { - extensions: [ '.ts', '.tsx' ] - }, - externals: { - 'react': 'React', - 'react-dom': 'ReactDOM' - } -}; diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/.eslintrc b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/.eslintrc deleted file mode 100644 index f7aa388ad..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/.eslintrc +++ /dev/null @@ -1,73 +0,0 @@ -{
- "root": true,
- "env": {
- "commonjs": true,
- },
- "rules": {
- "camelcase": 2,
- "comma-spacing": 1,
- "consistent-return": 2,
- "curly": [ 2, "all" ],
- "dot-notation": [
- 2,
- { "allowKeywords": true }
- ],
- "eol-last": 2,
- "eqeqeq": 2,
- "keyword-spacing": 2,
- "new-cap": 2,
- "new-parens": 2,
- "no-alert": 2,
- "no-array-constructor": 2,
- "no-caller": 2,
- "no-catch-shadow": 2,
- "no-eval": 2,
- "no-extend-native": 2,
- "no-extra-bind": 2,
- "no-extra-parens": [ 2, "functions" ],
- "no-implied-eval": 2,
- "no-iterator": 2,
- "no-labels": 2,
- "no-label-var": 2,
- "no-lone-blocks": 2,
- "no-loop-func": 2,
- "no-multi-str": 2,
- "no-native-reassign": 2,
- "no-new": 2,
- "no-new-func": 2,
- "no-new-object": 2,
- "no-new-wrappers": 2,
- "no-octal-escape": 2,
- "no-proto": 2,
- "no-return-assign": 2,
- "no-script-url": 2,
- "no-sequences": 2,
- "no-shadow": 2,
- "no-shadow-restricted-names": 2,
- "no-spaced-func": 2,
- "no-trailing-spaces": 1,
- "no-undef-init": 2,
- "no-unused-expressions": 2,
- "no-use-before-define": [ 2, "nofunc" ],
- "no-with": 2,
- "quotes": [ 1, "single" ],
- "semi": 2,
- "semi-spacing": [
- 2,
- {
- "before": false,
- "after": true
- }
- ],
- "space-infix-ops": 2,
- "space-unary-ops": [
- 2,
- {
- "words": true,
- "nonwords": false
- }
- ],
- "strict": [ 2, "global" ],
- "yoda": [ 2, "never" ]
- }
-}
diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/clean.js b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/clean.js deleted file mode 100644 index c51b4e416..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/clean.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -var del = require('del'); -var gutil = require('gulp-util'); -var fs = require('fs'); - -function run(done) { - fs.stat('./dist', function(err){ - if (err) { - // Never existed - done(); - } - else { - del(['./dist'], { force: true }) - .then(function(paths) { - gutil.log('Deleted files/folders:\n', paths.join('\n')); - done(); - }) - .catch(function(error) { - gutil.log('Problem deleting:\n', error); - done(); - }); - } - }); -} - -module.exports = { - run: function(done) { return run(done); } -}; diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/inject.js b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/inject.js deleted file mode 100644 index e4133e565..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/inject.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var inject = require('gulp-inject'); -var glob = require('glob'); - -function injectIndex(options) { - function run() { - var target = gulp.src('./src/index.html'); - var sources = gulp.src([ - //'./dist/styles/main*.css', - './dist/scripts/vendor*.js', - './dist/scripts/main*.js' - ], { read: false }); - - return target - .pipe(inject(sources, { ignorePath: '/dist/', addRootSlash: false, removeTags: true })) - .pipe(gulp.dest('./dist')); - } - - var jsCssGlob = 'dist/**/*.{js,css}'; - - function checkForInitialFilesThenRun() { - glob(jsCssGlob, function (er, files) { - var filesWeNeed = ['dist/scripts/main', 'dist/scripts/vendor'/*, 'dist/styles/main'*/]; - - function fileIsPresent(fileWeNeed) { - return files.some(function(file) { - return file.indexOf(fileWeNeed) !== -1; - }); - } - - if (filesWeNeed.every(fileIsPresent)) { - run('initial build'); - } else { - checkForInitialFilesThenRun(); - } - }); - } - - checkForInitialFilesThenRun(); - - if (options.shouldWatch) { - gulp.watch(jsCssGlob, function(evt) { - if (evt.path && evt.type === 'changed') { - run(evt.path); - } - }); - } -} - -module.exports = { - build: function() { return injectIndex({ shouldWatch: false }); }, - watch: function() { return injectIndex({ shouldWatch: true }); } -}; diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/staticFiles.js b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/staticFiles.js deleted file mode 100644 index 20327f272..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/staticFiles.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var cache = require('gulp-cached'); - -var targets = [ - { description: 'INDEX', src: './src/index.html', dest: './dist' } -]; - -function copy(options) { - function run(target) { - gulp.src(target.src) - .pipe(cache(target.description)) - .pipe(gulp.dest(target.dest)); - } - - function watch(target) { - gulp.watch(target.src, function() { run(target); }); - } - - targets.forEach(run); - - if (options.shouldWatch) { - targets.forEach(watch); - } -} - -module.exports = { - build: function() { return copy({ shouldWatch: false }); }, - watch: function() { return copy({ shouldWatch: true }); } -}; diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/tests.js b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/tests.js deleted file mode 100644 index 05af0a551..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/tests.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -var Server = require('karma').Server; -var path = require('path'); -var gutil = require('gulp-util'); - -function runTests(options) { - // Documentation: https://karma-runner.github.io/0.13/dev/public-api.html - var karmaConfig = { - configFile: path.join(__dirname, '../karma.conf.js'), - singleRun: !options.shouldWatch, - - plugins: ['karma-webpack', 'karma-jasmine', 'karma-mocha-reporter', 'karma-sourcemap-loader', 'karma-phantomjs-launcher'], - reporters: ['mocha'] - }; - - if (options.done) { - karmaConfig.plugins.push('karma-junit-reporter'); - karmaConfig.reporters.push('junit'); - } else { - karmaConfig.plugins.push('karma-notify-reporter'); - karmaConfig.reporters.push('notify'); - } - - new Server(karmaConfig, karmaCompleted).start(); - - function karmaCompleted(exitCode) { - if (options.done) { - if (exitCode === 1) { - gutil.log('Karma: tests failed with code ' + exitCode); - } else { - gutil.log('Karma completed!'); - } - options.done(); - } - else { - process.exit(exitCode); - } - } -} - -module.exports = { - run: function(done) { return runTests({ shouldWatch: false, done: done }); }, - watch: function() { return runTests({ shouldWatch: true }); } -}; diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/webpack.js b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/webpack.js deleted file mode 100644 index b0de5c558..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulp/webpack.js +++ /dev/null @@ -1,98 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var gutil = require('gulp-util'); -var webpack = require('webpack'); -var WebpackNotifierPlugin = require('webpack-notifier'); -var failPlugin = require('webpack-fail-plugin'); -var webpackConfig = require('../webpack.config.js'); -var packageJson = require('../package.json'); - -function buildProduction(done) { - // modify some webpack config options - var myProdConfig = Object.create(webpackConfig); - myProdConfig.output.filename = '[name].[hash].js'; - - myProdConfig.plugins = myProdConfig.plugins.concat( - new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': JSON.stringify('production') - } - }), - new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.[hash].js' }), - new webpack.optimize.DedupePlugin(), - new webpack.optimize.UglifyJsPlugin(), - failPlugin - ); - - // run webpack - webpack(myProdConfig, function (err, stats) { - if (err) { throw new gutil.PluginError('webpack:build', err); } - gutil.log('[webpack:build]', stats.toString({ - colors: true - })); - - if (done) { done(); } - }); -} - -function createDevCompiler() { - // modify some webpack config options - var myDevConfig = Object.create(webpackConfig); - myDevConfig.devtool = 'inline-source-map'; - myDevConfig.debug = true; - - myDevConfig.plugins = myDevConfig.plugins.concat( - new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.js' }), - new WebpackNotifierPlugin({ title: 'Webpack build', excludeWarnings: true }) - ); - - // create a single instance of the compiler to allow caching - return webpack(myDevConfig); -} - -function build() { - return new Promise(function (resolve, reject) { - buildProduction(function (err) { - if (err) { - reject(err); - } else { - resolve('webpack built'); - } - }); - }); -} - -function watch() { - var firstBuildDone = false; - - return new Promise(function (resolve, reject) { - var devCompiler = createDevCompiler(); - devCompiler.watch({ // watch options: - aggregateTimeout: 300 // wait so long for more changes - }, function (err, stats) { - if (err) { - if (!firstBuildDone) { - firstBuildDone = true; - reject(err); - } - throw new gutil.PluginError('webpack:build-dev', err); - } else { - if (!firstBuildDone) { - firstBuildDone = true; - resolve('webpack built'); - } - } - - gutil.log('[webpack:build-dev]', stats.toString({ - chunks: false, - colors: true - })); - }); - }); -} - -module.exports = { - build: function () { return build(); }, - watch: function () { return watch(); } -}; diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulpFile.js b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulpFile.js deleted file mode 100644 index b7b3abe73..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/gulpFile.js +++ /dev/null @@ -1,66 +0,0 @@ -/* eslint-disable no-var, strict, prefer-arrow-callback */ -'use strict'; - -var gulp = require('gulp'); -var gutil = require('gulp-util'); -var eslint = require('gulp-eslint'); -var webpack = require('./gulp/webpack'); -var staticFiles = require('./gulp/staticFiles'); -var tests = require('./gulp/tests'); -var clean = require('./gulp/clean'); -var inject = require('./gulp/inject'); - -var lintSrcs = ['./gulp/**/*.js']; - -gulp.task('delete-dist', function (done) { - clean.run(done); -}); - -gulp.task('build-process.env.NODE_ENV', function () { - process.env.NODE_ENV = 'production'; -}); - -gulp.task('build-js', ['delete-dist', 'build-process.env.NODE_ENV'], function(done) { - webpack.build().then(function() { done(); }); -}); - -gulp.task('build-other', ['delete-dist', 'build-process.env.NODE_ENV'], function() { - staticFiles.build(); -}); - -gulp.task('build', ['build-js', 'build-other', 'lint'], function () { - inject.build(); -}); - -gulp.task('lint', function () { - return gulp.src(lintSrcs) - .pipe(eslint()) - .pipe(eslint.format()); -}); - -gulp.task('watch', ['delete-dist'], function(done) { - process.env.NODE_ENV = 'development'; - Promise.all([ - webpack.watch()//, - //less.watch() - ]).then(function() { - gutil.log('Now that initial assets (js and css) are generated inject will start...'); - inject.watch(); - done(); - }).catch(function(error) { - gutil.log('Problem generating initial assets (js and css)', error); - }); - - gulp.watch(lintSrcs, ['lint']); - staticFiles.watch(); - tests.watch(); -}); - -gulp.task('watch-and-serve', ['watch'], function() { - // local as not required for build - var express = require('express') - var app = express() - - app.use(express.static('dist', {'index': 'index.html'})) - app.listen(8080); -}); diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/karma.conf.js b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/karma.conf.js deleted file mode 100644 index 72579927f..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/karma.conf.js +++ /dev/null @@ -1,66 +0,0 @@ -/* eslint-disable no-var, strict */ -'use strict'; - -var webpackConfig = require('./webpack.config.js'); - -module.exports = function(config) { - // Documentation: https://karma-runner.github.io/0.13/config/configuration-file.html - config.set({ - browsers: [ 'PhantomJS' ], - - files: [ - // This ensures we have the es6 shims in place from babel and that angular and angular-mocks are loaded - // and then loads all the tests - 'test/main.js' - ], - - port: 9876, - - frameworks: [ 'jasmine' ], - - logLevel: config.LOG_INFO, //config.LOG_DEBUG - - preprocessors: { - 'test/main.js': [ 'webpack', 'sourcemap' ] - }, - - webpack: { - devtool: 'inline-source-map', - debug: true, - module: webpackConfig.module, - resolve: webpackConfig.resolve - }, - - webpackMiddleware: { - quiet: true, - stats: { - colors: true - } - }, - - // reporter options - mochaReporter: { - colors: { - success: 'bgGreen', - info: 'cyan', - warning: 'bgBlue', - error: 'bgRed' - } - }, - - // the default configuration - junitReporter: { - outputDir: 'test-results', // results will be saved as $outputDir/$browserName.xml - outputFile: undefined, // if included, results will be saved as $outputDir/$browserName/$outputFile - suite: '' - }, - - coverageReporter: { - reporters:[ - //{type: 'html', dir:'coverage/'}, // https://github.com/karma-runner/karma-coverage/issues/123 - {type: 'text'}, - {type: 'text-summary'} - ], - } - }); -}; diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/package.json b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/package.json deleted file mode 100644 index 131bb2911..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{
- "name": "es6-babel-react-flux-karma",
- "version": "1.0.0",
- "description": "ES6 + TypeScript + Babel + React + Karma: The Secret Recipe",
- "main": "index.js",
- "scripts": {
- "test": "karma start --reporters mocha,junit --single-run --browsers PhantomJS",
- "serve": "gulp watch-and-serve",
- "watch": "gulp watch",
- "build": "gulp build"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/microsoft/typescriptsamples.git"
- },
- "keywords": [
- "React",
- "Flux",
- "ES2016",
- "typescript"
- ],
- "author": "John Reilly",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/microsoft/typescriptsamples/issues"
- },
- "homepage": "https://github.com/Microsoft/TypeScriptSamples/tree/master/es6-babel-react-flux-karma#readme",
- "devDependencies": {
- "@types/fbemitter": "^2.0.32",
- "@types/flux": "0.0.32",
- "@types/jasmine": "^2.5.35",
- "@types/react": "^0.14.41",
- "@types/react-addons-test-utils": "^0.14.15",
- "@types/react-bootstrap": "0.0.33",
- "@types/react-dom": "^0.14.18",
- "babel": "^6.0.0",
- "babel-core": "^6.0.0",
- "babel-loader": "^6.0.0",
- "babel-preset-es2015": "^6.0.0",
- "babel-preset-es2016": "^6.16.0",
- "babel-preset-react": "^6.0.0",
- "del": "^2.0.2",
- "eslint": "^2.0.0",
- "express": "^4.13.3",
- "glob": "^7.0.0",
- "gulp": "^3.9.0",
- "gulp-autoprefixer": "^3.1.0",
- "gulp-cached": "^1.1.0",
- "gulp-cssmin": "^0.1.7",
- "gulp-eslint": "^2.0.0",
- "gulp-if": "^2.0.0",
- "gulp-inject": "^3.0.0",
- "gulp-notify": "^2.2.0",
- "gulp-sourcemaps": "^1.5.2",
- "gulp-streamify": "1.0.2",
- "gulp-uglify": "^1.2.0",
- "gulp-util": "^3.0.6",
- "jasmine-core": "^2.3.4",
- "karma": "^1.2.0",
- "karma-coverage": "^1.0.0",
- "karma-jasmine": "^1.0.0",
- "karma-junit-reporter": "^1.0.0",
- "karma-mocha-reporter": "^2.0.0",
- "karma-notify-reporter": "^1.0.0",
- "karma-phantomjs-launcher": "^1.0.0",
- "karma-sourcemap-loader": "^0.3.6",
- "karma-webpack": "^1.7.0",
- "phantomjs-prebuilt": "^2.1.4",
- "ts-loader": "^1.3.3",
- "typescript": "^2.1.4",
- "webpack": "^1.12.2",
- "webpack-fail-plugin": "^1.0.4",
- "webpack-notifier": "^1.2.1"
- },
- "dependencies": {
- "babel-polyfill": "^6.0.0",
- "flux": "^2.0.3",
- "fbemitter": "^2.0.2",
- "react": "^15.4.1",
- "react-addons-test-utils": "^15.4.1",
- "react-dom": "^15.4.1"
- }
-}
diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/tsconfig.json b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/tsconfig.json deleted file mode 100644 index c3a732c12..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{
- "compileOnSave": false,
- "compilerOptions": {
- "allowSyntheticDefaultImports": true,
- "lib": [
- "dom",
- "es2015",
- "es2016"
- ],
- "jsx": "preserve",
- "target": "es2016",
- "module": "es2015",
- "moduleResolution": "node",
- "noImplicitAny": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "removeComments": false,
- "preserveConstEnums": true,
- "sourceMap": true,
- "skipLibCheck": true
- }
-}
\ No newline at end of file diff --git a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/webpack.config.js b/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/webpack.config.js deleted file mode 100644 index cc26b27b7..000000000 --- a/node_modules/ts-loader/examples/webpack1/react-babel-karma-gulp/webpack.config.js +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable no-var, strict, prefer-arrow-callback */ -'use strict'; - -var path = require('path'); - -module.exports = { - cache: true, - entry: { - main: './src/main.tsx', - vendor: [ - 'babel-polyfill', - 'fbemitter', - 'flux', - 'react', - 'react-dom' - ] - }, - output: { - path: path.resolve(__dirname, './dist/scripts'), - filename: '[name].js', - chunkFilename: '[chunkhash].js' - }, - module: { - loaders: [{ - test: /\.ts(x?)$/, - exclude: /node_modules/, - loader: 'babel-loader?presets[]=es2016&presets[]=es2015&presets[]=react!ts-loader' - }, { - test: /\.js$/, - exclude: /node_modules/, - loader: 'babel', - query: { - presets: ['es2016', 'es2015', 'react'] - } - }] - }, - plugins: [ - ], - resolve: { - // Add `.ts` and `.tsx` as a resolvable extension. - extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js'] - }, -}; |