Remove react-tools completely
This commit is contained in:
parent
d982d5e153
commit
94bc29b400
|
@ -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',
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var grunt = require('grunt');
|
||||
|
||||
var src = 'npm-react-tools';
|
||||
var srcSrc = 'src/**/*.js';
|
||||
var dest = 'build/npm-react-tools/';
|
||||
|
||||
function buildRelease() {
|
||||
if (grunt.file.exists(dest)) {
|
||||
grunt.file.delete(dest);
|
||||
}
|
||||
|
||||
// copy all files from src first, includes custom README
|
||||
var mappings = grunt.file.expandMapping('**/*', dest, {cwd: src});
|
||||
|
||||
// Also copy all files from src/ (for react-native)
|
||||
mappings = mappings.concat(
|
||||
grunt.file.expandMapping(srcSrc, dest)
|
||||
);
|
||||
|
||||
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,
|
||||
};
|
|
@ -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] <source directory> <output directory> [<module ID> [<module ID> ...]]
|
||||
|
||||
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 <js | coffee | ...> 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 <directory> Alternate directory to use for disk cache
|
||||
--no-cache-dir Disable the disk cache
|
||||
--source-charset <utf8 | win1252 | ...> Charset of source (default: utf8)
|
||||
--output-charset <utf8 | win1252 | ...> 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 <version> 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<br>`"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`.
|
||||
}
|
||||
```
|
|
@ -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);
|
||||
});
|
|
@ -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,
|
||||
};
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"name": "react-tools",
|
||||
"description": "A set of complementary tools to React, including the JSX transformer.",
|
||||
"version": "0.14.0-alpha3",
|
||||
"keywords": [
|
||||
"react",
|
||||
"jsx",
|
||||
"transformer",
|
||||
"view"
|
||||
],
|
||||
"homepage": "https://facebook.github.io/react",
|
||||
"bugs": "https://github.com/facebook/react/issues",
|
||||
"license": "BSD-3-Clause",
|
||||
"files": [
|
||||
"main.js",
|
||||
"bin/jsx",
|
||||
"src/"
|
||||
],
|
||||
"main": "main.js",
|
||||
"bin": {
|
||||
"jsx": "./bin/jsx"
|
||||
},
|
||||
"repository": "facebook/react",
|
||||
"dependencies": {
|
||||
"commoner": "^0.10.0",
|
||||
"jstransform": "^11.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"preferGlobal": true
|
||||
}
|
Loading…
Reference in New Issue