@samitouri / QOS-React / commits / 90856ee61b

Remove jsx task & jsx-internal script

These haven't been used in a long time so it's time to get rid of them.

Paul O’Shannessy committed Apr 5, 2016 at 10:18 UTC 90856ee61bbdcb26d15b4c6bec529e1d7df26391
4 files changed -125
Gruntfile.js
-4
@@ -11,7 +11,6 @@ module.exports = function(grunt) {
11
12 grunt.initConfig({
13 pkg: grunt.file.readJSON('package.json'),
14 - jsx: require('./grunt/config/jsx'),
14 browserify: require('./grunt/config/browserify'),
15 npm: require('./grunt/config/npm'),
16 clean: [
@@ -62,9 +61,6 @@ module.exports = function(grunt) {
61 spawnGulp(['react:clean'], null, this.async());
62 });
63
65 - // Register jsx:normal and :release tasks.
66 - grunt.registerMultiTask('jsx', require('./grunt/tasks/jsx'));
67 -
64 // Our own browserify-based tasks to build a single JS file build.
65 grunt.registerMultiTask('browserify', require('./grunt/tasks/browserify'));
66
bin/jsx-internal deleted
-48
@@ -1,48 +0,0 @@
1 -#!/usr/bin/env node
2 -// -*- mode: js -*-
3 -// vim: set ft=javascript :
4 -
5 -'use strict';
6 -
7 -var babel = require('babel');
8 -
9 -var devExpressionPlugin = require('fbjs/scripts/babel/dev-expression');
10 -
11 -var TRANSFORM_IGNORE_RE = /^WebComponents$/;
12 -
13 -require('commoner').version(
14 - require('../package.json').version
15 -).resolve(function(id) {
16 - var context = this;
17 -
18 - // Note that the result of context.getProvidedP() is cached for the
19 - // duration of the build, so it is both consistent and cheap to
20 - // evaluate multiple times.
21 - return context.getProvidedP().then(function(idToPath) {
22 - // If a module declares its own identifier using @providesModule
23 - // then that identifier will be a key in the idToPath object.
24 - if (idToPath.hasOwnProperty(id)) {
25 - return context.readFileP(idToPath[id]);
26 - }
27 -
28 - // Otherwise assume the identifier maps directly to a path in the
29 - // filesystem.
30 - return context.readModuleP(id);
31 - });
32 -
33 -}).process(function(id, source) {
34 - var context = this;
35 -
36 - // This is hacky but that's ok… It really only matters for tests since it
37 - // won't otherwise be in the dependency tree.
38 - if (!TRANSFORM_IGNORE_RE.test(id)) {
39 - // This is where JSX, ES6, etc. desugaring happens.
40 - source = babel.transform(source, {
41 - blacklist: ['spec.functionName', 'validation.react'],
42 - plugins: [devExpressionPlugin],
43 - filename: id,
44 - }).code;
45 - }
46 -
47 - return source;
48 -});
grunt/config/jsx.js deleted
-25
@@ -1,25 +0,0 @@
1 -'use strict';
2 -
3 -var grunt = require('grunt');
4 -
5 -var rootIDs = [
6 - 'React',
7 - 'ReactWithAddons',
8 - // deprecated is used in the npm package but not anywhere else, so build it.
9 - 'deprecated',
10 -];
11 -
12 -var normal = {
13 - rootIDs: rootIDs,
14 - getConfig: function() {
15 - return {
16 - commonerConfig: grunt.config.data.pkg.commonerConfig,
17 - };
18 - },
19 - sourceDir: 'src',
20 - outputDir: 'build/modules',
21 -};
22 -
23 -module.exports = {
24 - normal: normal,
25 -};
grunt/tasks/jsx.js deleted
-48
@@ -1,48 +0,0 @@
1 -'use strict';
2 -
3 -var path = require('path');
4 -var grunt = require('grunt');
5 -var expand = grunt.file.expand;
6 -var spawn = grunt.util.spawn;
7 -
8 -module.exports = function() {
9 - var done = this.async();
10 - var config = this.data;
11 -
12 - var args = [
13 - '--cache-dir', '.module-cache',
14 - '--relativize',
15 - '--follow-requires',
16 - '--use-provides-module',
17 - config.sourceDir,
18 - config.outputDir,
19 - ];
20 -
21 - var rootIDs = expand({
22 - nonull: true, // Keep IDs that don't expand to anything.
23 - cwd: 'src',
24 - }, config.rootIDs).map(function(id) {
25 - return id.replace(/\.js$/i, '');
26 - });
27 -
28 - args.push.apply(args, rootIDs);
29 - args.push('--config');
30 -
31 - var child = spawn({
32 - cmd: 'node',
33 - args: [path.join('bin', 'jsx-internal')].concat(args),
34 - }, function(error, result, code) {
35 - if (error) {
36 - grunt.log.error(error);
37 - done(false);
38 - } else {
39 - done();
40 - }
41 - });
42 -
43 - child.stdin.write(JSON.stringify(config.getConfig()));
44 - child.stdin.end();
45 -
46 - child.stdout.pipe(process.stdout);
47 - child.stderr.pipe(process.stderr);
48 -};