Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,69 @@
# babel-plugin-transform-strict-mode
> This plugin places a `"use strict";` directive at the top of all files to enable [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).
This plugin may be enabled via `babel-plugin-transform-es2015-modules-commonjs`.
If you wish to disable it you can either turn `strict` off or pass
`strictMode: false` as an option to the commonjs transform.
## Example
**In**
```javascript
foo();
```
**Out**
```javascript
"use strict";
foo();
```
## Installation
```sh
npm install --save-dev babel-plugin-transform-strict-mode
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
Without options:
```json
{
"plugins": ["transform-strict-mode"]
}
```
With options:
```json
{
"plugins": [
["transform-strict-mode", {
"strict": true
}]
]
}
```
### Via CLI
```sh
babel --plugins transform-strict-mode script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["transform-strict-mode"]
});
```

View File

@@ -0,0 +1,49 @@
"use strict";
exports.__esModule = true;
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
exports.default = function () {
return {
visitor: {
Program: function Program(path, state) {
if (state.opts.strict === false || state.opts.strictMode === false) return;
var node = path.node;
for (var _iterator = node.directives, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var directive = _ref;
if (directive.value.value === "use strict") return;
}
path.unshiftContainer("directives", t.directive(t.directiveLiteral("use strict")));
}
}
};
};
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = exports["default"];

View File

@@ -0,0 +1,49 @@
{
"_args": [
[
"babel-plugin-transform-strict-mode@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-plugin-transform-strict-mode@6.24.1",
"_id": "babel-plugin-transform-strict-mode@6.24.1",
"_inBundle": false,
"_integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=",
"_location": "/react-scripts/babel-plugin-transform-strict-mode",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-transform-strict-mode@6.24.1",
"name": "babel-plugin-transform-strict-mode",
"escapedName": "babel-plugin-transform-strict-mode",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/react-scripts/babel-plugin-transform-es2015-modules-commonjs"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
},
"description": "This plugin places a 'use strict'; directive at the top of all files to enable strict mode",
"devDependencies": {
"babel-helper-plugin-test-runner": "^6.24.1"
},
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-plugin-transform-strict-mode",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-strict-mode"
},
"version": "6.24.1"
}