Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcbd315bc1 | ||
|
|
71646f4ade | ||
|
|
e5f1eb64b6 | ||
|
|
6145f0a03b | ||
|
|
54f901f131 | ||
|
|
5deeae1aa2 | ||
|
|
c17878913b | ||
|
|
c8139317ee | ||
|
|
74f11dfddf | ||
|
|
6332e725fe | ||
|
|
89ecd46b77 | ||
|
|
7e8c5cd20f | ||
|
|
ddbb522392 | ||
|
|
288cfd1f00 | ||
|
|
1841f5c8a0 | ||
|
|
33f8988313 | ||
|
|
af997b9945 | ||
|
|
a2332f08bc |
@@ -3,6 +3,10 @@ node_js:
|
||||
- "0.10"
|
||||
- "0.11"
|
||||
|
||||
branches:
|
||||
except:
|
||||
- experimental
|
||||
|
||||
before_script: "npm install -g codeclimate-test-reporter"
|
||||
script: "make test-travis"
|
||||
|
||||
|
||||
56
README.md
56
README.md
@@ -103,6 +103,10 @@ Compile the entire `src` directory and output it to the `lib` directory.
|
||||
|
||||
$ 6to5 src --out-dir lib
|
||||
|
||||
Compile the entire `src` directory and output it to the one concatenated file.
|
||||
|
||||
$ 6to5 src --out-file script-compiled.js
|
||||
|
||||
Pipe a file in via stdin and output it to `script-compiled.js`
|
||||
|
||||
$ 6to5 --out-file script-compiled.js < script.js
|
||||
@@ -186,21 +190,34 @@ require("6to5/register");
|
||||
```
|
||||
|
||||
**NOTE:** By default all requires to `node_modules` will be ignored. You can
|
||||
override this by passing an ignore regex via:
|
||||
|
||||
```javascript
|
||||
require("6to5/register")(/regex/);
|
||||
```
|
||||
|
||||
You can also customise the file extensions that the require hook will use via:
|
||||
override this by passing an ignore regex via options.
|
||||
|
||||
```javascript
|
||||
require("6to5/register")({
|
||||
// optional ignore regex
|
||||
ignoreRegex: /regex/,
|
||||
// This will override `node_modules` ignoring - you can alternatively pass
|
||||
// a regex
|
||||
ignore: false
|
||||
});
|
||||
```
|
||||
|
||||
// this will remove the currently hooked extensions of .es6 and .js so you'll
|
||||
// have to add them back if you want them to be used again
|
||||
##### Options
|
||||
|
||||
```javascript
|
||||
require("6to5/register")({
|
||||
// Optional ignore regex - if any filenames **do** match this regex then they
|
||||
// aren't compiled
|
||||
ignore: /regex/,
|
||||
|
||||
// Optional only regex - if any filenames **don't** match this regex then they
|
||||
// aren't compiled
|
||||
only: /my_es6_folder/,
|
||||
|
||||
// See options above for usage
|
||||
whitelist: [],
|
||||
blacklist: [],
|
||||
|
||||
// This will remove the currently hooked extensions of .es6 and .js so you'll
|
||||
// have to add them back if you want them to be used again.
|
||||
extensions: [".js", ".es6"]
|
||||
});
|
||||
```
|
||||
@@ -279,6 +296,23 @@ If you're inheriting from a class then static properties are inherited from it
|
||||
via [\_\_proto\_\_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto),
|
||||
this is widely supported but you may run into problems with much older browsers.
|
||||
|
||||
**NOTE:** `__proto__` is not supported on IE <= 9 so static properties
|
||||
**will not** be inherited. A possible workaround is to use `super();`:
|
||||
|
||||
```javascript
|
||||
class Foo {
|
||||
static foo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Bar extends Foo {
|
||||
static foo() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Generators
|
||||
|
||||
The [regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js)
|
||||
|
||||
@@ -100,8 +100,8 @@ module.exports = function (commander, filenames) {
|
||||
}
|
||||
});
|
||||
|
||||
_.each(_filenames, function (filename, i) {
|
||||
results.push(util.compile(filename, { _noStrict: +i !== 0 }));
|
||||
_.each(_filenames, function (filename) {
|
||||
results.push(util.compile(filename));
|
||||
});
|
||||
|
||||
output();
|
||||
|
||||
@@ -20,17 +20,56 @@ sourceMapSupport.install({
|
||||
|
||||
//
|
||||
|
||||
var blacklist = [];
|
||||
|
||||
var blacklistTest = function (transformer, code) {
|
||||
try {
|
||||
if (_.isFunction(code)) {
|
||||
code();
|
||||
} else {
|
||||
new Function(code);
|
||||
}
|
||||
blacklist.push(transformer);
|
||||
} catch (err) {
|
||||
if (err.name !== "SyntaxError") throw err;
|
||||
}
|
||||
};
|
||||
|
||||
blacklistTest("arrayComprehension", "var foo = [for (foo of bar) foo * foo];");
|
||||
blacklistTest("arrowFunctions", "var foo = x => x * x;");
|
||||
blacklistTest("classes", "class Foo {}");
|
||||
blacklistTest("computedPropertyNames", "var foo = { [foo]: bar };");
|
||||
//blacklistTest("constants", "const foo = 0;");
|
||||
blacklistTest("defaultParamaters", "var foo = function (bar = 0) {};");
|
||||
blacklistTest("destructuring", "var { x, y } = { x: 0, y: 0 };");
|
||||
blacklistTest("forOf", "for (var foo of bar) {}");
|
||||
blacklistTest("generators", "function* foo() {}");
|
||||
blacklistTest("letScoping", "let foo = 0;");
|
||||
blacklistTest("modules", 'import foo from "from";');
|
||||
blacklistTest("propertyMethodAssignment", "{ get foo() {} }");
|
||||
blacklistTest("propertyNameShorthand", "var foo = { x, y };");
|
||||
blacklistTest("restParameters", "function foo(...bar) {}");
|
||||
blacklistTest("spread", "foo(...bar);");
|
||||
blacklistTest("templateLiterals", "`foo`");
|
||||
blacklistTest("unicodeRegex", function () { new RegExp("foo", "u"); });
|
||||
|
||||
//
|
||||
|
||||
var ignoreRegex = /node_modules/;
|
||||
var onlyRegex;
|
||||
var whitelist = [];
|
||||
var exts = {};
|
||||
var maps = {};
|
||||
var old = require.extensions[".js"];
|
||||
|
||||
var loader = function (m, filename) {
|
||||
if (ignoreRegex && ignoreRegex.test(filename)) {
|
||||
if ((ignoreRegex && ignoreRegex.test(filename)) || (onlyRegex && !onlyRegex.test(filename))) {
|
||||
return old.apply(this, arguments);
|
||||
}
|
||||
|
||||
var result = to5.transformFileSync(filename, {
|
||||
whitelist: whitelist,
|
||||
blacklist: blacklist,
|
||||
sourceMap: true
|
||||
});
|
||||
|
||||
@@ -55,12 +94,16 @@ var hookExtensions = function (_exts) {
|
||||
hookExtensions([".es6", ".js"]);
|
||||
|
||||
module.exports = function (opts) {
|
||||
// normalise options
|
||||
opts = opts || {};
|
||||
if (_.isRegExp(opts)) opts = { ignoreRegex: opts };
|
||||
if (_.isRegExp(opts)) opts = { ignore: opts };
|
||||
if (opts.ignoreRegex != null) opts.ignore = opts.ignoreRegex;
|
||||
|
||||
if (opts.ignoreRegex != null) {
|
||||
ignoreRegex = opts.ignoreRegex;
|
||||
}
|
||||
if (opts.only != null) onlyRegex = opts.only;
|
||||
if (opts.ignore != null) ignoreRegex = opts.ignore;
|
||||
|
||||
if (opts.extensions) hookExtensions(opts.extensions);
|
||||
|
||||
if (opts.blacklist) blacklist = opts.blacklist;
|
||||
if (opts.whitelist) whitelist = opts.whitelist;
|
||||
};
|
||||
|
||||
4
lib/6to5/templates/class-props.js
Normal file
4
lib/6to5/templates/class-props.js
Normal file
@@ -0,0 +1,4 @@
|
||||
(function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
})
|
||||
@@ -95,6 +95,7 @@ transform.transformers = {
|
||||
forOf: require("./transformers/for-of"),
|
||||
unicodeRegex: require("./transformers/unicode-regex"),
|
||||
generators: require("./transformers/generators"),
|
||||
numericLiterals: require("./transformers/numeric-literals"),
|
||||
|
||||
react: require("./transformers/react"),
|
||||
jsx: require("./transformers/jsx"),
|
||||
@@ -102,9 +103,10 @@ transform.transformers = {
|
||||
_aliasFunctions: require("./transformers/_alias-functions"),
|
||||
_blockHoist: require("./transformers/_block-hoist"),
|
||||
_declarations: require("./transformers/_declarations"),
|
||||
_moduleFormatter: require("./transformers/_module-formatter"),
|
||||
|
||||
useStrict: require("./transformers/use-strict")
|
||||
useStrict: require("./transformers/use-strict"),
|
||||
|
||||
_moduleFormatter: require("./transformers/_module-formatter")
|
||||
};
|
||||
|
||||
transform.moduleFormatters = {
|
||||
|
||||
@@ -56,14 +56,14 @@ var buildClass = function (node, file) {
|
||||
container.callee.params.push(superClassCallee);
|
||||
}
|
||||
|
||||
buildClassBody(body, className, superName, node);
|
||||
buildClassBody(file, body, className, superName, node);
|
||||
|
||||
body.push(returnStatement);
|
||||
|
||||
return container;
|
||||
};
|
||||
|
||||
var buildClassBody = function (body, className, superName, node) {
|
||||
var buildClassBody = function (file, body, className, superName, node) {
|
||||
var instanceMutatorMap = {};
|
||||
var staticMutatorMap = {};
|
||||
var hasConstructor = false;
|
||||
@@ -105,16 +105,28 @@ var buildClassBody = function (body, className, superName, node) {
|
||||
}, true));
|
||||
}
|
||||
|
||||
var instanceProps;
|
||||
var staticProps;
|
||||
|
||||
if (!_.isEmpty(instanceMutatorMap)) {
|
||||
var protoId = util.template("prototype-identifier", {
|
||||
CLASS_NAME: className
|
||||
});
|
||||
|
||||
body.push(util.buildDefineProperties(instanceMutatorMap, protoId));
|
||||
instanceProps = util.buildDefineProperties(instanceMutatorMap, protoId);
|
||||
}
|
||||
|
||||
if (!_.isEmpty(staticMutatorMap)) {
|
||||
body.push(util.buildDefineProperties(staticMutatorMap, className));
|
||||
staticProps = util.buildDefineProperties(staticMutatorMap, className);
|
||||
}
|
||||
|
||||
if (instanceProps || staticProps) {
|
||||
instanceProps = instanceProps || b.literal(null);
|
||||
staticProps = staticProps || b.literal(null);
|
||||
|
||||
body.push(b.expressionStatement(
|
||||
b.callExpression(file.addDeclaration("class-props"), [className, staticProps, instanceProps])
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
6
lib/6to5/transformers/numeric-literals.js
Normal file
6
lib/6to5/transformers/numeric-literals.js
Normal file
@@ -0,0 +1,6 @@
|
||||
var _ = require("lodash");
|
||||
|
||||
exports.Literal = function (node) {
|
||||
// TODO: remove this when the new code generator is released
|
||||
if (_.isNumber(node.value)) delete node.raw;
|
||||
};
|
||||
@@ -24,6 +24,9 @@ exports.ObjectExpression = function (node, parent, file) {
|
||||
return util.template("object-define-properties-closure", {
|
||||
KEY: objId,
|
||||
OBJECT: node,
|
||||
CONTENT: util.buildDefineProperties(mutatorMap, objId).expression
|
||||
CONTENT: util.template("object-define-properties", {
|
||||
OBJECT: objId,
|
||||
PROPS: util.buildDefineProperties(mutatorMap)
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
var b = require("acorn-ast-types").builders;
|
||||
|
||||
module.exports = function (ast, file) {
|
||||
module.exports = function (ast) {
|
||||
var body = ast.program.body;
|
||||
var first = body[0];
|
||||
|
||||
var noStrict = !first || first.type !== "ExpressionStatement" || first.expression.type !== "Literal" || first.expression.value !== "use strict";
|
||||
|
||||
if (noStrict) {
|
||||
if (file.opts._noStrict) return;
|
||||
body.unshift(b.expressionStatement(b.literal("use strict")));
|
||||
} else {
|
||||
if (file.opts._noStrict) body.shift();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -147,7 +147,7 @@ exports.pushMutatorMap = function (mutatorMap, key, kind, method) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.buildDefineProperties = function (mutatorMap, keyNode) {
|
||||
exports.buildDefineProperties = function (mutatorMap) {
|
||||
var objExpr = b.objectExpression([]);
|
||||
|
||||
_.each(mutatorMap, function (map, key) {
|
||||
@@ -164,10 +164,7 @@ exports.buildDefineProperties = function (mutatorMap, keyNode) {
|
||||
objExpr.properties.push(propNode);
|
||||
});
|
||||
|
||||
return exports.template("object-define-properties", {
|
||||
OBJECT: keyNode,
|
||||
PROPS: objExpr
|
||||
}, true);
|
||||
return objExpr;
|
||||
};
|
||||
|
||||
exports.template = function (name, nodes, keepExpression) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "1.10.9",
|
||||
"version": "1.10.12",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://github.com/sebmck/6to5",
|
||||
"repository": {
|
||||
@@ -59,6 +59,7 @@
|
||||
"browserify": "6.1.0",
|
||||
"proclaim": "2.0.0",
|
||||
"rimraf": "2.2.8",
|
||||
"jshint": "2.5.6"
|
||||
"jshint": "2.5.6",
|
||||
"chai": "^1.9.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ var rimraf = require("rimraf");
|
||||
var mkdirp = require("mkdirp");
|
||||
var child = require("child_process");
|
||||
var path = require("path");
|
||||
var chai = require("chai");
|
||||
var fs = require("fs");
|
||||
var _ = require("lodash");
|
||||
|
||||
@@ -42,7 +43,7 @@ var assertTest = function (stdout, stderr, opts) {
|
||||
if (opts.stderrContains) {
|
||||
assert.ok(_.contains(stderr, expectStderr), "stderr " + JSON.stringify(stderr) + " didn't contain " + JSON.stringify(expectStderr));
|
||||
} else {
|
||||
assert.equal(stderr, expectStderr, "stderr didn't match");
|
||||
chai.expect(stderr).to.equal(expectStderr, "stderr didn't match");
|
||||
}
|
||||
} else if (stderr) {
|
||||
throw new Error("stderr: " + JSON.stringify(stderr));
|
||||
@@ -55,7 +56,7 @@ var assertTest = function (stdout, stderr, opts) {
|
||||
if (opts.stdoutContains) {
|
||||
assert.ok(_.contains(stdout, expectStdout), "stdout " + JSON.stringify(stdout) + " didn't contain " + JSON.stringify(expectStdout));
|
||||
} else {
|
||||
assert.equal(stdout, expectStdout, "stdout didn't match");
|
||||
chai.expect(stdout).to.equal(expectStdout, "stdout didn't match");
|
||||
}
|
||||
} else if (stdout) {
|
||||
throw new Error("stdout: " + JSON.stringify(stdout));
|
||||
@@ -63,7 +64,7 @@ var assertTest = function (stdout, stderr, opts) {
|
||||
|
||||
_.each(opts.outFiles, function (expect, filename) {
|
||||
var actual = readFile(filename);
|
||||
assert.equal(actual, expect, "out-file " + filename);
|
||||
chai.expect(actual).to.equal(expect, "out-file " + filename);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@ var Test = function() {
|
||||
var Test = function Test() {};
|
||||
return Test;
|
||||
}();
|
||||
"use strict";
|
||||
arr.map(function(x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyIsInNjcmlwdDIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7SUFBTSxDQUFDLENBQUMsQ0FBQztNQUFILENBQUMsQ0FBQyxDQUFDLGFBQUgsQ0FBQyxDQUFDLENBQUM7U0FBSCxDQUFDLENBQUMsQ0FBQzs7O0FDQVQsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxVQUFDO1NBQUssRUFBRSxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0NBQUMsQ0FBQyIsImZpbGUiOiJzY3JpcHQzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiY2xhc3MgVGVzdCB7XG5cbn0iLCJhcnIubWFwKHggPT4geCAqIE1VTFRJUExJRVIpOyJdfQ==
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyIsInNjcmlwdDIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7SUFBTSxDQUFDLENBQUMsQ0FBQztNQUFILENBQUMsQ0FBQyxDQUFDLGFBQUgsQ0FBQyxDQUFDLENBQUM7U0FBSCxDQUFDLENBQUMsQ0FBQzs7OztBQ0FULENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsVUFBQztTQUFLLEVBQUUsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztDQUFDLENBQUMiLCJmaWxlIjoic2NyaXB0My5qcyIsInNvdXJjZXNDb250ZW50IjpbImNsYXNzIFRlc3Qge1xuXG59IiwiYXJyLm1hcCh4ID0+IHggKiBNVUxUSVBMSUVSKTsiXX0=
|
||||
|
||||
@@ -4,6 +4,7 @@ var Test = function() {
|
||||
var Test = function Test() {};
|
||||
return Test;
|
||||
}();
|
||||
"use strict";
|
||||
arr.map(function(x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["script.js","script2.js"],"names":[],"mappings":";;IAAM,CAAC,CAAC,CAAC;MAAH,CAAC,CAAC,CAAC,aAAH,CAAC,CAAC,CAAC;SAAH,CAAC,CAAC,CAAC;;;ACAT,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAC;SAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,CAAC","file":"script3.js","sourcesContent":["class Test {\n\n}","arr.map(x => x * MULTIPLIER);"]}
|
||||
{"version":3,"sources":["script.js","script2.js"],"names":[],"mappings":";;IAAM,CAAC,CAAC,CAAC;MAAH,CAAC,CAAC,CAAC,aAAH,CAAC,CAAC,CAAC;SAAH,CAAC,CAAC,CAAC;;;;ACAT,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAC;SAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,CAAC","file":"script3.js","sourcesContent":["class Test {\n\n}","arr.map(x => x * MULTIPLIER);"]}
|
||||
|
||||
@@ -4,6 +4,7 @@ var Test = function() {
|
||||
var Test = function Test() {};
|
||||
return Test;
|
||||
}();
|
||||
"use strict";
|
||||
arr.map(function(x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var _slice = Array.prototype.slice;
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
child.prototype = Object.create(parent.prototype, {
|
||||
constructor: {
|
||||
@@ -27,7 +34,17 @@ var Test = function(Foo) {
|
||||
|
||||
_extends(Test, Foo);
|
||||
|
||||
Object.defineProperties(Test.prototype, {
|
||||
_classProps(Test, {
|
||||
foo: {
|
||||
writable: true,
|
||||
|
||||
value: function() {
|
||||
Foo.foo.call(this);
|
||||
Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments)));
|
||||
Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments)));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
test: {
|
||||
writable: true,
|
||||
|
||||
@@ -39,17 +56,5 @@ var Test = function(Foo) {
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperties(Test, {
|
||||
foo: {
|
||||
writable: true,
|
||||
|
||||
value: function() {
|
||||
Foo.foo.call(this);
|
||||
Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments)));
|
||||
Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments)));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Test;
|
||||
}(Foo);
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
child.prototype = Object.create(parent.prototype, {
|
||||
constructor: {
|
||||
@@ -13,7 +18,6 @@ var _extends = function (child, parent) {
|
||||
child.__proto__ = parent;
|
||||
};
|
||||
|
||||
|
||||
var Test = function(Foo) {
|
||||
var Test = function Test() {
|
||||
Foo.prototype.test.whatever();
|
||||
@@ -22,7 +26,7 @@ var Test = function(Foo) {
|
||||
|
||||
_extends(Test, Foo);
|
||||
|
||||
Object.defineProperties(Test, {
|
||||
_classProps(Test, {
|
||||
test: {
|
||||
writable: true,
|
||||
|
||||
@@ -30,7 +34,7 @@ var Test = function(Foo) {
|
||||
return Foo.wow.call(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, null);
|
||||
|
||||
return Test;
|
||||
}(Foo);
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function() {
|
||||
var Test = function Test() {};
|
||||
|
||||
Object.defineProperties(Test.prototype, {
|
||||
_classProps(Test, null, {
|
||||
test: {
|
||||
get: function() {
|
||||
return 5 + 5;
|
||||
@@ -16,4 +21,4 @@ var Test = function() {
|
||||
});
|
||||
|
||||
return Test;
|
||||
}();
|
||||
}();
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function() {
|
||||
var Test = function Test() {};
|
||||
|
||||
Object.defineProperties(Test.prototype, {
|
||||
_classProps(Test, null, {
|
||||
test: {
|
||||
get: function() {
|
||||
return 5 + 5;
|
||||
@@ -12,4 +17,4 @@ var Test = function() {
|
||||
});
|
||||
|
||||
return Test;
|
||||
}();
|
||||
}();
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function() {
|
||||
var Test = function Test() {};
|
||||
|
||||
Object.defineProperties(Test.prototype, {
|
||||
_classProps(Test, null, {
|
||||
test: {
|
||||
writable: true,
|
||||
|
||||
@@ -14,4 +19,4 @@ var Test = function() {
|
||||
});
|
||||
|
||||
return Test;
|
||||
}();
|
||||
}();
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function() {
|
||||
var Test = function Test() {};
|
||||
|
||||
Object.defineProperties(Test.prototype, {
|
||||
_classProps(Test, null, {
|
||||
test: {
|
||||
set: function(val) {
|
||||
this._test = val;
|
||||
@@ -12,4 +17,4 @@ var Test = function() {
|
||||
});
|
||||
|
||||
return Test;
|
||||
}();
|
||||
}();
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var A = function() {
|
||||
var A = function A() {};
|
||||
|
||||
Object.defineProperties(A, {
|
||||
_classProps(A, {
|
||||
a: {
|
||||
writable: true,
|
||||
value: function() {}
|
||||
@@ -13,7 +18,7 @@ var A = function() {
|
||||
get: function() {},
|
||||
set: function(b) {}
|
||||
}
|
||||
});
|
||||
}, null);
|
||||
|
||||
return A;
|
||||
}();
|
||||
}();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports"], function (exports) {
|
||||
"use strict";
|
||||
|
||||
exports.default = 42;
|
||||
exports.default = {};
|
||||
exports.default = [];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
(function(obj) {
|
||||
for (var i in obj) {
|
||||
exports[i] = obj[i];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports"], function (exports) {
|
||||
"use strict";
|
||||
|
||||
exports.foo = foo;
|
||||
exports.foo = foo;
|
||||
exports.bar = bar;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports"], function (exports) {
|
||||
"use strict";
|
||||
|
||||
exports.foo7 = foo7;
|
||||
var foo = 1;
|
||||
exports.foo = foo;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports", "./evens"], function (exports, _evens) {
|
||||
"use strict";
|
||||
|
||||
exports.nextOdd = nextOdd;
|
||||
var isEven = _evens.isEven;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
var foo = _foo.default;
|
||||
var foo = _foo.default;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
var foo = _foo;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo.default;
|
||||
var xyz = _foo.baz;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var bar = _foo.bar;
|
||||
var bar = _foo.bar;
|
||||
var baz = _foo.baz;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
|
||||
"use strict";
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo.default;
|
||||
var foo = _foo;
|
||||
var bar = _foo.bar;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
@@ -7,6 +5,8 @@
|
||||
factory(exports);
|
||||
}
|
||||
})(function (exports) {
|
||||
"use strict";
|
||||
|
||||
exports.default = 42;
|
||||
exports.default = {};
|
||||
exports.default = [];
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -7,6 +5,8 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
(function(obj) {
|
||||
for (var i in obj) {
|
||||
exports[i] = obj[i];
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
@@ -7,6 +5,8 @@
|
||||
factory(exports);
|
||||
}
|
||||
})(function (exports) {
|
||||
"use strict";
|
||||
|
||||
exports.foo = foo;
|
||||
exports.foo = foo;
|
||||
exports.bar = bar;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
@@ -7,6 +5,8 @@
|
||||
factory(exports);
|
||||
}
|
||||
})(function (exports) {
|
||||
"use strict";
|
||||
|
||||
exports.foo7 = foo7;
|
||||
var foo = 1;
|
||||
exports.foo = foo;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "./evens"], factory);
|
||||
@@ -7,6 +5,8 @@
|
||||
factory(exports, require("./evens"));
|
||||
}
|
||||
})(function (exports, _evens) {
|
||||
"use strict";
|
||||
|
||||
exports.nextOdd = nextOdd;
|
||||
var isEven = _evens.isEven;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -7,6 +5,8 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo.default;
|
||||
var foo = _foo.default;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -7,5 +5,6 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
var foo = _foo;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -7,6 +5,7 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
var foo = _foo.default;
|
||||
var xyz = _foo.baz;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
@@ -7,6 +5,7 @@
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
var bar = _foo.bar;
|
||||
var bar = _foo.bar;
|
||||
var baz = _foo.baz;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], factory);
|
||||
@@ -7,5 +5,5 @@
|
||||
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
|
||||
}
|
||||
})(function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
|
||||
"use strict";
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], factory);
|
||||
@@ -7,6 +5,7 @@
|
||||
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
|
||||
}
|
||||
})(function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
var foo = _foo.default;
|
||||
var foo = _foo;
|
||||
var bar = _foo.bar;
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function() {
|
||||
var Test = function Test() {};
|
||||
|
||||
Object.defineProperties(Test.prototype, {
|
||||
_classProps(Test, null, {
|
||||
bar: {
|
||||
get: function() {
|
||||
throw new Error("wow");
|
||||
@@ -15,4 +20,4 @@ var Test = function() {
|
||||
}();
|
||||
|
||||
var test = new Test();
|
||||
test.bar;
|
||||
test.bar;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"column": 11
|
||||
},
|
||||
"generated": {
|
||||
"line": 9,
|
||||
"line": 17,
|
||||
"column": 15
|
||||
}
|
||||
}]
|
||||
|
||||
Reference in New Issue
Block a user