diff --git a/Gruntfile.js b/Gruntfile.js index f2cf451f726a..52f55e91b08c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -71,10 +71,6 @@ module.exports = function(grunt) { grunt.registerTask('npm-react:release', npmReactTasks.buildRelease); grunt.registerTask('npm-react:pack', npmReactTasks.packRelease); - var npmReactToolsTasks = require('./grunt/tasks/npm-react-tools'); - grunt.registerTask('npm-react-tools:release', npmReactToolsTasks.buildRelease); - grunt.registerTask('npm-react-tools:pack', npmReactToolsTasks.packRelease); - var npmReactDOMTasks = require('./grunt/tasks/npm-react-dom'); grunt.registerTask('npm-react-dom:pack', npmReactDOMTasks.packRelease); @@ -133,8 +129,6 @@ module.exports = function(grunt) { 'browserify:addonsMin', 'npm-react:release', 'npm-react:pack', - 'npm-react-tools:release', - 'npm-react-tools:pack', 'npm-react-dom:pack', 'npm-react-addons:release', 'npm-react-addons:pack', diff --git a/bin/jsx b/bin/jsx deleted file mode 100755 index 616d7afe4010..000000000000 --- a/bin/jsx +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env node -// -*- mode: js -*- -'use strict'; - -var transform = require('../main').transform; - -require('commoner').version( - require('../package.json').version -).resolve(function(id) { - return this.readModuleP(id); -}).option( - '--harmony', - 'Turns on JS transformations such as ES6 Classes etc.' -).option( - '--target [version]', - 'Specify your target version of ECMAScript. Valid values are "es3" and ' + - '"es5". The default is "es5". "es3" will avoid uses of defineProperty and ' + - 'will quote reserved words. WARNING: "es5" is not properly supported, even ' + - 'with the use of es5shim, es5sham. If you need to support IE8, use "es3".', - 'es5' -).option( - '--strip-types', - 'Strips out type annotations.' -).option( - '--es6module', - 'Parses the file as a valid ES6 module. ' + - '(Note that this means implicit strict mode)' -).option( - '--non-strict-es6module', - 'Parses the file as an ES6 module, except disables implicit strict-mode. ' + - '(This is useful if you\'re porting non-ES6 modules to ES6, but haven\'t ' + - 'yet verified that they are strict-mode safe yet)' -).option( - '--source-map-inline', - 'Embed inline sourcemap in transformed source' -).process(function(id, source) { - // This is where JSX, ES6, etc. desugaring happens. - // We don't do any pre-processing of options so that the command line and the - // JS API both expose the same set of options. We do extract the options that - // we care about from commoner though so we aren't passing too many things - // along. - var options = { - harmony: this.options.harmony, - sourceMap: this.options.sourceMapInline, - stripTypes: this.options.stripTypes, - es6module: this.options.es6module, - nonStrictEs6module: this.options.nonStrictEs6module, - target: this.options.target - }; - return transform(source, options); -}); diff --git a/grunt/tasks/npm-react-tools.js b/grunt/tasks/npm-react-tools.js deleted file mode 100644 index e68ecf8cfe24..000000000000 --- a/grunt/tasks/npm-react-tools.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -var fs = require('fs'); -var grunt = require('grunt'); - -var src = 'npm-react-tools'; -var dest = 'build/npm-react-tools/'; - -function buildRelease() { - if (grunt.file.exists(dest)) { - grunt.file.delete(dest); - } - - // read our required files from package.json - var pkgFiles = grunt.config.data.pkg.files; - - // copy all files from src first, includes custom README - var mappings = grunt.file.expandMapping('**/*', dest, {cwd: src}); - - // make sure we also get package.json - pkgFiles.push('package.json'); - - pkgFiles.map(function(file) { - if (grunt.file.isDir(file)) { - mappings = mappings.concat(grunt.file.expandMapping(file + '**/*', dest)); - } else { - mappings.push({src: [file], dest: dest + file}); - } - }); - - mappings.forEach(function(mapping) { - var mappingSrc = mapping.src[0]; - var mappingDest = mapping.dest; - if (grunt.file.isDir(mappingSrc)) { - grunt.file.mkdir(mappingDest); - } else { - grunt.file.copy(mappingSrc, mappingDest); - } - }); -} - -function packRelease() { - var done = this.async(); - var spawnCmd = { - cmd: 'npm', - args: ['pack', 'npm-react-tools'], - opts: { - cwd: 'build/', - }, - }; - grunt.util.spawn(spawnCmd, function() { - var buildSrc = 'build/react-tools-' + grunt.config.data.pkg.version + '.tgz'; - var buildDest = 'build/react-tools.tgz'; - fs.rename(buildSrc, buildDest, done); - }); -} - -module.exports = { - buildRelease: buildRelease, - packRelease: packRelease, -}; diff --git a/main.js b/main.js deleted file mode 100644 index 0dc6d5e68826..000000000000 --- a/main.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -'use strict'; - -var jstransform = require('jstransform/simple'); - -function transformWithDetails(code, opts) { - opts = opts || {}; - - // Copy out the values we need and make sure they are compatible with - // jstransform options. Always set react:true. - var options = { - react: true, - harmony: opts.harmony, - stripTypes: opts.stripTypes, - sourceMapInline: opts.sourceMap, - sourceFilename: opts.sourceFilename, - es6module: opts.es6module, - nonStrictEs6module: opts.nonStrictEs6module, - target: opts.target, - }; - - return jstransform.transform(code, options); -} - -module.exports = { - transform: function(input, options) { - return transformWithDetails(input, options).code; - }, - transformWithDetails: transformWithDetails, -}; diff --git a/npm-react-tools/README.md b/npm-react-tools/README.md deleted file mode 100644 index 895c3e703428..000000000000 --- a/npm-react-tools/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# react-tools - -This package compliments the usage of [React](https://facebook.github.io/react/). It ships with tools that are often used in conjunction. - -## JSX - -This package installs a `jsx` executable that can be used to transform JSX into vanilla JS. This is often used as part of a build step. This transform is also exposed as an API. - -By default JSX files with a `.js` extension are transformed. Use the `-x` option to transform files with a `.jsx` extension. - -## Usage - -### Command Line - - Usage: jsx [options] [ [ ...]] - - Options: - - -h, --help output usage information - -V, --version output the version number - -c, --config [file] JSON configuration file (no file or - means STDIN) - -w, --watch Continually rebuild - -x, --extension File extension to assume when resolving module identifiers (default: js) - --relativize Rewrite all module identifiers to be relative - --follow-requires Scan modules for required dependencies - --cache-dir Alternate directory to use for disk cache - --no-cache-dir Disable the disk cache - --source-charset Charset of source (default: utf8) - --output-charset Charset of output (default: utf8) - --harmony Turns on JS transformations such as ES6 Classes etc. - --source-map-inline Embed inline sourcemap in transformed source - --strip-types Strips out type annotations - --es6module Parses the file as a valid ES6 module - --non-strict-es6module Parses the file as an ES6 module, except disables implicit strict-mode (i.e. CommonJS modules et al are allowed) - --target Target version of ECMAScript. Valid values are "es3" and "es5". Use "es3" for legacy browsers like IE8. - -## API - -### `transform(inputString, options)` - -option | values | default --------|--------|--------- -`sourceMap` | `true`: append inline source map at the end of the transformed source | `false` -`harmony` | `true`: enable ES6 features | `false` -`sourceFilename` | the output filename for the source map | `"source.js"` -`stripTypes` | `true`: strips out type annotations | `false` -`es6module` | `true`: parses the file as an ES6 module | `false` -`nonStrictEs6module` | `true`: parses the file as an ES6 module, except disables implicit strict-mode (i.e. CommonJS modules et al are allowed) | `false` -`target` | `"es3"`: ECMAScript 3
`"es5"`: ECMAScript 5| `"es5"` - -```js -var reactTools = require('react-tools'); - -reactTools.transform(string, options); -``` - -### `transformWithDetails(inputString, options)` - -Just like `transform`, but outputs an object: -```js -{ - code: outputString, - sourceMap: theSourceMap // Only if the `sourceMap` option is `true`. -} -``` diff --git a/package.json b/package.json index ca08a3d6802f..32001f6e61f8 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,7 @@ { - "name": "react-tools", - "description": "A set of complementary tools to React, including the JSX transformer.", + "name": "react-build", + "private": true, "version": "0.14.0-beta1", - "keywords": [ - "jsx", - "react", - "transformer", - "view" - ], - "homepage": "https://facebook.github.io/react", - "bugs": "https://github.com/facebook/react/issues", - "license": "BSD-3-Clause", - "files": [ - "bin/jsx", - "main.js", - "src/" - ], - "main": "main.js", - "bin": { - "jsx": "./bin/jsx" - }, - "repository": { - "type": "git", - "url": "https://github.com/facebook/react" - }, - "dependencies": { - "commoner": "^0.10.0", - "jstransform": "^11.0.0" - }, "devDependencies": { "babel": "^5.8.3", "babel-eslint": "^3.1.25", @@ -54,6 +28,7 @@ "gulp-util": "^3.0.5", "gzip-js": "~0.3.2", "jest-cli": "^0.4.13", + "jstransform": "^11.0.0", "object-assign": "^3.0.0", "optimist": "^0.6.1", "platform": "^1.1.0", @@ -67,7 +42,6 @@ "engines": { "node": ">=0.10.0" }, - "preferGlobal": true, "commonerConfig": { "version": 7 }, diff --git a/packages/react/package.json b/packages/react/package.json index 15afb92cbde8..52531a3aa0a2 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -16,10 +16,7 @@ "lib/" ], "main": "react.js", - "repository": { - "type": "git", - "url": "https://github.com/facebook/react" - }, + "repository": "facebook/react", "engines": { "node": ">=0.10.0" },