Compare commits
53 Commits
v7.0.0-bet
...
v7.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdfeeb38c6 | ||
|
|
47ada5ab3a | ||
|
|
59ba3959dc | ||
|
|
0200e6256a | ||
|
|
9a26c2b07a | ||
|
|
901571d72f | ||
|
|
b09c729675 | ||
|
|
a36525be45 | ||
|
|
a10c91790f | ||
|
|
ab7d1231ad | ||
|
|
a5df709bc3 | ||
|
|
1dbed5f458 | ||
|
|
40e38646e4 | ||
|
|
9e4dd861ee | ||
|
|
a7bddc02ba | ||
|
|
023f8bd1cb | ||
|
|
c9b99af5a6 | ||
|
|
c8d82d6483 | ||
|
|
db42a5d70f | ||
|
|
0856f89882 | ||
|
|
921702ef8c | ||
|
|
8b57a3e3b9 | ||
|
|
21309cc8d4 | ||
|
|
19708e0154 | ||
|
|
f98dff9189 | ||
|
|
840ba187a7 | ||
|
|
de00d939f0 | ||
|
|
e80488f1d5 | ||
|
|
81c1b49f6a | ||
|
|
55bf55398a | ||
|
|
f0d681a238 | ||
|
|
6d6fe844fd | ||
|
|
edb0a70e14 | ||
|
|
669f6b97b2 | ||
|
|
e2c5f25e97 | ||
|
|
8eee435cd6 | ||
|
|
d260bfaec4 | ||
|
|
c662c2ada2 | ||
|
|
b6e54800b4 | ||
|
|
ae210a46d1 | ||
|
|
017d0e7078 | ||
|
|
b8d1d221f8 | ||
|
|
fed530f6bf | ||
|
|
29d44193cd | ||
|
|
82994ce087 | ||
|
|
586d3b5929 | ||
|
|
d682e32529 | ||
|
|
07ab02f6b2 | ||
|
|
91a114f74a | ||
|
|
6d9887fc0f | ||
|
|
d2a3a8151e | ||
|
|
da2aea31f5 | ||
|
|
8317f8ab14 |
122
.babelrc.js
122
.babelrc.js
@@ -1,48 +1,80 @@
|
||||
"use strict";
|
||||
|
||||
const env = process.env.BABEL_ENV || process.env.NODE_ENV;
|
||||
const envOpts = {
|
||||
loose: true,
|
||||
module.exports = function(api) {
|
||||
const env = api.env();
|
||||
|
||||
const includeCoverage = process.env.BABEL_COVERAGE === "true";
|
||||
|
||||
const envOpts = {
|
||||
loose: true,
|
||||
modules: false,
|
||||
exclude: ["transform-typeof-symbol"],
|
||||
};
|
||||
|
||||
let convertESM = true;
|
||||
|
||||
switch (env) {
|
||||
// Configs used during bundling builds.
|
||||
case "babylon":
|
||||
case "standalone":
|
||||
convertESM = false;
|
||||
break;
|
||||
case "production":
|
||||
// Config during builds before publish.
|
||||
break;
|
||||
case "development":
|
||||
envOpts.debug = true;
|
||||
envOpts.targets = {
|
||||
node: "current",
|
||||
};
|
||||
break;
|
||||
case "test":
|
||||
envOpts.targets = {
|
||||
node: "current",
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
const config = {
|
||||
comments: false,
|
||||
presets: [["@babel/env", envOpts]],
|
||||
plugins: [
|
||||
// TODO: Use @babel/preset-flow when
|
||||
// https://github.com/babel/babel/issues/7233 is fixed
|
||||
"@babel/plugin-transform-flow-strip-types",
|
||||
["@babel/proposal-class-properties", { loose: true }],
|
||||
"@babel/proposal-export-namespace-from",
|
||||
"@babel/proposal-numeric-separator",
|
||||
["@babel/proposal-object-rest-spread", { useBuiltIns: true }],
|
||||
|
||||
// Explicitly use the lazy version of CommonJS modules.
|
||||
convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null,
|
||||
].filter(Boolean),
|
||||
overrides: [
|
||||
{
|
||||
test: "packages/babylon",
|
||||
plugins: [
|
||||
"babel-plugin-transform-charcodes",
|
||||
["@babel/transform-for-of", { assumeArray: true }],
|
||||
],
|
||||
},
|
||||
{
|
||||
test: "./packages/babel-register",
|
||||
plugins: [
|
||||
// Override the root options to disable lazy imports for babel-register
|
||||
// because otherwise the require hook will try to lazy-import things
|
||||
// leading to dependency cycles.
|
||||
convertESM ? "@babel/transform-modules-commonjs" : null,
|
||||
].filter(Boolean),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// we need to do this as long as we do not test everything from source
|
||||
if (includeCoverage) {
|
||||
config.auxiliaryCommentBefore = "istanbul ignore next";
|
||||
config.plugins.push("babel-plugin-istanbul");
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
switch (env) {
|
||||
case "development":
|
||||
envOpts.debug = true;
|
||||
// fall-through
|
||||
case "test":
|
||||
case "cov":
|
||||
envOpts.targets = {
|
||||
node: "current",
|
||||
};
|
||||
}
|
||||
|
||||
const config = {
|
||||
comments: false,
|
||||
presets: [["@babel/env", envOpts]],
|
||||
plugins: [
|
||||
// TODO: Use @babel/preset-flow when
|
||||
// https://github.com/babel/babel/issues/7233 is fixed
|
||||
"@babel/plugin-transform-flow-strip-types",
|
||||
["@babel/proposal-class-properties", { loose: true }],
|
||||
"@babel/proposal-export-namespace-from",
|
||||
"@babel/proposal-numeric-separator",
|
||||
["@babel/proposal-object-rest-spread", { useBuiltIns: true }],
|
||||
],
|
||||
overrides: [
|
||||
{
|
||||
test: "packages/babylon",
|
||||
plugins: [
|
||||
"babel-plugin-transform-charcodes",
|
||||
["@babel/transform-for-of", { assumeArray: true }],
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// we need to do this as long as we do not test everything from source
|
||||
if (env === "cov") {
|
||||
config.auxiliaryCommentBefore = "istanbul ignore next";
|
||||
config.plugins.push("babel-plugin-istanbul");
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const cloneDeep = require("lodash/cloneDeep");
|
||||
const babelrc = require("./.babelrc.js");
|
||||
|
||||
const config = cloneDeep(babelrc);
|
||||
|
||||
const presetEnv = config.presets.find(preset => preset[0] === "@babel/env");
|
||||
|
||||
if (!presetEnv) {
|
||||
throw new Error("Error while extracting @preset/env from .babelrc.js");
|
||||
}
|
||||
|
||||
presetEnv[1].modules = false;
|
||||
|
||||
module.exports = config;
|
||||
@@ -22,6 +22,7 @@
|
||||
"files": [
|
||||
"packages/*/test/**/*.js",
|
||||
"codemods/*/test/**/*.js",
|
||||
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
|
||||
"test/**/*.js"
|
||||
],
|
||||
"env": {
|
||||
|
||||
@@ -98,8 +98,9 @@ function buildRollup(packages) {
|
||||
format: "cjs",
|
||||
plugins: [
|
||||
rollupBabel({
|
||||
envName: "babylon",
|
||||
babelrc: false,
|
||||
extends: "./.babelrc.rollup.js",
|
||||
extends: "./.babelrc.js",
|
||||
}),
|
||||
rollupNodeResolve(),
|
||||
],
|
||||
|
||||
27
Makefile
27
Makefile
@@ -2,7 +2,7 @@ MAKEFLAGS = -j1
|
||||
FLOW_COMMIT = 622bbc4f07acb77eb1109830c70815f827401d90
|
||||
TEST262_COMMIT = 52f70e2f637731aae92a9c9a2d831310c3ab2e1e
|
||||
|
||||
export NODE_ENV = test
|
||||
export BABEL_ENV = test
|
||||
|
||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||
export FORCE_COLOR = true
|
||||
@@ -11,8 +11,7 @@ SOURCES = packages codemods
|
||||
|
||||
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
|
||||
|
||||
build: clean
|
||||
make clean-lib
|
||||
build: clean clean-lib
|
||||
./node_modules/.bin/gulp build
|
||||
node ./packages/babel-types/scripts/generateTypeHelpers.js
|
||||
# call build again as the generated files might need to be compiled again.
|
||||
@@ -22,7 +21,7 @@ build: clean
|
||||
node scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts
|
||||
# generate docs
|
||||
node scripts/generators/docs.js > ./packages/babel-types/README.md
|
||||
ifneq ("$(BABEL_ENV)", "cov")
|
||||
ifneq ("$(BABEL_COVERAGE)", "true")
|
||||
make build-standalone
|
||||
make build-preset-env-standalone
|
||||
endif
|
||||
@@ -39,8 +38,7 @@ build-dist: build
|
||||
cd packages/babel-runtime; \
|
||||
node scripts/build-dist.js
|
||||
|
||||
watch: clean
|
||||
make clean-lib
|
||||
watch: clean clean-lib
|
||||
|
||||
# Ensure that build artifacts for types are created during local
|
||||
# development too.
|
||||
@@ -76,13 +74,11 @@ test-only:
|
||||
|
||||
test: lint test-only
|
||||
|
||||
test-ci:
|
||||
make bootstrap
|
||||
make test-only
|
||||
test-ci: bootstrap test-only
|
||||
|
||||
test-ci-coverage: SHELL:=/bin/bash
|
||||
test-ci-coverage:
|
||||
BABEL_ENV=cov make bootstrap
|
||||
BABEL_COVERAGE=true BABEL_ENV=test make bootstrap
|
||||
TEST_TYPE=cov ./scripts/test-cov.sh
|
||||
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
|
||||
|
||||
@@ -95,9 +91,7 @@ bootstrap-flow:
|
||||
test-flow:
|
||||
node scripts/tests/flow/run_babylon_flow_tests.js
|
||||
|
||||
test-flow-ci:
|
||||
make bootstrap
|
||||
make test-flow
|
||||
test-flow-ci: bootstrap test-flow
|
||||
|
||||
test-flow-update-whitelist:
|
||||
node scripts/tests/flow/run_babylon_flow_tests.js --update-whitelist
|
||||
@@ -111,9 +105,7 @@ bootstrap-test262:
|
||||
test-test262:
|
||||
node scripts/tests/test262/run_babylon_test262.js
|
||||
|
||||
test-test262-ci:
|
||||
make bootstrap
|
||||
make test-test262
|
||||
test-test262-ci: bootstrap test-test262
|
||||
|
||||
test-test262-update-whitelist:
|
||||
node scripts/tests/test262/run_babylon_test262.js --update-whitelist
|
||||
@@ -130,8 +122,7 @@ publish:
|
||||
./node_modules/.bin/lerna publish --force-publish=* --exact --skip-temp-tag
|
||||
make clean
|
||||
|
||||
bootstrap:
|
||||
make clean-all
|
||||
bootstrap: clean-all
|
||||
yarn --ignore-engines
|
||||
./node_modules/.bin/lerna bootstrap -- --ignore-engines
|
||||
make build
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/plugin-codemod-optional-catch-binding",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Remove unused catch bindings",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-remove-unused-catch-binding",
|
||||
"license": "MIT",
|
||||
@@ -9,13 +9,13 @@
|
||||
"@babel/plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.41"
|
||||
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.43"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"lerna": "2.0.0-rc.4",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"changelog": {
|
||||
"repo": "babel/babel",
|
||||
"labels": {
|
||||
|
||||
17
package.json
17
package.json
@@ -10,18 +10,19 @@
|
||||
"test": "make test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.0.0-beta.40",
|
||||
"@babel/core": "7.0.0-beta.40",
|
||||
"@babel/preset-env": "7.0.0-beta.40",
|
||||
"@babel/preset-flow": "7.0.0-beta.40",
|
||||
"@babel/preset-stage-0": "7.0.0-beta.40",
|
||||
"@babel/register": "7.0.0-beta.40",
|
||||
"@babel/cli": "7.0.0-beta.42",
|
||||
"@babel/core": "7.0.0-beta.42",
|
||||
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.42",
|
||||
"@babel/preset-env": "7.0.0-beta.42",
|
||||
"@babel/preset-flow": "7.0.0-beta.42",
|
||||
"@babel/preset-stage-0": "7.0.0-beta.42",
|
||||
"@babel/register": "7.0.0-beta.42",
|
||||
"babel-core": "^7.0.0-0",
|
||||
"babel-eslint": "^8.0.1",
|
||||
"babel-jest": "^22.4.1",
|
||||
"babel-loader": "8.0.0-beta.0",
|
||||
"babel-plugin-transform-charcodes": "^0.1.0",
|
||||
"babylon": "7.0.0-beta.40",
|
||||
"babylon": "7.0.0-beta.42",
|
||||
"browserify": "^13.1.1",
|
||||
"bundle-collapser": "^1.2.1",
|
||||
"chai": "^4.1.0",
|
||||
@@ -36,7 +37,7 @@
|
||||
"flow-bin": "^0.66.0",
|
||||
"graceful-fs": "^4.1.11",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-babel": "^8.0.0-beta.0",
|
||||
"gulp-babel": "^8.0.0-beta.2",
|
||||
"gulp-filter": "^5.1.0",
|
||||
"gulp-newer": "^1.0.0",
|
||||
"gulp-plumber": "^1.0.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/cli",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Babel command line.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -29,11 +29,11 @@
|
||||
"chokidar": "^1.6.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41",
|
||||
"@babel/helper-fixtures": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43",
|
||||
"@babel/helper-fixtures": "7.0.0-beta.43"
|
||||
},
|
||||
"bin": {
|
||||
"babel": "./bin/babel.js",
|
||||
|
||||
@@ -32,7 +32,6 @@ function collect(value, previousValue): Array<string> {
|
||||
return previousValue ? previousValue.concat(values) : values;
|
||||
}
|
||||
|
||||
/* eslint-disable max-len */
|
||||
// Standard Babel input configs.
|
||||
commander.option(
|
||||
"-f, --filename [filename]",
|
||||
@@ -168,7 +167,6 @@ commander.option(
|
||||
"--delete-dir-on-start",
|
||||
"Delete the out directory before compilation",
|
||||
);
|
||||
/* eslint-enable max-len */
|
||||
|
||||
commander.version(pkg.version + " (@babel/core " + version + ")");
|
||||
commander.usage("[options] <files ...>");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/code-frame",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -8,7 +8,7 @@
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-code-frame",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/highlight": "7.0.0-beta.41"
|
||||
"@babel/highlight": "7.0.0-beta.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chalk": "^2.0.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/core",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Babel compiler core.",
|
||||
"main": "./lib/index.js",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
@@ -28,13 +28,13 @@
|
||||
"./lib/transform-file-sync.js": "./lib/transform-file-sync-browser.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "7.0.0-beta.41",
|
||||
"@babel/generator": "7.0.0-beta.41",
|
||||
"@babel/helpers": "7.0.0-beta.41",
|
||||
"@babel/template": "7.0.0-beta.41",
|
||||
"@babel/traverse": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41",
|
||||
"babylon": "7.0.0-beta.41",
|
||||
"@babel/code-frame": "7.0.0-beta.43",
|
||||
"@babel/generator": "7.0.0-beta.43",
|
||||
"@babel/helpers": "7.0.0-beta.43",
|
||||
"@babel/template": "7.0.0-beta.43",
|
||||
"@babel/traverse": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43",
|
||||
"babylon": "7.0.0-beta.43",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"debug": "^3.1.0",
|
||||
"json5": "^0.5.0",
|
||||
@@ -45,7 +45,7 @@
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.41",
|
||||
"@babel/register": "7.0.0-beta.41"
|
||||
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.43",
|
||||
"@babel/register": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,6 @@ function resolveStandardizedName(
|
||||
} catch (e2) {}
|
||||
|
||||
if (resolvedOriginal) {
|
||||
// eslint-disable-next-line max-len
|
||||
e.message += `\n- If you want to resolve "${name}", use "module:${name}"`;
|
||||
}
|
||||
}
|
||||
@@ -119,7 +118,6 @@ function resolveStandardizedName(
|
||||
} catch (e2) {}
|
||||
|
||||
if (resolvedBabel) {
|
||||
// eslint-disable-next-line max-len
|
||||
e.message += `\n- Did you mean "@babel/${name}"?`;
|
||||
}
|
||||
|
||||
@@ -131,7 +129,6 @@ function resolveStandardizedName(
|
||||
} catch (e2) {}
|
||||
|
||||
if (resolvedOppositeType) {
|
||||
// eslint-disable-next-line max-len
|
||||
e.message += `\n- Did you accidentally pass a ${type} as a ${oppositeType}?`;
|
||||
}
|
||||
|
||||
@@ -143,8 +140,9 @@ const LOADING_MODULES = new Set();
|
||||
function requireModule(type: string, name: string): mixed {
|
||||
if (LOADING_MODULES.has(name)) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line max-len
|
||||
`Reentrant ${type} detected trying to load "${name}". This module is not ignored and is trying to load itself while compiling itself, leading to a dependency cycle. We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.`,
|
||||
`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` +
|
||||
"and is trying to load itself while compiling itself, leading to a dependency cycle. " +
|
||||
'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,8 +174,7 @@ const loadDescriptor = makeWeakCache(
|
||||
|
||||
let item = value;
|
||||
if (typeof value === "function") {
|
||||
const api = Object.assign(Object.create(context), makeAPI(cache));
|
||||
|
||||
const api = Object.assign({}, context, makeAPI(cache));
|
||||
try {
|
||||
item = value(api, options, dirname);
|
||||
} catch (e) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// @flow
|
||||
/* eslint max-len: "off" */
|
||||
|
||||
export default {
|
||||
auxiliaryComment: {
|
||||
@@ -16,36 +15,42 @@ export default {
|
||||
},
|
||||
externalHelpers: {
|
||||
message:
|
||||
"Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/",
|
||||
"Use the `external-helpers` plugin instead. " +
|
||||
"Check out http://babeljs.io/docs/plugins/external-helpers/",
|
||||
},
|
||||
extra: {
|
||||
message: "",
|
||||
},
|
||||
jsxPragma: {
|
||||
message:
|
||||
"use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/",
|
||||
"use the `pragma` option in the `react-jsx` plugin. " +
|
||||
"Check out http://babeljs.io/docs/plugins/transform-react-jsx/",
|
||||
},
|
||||
loose: {
|
||||
message:
|
||||
"Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option.",
|
||||
"Specify the `loose` option for the relevant plugin you are using " +
|
||||
"or use a preset that sets the option.",
|
||||
},
|
||||
metadataUsedHelpers: {
|
||||
message: "Not required anymore as this is enabled by default",
|
||||
},
|
||||
modules: {
|
||||
message:
|
||||
"Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules",
|
||||
"Use the corresponding module transform plugin in the `plugins` option. " +
|
||||
"Check out http://babeljs.io/docs/plugins/#modules",
|
||||
},
|
||||
nonStandard: {
|
||||
message:
|
||||
"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/",
|
||||
"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. " +
|
||||
"Also check out the react preset http://babeljs.io/docs/plugins/preset-react/",
|
||||
},
|
||||
optional: {
|
||||
message: "Put the specific transforms you want in the `plugins` option",
|
||||
},
|
||||
sourceMapName: {
|
||||
message:
|
||||
"The `sourceMapName` option has been removed because it makes more sense for the tooling that calls Babel to assign `map.file` themselves.",
|
||||
"The `sourceMapName` option has been removed because it makes more sense for the " +
|
||||
"tooling that calls Babel to assign `map.file` themselves.",
|
||||
},
|
||||
stage: {
|
||||
message:
|
||||
@@ -69,6 +74,7 @@ export default {
|
||||
sourceMapTarget: {
|
||||
version: 6,
|
||||
message:
|
||||
"The `sourceMapTarget` option has been removed because it makes more sense for the tooling that calls Babel to assign `map.file` themselves.",
|
||||
"The `sourceMapTarget` option has been removed because it makes more sense for the tooling " +
|
||||
"that calls Babel to assign `map.file` themselves.",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -243,7 +243,6 @@ describe("addon resolution", function() {
|
||||
babelrc: false,
|
||||
presets: ["foo"],
|
||||
});
|
||||
// eslint-disable-next-line max-len
|
||||
}).toThrow(
|
||||
/Cannot find module 'babel-preset-foo'.*\n- If you want to resolve "foo", use "module:foo"/,
|
||||
);
|
||||
@@ -258,7 +257,6 @@ describe("addon resolution", function() {
|
||||
babelrc: false,
|
||||
plugins: ["foo"],
|
||||
});
|
||||
// eslint-disable-next-line max-len
|
||||
}).toThrow(
|
||||
/Cannot find module 'babel-plugin-foo'.*\n- If you want to resolve "foo", use "module:foo"/,
|
||||
);
|
||||
@@ -273,7 +271,6 @@ describe("addon resolution", function() {
|
||||
babelrc: false,
|
||||
presets: ["foo"],
|
||||
});
|
||||
// eslint-disable-next-line max-len
|
||||
}).toThrow(
|
||||
/Cannot find module 'babel-preset-foo'.*\n- Did you mean "@babel\/foo"\?/,
|
||||
);
|
||||
@@ -288,7 +285,6 @@ describe("addon resolution", function() {
|
||||
babelrc: false,
|
||||
plugins: ["foo"],
|
||||
});
|
||||
// eslint-disable-next-line max-len
|
||||
}).toThrow(
|
||||
/Cannot find module 'babel-plugin-foo'.*\n- Did you mean "@babel\/foo"\?/,
|
||||
);
|
||||
@@ -303,7 +299,6 @@ describe("addon resolution", function() {
|
||||
babelrc: false,
|
||||
presets: ["testplugin"],
|
||||
});
|
||||
// eslint-disable-next-line max-len
|
||||
}).toThrow(
|
||||
/Cannot find module 'babel-preset-testplugin'.*\n- Did you accidentally pass a preset as a plugin\?/,
|
||||
);
|
||||
@@ -318,7 +313,6 @@ describe("addon resolution", function() {
|
||||
babelrc: false,
|
||||
plugins: ["testpreset"],
|
||||
});
|
||||
// eslint-disable-next-line max-len
|
||||
}).toThrow(
|
||||
/Cannot find module 'babel-plugin-testpreset'.*\n- Did you accidentally pass a plugin as a preset\?/,
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/generator",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Turns an AST into code.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -11,14 +11,14 @@
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/types": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.43",
|
||||
"jsesc": "^2.5.1",
|
||||
"lodash": "^4.2.0",
|
||||
"source-map": "^0.5.0",
|
||||
"trim-right": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-fixtures": "7.0.0-beta.41",
|
||||
"babylon": "7.0.0-beta.41"
|
||||
"@babel/helper-fixtures": "7.0.0-beta.43",
|
||||
"babylon": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,6 +302,7 @@ export function TSMappedType(node) {
|
||||
this.token("{");
|
||||
this.space();
|
||||
if (readonly) {
|
||||
tokenIfPlusMinus(this, readonly);
|
||||
this.word("readonly");
|
||||
this.space();
|
||||
}
|
||||
@@ -315,6 +316,7 @@ export function TSMappedType(node) {
|
||||
this.token("]");
|
||||
|
||||
if (optional) {
|
||||
tokenIfPlusMinus(this, optional);
|
||||
this.token("?");
|
||||
}
|
||||
this.token(":");
|
||||
@@ -324,6 +326,12 @@ export function TSMappedType(node) {
|
||||
this.token("}");
|
||||
}
|
||||
|
||||
function tokenIfPlusMinus(self, tok) {
|
||||
if (tok !== true) {
|
||||
self.token(tok);
|
||||
}
|
||||
}
|
||||
|
||||
export function TSLiteralType(node) {
|
||||
this.print(node.literal, node);
|
||||
}
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
let map: { [P in string]: number; };
|
||||
let map: { readonly [P in string]?: number; };
|
||||
let map: { [P in string]: number };
|
||||
let map: { readonly [P in string]?: number };
|
||||
let map: { +readonly [P in string]+?: number };
|
||||
let map: { -readonly [P in string]-?: number };
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
let map: { [P in string]: number };
|
||||
let map: { readonly [P in string]?: number };
|
||||
let map: { readonly [P in string]?: number };
|
||||
let map: { +readonly [P in string]+?: number };
|
||||
let map: { -readonly [P in string]-?: number };
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@babel/helper-annotate-as-pure",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to annotate paths and nodes with #__PURE__ comment",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-annotate-as-pure",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import annotateAsPure from "../";
|
||||
import assert from "assert";
|
||||
|
||||
describe("@babel/helper-annotate-as-pure", () => {
|
||||
it("will add leading comment", () => {
|
||||
const node = {};
|
||||
annotateAsPure(node);
|
||||
|
||||
assert.deepEqual(node.leadingComments, [
|
||||
expect(node.leadingComments).toEqual([
|
||||
{
|
||||
type: "CommentBlock",
|
||||
value: "#__PURE__",
|
||||
@@ -26,7 +25,7 @@ describe("@babel/helper-annotate-as-pure", () => {
|
||||
|
||||
annotateAsPure(node);
|
||||
|
||||
assert.deepEqual(node.leadingComments, [
|
||||
expect(node.leadingComments).toEqual([
|
||||
{
|
||||
type: "CommentBlock",
|
||||
value: "#__PURE__",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@babel/helper-bindify-decorators",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to bindify decorators",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-bindify-decorators",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/traverse": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/traverse": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@babel/helper-builder-binary-assignment-operator-visitor",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to build binary assignment operator visitors",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-explode-assignable-expression": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/helper-explode-assignable-expression": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@babel/helper-builder-react-jsx",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to build react jsx",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.43",
|
||||
"esutils": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@babel/helper-call-delegate",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to call delegate",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-hoist-variables": "7.0.0-beta.41",
|
||||
"@babel/traverse": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/helper-hoist-variables": "7.0.0-beta.43",
|
||||
"@babel/traverse": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@babel/helper-define-map",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to define a map",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-function-name": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41",
|
||||
"@babel/helper-function-name": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43",
|
||||
"lodash": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@babel/helper-explode-assignable-expression",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to explode an assignable expression",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/traverse": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/traverse": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@babel/helper-explode-class",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to explode class",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-class",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-bindify-decorators": "7.0.0-beta.41",
|
||||
"@babel/traverse": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/helper-bindify-decorators": "7.0.0-beta.43",
|
||||
"@babel/traverse": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-fixtures",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to support fixtures",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@babel/helper-function-name",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to change the property 'name' of every function",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-get-function-arity": "7.0.0-beta.41",
|
||||
"@babel/template": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/helper-get-function-arity": "7.0.0-beta.43",
|
||||
"@babel/template": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@babel/helper-get-function-arity",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to get function arity",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@babel/helper-hoist-variables",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to hoist variables",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-hoist-variables",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-module-imports",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Babel helper functions for inserting module loads",
|
||||
"author": "Logan Smyth <loganfsmyth@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -8,10 +8,10 @@
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-module-imports",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.43",
|
||||
"lodash": "^4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import chai from "chai";
|
||||
import * as babel from "@babel/core";
|
||||
|
||||
import { ImportInjector } from "../";
|
||||
@@ -33,9 +32,9 @@ function test(sourceType, opts, initializer, expectedCode) {
|
||||
],
|
||||
});
|
||||
|
||||
chai
|
||||
.expect(result.code.replace(/\s+/g, " ").trim())
|
||||
.to.equal((expectedCode || "").replace(/\s+/g, " ").trim());
|
||||
expect(result.code.replace(/\s+/g, " ").trim()).toBe(
|
||||
(expectedCode || "").replace(/\s+/g, " ").trim(),
|
||||
);
|
||||
}
|
||||
const testScript = test.bind(undefined, "script");
|
||||
const testModule = test.bind(undefined, "module");
|
||||
@@ -90,11 +89,9 @@ describe("@babel/helper-module-imports", () => {
|
||||
|
||||
describe("using a CommonJS loader", () => {
|
||||
it("should import", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript({ importedType }, addNamespace());
|
||||
})
|
||||
.to.throw(Error, "Cannot import an ES6 module from CommonJS");
|
||||
expect(() => {
|
||||
testScript({ importedType }, addNamespace());
|
||||
}).toThrow("Cannot import an ES6 module from CommonJS");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -302,11 +299,9 @@ describe("@babel/helper-module-imports", () => {
|
||||
|
||||
describe("using a CommonJS loader", () => {
|
||||
it("should import", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript({ importedType }, addDefault());
|
||||
})
|
||||
.to.throw(Error, "Cannot import an ES6 module from CommonJS");
|
||||
expect(() => {
|
||||
testScript({ importedType }, addDefault());
|
||||
}).toThrow("Cannot import an ES6 module from CommonJS");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -390,14 +385,12 @@ describe("@babel/helper-module-imports", () => {
|
||||
});
|
||||
|
||||
it("should fail to import with force-enabled liveness", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript(
|
||||
{ importedInterop, ensureLiveReference: true },
|
||||
addDefault(),
|
||||
);
|
||||
})
|
||||
.to.throw(Error, "No live reference for commonjs default");
|
||||
expect(() => {
|
||||
testScript(
|
||||
{ importedInterop, ensureLiveReference: true },
|
||||
addDefault(),
|
||||
);
|
||||
}).toThrow("No live reference for commonjs default");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -659,11 +652,9 @@ describe("@babel/helper-module-imports", () => {
|
||||
|
||||
describe("using a CommonJS loader", () => {
|
||||
it("should import", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript({ importedType }, addNamed());
|
||||
})
|
||||
.to.throw(Error, "Cannot import an ES6 module from CommonJS");
|
||||
expect(() => {
|
||||
testScript({ importedType }, addNamed());
|
||||
}).toThrow("Cannot import an ES6 module from CommonJS");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -967,11 +958,9 @@ describe("@babel/helper-module-imports", () => {
|
||||
|
||||
describe("using a CommonJS loader", () => {
|
||||
it("should import", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript({ importedType }, addSideEffect());
|
||||
})
|
||||
.to.throw(Error, "Cannot import an ES6 module from CommonJS");
|
||||
expect(() => {
|
||||
testScript({ importedType }, addSideEffect());
|
||||
}).toThrow("Cannot import an ES6 module from CommonJS");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-module-transforms",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Babel helper functions for implementing ES6 module transformations",
|
||||
"author": "Logan Smyth <loganfsmyth@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -8,11 +8,11 @@
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-module-transforms",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-module-imports": "7.0.0-beta.41",
|
||||
"@babel/helper-simple-access": "7.0.0-beta.41",
|
||||
"@babel/helper-split-export-declaration": "7.0.0-beta.41",
|
||||
"@babel/template": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41",
|
||||
"@babel/helper-module-imports": "7.0.0-beta.43",
|
||||
"@babel/helper-simple-access": "7.0.0-beta.43",
|
||||
"@babel/helper-split-export-declaration": "7.0.0-beta.43",
|
||||
"@babel/template": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43",
|
||||
"lodash": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,16 @@ export { hasExports, isSideEffectImport, isModule };
|
||||
*/
|
||||
export function rewriteModuleStatementsAndPrepareHeader(
|
||||
path: NodePath,
|
||||
{ exportName, strict, allowTopLevelThis, strictMode, loose, noInterop, lazy },
|
||||
{
|
||||
exportName,
|
||||
strict,
|
||||
allowTopLevelThis,
|
||||
strictMode,
|
||||
loose,
|
||||
noInterop,
|
||||
lazy,
|
||||
esNamespaceOnly,
|
||||
},
|
||||
) {
|
||||
assert(isModule(path), "Cannot process module statements in a script");
|
||||
path.node.sourceType = "script";
|
||||
@@ -31,6 +40,7 @@ export function rewriteModuleStatementsAndPrepareHeader(
|
||||
noInterop,
|
||||
loose,
|
||||
lazy,
|
||||
esNamespaceOnly,
|
||||
});
|
||||
|
||||
if (!allowTopLevelThis) {
|
||||
|
||||
@@ -86,7 +86,12 @@ export function isSideEffectImport(source: SourceModuleMetadata) {
|
||||
export default function normalizeModuleAndLoadMetadata(
|
||||
programPath: NodePath,
|
||||
exportName?: string,
|
||||
{ noInterop = false, loose = false, lazy = false } = {},
|
||||
{
|
||||
noInterop = false,
|
||||
loose = false,
|
||||
lazy = false,
|
||||
esNamespaceOnly = false,
|
||||
} = {},
|
||||
): ModuleMetadata {
|
||||
if (!exportName) {
|
||||
exportName = programPath.scope.generateUidIdentifier("exports").name;
|
||||
@@ -107,6 +112,16 @@ export default function normalizeModuleAndLoadMetadata(
|
||||
}
|
||||
|
||||
if (noInterop) metadata.interop = "none";
|
||||
else if (esNamespaceOnly) {
|
||||
// Both the default and namespace interops pass through __esModule
|
||||
// objects, but the namespace interop is used to enable Babel's
|
||||
// destructuring-like interop behavior for normal CommonJS.
|
||||
// Since some tooling has started to remove that behavior, we expose
|
||||
// it as the `esNamespace` option.
|
||||
if (metadata.interop === "namespace") {
|
||||
metadata.interop = "default";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@babel/helper-optimise-call-expression",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to optimise call expression",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-optimise-call-expression",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@babel/helper-plugin-test-runner",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to support test runner",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.41"
|
||||
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-plugin-utils",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "General utilities for plugins to use",
|
||||
"author": "Logan Smyth <loganfsmyth@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
|
||||
@@ -3,7 +3,7 @@ export function declare(builder) {
|
||||
if (!api.assertVersion) {
|
||||
// Inject a custom version of 'assertVersion' for Babel 6 and early
|
||||
// versions of Babel 7's beta that didn't have it.
|
||||
api = Object.assign({}, api, {
|
||||
api = Object.assign(copyApiObject(api), {
|
||||
assertVersion(range) {
|
||||
throwVersionError(range, api.version);
|
||||
},
|
||||
@@ -14,6 +14,33 @@ export function declare(builder) {
|
||||
};
|
||||
}
|
||||
|
||||
function copyApiObject(api) {
|
||||
// Babel >= 7 <= beta.41 passed the API as a new object that had
|
||||
// babel/core as the prototype. While slightly faster, it also
|
||||
// means that the Object.assign copy below fails. Rather than
|
||||
// keep complexity, the Babel 6 behavior has been reverted and this
|
||||
// normalizes all that for Babel 7.
|
||||
let proto = null;
|
||||
if (typeof api.version === "string" && /^7\./.test(api.version)) {
|
||||
proto = Object.getPrototypeOf(api);
|
||||
if (
|
||||
proto &&
|
||||
(!has(proto, "version") ||
|
||||
!has(proto, "transform") ||
|
||||
!has(proto, "template") ||
|
||||
!has(proto, "types"))
|
||||
) {
|
||||
proto = null;
|
||||
}
|
||||
}
|
||||
|
||||
return Object.assign({}, proto, api);
|
||||
}
|
||||
|
||||
function has(obj, key) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
function throwVersionError(range, version) {
|
||||
if (typeof range === "number") {
|
||||
if (!Number.isInteger(range)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-regex",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to check for literal RegEx",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-regex",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "@babel/helper-remap-async-to-generator",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to remap async functions to generators",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-annotate-as-pure": "7.0.0-beta.41",
|
||||
"@babel/helper-wrap-function": "7.0.0-beta.41",
|
||||
"@babel/template": "7.0.0-beta.41",
|
||||
"@babel/traverse": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/helper-annotate-as-pure": "7.0.0-beta.43",
|
||||
"@babel/helper-wrap-function": "7.0.0-beta.43",
|
||||
"@babel/template": "7.0.0-beta.43",
|
||||
"@babel/traverse": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "@babel/helper-replace-supers",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper function to replace supers",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-optimise-call-expression": "7.0.0-beta.41",
|
||||
"@babel/template": "7.0.0-beta.41",
|
||||
"@babel/traverse": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/helper-optimise-call-expression": "7.0.0-beta.43",
|
||||
"@babel/template": "7.0.0-beta.43",
|
||||
"@babel/traverse": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-simple-access",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Babel helper for ensuring that access to a given value is performed through simple accesses",
|
||||
"author": "Logan Smyth <loganfsmyth@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -8,8 +8,8 @@
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-simple-access",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/template": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41",
|
||||
"@babel/template": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43",
|
||||
"lodash": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@babel/helper-split-export-declaration",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-split-export-declaration",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-transform-fixture-test-runner",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Transform test runner for @babel/helper-fixtures module",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -8,10 +8,10 @@
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-transform-fixture-test-runner",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "7.0.0-beta.41",
|
||||
"@babel/core": "7.0.0-beta.41",
|
||||
"@babel/helper-fixtures": "7.0.0-beta.41",
|
||||
"@babel/polyfill": "7.0.0-beta.41",
|
||||
"@babel/code-frame": "7.0.0-beta.43",
|
||||
"@babel/core": "7.0.0-beta.43",
|
||||
"@babel/helper-fixtures": "7.0.0-beta.43",
|
||||
"@babel/polyfill": "7.0.0-beta.43",
|
||||
"chai": "^4.1.0",
|
||||
"jest": "^22.4.2",
|
||||
"jest-diff": "^22.4.0",
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
import assert from "assert";
|
||||
|
||||
export function assertNoOwnProperties(obj) {
|
||||
assert.equal(Object.getOwnPropertyNames(obj).length, 0);
|
||||
expect(Object.getOwnPropertyNames(obj)).toHaveLength(0);
|
||||
}
|
||||
|
||||
export function assertHasOwnProperty() {}
|
||||
|
||||
export function assertLacksOwnProperty() {}
|
||||
|
||||
export function multiline(arr) {
|
||||
return arr.join("\n");
|
||||
}
|
||||
|
||||
export const assertArrayEquals = assert.deepEqual;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import assert from "assert";
|
||||
import { runCodeInTestContext } from "..";
|
||||
|
||||
describe("helper-transform-fixture-test-runner", function() {
|
||||
@@ -6,13 +5,13 @@ describe("helper-transform-fixture-test-runner", function() {
|
||||
try {
|
||||
global.foo = "outer";
|
||||
runCodeInTestContext(`
|
||||
assert.equal(global.foo, undefined);
|
||||
expect(global.foo).toBeUndefined();
|
||||
global.foo = "inner";
|
||||
`);
|
||||
|
||||
assert.equal(global.foo, "outer");
|
||||
expect(global.foo).toBe("outer");
|
||||
runCodeInTestContext(`
|
||||
assert.equal(global.foo, "inner");
|
||||
expect(global.foo).toBe("inner");
|
||||
`);
|
||||
} finally {
|
||||
delete global.foo;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "@babel/helper-wrap-function",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Helper to wrap functions inside a function call.",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-wrap-function",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-function-name": "7.0.0-beta.41",
|
||||
"@babel/template": "7.0.0-beta.41",
|
||||
"@babel/traverse": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/helper-function-name": "7.0.0-beta.43",
|
||||
"@babel/template": "7.0.0-beta.43",
|
||||
"@babel/traverse": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helpers",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Collection of helper functions used by Babel transforms.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -8,11 +8,11 @@
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helpers",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/template": "7.0.0-beta.41",
|
||||
"@babel/traverse": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/template": "7.0.0-beta.43",
|
||||
"@babel/traverse": "7.0.0-beta.43",
|
||||
"@babel/types": "7.0.0-beta.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.41"
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint max-len: "off" */
|
||||
|
||||
import template from "@babel/template";
|
||||
|
||||
const helpers = {};
|
||||
@@ -26,7 +24,9 @@ helpers.jsx = () => template.program.ast`
|
||||
|
||||
export default function _createRawReactElement(type, props, key, children) {
|
||||
if (!REACT_ELEMENT_TYPE) {
|
||||
REACT_ELEMENT_TYPE = (typeof Symbol === "function" && Symbol.for && Symbol.for("react.element")) || 0xeac7;
|
||||
REACT_ELEMENT_TYPE = (
|
||||
typeof Symbol === "function" && Symbol.for && Symbol.for("react.element")
|
||||
) || 0xeac7;
|
||||
}
|
||||
|
||||
var defaultProps = type && type.defaultProps;
|
||||
@@ -431,7 +431,8 @@ helpers.inherits = () => template.program.ast`
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||||
if (superClass)
|
||||
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -445,46 +446,57 @@ helpers.inheritsLoose = () => template.program.ast`
|
||||
|
||||
// Based on https://github.com/WebReflection/babel-plugin-transform-builtin-classes
|
||||
helpers.wrapNativeSuper = () => template.program.ast`
|
||||
var _gPO = Object.getPrototypeOf || function _gPO(o) { return o.__proto__ };
|
||||
var _sPO = Object.setPrototypeOf || function _sPO(o, p) { o.__proto__ = p; return o };
|
||||
var _construct = (typeof Reflect === "object" && Reflect.construct) ||
|
||||
function _construct(Parent, args, Class) {
|
||||
var Constructor, a = [null];
|
||||
a.push.apply(a, args);
|
||||
Constructor = Parent.bind.apply(Parent, a);
|
||||
return _sPO(new Constructor, Class.prototype);
|
||||
};
|
||||
|
||||
var _cache = typeof Map === "function" && new Map();
|
||||
function _gPO(o) {
|
||||
_gPO = Object.getPrototypeOf || function _gPO(o) { return o.__proto__ };
|
||||
return _gPO(o);
|
||||
}
|
||||
function _sPO(o, p) {
|
||||
_sPO = Object.setPrototypeOf || function _sPO(o, p) { o.__proto__ = p; return o };
|
||||
return _sPO(o, p);
|
||||
}
|
||||
function _construct(Parent, args, Class) {
|
||||
_construct = (typeof Reflect === "object" && Reflect.construct) ||
|
||||
function _construct(Parent, args, Class) {
|
||||
var Constructor, a = [null];
|
||||
a.push.apply(a, args);
|
||||
Constructor = Parent.bind.apply(Parent, a);
|
||||
return _sPO(new Constructor, Class.prototype);
|
||||
};
|
||||
return _construct(Parent, args, Class);
|
||||
}
|
||||
|
||||
export default function _wrapNativeSuper(Class) {
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {}
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writeable: true,
|
||||
configurable: true,
|
||||
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
});
|
||||
return _sPO(
|
||||
Wrapper,
|
||||
_sPO(
|
||||
function Super() {
|
||||
return _construct(Class, arguments, _gPO(this).constructor);
|
||||
},
|
||||
Class
|
||||
)
|
||||
);
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
function Wrapper() {}
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
}
|
||||
});
|
||||
return _sPO(
|
||||
Wrapper,
|
||||
_sPO(
|
||||
function Super() {
|
||||
return _construct(Class, arguments, _gPO(this).constructor);
|
||||
},
|
||||
Class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return _wrapNativeSuper(Class)
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/highlight",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Syntax highlight JavaScript strings for output in terminals.",
|
||||
"author": "suchipi <me@suchipi.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import assert from "assert";
|
||||
import chalk from "chalk";
|
||||
import stripAnsi from "strip-ansi";
|
||||
import highlight, { shouldHighlight, getChalk } from "..";
|
||||
@@ -24,8 +23,8 @@ describe("@babel/highlight", function() {
|
||||
const code = "console.log('hi')";
|
||||
const result = highlight(code);
|
||||
const stripped = stripAnsi(result);
|
||||
assert.ok(result.length > stripped.length);
|
||||
assert.equal(stripped, code);
|
||||
expect(result.length).toBeGreaterThan(stripped.length);
|
||||
expect(stripped).toBe(code);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,8 +35,8 @@ describe("@babel/highlight", function() {
|
||||
const code = "console.log('hi')";
|
||||
const result = highlight(code);
|
||||
const stripped = stripAnsi(result);
|
||||
assert.ok(result.length === stripped.length);
|
||||
assert.equal(result, code);
|
||||
expect(result.length).toBe(stripped.length);
|
||||
expect(result).toBe(code);
|
||||
});
|
||||
|
||||
describe("and the forceColor option is passed", function() {
|
||||
@@ -45,8 +44,8 @@ describe("@babel/highlight", function() {
|
||||
const code = "console.log('hi')";
|
||||
const result = highlight(code, { forceColor: true });
|
||||
const stripped = stripAnsi(result);
|
||||
assert.ok(result.length > stripped.length);
|
||||
assert.equal(stripped, code);
|
||||
expect(result.length).toBeGreaterThan(stripped.length);
|
||||
expect(stripped).toBe(code);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -57,7 +56,7 @@ describe("@babel/highlight", function() {
|
||||
stubColorSupport(true);
|
||||
|
||||
it("returns true", function() {
|
||||
assert.ok(shouldHighlight({}));
|
||||
expect(shouldHighlight({})).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -65,12 +64,12 @@ describe("@babel/highlight", function() {
|
||||
stubColorSupport(false);
|
||||
|
||||
it("returns false", function() {
|
||||
assert.ok(!shouldHighlight({}));
|
||||
expect(shouldHighlight({})).toBeFalsy();
|
||||
});
|
||||
|
||||
describe("and the forceColor option is passed", function() {
|
||||
it("returns true", function() {
|
||||
assert.ok(shouldHighlight({ forceColor: true }));
|
||||
expect(shouldHighlight({ forceColor: true })).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -82,14 +81,13 @@ describe("@babel/highlight", function() {
|
||||
|
||||
describe("when forceColor is not passed", function() {
|
||||
it("returns a Chalk instance", function() {
|
||||
assert.equal(getChalk({}).constructor, chalk.constructor);
|
||||
expect(getChalk({}).constructor).toBe(chalk.constructor);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when forceColor is passed", function() {
|
||||
it("returns a Chalk instance", function() {
|
||||
assert.equal(
|
||||
getChalk({ forceColor: true }).constructor,
|
||||
expect(getChalk({ forceColor: true }).constructor).toBe(
|
||||
chalk.constructor,
|
||||
);
|
||||
});
|
||||
@@ -101,14 +99,13 @@ describe("@babel/highlight", function() {
|
||||
|
||||
describe("when forceColor is not passed", function() {
|
||||
it("returns a Chalk instance", function() {
|
||||
assert.equal(getChalk({}).constructor, chalk.constructor);
|
||||
expect(getChalk({}).constructor).toBe(chalk.constructor);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when forceColor is passed", function() {
|
||||
it("returns a Chalk instance", function() {
|
||||
assert.equal(
|
||||
getChalk({ forceColor: true }).constructor,
|
||||
expect(getChalk({ forceColor: true }).constructor).toBe(
|
||||
chalk.constructor,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/node",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Babel command line",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -16,8 +16,8 @@
|
||||
"compiler"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "7.0.0-beta.41",
|
||||
"@babel/register": "7.0.0-beta.41",
|
||||
"@babel/polyfill": "7.0.0-beta.43",
|
||||
"@babel/register": "7.0.0-beta.43",
|
||||
"commander": "^2.8.1",
|
||||
"fs-readdir-recursive": "^1.0.0",
|
||||
"lodash": "^4.2.0",
|
||||
@@ -25,11 +25,11 @@
|
||||
"v8flags": "^3.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41",
|
||||
"@babel/helper-fixtures": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43",
|
||||
"@babel/helper-fixtures": "7.0.0-beta.43"
|
||||
},
|
||||
"bin": {
|
||||
"babel-node": "./bin/babel-node.js"
|
||||
|
||||
@@ -21,8 +21,8 @@ function collect(value, previousValue): Array<string> {
|
||||
return previousValue ? previousValue.concat(values) : values;
|
||||
}
|
||||
|
||||
/* eslint-disable max-len */
|
||||
program.option("-e, --eval [script]", "Evaluate script");
|
||||
program.option("-r, --require [module]", "Require module");
|
||||
program.option("-p, --print [code]", "Evaluate script and print result");
|
||||
program.option(
|
||||
"-o, --only [globs]",
|
||||
@@ -41,7 +41,6 @@ program.option(
|
||||
);
|
||||
program.option("-w, --plugins [string]", "", collect);
|
||||
program.option("-b, --presets [string]", "", collect);
|
||||
/* eslint-enable max-len */
|
||||
|
||||
program.version(pkg.version);
|
||||
program.usage("[options] [ -e script | script.js ] [arguments]");
|
||||
@@ -132,7 +131,11 @@ if (program.eval || program.print) {
|
||||
|
||||
if (arg[0] === "-") {
|
||||
const parsedArg = program[arg.slice(2)];
|
||||
if (parsedArg && parsedArg !== true) {
|
||||
if (
|
||||
arg === "-r" ||
|
||||
arg === "--require" ||
|
||||
(parsedArg && parsedArg !== true)
|
||||
) {
|
||||
ignoreNext = true;
|
||||
}
|
||||
} else {
|
||||
@@ -142,6 +145,15 @@ if (program.eval || program.print) {
|
||||
});
|
||||
args = args.slice(i);
|
||||
|
||||
// We have to handle require ourselfs, as we want to require it in the context of babel-register
|
||||
if (program.require) {
|
||||
let requireFileName = program.require;
|
||||
if (!path.isAbsolute(requireFileName)) {
|
||||
requireFileName = path.join(process.cwd(), requireFileName);
|
||||
}
|
||||
require(requireFileName);
|
||||
}
|
||||
|
||||
// make the filename absolute
|
||||
const filename = args[0];
|
||||
if (!path.isAbsolute(filename)) {
|
||||
|
||||
@@ -34,7 +34,7 @@ function getNormalizedV8Flag(arg) {
|
||||
}
|
||||
|
||||
getV8Flags(function(err, v8Flags) {
|
||||
babelArgs.forEach(function(arg) {
|
||||
babelArgs.forEach(function(arg, index) {
|
||||
const flag = arg.split("=")[0];
|
||||
|
||||
switch (flag) {
|
||||
@@ -50,6 +50,13 @@ getV8Flags(function(err, v8Flags) {
|
||||
args.unshift(arg);
|
||||
break;
|
||||
|
||||
case "-r":
|
||||
case "--require":
|
||||
args.push(flag);
|
||||
args.push(babelArgs[index + 1]);
|
||||
delete babelArgs[index + 1];
|
||||
break;
|
||||
|
||||
case "-gc":
|
||||
args.unshift("--expose-gc");
|
||||
break;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
const includes = require("lodash/includes");
|
||||
const readdir = require("fs-readdir-recursive");
|
||||
const helper = require("@babel/helper-fixtures");
|
||||
const assert = require("assert");
|
||||
const rimraf = require("rimraf");
|
||||
const outputFileSync = require("output-file-sync");
|
||||
const child = require("child_process");
|
||||
const merge = require("lodash/merge");
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const fs = require("fs");
|
||||
|
||||
const fixtureLoc = path.join(__dirname, "fixtures");
|
||||
@@ -53,18 +51,12 @@ const assertTest = function(stdout, stderr, opts) {
|
||||
|
||||
if (opts.stderr) {
|
||||
if (opts.stderrContains) {
|
||||
assert.ok(
|
||||
includes(stderr, expectStderr),
|
||||
"stderr " +
|
||||
JSON.stringify(stderr) +
|
||||
" didn't contain " +
|
||||
JSON.stringify(expectStderr),
|
||||
);
|
||||
expect(includes(stderr, expectStderr)).toBeTruthy();
|
||||
} else {
|
||||
chai.expect(stderr).to.equal(expectStderr, "stderr didn't match");
|
||||
expect(stderr).toBe(expectStderr);
|
||||
}
|
||||
} else if (stderr) {
|
||||
throw new Error("stderr:\n" + stderr);
|
||||
throw new Error("stderr:\n" + stderr + "\n\nstdout:\n" + stdout);
|
||||
}
|
||||
|
||||
const expectStdout = opts.stdout.trim();
|
||||
@@ -73,15 +65,9 @@ const assertTest = function(stdout, stderr, opts) {
|
||||
|
||||
if (opts.stdout) {
|
||||
if (opts.stdoutContains) {
|
||||
assert.ok(
|
||||
includes(stdout, expectStdout),
|
||||
"stdout " +
|
||||
JSON.stringify(stdout) +
|
||||
" didn't contain " +
|
||||
JSON.stringify(expectStdout),
|
||||
);
|
||||
expect(includes(stdout, expectStdout)).toBeTruthy();
|
||||
} else {
|
||||
chai.expect(stdout).to.equal(expectStdout, "stdout didn't match");
|
||||
expect(stdout).toBe(expectStdout);
|
||||
}
|
||||
} else if (stdout) {
|
||||
throw new Error("stdout:\n" + stdout);
|
||||
@@ -92,24 +78,19 @@ const assertTest = function(stdout, stderr, opts) {
|
||||
|
||||
Object.keys(actualFiles).forEach(function(filename) {
|
||||
if (!opts.inFiles.hasOwnProperty(filename)) {
|
||||
const expect = opts.outFiles[filename];
|
||||
const expected = opts.outFiles[filename];
|
||||
const actual = actualFiles[filename];
|
||||
|
||||
chai.expect(expect, "Output is missing: " + filename).to.not.be
|
||||
.undefined;
|
||||
expect(expected).not.toBeUndefined();
|
||||
|
||||
if (expect) {
|
||||
chai
|
||||
.expect(actual)
|
||||
.to.equal(expect, "Compiled output does not match: " + filename);
|
||||
if (expected) {
|
||||
expect(actual).toBe(expected);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(opts.outFiles).forEach(function(filename) {
|
||||
chai
|
||||
.expect(actualFiles, "Extraneous file in output: " + filename)
|
||||
.to.contain.key(filename);
|
||||
expect(actualFiles).toHaveProperty(filename);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/plugin-external-helpers",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "This plugin contains helper functions that’ll be placed at the top of the generated code",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-external-helpers",
|
||||
"license": "MIT",
|
||||
@@ -9,13 +9,13 @@
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.41"
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.43"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/plugin-proposal-async-generator-functions",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "Turn async generator functions into ES2015 generators",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-async-generator-functions",
|
||||
"license": "MIT",
|
||||
@@ -9,17 +9,15 @@
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.41",
|
||||
"@babel/helper-remap-async-to-generator": "7.0.0-beta.41",
|
||||
"@babel/plugin-syntax-async-generators": "7.0.0-beta.41"
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.43",
|
||||
"@babel/helper-remap-async-to-generator": "7.0.0-beta.43",
|
||||
"@babel/plugin-syntax-async-generators": "7.0.0-beta.43"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.41",
|
||||
"@babel/template": "7.0.0-beta.41",
|
||||
"@babel/types": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import * as t from "@babel/types";
|
||||
import template from "@babel/template";
|
||||
import { types as t, template } from "@babel/core";
|
||||
|
||||
const buildForAwait = template(`
|
||||
async function wrapper() {
|
||||
|
||||
@@ -20,5 +20,5 @@ async function main() {
|
||||
}
|
||||
|
||||
return main().then(() => {
|
||||
assert.deepEqual(actual, expected);
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -20,5 +20,5 @@ async function main() {
|
||||
}
|
||||
|
||||
return main().then(() => {
|
||||
assert.deepEqual(actual, expected);
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -21,6 +21,6 @@ function forEach(ai, fn) {
|
||||
var output = 0;
|
||||
return forEach(genAnswers(), function(val) { output += val.value })
|
||||
.then(function () {
|
||||
assert.equal(output, 42);
|
||||
expect(output).toBe(42);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/plugin-proposal-class-properties",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"description": "This plugin transforms static class properties as well as properties declared with the property initializer syntax",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-class-properties",
|
||||
"license": "MIT",
|
||||
@@ -9,15 +9,15 @@
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/helper-function-name": "7.0.0-beta.41",
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.41",
|
||||
"@babel/plugin-syntax-class-properties": "7.0.0-beta.41"
|
||||
"@babel/helper-function-name": "7.0.0-beta.43",
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.43",
|
||||
"@babel/plugin-syntax-class-properties": "7.0.0-beta.43"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@ class MyClass {
|
||||
const inst = new MyClass();
|
||||
|
||||
const expectedOrder = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
|
||||
assert.deepEqual(actualOrder, expectedOrder);
|
||||
expect(actualOrder).toEqual(expectedOrder);
|
||||
|
||||
assert.equal(MyClass[1], 10);
|
||||
assert.equal(inst[2], 13);
|
||||
assert.equal(inst[3], "foo");
|
||||
expect(MyClass[1]).toBe(10);
|
||||
expect(inst[2]).toBe(13);
|
||||
expect(inst[3]).toBe("foo");
|
||||
inst[4] = "baz";
|
||||
assert.equal(inst.bar, "baz");
|
||||
assert.equal(inst[5], 14);
|
||||
assert.equal(MyClass[6], 11);
|
||||
assert.equal(MyClass[7], 12);
|
||||
assert.ok(typeof inst[8] === "function");
|
||||
assert.equal(inst[9], 15);
|
||||
expect(inst.bar).toBe("baz");
|
||||
expect(inst[5]).toBe(14);
|
||||
expect(MyClass[6]).toBe(11);
|
||||
expect(MyClass[7]).toBe(12);
|
||||
expect(typeof inst[8]).toBe("function");
|
||||
expect(inst[9]).toBe(15);
|
||||
|
||||
@@ -5,9 +5,9 @@ function test(x) {
|
||||
}
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -5,9 +5,9 @@ function test(x) {
|
||||
}
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -12,9 +12,9 @@ function test(x) {
|
||||
};
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -2,6 +2,6 @@ var Foo = class {
|
||||
static num = 0;
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.name, "Foo");
|
||||
expect(Foo.num).toBe(0);
|
||||
expect(Foo.num = 1).toBe(1);
|
||||
expect(Foo.name).toBe("Foo");
|
||||
|
||||
@@ -2,5 +2,5 @@ class Foo {
|
||||
static num;
|
||||
}
|
||||
|
||||
assert.equal("num" in Foo, true);
|
||||
assert.equal(Foo.num, undefined);
|
||||
expect("num" in Foo).toBe(true);
|
||||
expect(Foo.num).toBeUndefined();
|
||||
|
||||
@@ -3,7 +3,7 @@ class Foo {
|
||||
static str = "foo";
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.str, "foo");
|
||||
assert.equal(Foo.str = "bar", "bar");
|
||||
expect(Foo.num).toBe(0);
|
||||
expect(Foo.num = 1).toBe(1);
|
||||
expect(Foo.str).toBe("foo");
|
||||
expect(Foo.str = "bar").toBe("bar");
|
||||
|
||||
@@ -5,9 +5,9 @@ function test(x) {
|
||||
}
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -5,9 +5,9 @@ function test(x) {
|
||||
}
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -7,9 +7,9 @@ function test(x) {
|
||||
};
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -2,6 +2,6 @@ var Foo = class {
|
||||
static num = 0;
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.name, "Foo");
|
||||
expect(Foo.num).toBe(0);
|
||||
expect(Foo.num = 1).toBe(1);
|
||||
expect(Foo.name).toBe("Foo");
|
||||
|
||||
@@ -2,5 +2,5 @@ class Foo {
|
||||
static num;
|
||||
}
|
||||
|
||||
assert.equal("num" in Foo, true);
|
||||
assert.equal(Foo.num, undefined);
|
||||
expect("num" in Foo).toBe(true);
|
||||
expect(Foo.num).toBeUndefined();
|
||||
|
||||
@@ -3,7 +3,7 @@ class Foo {
|
||||
static str = "foo";
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.str, "foo");
|
||||
assert.equal(Foo.str = "bar", "bar");
|
||||
expect(Foo.num).toBe(0);
|
||||
expect(Foo.num = 1).toBe(1);
|
||||
expect(Foo.str).toBe("foo");
|
||||
expect(Foo.str = "bar").toBe("bar");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/plugin-proposal-decorators",
|
||||
"version": "7.0.0-beta.41",
|
||||
"version": "7.0.0-beta.43",
|
||||
"author": "Logan Smyth <loganfsmyth@gmail.com>",
|
||||
"license": "MIT",
|
||||
"description": "Compile class and object decorators to ES5",
|
||||
@@ -12,14 +12,14 @@
|
||||
"decorators"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.41",
|
||||
"@babel/plugin-syntax-decorators": "7.0.0-beta.41"
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.43",
|
||||
"@babel/plugin-syntax-decorators": "7.0.0-beta.43"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.41",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.41"
|
||||
"@babel/core": "7.0.0-beta.43",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ class Parent {
|
||||
parent() {};
|
||||
}
|
||||
|
||||
assert.equal(Parent.staticProp, "prop");
|
||||
expect(Parent.staticProp).toBe("prop");
|
||||
|
||||
@@ -9,5 +9,5 @@ class Parent {
|
||||
parent(){}
|
||||
}
|
||||
|
||||
assert.equal(typeof Parent.prototype.parent, "function")
|
||||
assert.equal(typeof Parent.prototype.child, "function")
|
||||
expect(typeof Parent.prototype.parent).toBe("function");
|
||||
expect(typeof Parent.prototype.child).toBe("function");
|
||||
|
||||
@@ -11,4 +11,4 @@ export default class Foo {
|
||||
}
|
||||
}
|
||||
|
||||
assert.deepEqual(calls, ["Foo"]);
|
||||
expect(calls).toEqual(["Foo"]);
|
||||
|
||||
@@ -25,4 +25,4 @@ class Example {
|
||||
prop2 = 2;
|
||||
}
|
||||
|
||||
assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
expect(calls).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
|
||||
@@ -26,4 +26,4 @@ class Example2 {
|
||||
prop2 = 2;
|
||||
}
|
||||
|
||||
assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
expect(calls).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -58,8 +58,8 @@ class Example {
|
||||
}
|
||||
}
|
||||
|
||||
assert(Example.prototype.hasOwnProperty('decoratedProps'));
|
||||
assert.deepEqual(Example.prototype.decoratedProps, [
|
||||
expect(Example.prototype).toHaveProperty('decoratedProps');
|
||||
expect(Example.prototype.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -74,42 +74,42 @@ const inst = new Example();
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(Example.prototype);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite(), "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite()).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf(), "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf()).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite(), "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite()).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum(), "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum()).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite(), "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite()).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf(), "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf()).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write(), "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write()).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._(), "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._()).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(name, 4);
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe(4);
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
class Example {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -59,8 +59,8 @@ class Example {
|
||||
}
|
||||
|
||||
|
||||
assert(Example.prototype.hasOwnProperty('decoratedProps'));
|
||||
assert.deepEqual(Example.prototype.decoratedProps, [
|
||||
expect(Example.prototype).toHaveProperty('decoratedProps');
|
||||
expect(Example.prototype.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -76,42 +76,42 @@ const inst = new Example();
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(Example.prototype);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite(), "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite()).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf(), "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf()).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite(), "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite()).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum(), "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum()).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite(), "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite()).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf(), "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf()).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write(), "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write()).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._(), "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._()).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(name, "str");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe("str");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
class Example {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -23,5 +23,5 @@ class Example extends Base {
|
||||
|
||||
let inst = new Example();
|
||||
|
||||
assert.equal(inst.prop, "__3__");
|
||||
assert.equal(inst.prop2, "__4__");
|
||||
expect(inst.prop).toBe("__3__");
|
||||
expect(inst.prop2).toBe("__4__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -44,8 +44,8 @@ class Example {
|
||||
|
||||
const inst = new Example();
|
||||
|
||||
assert(Example.prototype.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(inst.decoratedProps, [
|
||||
expect(Example.prototype).toHaveProperty("decoratedProps");
|
||||
expect(inst.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -58,42 +58,42 @@ assert.deepEqual(inst.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(inst);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite, "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf, "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite, "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum, "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite, "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf, "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write, "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._, "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, "prop");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe("prop");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
let {initializer} = descriptor;
|
||||
delete descriptor.initializer;
|
||||
@@ -24,4 +24,4 @@ class Example {
|
||||
|
||||
let inst = new Example();
|
||||
|
||||
assert.equal(inst.prop, "__3__");
|
||||
expect(inst.prop).toBe("__3__");
|
||||
|
||||
@@ -7,5 +7,5 @@ class Example {
|
||||
}
|
||||
|
||||
let inst = new Example();
|
||||
assert(inst.hasOwnProperty("prop"));
|
||||
assert.equal(inst.prop, undefined);
|
||||
expect(inst).toHaveProperty("prop");
|
||||
expect(inst.prop).toBeUndefined();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -44,8 +44,8 @@ class Example {
|
||||
|
||||
const inst = new Example();
|
||||
|
||||
assert(Example.prototype.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(inst.decoratedProps, [
|
||||
expect(Example.prototype).toHaveProperty("decoratedProps");
|
||||
expect(inst.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -58,42 +58,42 @@ assert.deepEqual(inst.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(inst);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite, "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf, "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite, "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum, "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite, "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf, "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write, "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._, "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -58,8 +58,8 @@ class Example {
|
||||
}
|
||||
}
|
||||
|
||||
assert(Example.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(Example.decoratedProps, [
|
||||
expect(Example).toHaveProperty("decoratedProps");
|
||||
expect(Example.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -72,42 +72,42 @@ assert.deepEqual(Example.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(Example);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(Example.enumconfwrite(), "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(Example.enumconfwrite()).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(Example.enumconf(), "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(Example.enumconf()).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(Example.enumwrite(), "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(Example.enumwrite()).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(Example.enum(), "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(Example.enum()).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(Example.confwrite(), "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(Example.confwrite()).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(Example.conf(), "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(Example.conf()).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(Example.write(), "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(Example.write()).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(Example._(), "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(Example._()).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, 4);
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe(4);
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
class Example {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user